From d676635325b49faf92c91eb365eead984c38a063 Mon Sep 17 00:00:00 2001 From: DietrichGebert Date: Mon, 15 Jun 2026 11:23:59 +0200 Subject: [PATCH] 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) --- README.md | 2 ++ hooks/hooks.json | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b76594a..790b846 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ Lazy, not negligent: trust-boundary validation, data-loss handling, security, an The most effort ponytail will ever ask of you: +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. + ### Claude Code ``` diff --git a/hooks/hooks.json b/hooks/hooks.json index 962b852..483c3e1 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -6,8 +6,8 @@ "hooks": [ { "type": "command", - "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-activate.js\"", - "commandWindows": "node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-activate.js\"", + "command": "command -v node >/dev/null 2>&1 && node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-activate.js\" || exit 0", + "commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-activate.js\" }", "timeout": 5, "statusMessage": "Loading ponytail mode..." } @@ -19,8 +19,8 @@ "hooks": [ { "type": "command", - "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\"", - "commandWindows": "node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-mode-tracker.js\"", + "command": "command -v node >/dev/null 2>&1 && node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\" || exit 0", + "commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-mode-tracker.js\" }", "timeout": 5, "statusMessage": "Tracking ponytail mode..." }