test-hook.sh never evaluates the matcher, so a hook wired to the wrong tool passes
plugin-dev/skills/hook-development/scripts/test-hook.sh pipes the test input straight into the handler and never consults the hook configuration, so the matcher is never evaluated. A hook wired to the wrong tool passes every shipped check and then never fires in production.
Root cause
Neither string appears anywhere in the file:
$ grep -c 'hooks\.json' test-hook.sh
0
$ grep -c 'matcher' test-hook.sh
0
The script takes a handler path and an input file, and executes the handler directly. The mapping from event and tool_name to handler, which is the part that decides whether the hook runs at all, is never exercised.
Reproduction
Handler correctly denies writes under infra/. Configuration scopes it to Write only:
{ "hooks": { "PreToolUse": [ { "matcher": "Write", "hooks": [ { "type": "command", "command": "node guard.mjs" } ] } ] } }
An Edit to infra/main.tf is unprotected in a real session, because the matcher does not select the handler. But test-hook.sh executes the handler directly with an Edit payload, the handler denies, and the script reports success.
validate-hook-schema.sh also does not catch this: it checks the shape of the configuration, not whether the matcher selects the intended handler for the intended tool.
Expected
Given a hook configuration and a synthetic event, the tester should report which handler (if any) the matcher actually selects, and fail when the intended handler is not selected.
Suggested fix
Add an optional --config <hooks.json> mode: resolve hooks -> EventName -> [{matcher, hooks}], apply the documented matcher semantics (alphanumerics, underscore, hyphen, space, comma and pipe mean exact or list; anything else is an unanchored regex; * and "" are wildcards), and report the selected handlers before executing them.
Environment: Claude Code 2.1.219, Windows 11, Git Bash, Node 24.14.1.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗