SIGN IN SIGN UP

fix(hooks): read PostToolUse payload from stdin instead of $TOOL_INPUT env var

The PostToolUse auto-update hook read "$TOOL_INPUT" to detect git
commit/merge/cherry-pick/rebase commands, but Claude Code never sets a
TOOL_INPUT environment variable for hook processes — hook input is
delivered as JSON on stdin (fields tool_name, tool_input, cwd, ...).
The grep therefore always tested an empty string, the && chain
short-circuited, and the trailing || true swallowed the failure: the
per-commit auto-update silently never fired, on any OS.

Capture stdin into INPUT, then extract tool_input.command via a small
node -e script (matching the JSON-parsing style already used by the
SessionStart hook's node -p call, and requiring no new dependency —
jq isn't guaranteed present on Windows/Git Bash hosts). The extracted
command is piped into the same grep check as before; everything
downstream (UA_DIR resolution, config.json/knowledge-graph.json gating)
is unchanged.

Verified by piping a realistic PostToolUse JSON payload into both the
old and new hook commands: the old command produces no output (bug
reproduced), the new one prints the auto-update instruction. Also
checked git merge/cherry-pick/rebase trigger correctly, non-matching
commands and non-Bash tool payloads (no tool_input.command field) stay
silent, embedded quotes in commit messages don't break JSON parsing,
and the autoUpdate:false / missing knowledge-graph.json gates still
suppress the hook as before.

Fixes #594.
A
Amit Vijapur committed
f4c7e1a37ff5bae400badf8a0ff26ce98444ea48
Parent: 2f24580