Skip to content

fix(doctor): handle Claude Code Homebrew casks#854

Merged
matt2e merged 7 commits into
mainfrom
installation-env-root
Jul 3, 2026
Merged

fix(doctor): handle Claude Code Homebrew casks#854
matt2e merged 7 commits into
mainfrom
installation-env-root

Conversation

@matt2e

@matt2e matt2e commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • register the Claude Code Homebrew cask for brew-managed main CLI installs
  • emit brew upgrade commands for brew-managed Claude Code updates
  • preserve exact Claude cask tokens such as claude-code@latest from Caskroom paths
  • allowlist known Claude casks before mapping path text to brew package ids

Testing

  • crates-fmt
  • crates-lint
  • crates-test
  • differ-ci
  • staged-ci
  • bin/cargo test -p doctor (local attempt blocked by another cargo test holding the shared Cargo target lock; stopped after about one minute)

@matt2e
matt2e requested review from baxen and wesbillman as code owners July 3, 2026 07:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@matt2e matt2e changed the title fix(doctor): map Claude Code cask updates to brew fix(doctor): handle Claude Code Homebrew casks Jul 3, 2026
@matt2e
matt2e force-pushed the installation-env-root branch from 4408b50 to af38282 Compare July 3, 2026 08:21
matt2e added 2 commits July 3, 2026 18:46
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>
@matt2e
matt2e force-pushed the installation-env-root branch from af38282 to b9b6a50 Compare July 3, 2026 08:46
matt2e added 5 commits July 3, 2026 18:56
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>
@matt2e
matt2e merged commit 639c725 into main Jul 3, 2026
6 checks passed
@matt2e
matt2e deleted the installation-env-root branch July 3, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant