Fix Windows binary resolution for npm global installs#5
Merged
Merged
Conversation
On Windows with npm global install, `where claude` returns the extensionless bash shim (npm/claude) rather than claude.cmd. The existing .cmd handler never fires, so findClaudeBinary falls through to platform candidates which list cli.mjs (should be cli.js) and claude.cmd (a 347-byte shim, not the binary). Additionally, the Windows JS bundle (cli.js) contains the salt string once, but all thresholds required >= 3 occurrences (matching the Linux compiled binary), causing every salt check to fail. Fixes: - Try .cmd sibling when which() returns an extensionless shim - Fix cli.mjs -> cli.js in Windows platform candidates - Lower salt occurrence thresholds from >= 3 to >= 1 - Keep salt-count warning for non-Windows platforms (>= 3 expected) Tested on Windows 11 with Claude Code installed via npm.
Owner
|
Reviewing this, will merge son |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
where claudereturns the extensionless bash shim (npm/claude) notclaude.cmd, so the existing.cmdhandler never fires. Added fallback to try the.cmdsibling and parse it to findcli.js.cli.mjs->cli.jsin the Windows fallback path list.>= 3to>= 1. Kept the low-count warning for non-Windows platforms where 3 occurrences are expected.Reproduction
The tool was searching
claude.cmd(347-byte shim) instead ofcli.js(13MB JS bundle).Test plan
findClaudeBinary()resolves tonode_modules/@anthropic-ai/claude-code/cli.jsverifySalt()finds 1 occurrence of the salt incli.jsgetCurrentSalt()correctly returnspatched: falsewith 1 occurrencerunPreflight()passes withok: trueany-buddy currentdisplays the pet correctlyTested on Windows 11 with Claude Code installed via
npm i -g @anthropic-ai/claude-code.