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,10 +327,14 @@ def find_all_cli_js():
|
|||||||
r = subprocess.run(["which", "claude"], capture_output=True, text=True, timeout=5)
|
r = subprocess.run(["which", "claude"], capture_output=True, text=True, timeout=5)
|
||||||
if r.returncode == 0:
|
if r.returncode == 0:
|
||||||
claude_bin = os.path.realpath(r.stdout.strip())
|
claude_bin = os.path.realpath(r.stdout.strip())
|
||||||
# claude binary is at node_modules/.bin/claude
|
if os.path.basename(claude_bin) == "cli.js":
|
||||||
# cli.js is in node_modules/@anthropic-ai/claude-code/cli.js
|
# which claude resolves directly to cli.js
|
||||||
nm = os.path.dirname(os.path.dirname(claude_bin)) # node_modules/
|
candidates.add(claude_bin)
|
||||||
candidates.add(os.path.join(nm, "@anthropic-ai", "claude-code", "cli.js"))
|
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:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user