Documentation
¶
Overview ¶
Package hook provides types and utilities for handling Claude Code hook events. For more information about Claude Code hooks, see: https://docs.anthropic.com/en/docs/claude-code/hooks
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HookEvent ¶
type HookEvent struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd,omitempty"`
HookEventName string `json:"hook_event_name"`
}
HookEvent represents the common hook event data from Claude Code
func ParseHookEvent ¶
ParseHookEvent reads and parses the hook event from stdin
func ReadHookEvent ¶
ReadHookEvent is a convenience function to read hook event from stdin
type NotificationEvent ¶
NotificationEvent represents the Notification hook event
func ParseNotificationEvent ¶
func ParseNotificationEvent(r io.Reader) (*NotificationEvent, error)
ParseNotificationEvent reads and parses Notification event from stdin
func ReadNotificationEvent ¶
func ReadNotificationEvent() (*NotificationEvent, error)
ReadNotificationEvent is a convenience function to read Notification event from stdin
type PostToolUseEvent ¶
type PostToolUseEvent struct {
HookEvent
ToolName string `json:"tool_name"`
ToolResult map[string]interface{} `json:"tool_result,omitempty"`
}
PostToolUseEvent represents the PostToolUse hook event
type PreCompactEvent ¶
type PreCompactEvent struct {
HookEvent
CompactMode string `json:"compact_mode"` // "manual" or "auto"
}
PreCompactEvent represents the PreCompact hook event
type PreToolUseEvent ¶
type PreToolUseEvent struct {
HookEvent
ToolName string `json:"tool_name"`
ToolParams map[string]interface{} `json:"tool_params,omitempty"`
}
PreToolUseEvent represents the PreToolUse hook event
type StopEvent ¶
StopEvent represents the Stop/SubagentStop hook event
func ParseStopEvent ¶
ParseStopEvent reads and parses Stop event from stdin
func ReadStopEvent ¶
ReadStopEvent is a convenience function to read Stop event from stdin
type UserPromptSubmitEvent ¶
UserPromptSubmitEvent represents the UserPromptSubmit hook event
func ParseUserPromptSubmitEvent ¶
func ParseUserPromptSubmitEvent(r io.Reader) (*UserPromptSubmitEvent, error)
ParseUserPromptSubmitEvent reads and parses UserPromptSubmit event from stdin
func ReadUserPromptSubmitEvent ¶
func ReadUserPromptSubmitEvent() (*UserPromptSubmitEvent, error)
ReadUserPromptSubmitEvent is a convenience function to read UserPromptSubmit event from stdin