fix(doctor): handle Claude Code Homebrew casks#854
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 210d362e1d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // the main Claude Code CLI. | ||
| ( | ||
| InstallSource::Brew, | ||
| "claude-code", |
There was a problem hiding this comment.
Preserve the installed Claude cask channel
When a user has Homebrew’s claude-code@latest cask installed, the resolved binary still carries only InstallSource::Brew, so this entry makes resolve_package(..., Role::Main) always probe and update the stable claude-code cask. That compares the @latest binary’s installed version against the stable channel and emits brew upgrade claude-code instead of brew upgrade claude-code@latest, so doctor can miss available @latest updates or direct users to the wrong cask; the package id needs to be derived from the installed cask token or otherwise preserve the @latest variant.
Useful? React with 👍 / 👎.
4408b50 to
af38282
Compare
Apply the builderbot doctor change referenced by Berd commit 49c07563c2148f0f6940b6b14fff7eb6b6c6a6ee so Homebrew cask installs update with brew upgrade claude-code. Signed-off-by: Matt Toohey <contact@matttoohey.com>
Derive the Claude Code Homebrew cask token from the resolved Caskroom path when building freshness targets, while allowlisting known Claude casks so arbitrary path text cannot become a brew package id. This keeps claude-code@latest installs using brew info and brew upgrade with claude-code@latest instead of collapsing to claude-code. Signed-off-by: Matt Toohey <contact@matttoohey.com>
af38282 to
b9b6a50
Compare
Add npm --force when doctor derives the @anthropic-ai/claude-code global update command so existing claude binaries can be overwritten, while leaving other npm updates and Homebrew cask upgrades unchanged. Signed-off-by: Matt Toohey <contact@matttoohey.com>
Restore doctor-derived npm update commands to the standard npm install -g <package>@latest form instead of special-casing Claude Code with --force. The Homebrew cask source/channel fixes remain intact, so brew-installed Claude Code updates continue to derive brew upgrade commands with the preserved cask token. Signed-off-by: Matt Toohey <contact@matttoohey.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Check the immediate binary symlink target before canonicalizing so claude-code@latest cask installs that point onward into node_modules still derive brew update commands for the owning cask token. Signed-off-by: Matt Toohey <contact@matttoohey.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Summary
Testing