fix: correct which claude resolution in find_all_cli_js()
- Handle case where which claude resolves directly to cli.js (not to .bin/claude) - When claude binary basename is cli.js, add it directly to candidates - When claude binary is in .bin/, resolve to parent node_modules/@anthropic-ai/claude-code/cli.js - Fixes: which claude path not being properly included in multi-install patching Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -327,8 +327,12 @@ def find_all_cli_js():
|
||||
r = subprocess.run(["which", "claude"], capture_output=True, text=True, timeout=5)
|
||||
if r.returncode == 0:
|
||||
claude_bin = os.path.realpath(r.stdout.strip())
|
||||
# claude binary is at node_modules/.bin/claude
|
||||
# cli.js is in node_modules/@anthropic-ai/claude-code/cli.js
|
||||
if os.path.basename(claude_bin) == "cli.js":
|
||||
# which claude resolves directly to cli.js
|
||||
candidates.add(claude_bin)
|
||||
else:
|
||||
# which claude points to .bin/claude wrapper
|
||||
# cli.js is at node_modules/@anthropic-ai/claude-code/cli.js
|
||||
nm = os.path.dirname(os.path.dirname(claude_bin)) # node_modules/
|
||||
candidates.add(os.path.join(nm, "@anthropic-ai", "claude-code", "cli.js"))
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user