fix(wallet): use -p flag so npx resolves the correct binary - #89
Conversation
All kh wallet subcommands that wrap @keeperhub/wallet fail with: could not determine executable to run The package publishes three bins — keeperhub-wallet, keeperhub-wallet-hook, keeperhub-wallet-mcp — none named "wallet". Without an explicit binary name, npx cannot infer which to run and exits with the above error, regardless of whether Node.js is installed. Fix: pass -p @keeperhub/wallet keeperhub-wallet instead of @keeperhub/wallet, which tells npx the package to install and the exact binary to invoke. Found while using kh wallet fund / info during a first-run onboarding session on v0.13.1 (2026-08-06) — not from reading code.
|
Related: #88 (docs PR that initially misdiagnosed this error as a missing Node install — amended to drop the incorrect mapping now that the root cause is identified here). |
joelorzet
left a comment
There was a problem hiding this comment.
Verified the root cause independently rather than taking the report at face value. npm view @keeperhub/wallet bin returns exactly the three you listed:
{
'keeperhub-wallet': 'bin/keeperhub-wallet.js',
'keeperhub-wallet-mcp': 'bin/keeperhub-wallet-mcp.js',
'keeperhub-wallet-hook': 'bin/keeperhub-wallet-hook.js'
}
None is named wallet, so npx has nothing to infer from and the failure is unconditional rather than environment specific. npx -p <package> <binary> is the correct form, and the comment explaining why earns its place, because the next person to read that line would otherwise assume the package name alone was sufficient.
On your branch: builds, go vet clean, go test ./cmd/wallet/... passes, and go generate ./docs/ leaves no diff, so docs-check is satisfied.
Two changes requested before this merges.
There is no test asserting the argv. execCommand is already a package level var whose comment says it exists "so tests can override with a fake builder", but nothing overrides it, so the exact bug this fixes was never covered and a future regression would not be caught either. Worth adding while the context is fresh. The current tests live in package wallet_test and execCommand is unexported, so the override needs an in package test file declaring package wallet, capturing the args and asserting the first three are -p, @keeperhub/wallet, keeperhub-wallet.
Separately, Long on these commands still reads "Thin wrapper around npx @keeperhub/wallet info", which now describes the old invocation. If you touch that string, note that TestNewAddCmd_Help asserts npx @keeperhub/wallet appears in the help output, and docs/ is generated from those strings, so it needs go generate ./docs/ in the same commit.
The diagnosis holds up and this restores five broken subcommands, so the substance is not in question. The test is the one I would insist on: a one line argv fix with no argv assertion is exactly the shape that silently regresses.
- All agentic subcommand Long strings now show the correct invocation: npx -p @keeperhub/wallet keeperhub-wallet <subcmd> (previously npx @keeperhub/wallet <subcmd>, which fails with "could not determine executable to run" when the package exposes multiple bins) - Add agentic_wrapper_internal_test.go (package wallet) that overrides execCommand and lookPath to assert argv[0..2] = [-p, @keeperhub/wallet, keeperhub-wallet] without spawning a real process - Update TestNewAddCmd_Help assertion: "npx @keeperhub/wallet" no longer appears contiguously after the Long string fix; split into two checks for "@keeperhub/wallet" and "keeperhub-wallet" - Regenerate docs/kh_wallet*.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Heads up on merge order: #88 and #89 both touch the |
What changed since the last review
Previously raised items
BlockingNone. Mechanical - actionable as-is
Needs a decisionNone. VerdictApprove. Both items from the prior review are resolved with no new issues introduced by these commits. |
Problem
Every
kh walletsubcommand that wraps@keeperhub/walletfails with:The error is reproducible on any machine with Node installed. Root cause:
@keeperhub/walletpublishes three bins —keeperhub-wallet,keeperhub-wallet-hook,keeperhub-wallet-mcp— none namedwallet. Whennpxreceives only the package name (npx @keeperhub/wallet <subcmd>), it tries to infer the binary from the package name, finds no match, and exits.This affects
kh wallet info,kh wallet fund,kh wallet add,kh wallet link, andkh wallet feedback. The error message gives no indication that the issue is binary name inference rather than a missing Node installation.Fix
-p @keeperhub/walletnames the package to install/use;keeperhub-walletnames the exact binary. npx resolves correctly andkh wallet infoworks.Verification
Tested on Ubuntu/WSL2 (Node v24.13.0, npm 11.12.1):
All existing wallet tests pass. One-line diff, no behaviour change beyond fixing the broken invocation.
How it was found
Found while running
kh wallet fundduring a live onboarding session — not from reading code. The workaround (keeperhub-wallet fundvia the global npm install) led to discovering that the binary names didn't match what npx was trying to infer.Related
kh_wallet_info.md, treating this as an undocumented dependency. That diagnosis was wrong — the dependency is documented in the synopsis; the actual bug is binary name inference. docs: fix three onboarding friction points for Linux/headless installs #88 is still useful as a fallback note but this PR fixes the root cause.