feat(junie): support UserPromptSubmit, Stop, and SessionEnd hook events - #1897
Merged
Conversation
Junie CLI now documents four lifecycle hook events (SessionStart, UserPromptSubmit, Stop, SessionEnd). rulesync previously mapped only SessionStart. Add the three new canonical event mappings (beforeSubmitPrompt, stop, sessionEnd) so they survive generation, and update the stale JSDoc, unit tests, and e2e coverage accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…vents Junie CLI applies matchers only to SessionStart/SessionEnd; UserPromptSubmit and Stop always run. Add noMatcherEvents so generated config matches upstream capability. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
@dyoshikawa Thank you! |
Merged
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
Follow up JetBrains Junie CLI upstream updates: Junie CLI now documents four lifecycle hook events under the
"hooks"key of~/.junie/config.json—SessionStart,UserPromptSubmit,Stop, andSessionEnd. rulesync previously mapped onlySessionStart, sobeforeSubmitPrompt,stop, andsessionEndhooks were silently dropped during generation.This PR adds the three new canonical event mappings so they survive generation and round-trip on import.
Changes
src/types/hooks.tsJUNIE_HOOK_EVENTSto["sessionStart", "beforeSubmitPrompt", "stop", "sessionEnd"].CANONICAL_TO_JUNIE_EVENT_NAMESwithbeforeSubmitPrompt → UserPromptSubmit,stop → Stop,sessionEnd → SessionEnd(reverse mapJUNIE_TO_CANONICAL_EVENT_NAMESis auto-derived).SessionStart/SessionEndand onlytype: "command"hooks are supported.src/features/hooks/junie-hooks.ts— no adapter change needed; it is driven by the constants above and keeps thecommand-only restriction intact.src/types/hooks.test.ts— add Junie event-map completeness, naming, and round-trip assertions.src/features/hooks/junie-hooks.test.ts— assertUserPromptSubmit/Stop/SessionEndare now emitted from their canonical inputs; keep a drop-assertion for a genuinely-unsupported event (preToolUse).src/e2e/e2e-hooks.spec.ts— update the Junie global-mode case so bothSessionStartandStopsurvive generation (previously onlySessionStart).No support-matrix or docs changes are required: Junie hooks remain a boolean ✅ feature in the support matrix and Junie is not listed in the per-event hook × tool matrix in
docs/reference/file-formats.md. Scope is unchanged (user/global only).Evidence
Verification
pnpm cicheck— fully green (267 test files, 6418 tests passed; fmt/oxlint/typecheck/cspell/secretlint/skill-docs-sync all pass).pnpm test:e2e src/e2e/e2e-hooks.spec.ts— 47 tests passed.Closes #1889
🤖 Generated with Claude Code