Menubar CLI update runs brew upgrade for npm installs under Homebrew's Node prefix
Summary
On macOS, when Node comes from Homebrew and codeburn is installed with npm install -g codeburn, the menubar's one-click update runs brew upgrade codeburn and fails with Error: codeburn not installed. The popover shows "CLI Update Failed / CodeBurn could not update the CLI."
Why it happens
Homebrew's Node sets the npm global prefix to /opt/homebrew, so the npm launcher lands at /opt/homebrew/bin/codeburn:
$ npm prefix -g
/opt/homebrew
$ readlink /opt/homebrew/bin/codeburn
../lib/node_modules/codeburn/dist/cli.js
$ brew list --formula | grep codeburn
(nothing)UpdateChecker.cliUpdateInvocation(cliPath:) (mac/Sources/CodeBurnMenubar/Data/UpdateChecker.swift, around line 264) treats any path containing /homebrew/ as a Homebrew install and returns [brew, "upgrade", "codeburn"]. Homebrew has no codeburn formula installed here, so brew exits non-zero. cliUpdateCommand (around line 121) uses the same substring test, so the manual fallback hint also says brew upgrade codeburn.
The existing tests pin this behavior: UpdateCheckerTests.swift expects /opt/homebrew/bin/codeburn to map to brew, and expects nil when only npm exists at that path.
Proposed fix
Decide by where the launcher really points, not by its directory:
- Resolve the symlink (
URL.resolvingSymlinksInPath()orFileManager.destinationOfSymbolicLink), keeping it injectable likefileExistsso the tests stay pure. - Resolved path contains
/Cellar/codeburn/-> brew. - Resolved path contains
/node_modules/codeburn/-> npm from the launcher's directory (/opt/homebrew/bin/npmin this layout). - Otherwise keep the current fallbacks.
- Route
cliUpdateCommandthrough the same decision so the manual hint matches. - Tests: a brew-Node + npm-global case (
/opt/homebrew/bin/codeburn->../lib/node_modules/codeburn/dist/cli.js-> npm) next to the existing Cellar case.
I can send a PR for this if the approach looks right.
Environment
- macOS 27.0, Apple Silicon
- CodeBurn menubar 0.9.25, CLI 0.9.25 (npm global)
- Node from Homebrew (
brew list --formulaincludesnode)
Workaround
Run npm install -g codeburn@latest in a terminal; the menubar stops offering the CLI update once the versions match.
Source: getagentseal/codeburn