Skip to content

Commit d676635

Browse files
fix: hooks degrade gracefully when node is not on PATH (#57)
Claude Code runs hooks via a non-interactive /bin/sh. On setups where node isn't on that shell's PATH (Nix/nix-darwin, nvm, fnm), every prompt errored with "/bin/sh: node: command not found". Guard each hook command so it runs node only when present and exits 0 otherwise, no more per-prompt noise. The slash-command skills are unaffected; only the always-on activation needs node. Document the requirement in the README install section. Closes #51. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f02f942 commit d676635

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Lazy, not negligent: trust-boundary validation, data-loss handling, security, an
7171

7272
The most effort ponytail will ever ask of you:
7373

74+
The Claude Code and Codex plugins run two tiny Node.js lifecycle hooks, so `node` needs to be on your PATH (note for Nix/nvm users: it must be on the non-interactive shell's PATH). If it isn't, the skills still work, the always-on activation just stays quiet instead of erroring on every prompt.
75+
7476
### Claude Code
7577

7678
```

‎hooks/hooks.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"hooks": [
77
{
88
"type": "command",
9-
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-activate.js\"",
10-
"commandWindows": "node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-activate.js\"",
9+
"command": "command -v node >/dev/null 2>&1 && node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-activate.js\" || exit 0",
10+
"commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-activate.js\" }",
1111
"timeout": 5,
1212
"statusMessage": "Loading ponytail mode..."
1313
}
@@ -19,8 +19,8 @@
1919
"hooks": [
2020
{
2121
"type": "command",
22-
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\"",
23-
"commandWindows": "node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-mode-tracker.js\"",
22+
"command": "command -v node >/dev/null 2>&1 && node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\" || exit 0",
23+
"commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-mode-tracker.js\" }",
2424
"timeout": 5,
2525
"statusMessage": "Tracking ponytail mode..."
2626
}

0 commit comments

Comments
 (0)