refactor(shell): collapse managed tree back into stubs

Drop ~/.config/zsh/{env,interactive,login} modules. PATH and local.zsh
live in .zshenv; interactive UX is a single .zshrc again. Deploy only
installs the three stubs and removes obsolete trees/examples.
This commit is contained in:
Jeffrey
2026-08-06 14:46:56 +08:00
parent 7f80bb66e1
commit e5e2801ce8
12 changed files with 225 additions and 379 deletions
+13 -43
View File
@@ -11,67 +11,37 @@ curl -fsSL https://git.miomio.moe/mio/easyzsh/raw/branch/master/install.sh | bas
```
Options: `--cp-hist` / `-c` imports bash history; `--non-interactive` / `-n`
skips the default-shell change. The installer backs up existing shell stubs
before replacing them.
skips the default-shell change.
From a git checkout (recommended for multi-machine sync):
From a git checkout:
```bash
./deploy.sh --migrate-zprofile
./deploy.sh
```
## Architecture
```text
every zsh login only interactive only
────────── ────────── ────────────────
~/.zshenv (stub) ~/.zprofile (stub) ~/.zshrc (stub)
→ config/zsh/env/* → config/zsh/login/* → config/zsh/interactive/*
→ config/zsh/local.zsh → ~/.config/zshrc/* (before omz)
```
PATH for user tools is built **once** in `~/.config/zsh/env/00-path.zsh`
(always-on), so non-interactive agent shells (`zsh -c`, Codex, Claude) resolve
`~/.local/bin` the same way interactive terminals do.
## Layout
| Path | Role | Reinstall |
| --- | --- | --- |
| `~/.zshenv` `~/.zprofile` `~/.zshrc` | Thin stubs | Overwritten |
| `~/.config/zsh/env/` | Managed always-on env (PATH, Homebrew) | Overwritten |
| `~/.config/zsh/interactive/` | Managed interactive UX (omz, aliases) | Overwritten |
| `~/.config/zsh/login/` | Managed login hooks (usually empty) | Overwritten |
| `~/.config/zsh/local.zsh` | Machine-local overrides (every zsh) | **Never overwritten** |
| `~/.config/zshrc/*.zsh` | Personal/tool overlays (before omz) | Left alone |
| `~/.local/bin/` | User tools + intentional shims (e.g. `grok`) | Left alone |
| `~/.zshenv` | Always-on: Homebrew, `~/.local/bin`, source `local.zsh` | Overwritten |
| `~/.zshrc` | Interactive: omz, plugins, aliases, fzf, zoxide | Overwritten |
| `~/.zprofile` | Login placeholder (prefer `local.zsh` for machine hooks) | Overwritten |
| `~/.config/zsh/local.zsh` | Machine-local overrides (every zsh, including agents) | **Never overwritten** |
| `~/.config/zshrc/*.zsh` | Personal/tool overlays before oh-my-zsh | Left alone |
| `~/.local/bin/` | User tools + shims (e.g. `grok``~/.grok/bin/grok`) | Left alone |
Do **not** put `~/.grok/bin` on PATH wholesale (generic names like `agent` shadow
other tools). Link wanted entrypoints into `~/.local/bin` instead.
## Personal configuration
### Machine-local (agents see this)
Do **not** put `~/.grok/bin` on PATH wholesale.
```bash
# ~/.config/zsh/local.zsh
. "$HOME/.cargo/env"
source ~/.orbstack/shell/init.zsh 2>/dev/null || :
```
### Interactive overlays (before oh-my-zsh)
```bash
# ~/.config/zshrc/local.zsh
# ~/.config/zshrc/prefs.zsh
plugins+=(docker)
plugins=(${plugins:#zsh-autosuggestions})
```
Ready-made tool configs from this repo's `zshrc/` directory:
Tool fragments from this repo:
```bash
curl -fsSL https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s -- fnm pyenv
```
Current fragments: `fnm`, `nvm`, `pyenv`, `p10k`, `merlin_devbox`, `merlin_worker`.
Aliases that must beat oh-my-zsh belong after omz loads (see managed
`interactive/20-post-omz.zsh`).