Documentation
¶
Overview ¶
Package hooks runs shell-command hooks bound to lifecycle events. Each hook receives the event payload as JSON on stdin and may return a JSON Decision on stdout; PreToolUse decisions gate tool execution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision struct {
Approved *bool `json:"approved"`
Block bool `json:"block"`
Adjustment string `json:"adjustment"`
Reason string `json:"reason"`
}
Decision is a hook's JSON stdout response.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher fires hooks for events.
func New ¶
func New(hooks []types.HookConfig) *Dispatcher
New builds a dispatcher over the given hooks (a nil/empty slice is a no-op).
type ToolDecision ¶
ToolDecision is the combined PreToolUse verdict.
func CombineToolDecisions ¶
func CombineToolDecisions(ds []Decision) ToolDecision
CombineToolDecisions reduces PreToolUse decisions: any block / explicit approved:false denies (first one wins); otherwise any explicit approved:true approves (carrying its adjustment); otherwise undecided.
Click to show internal directories.
Click to hide internal directories.