docs(hooks): generate the hook event × tool matrix from the hooks factories - #2540
Merged
Conversation
dyoshikawa
pushed a commit
that referenced
this pull request
Jul 31, 2026
…mt plumbing Review follow-ups on PR #2540: - check:docs-content now also diffs docs/reference/file-formats.md, so a committed-stale table cannot slip past the gate even when the embed is fresh (matches how check:supported-tools diffs its markdown targets). - file-formats.md is rewritten unconditionally: the renderer emits cells without column padding and oxfmt owns the final layout, so the old changed-content guard never fired anyway. - The oxfmt invocation is factored into a runOxfmt helper with stderr inherited, keeping formatter failures diagnosable. - The marker-replacement logic is extracted to scripts/markdown-markers.ts (shared with generate-supported-tools-tables.ts) and now rejects END-before-BEGIN instead of silently duplicating content. - Unit tests for renderHookEventsMatrix and replaceBetweenMarkers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
Status: review complete and ready to merge, but intentionally left for a manual merge.
One optional follow-up noted by review (not blocking): |
…tories The Hook event x tool matrix in docs/reference/file-formats.md was hand-maintained and had drifted badly: it was missing columns for twelve hook-capable targets (Pi, Amp, Hermes Agent, Reasonix, Qwen Code, Vibe, Junie, Grok CLI, Kimi Code, Kiro CLI/IDE variants, plugin variants) and still carried a column for Gemini CLI, which is no longer a rulesync target at all. The table is now rendered between HOOK_EVENTS_MATRIX markers by scripts/hook-events-table.ts from each hooks factory's supportedEvents (the same source of truth the generator warns from at generate time), with columns ordered like the other generated tables (TOOL_DISPLAY) and rows in canonical HOOK_EVENTS order, restricted to events at least one target supports. scripts/generate-docs-content.ts applies it before embedding the docs, so a stale committed table fails the existing check:docs-content drift gate - no new package script needed. Also updates the hooks prose to name Qwen Code instead of the removed Gemini CLI target in the PascalCase-translation list. Closes #2522 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…mt plumbing Review follow-ups on PR #2540: - check:docs-content now also diffs docs/reference/file-formats.md, so a committed-stale table cannot slip past the gate even when the embed is fresh (matches how check:supported-tools diffs its markdown targets). - file-formats.md is rewritten unconditionally: the renderer emits cells without column padding and oxfmt owns the final layout, so the old changed-content guard never fired anyway. - The oxfmt invocation is factored into a runOxfmt helper with stderr inherited, keeping formatter failures diagnosable. - The marker-replacement logic is extracted to scripts/markdown-markers.ts (shared with generate-supported-tools-tables.ts) and now rejects END-before-BEGIN instead of silently duplicating content. - Unit tests for renderHookEventsMatrix and replaceBetweenMarkers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dyoshikawa
force-pushed
the
resolve-scrap-issue-2522-hook-matrix
branch
from
August 1, 2026 15:01
76fad24 to
b134a35
Compare
Owner
Author
|
@dyoshikawa Thank you! |
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
The
Hook event × tool matrixindocs/reference/file-formats.mdwas hand-maintained and had drifted badly:This PR takes the issue's "generate it so it cannot go stale" option:
scripts/hook-events-table.tsrenders the table betweenHOOK_EVENTS_MATRIXmarkers from each hooks factory'ssupportedEventsintoolHooksFactories— the same source of truth the generator's skip-warnings come from. Columns followTOOL_DISPLAYorder (like the other generated tables) and rows follow canonicalHOOK_EVENTSorder, restricted to events at least one target supports. A hooks target missing fromTOOL_DISPLAYthrows.scripts/generate-docs-content.tsapplies the renderer (and oxfmt) tofile-formats.mdbefore embedding the docs, so a stale committed table makes the existingcheck:docs-contentdrift gate fail — no new package script and nopackage.jsonchange needed.*_HOOK_EVENTSconstants (0 mismatches).Testing
pnpm cicheckgreen (generation is idempotent; second run produces no diff).toolHooksFactoriesreportedchecked rows: 48 cols: 28 errors: 0.Closes #2522
🤖 Generated with Claude Code