Skip to content

feat(junie): support UserPromptSubmit, Stop, and SessionEnd hook events - #1897

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issue-1889-junie-hooks
Jun 16, 2026
Merged

feat(junie): support UserPromptSubmit, Stop, and SessionEnd hook events#1897
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issue-1889-junie-hooks

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Follow up JetBrains Junie CLI upstream updates: Junie CLI now documents four lifecycle hook events under the "hooks" key of ~/.junie/config.jsonSessionStart, UserPromptSubmit, Stop, and SessionEnd. rulesync previously mapped only SessionStart, so beforeSubmitPrompt, stop, and sessionEnd hooks 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.ts
    • Extend JUNIE_HOOK_EVENTS to ["sessionStart", "beforeSubmitPrompt", "stop", "sessionEnd"].
    • Extend CANONICAL_TO_JUNIE_EVENT_NAMES with beforeSubmitPrompt → UserPromptSubmit, stop → Stop, sessionEnd → SessionEnd (reverse map JUNIE_TO_CANONICAL_EVENT_NAMES is auto-derived).
    • Update the stale JSDoc to list all four events and note that matchers apply only to SessionStart/SessionEnd and only type: "command" hooks are supported.
  • src/features/hooks/junie-hooks.ts — no adapter change needed; it is driven by the constants above and keeps the command-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 — assert UserPromptSubmit/Stop/SessionEnd are 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 both SessionStart and Stop survive generation (previously only SessionStart).

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

cm-dyoshikawa and others added 2 commits June 16, 2026 03:16
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>
@dyoshikawa
dyoshikawa merged commit 790fd29 into main Jun 16, 2026
8 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

@dyoshikawa
dyoshikawa deleted the resolve-scrap-issue-1889-junie-hooks branch June 16, 2026 11:00
@dyoshikawa dyoshikawa mentioned this pull request Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow up JetBrains Junie upstream updates: additional CLI hook events (UserPromptSubmit, Stop, SessionEnd)

2 participants