setup: discount npx's own PATH entry when choosing the invocation - #6
Merged
petergyang merged 1 commit intoAug 6, 2026
Merged
Conversation
`npx -y human-review setup --global` wrote a bare `human-review` into SKILL.md, because the `which` probe ran while npx had the package on PATH from its `_npx` cache. That binary is gone the moment npx exits, so every later agent invocation failed with "command not found". Ignore a resolution living inside the `_npx` cache and fall back to `npx -y human-review`. A real global install or `npm link` still wins. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
npx -y human-review setup --globalwrites a SKILL.md that tells agents to run a barehuman-review. On a machine without a global install that command does not exist, so every later invocation fails with "command not found".invocation()probeswhich human-reviewto decide which form to write. The probe runs inside the npx call that is doing the setup, and npx has put the package on PATH for the duration of that one command:That path is gone the moment npx exits, so the probe reports an install that was never there.
This change ignores a resolution living inside npm's
_npxcache and falls back tonpx -y human-review. A real global install ornpm linkstill wins.Checked all three cases against
invocation()on macOS, node 25.9.0:~/.npm/_npx/<hash>/node_modules/.bin/human-reviewnpx -y human-review/tmp/.../bin/human-reviewhuman-reviewnpx -y human-reviewOne test added, covering the cache path on both platforms, a real global install, and a directory that merely contains the characters
_npx. 68 pass.Found this installing the skill today, so the SKILL.md on my machine needed the
npx -yprefix put back by hand.🤖 Generated with Claude Code