`completion install zsh` writes `~/.zshrc` when `$ZDOTDIR` is set, so zsh never loads the completions
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript, zsh
- 領域
- cli
調査の方向性
src/core/completions/installers/zsh-installer.tsを読み、特にgetZshrcPath()と、それを使用するインストール、アンインストール、手動手順の各パスを確認してください。インストーラーのテストを確認し、一時的なHOMEとZDOTDIRを使って再現してください。インストールとアンインストールが${ZDOTDIR:-$HOME}/.zshrcを対象とし、そのパスを報告し、ZDOTDIRが設定されていない場合は既存のfallbackが維持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 73k
- フォーク
- 5k
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 54
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Fission-AI/OpenSpec のほかの issue
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifacts対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Fission-AI/OpenSpec#2165 ·
メンテナーはふだん 1 日以内に返信
-
openspec-archive-change skill: ignores delta specs when artifact ID is not "specs"対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Fission-AI/OpenSpec#2163 ·
メンテナーはふだん 1 日以内に返信
-
openspec-sync-specs skill: containment check missing for create/update path, only present for deleteオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
Fission-AI/OpenSpec#2164 ·
メンテナーはふだん 1 日以内に返信
-
documentation needs-triage
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
Fission-AI/OpenSpec#2157 ·
メンテナーはふだん 1 日以内に返信
-
documentation needs-triage
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
Fission-AI/OpenSpec#2143 ·
メンテナーはふだん 1 日以内に返信
Fission-AI/OpenSpec の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
better-auth/better-auth#12132 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
hurttlocker/o8#5112 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
webrecorder/wabac.js#386 ·
-
needs-triage
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
agent-of-empires/agent-of-empires#5098 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信