`completion install zsh` writes `~/.zshrc` when `$ZDOTDIR` is set, so zsh never loads the completions
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript, zsh
- Ambito
- cli
Direzione di ricerca
Leggi src/core/completions/installers/zsh-installer.ts, in particolare getZshrcPath() e i percorsi di installazione, disinstallazione e istruzioni manuali che lo usano. Controlla i test dell’installer e riproduci il caso con un HOME e un ZDOTDIR temporanei; il lavoro è completato quando installazione e disinstallazione hanno come destinazione ${ZDOTDIR:-$HOME}/.zshrc e riportano quel percorso, mantenendo il fallback esistente quando ZDOTDIR non è impostato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What you were trying to do
I was setting up tab completion for OpenSpec in zsh. My zsh config lives in ~/.config/zsh: ~/.zshenv exports ZDOTDIR="$HOME/.config/zsh".
This is a common XDG-style layout. It is also the default in Home Manager when xdg.enable is on and home.stateVersion is 26.05 or later: programs.zsh.dotDir defaults to ~/.config/zsh and is exported as ZDOTDIR. So new Home Manager setups with XDG enabled are affected too.
What happened
$ openspec completion install zsh
✓ Completion script installed and .zshrc configured successfully
Restart your shell or run: exec zsh
The installer created a new ~/.zshrc containing the # OPENSPEC:START … # OPENSPEC:END block. My real config, $ZDOTDIR/.zshrc, was not touched. zsh only reads ~/.zshrc when ZDOTDIR is unset (zsh manual: Startup/Shutdown Files). So the block is never loaded, _openspec never gets on fpath, and completion silently doesn't work even though the install reported success.
openspec completion uninstall zsh has the same problem: it only looks in ~/.zshrc.
What you expected instead
The block goes into the file zsh actually reads, ${ZDOTDIR:-$HOME}/.zshrc. Uninstall removes it from the same file, and the messages name that file.
Minimal steps to reproduce
These steps use a throwaway HOME, so they don't touch your real config:
TMPHOME=$(mktemp -d)
mkdir -p "$TMPHOME/.config/zsh"
echo '# my zshrc' > "$TMPHOME/.config/zsh/.zshrc"
HOME="$TMPHOME" ZDOTDIR="$TMPHOME/.config/zsh" openspec completion install zsh
ls -A "$TMPHOME" # a new .zshrc appears in HOME
cat "$TMPHOME/.config/zsh/.zshrc" # still just "# my zshrc", no OPENSPEC block
HOME="$TMPHOME" ZDOTDIR="$TMPHOME/.config/zsh" zsh -i -c 'whence -v _openspec'
# _openspec not found
With the fix described below, the last command prints _openspec is an autoload shell function from …/.zsh/completions/_openspec.
OpenSpec version
1.14.3 (also reproduces on main at c04f30e5)
Coding agent and model
None. This is plain CLI usage.
OS and Node version
macOS 26 (Darwin 25.5.0, arm64), zsh 5.9, Node 24.21.0
Where it comes from, and an offer to fix it
getZshrcPath() in src/core/completions/installers/zsh-installer.ts builds the path from $HOME only. Install, uninstall and the manual instructions all go through it.
I have a small fix with regression tests:
- It resolves the path from
$ZDOTDIRand falls back to$HOME. Output is identical whenZDOTDIRis unset. - The new tests fail on
mainand pass with the change. The full suite,tscandlintare green.
I'd be glad to open a PR if you'd like me to.
A few things I checked or wasn't sure about:
- IDE terminals. VS Code's zsh shell integration points
ZDOTDIRat its own directory during startup, then restores the user's value (USER_ZDOTDIR) before the prompt. So a command typed in the terminal sees the rightZDOTDIR. - Read-only
.zshrc. Under Home Manager,$ZDOTDIR/.zshrcis usually a read-only symlink into the Nix store. With the fix, the installer's existing write check catches that: it leaves the file alone and prints the manual instructions for the correct path. Today it reports "configured successfully" and drops a stray~/.zshrcinstead. - Script location. I kept the completion script itself in
~/.zsh/completionsto keep the change small. People who setZDOTDIRoften prefer nothing new in$HOME, so I can move it under$ZDOTDIRif you prefer. - The spec. The
cli-completionspec names~/.zshrcliterally. If you'd rather update the spec wording too, I'm happy to follow the feature flow. - Tests. The installer tests would also need to clear
ZDOTDIRthe way they already clearZSH. Otherwise, on a machine withZDOTDIRset, the suite would edit the developer's real.zshrconce the fix lands.
I found this while reading the installer code with Claude Code (Claude Opus 5.5), which also ran the reproduction above on my machine. I reviewed the report and the fix.
- Lingua principale
- TypeScript
- Stelle
- 72.3k
- Fork
- 4.9k
- Merge medio
- 2g 10h
- PR unite (30g)
- 72
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Fission-AI/OpenSpec
-
Triple-backtick inline code at line start opens a phantom code fence and hides the rest of the specForse già presa @kevin9327 l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Fission-AI/OpenSpec#2130 ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Fission-AI/OpenSpec#2105 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Fission-AI/OpenSpec#1966 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
feat(schemas): open each proposal with a short review focusForse già presa @GaoSSR l’ha presa 34 giorni fa. Apertadesign-review
Difficoltà 1/5 1-3 ore Idoneità per principianti 90/100
Fission-AI/OpenSpec#1908 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
Fission-AI/OpenSpec#2139 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di Fission-AI/OpenSpec
Issue simili
-
[Feature]: 建议导入源后,自动切换到新导入的源Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
lyswhut/lx-music-desktop#3026 ·
-
area: ci type: test
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
schlessera/brain-kit#2769 ·
I maintainer di solito rispondono entro 1 giorno
-
Read a vector index's quantization back on Neo4j 2026.10, which reports vector.quantization.typeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
liberation-data/drivine#231 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
alveusgg/alveusgg#2502 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno