feat(cli): /hooks preview <event> lists hooks that would fire#216
Merged
emal-avala merged 1 commit intomainfrom Apr 23, 2026
Merged
feat(cli): /hooks preview <event> lists hooks that would fire#216emal-avala merged 1 commit intomainfrom
emal-avala merged 1 commit intomainfrom
Conversation
A misspelled event in settings.toml (e.g. \`pre-tool-used\` instead of \`pre_tool_use\`) silently deserializes as a hook that never matches anything at runtime. Users only notice when the hook seems not to run — often hours of debugging later. And even with correctly-spelled events, there was no way to audit "which of my configured hooks would actually fire for user_prompt_submit?" without tracing the code. Adds a \`/hooks preview <event>\` subcommand that prints every configured hook matching the given event, along with its action line and optional tool_name filter. Shows "No configured hooks match event '<name>'" when empty, and rejects unknown event names with a hint pointing at \`/hooks events\`. Also adds \`parse_hook_event\`, which accepts both canonical \`snake_case\` and the hyphenated / mixed-case forms users tend to type. A round-trip test pins it to HOOK_EVENT_CATALOG — adding a new event to the catalog without teaching the parser will now fail the build instead of silently rejecting the new name. 5 new tests cover canonical parsing, hyphen/case tolerance, whitespace trimming, rejection of unknown names, and catalog round-trip.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A misspelled event in `settings.toml` (e.g. `pre-tool-used` instead of `pre_tool_use`) silently deserializes as a hook that never matches anything at runtime. Users only notice when the hook seems not to run — often hours of debugging later. And even with correctly-spelled events, there's no way to audit which of my configured hooks would actually fire for `user_prompt_submit` without tracing the code.
This PR adds a `/hooks preview ` subcommand:
```
```
Also adds a round-trip test that pins the new `parse_hook_event` helper to `HOOK_EVENT_CATALOG` — adding a new event to the catalog without teaching the parser will now fail the build instead of silently rejecting that event name from preview.
Test plan