Fix Claude Code CLI detection for npm-local installs#1978
Fix Claude Code CLI detection for npm-local installs#1978one-kash wants to merge 4 commits intogithub:mainfrom
Conversation
`specify check` reports "Claude Code CLI (not found)" for users who installed Claude Code via npm-local (the default installer path, common with nvm). The binary lives at ~/.claude/local/node_modules/.bin/claude which was not checked. Add CLAUDE_NPM_LOCAL_PATH as a second well-known location alongside the existing migrate-installer path. Fixes github#550
There was a problem hiding this comment.
Pull request overview
Fixes specify check incorrectly reporting Claude Code as missing when installed via npm-local by adding an additional well-known local binary path and covering the behavior with targeted tests.
Changes:
- Add
CLAUDE_NPM_LOCAL_PATH(~/.claude/local/node_modules/.bin/claude) and treat it as a valid Claude local install location incheck_tool("claude"). - Update Claude-specific detection logic comments to reflect multiple local install methods.
- Add unit tests covering Claude detection via migrate-installer path, npm-local path, PATH, and tracker updates; plus regression checks for other tools.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/specify_cli/__init__.py |
Adds npm-local Claude binary path constant and checks it in check_tool before falling back to PATH. |
tests/test_check_tool.py |
New tests validating Claude detection across install methods and ensuring non-Claude tools are unaffected. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback. If not applicable, please explain why
|
You brought the big guns, I like it! I might have to call my buddy Claude too ;) |
- Remove unused pytest import from test_check_tool.py - Use tmp_path instead of hardcoded /nonexistent/claude for hermetic tests - Simplify redundant exists() + is_file() to just is_file() AI-assisted: Changes applied with Claude Code.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
specify checkreporting "Claude Code CLI (not found)" for users with npm-local installs (the default Claude Code install method, common with nvm)CLAUDE_NPM_LOCAL_PATH(~/.claude/local/node_modules/.bin/claude) as a second well-known detection path alongside the existingmigrate-installerpathRoot Cause
check_tool("claude")only checks:~/.claude/local/claude(migrate-installer path)shutil.which("claude")(system PATH)For npm-local installs, the binary is at
~/.claude/local/node_modules/.bin/claude— neither of the above paths match, so detection fails even though Claude is installed and working.Test plan
~/.claude/local/claude)~/.claude/local/node_modules/.bin/claude)Fixes #550