-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add SessionStart hook handler #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Warning Rate limit exceeded@johnlindquist has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 59 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughA new Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant runHook
participant HookHandlers
Caller->>runHook: Call with SessionStart payload
runHook->>HookHandlers: Check for sessionStart handler
alt sessionStart handler exists
runHook->>HookHandlers: Invoke sessionStart(payload)
HookHandlers-->>runHook: SessionStartResponse
runHook->>Caller: Log and return response
else no handler
runHook->>Caller: Log empty response
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- Add SessionStartPayload interface with session metadata - Add SessionStartResponse interface for hook responses - Add SessionStartHandler type definition - Update HookHandlers interface to include sessionStart property - Add SessionStart case in runHook switch statement - Add optional title field to NotificationPayload Follows existing hook patterns without external dependencies
77cd68a to
d61232d
Compare
|
🎉 This PR is included in version 2.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
This PR adds support for the SessionStart hook handler to allow users to run custom logic when a Claude session starts.
Changes
SessionStartPayloadinterface with session metadata (session_id,transcript_path,hook_event_name,source)SessionStartResponseinterface for hook responses with optionaldecision,reason, andhookSpecificOutputSessionStartHandlertype definitionHookHandlersinterface to include optionalsessionStartpropertySessionStartcase in therunHookswitch statementtitlefield toNotificationPayloadinterfaceHookPayloadunion type to includeSessionStartPayloadImplementation Details
The SessionStart hook follows the same pattern as other existing hooks:
session_id,transcript_path,hook_event_name, andsourceBaseHookResponsewith optionaldecision,reason, andhookSpecificOutputSessionStartResponseThis allows users to implement session initialization logic, such as:
Testing
Notes
Summary by CodeRabbit
New Features
Improvements