[ef-38] feat: add 9 missing hook event types + daily sync workflow#38
Conversation
- Add PermissionDenied, TaskCreated, StopFailure, InstructionsLoaded, CwdChanged, FileChanged, PostCompact, Elicitation, ElicitationResult to HOOK_EVENT_TYPES (17 → 26 total) - Update manager.test.ts counts accordingly - Add .github/workflows/sync-hook-events.yml: daily + manual job that runs Claude Code (sonnet) to fetch the Anthropic hooks docs, diff coverage, and auto-open a PR when new/removed events are detected - Add scripts/sync-hook-events-prompt.md: the checked-in prompt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a scheduled/manual GitHub Actions workflow and prompt to sync HOOK_EVENT_TYPES from Claude docs, updates Changes
Sequence DiagramsequenceDiagram
participant GHA as GitHub Actions (scheduler)
participant CLI as Claude Code CLI
participant Doc as Docs (hooks pages)
participant Repo as Repository (src/hooks/types.ts, tests)
participant API as GitHub API
GHA->>CLI: invoke sync (cron or manual)
CLI->>Doc: fetch reference & guide pages
Doc-->>CLI: return event tables
CLI->>Repo: read current HOOK_EVENT_TYPES and tests
CLI-->>CLI: compute added/removed diffs
alt differences found
CLI->>Repo: update `src/hooks/types.ts` and tests
CLI->>Repo: write `.sync-hook-events-output.json`, commit & push branch
CLI->>API: open PR with added/removed lists and sources
API-->>CLI: PR created
else no differences
CLI-->>Repo: write `.sync-hook-events-output.json` (changed: false) and exit
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Claude Code step now only receives ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN - Claude writes analysis result to .sync-hook-events-output.json (no Bash tool needed) - A separate shell step reads the output file and handles all git/gh operations - Add .sync-hook-events-output.json to .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
HOOK_EVENT_TYPES(17 → 26 total):PermissionDenied,TaskCreated,StopFailure,InstructionsLoaded,CwdChanged,FileChanged,PostCompact,Elicitation,ElicitationResult__tests__/hooks/manager.test.ts(all passing).github/workflows/sync-hook-events.yml: daily (08:07 UTC) +workflow_dispatchjob that runs Claude Code (Sonnet) to fetch the Anthropic hooks docs, diff coverage againstsrc/hooks/types.ts, and auto-open a PR when events are added or removed upstreamscripts/sync-hook-events-prompt.md: the checked-in prompt the workflow feeds to Claude CodeSandbox design
The sync workflow only exposes
ANTHROPIC_BASE_URL,ANTHROPIC_AUTH_TOKEN, and the auto-generated scopedGITHUB_TOKENto the Claude Code process — no other project secrets.Test plan
bun run test:run— 723 tests passbunx tsc --noEmit— cleangh workflow run sync-hook-events.ymlafter merge to confirm "up to date" outputtypes.tson a test branch and re-trigger to verify PR creation🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
Tests