CommandCodeAI / CommandCodeAI/command-code
`cmd update` reports success but does not update the installed binary (when installed via bun)
未關閉
還沒有人認領這個 Issue。
- 主要語言
- 沒有語言資料
- 星號
- 4k
- 分支
- 350
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Summary
cmd update prints "✔ Updated to v1.17.0" but cmd --version stays on the old version. No error is shown. The self-updater assumes npm
global install and never touches bun-installed binaries, so the update silently no-ops for bun users.
Expected Behavior
cmd updateupgrades the binary that is actually on PATH.- After update,
cmd --versionshows the new version. - If the binary did not change, the command reports failure (non-zero exit) with manual instructions — never a false success.
--check-onlybehavior is preserved.
Actual Behavior
cmd updatealways runsnpm i -g command-code(hardcodedupdateCommandinupdateAction2→runCliUpdateCommand).- On a bun install (
~/.bun/bin/cmd→ bun global node_modules), the new version lands in npm's global dir as an orphan copy (nocmdbin link), while the PATH binary is untouched. - Success is reported from the install command's exit code, not from the on-disk version changing.
Steps to reproduce the issue
- Install via bun:
bun i -g command-code - Run
cmd update→ prints "✔ Updated to v1.17.0. Run cmd to start using the new version." - Run
cmd --version→ still old version (e.g. 1.14.0) - Confirm orphan copy:
ls /opt/homebrew/lib/node_modules/command-code(npm prefix) vsls ~/.bun/install/global/node_modules/command-code(bun) — versions differ.
Command Code Version
1.14.0
Operating System
macOS
Terminal/IDE
ghostty
Shell
zsh
Session file (optional)
No response
Fix prompt (optional)
Fix the self-update logic so it updates the binary that is really on PATH:
- Detect install method before updating. Inspect the resolved binary path (
process.argv[1]; e.g..bun/install/global/...,
/opt/homebrew/bin, npx shim) and/or probe package-manager globals forcommand-code(bun:~/.bun/install/global, npm:npm root -g,
brew:brew list). - Update via the matching manager:
- bun →
bun i -g command-code@latest - npm →
npm i -g command-code@latest - brew →
brew upgrade command-code(if available) - unknown → current behavior + warning.
- bun →
- Verify after update. Compare the version of the resolved install before/after (package.json or
--version). Report success only
if the PATH binary version actually changed. - On stale binary → print failure with manual instructions, exit non-zero.
- Keep
--check-onlysemantics; keep telemetry, addinstall_methodfield if cheap.
Acceptance criteria:
- bun install:
cmd updateupgrades the bun copy;cmd --versionshows new version; no orphan npm copy created. - npm install: behavior unchanged.
- Update command succeeds but version unchanged → failure, non-zero exit, manual instructions.
- Unit tests cover: method detection (bun/npm/brew/path shims), command selection per method, post-update verification (success + stale
cases).
Additional context
OS: macOS Tahoe 26.5.2
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從硬編碼的 updateCommand 和由 process.argv[1] 解析出的路徑開始,追蹤 updateAction2 和 runCliUpdateCommand。使用所述的單元測試案例涵蓋 bun、npm、brew 和路徑 shim,然後驗證更新後解析出的二進位檔會發生變化,且過時的更新會失敗,同時不改變 --check-only 的行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- bun
- 領域
- cli
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 52/100