Documentation
¶
Overview ¶
Package hooks — user-defined shell-command hooks for clawtool lifecycle events (ADR-014 F3, Claude Code parity).
Pattern: every clawtool call site that wants to expose a hook emits one event; hooks.Emit fans the event out to every configured HookEntry under the matching event name. Events carry structured JSON metadata that lands on the script's stdin, so user scripts stay free of argv parsing. Failures default to log-and-continue; `block_on_error = true` flips that for guard-rail hooks.
Per ADR-007 we wrap stdlib (`os/exec` + `encoding/json`); we don't invent an event-bus or RPC.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event string
Event is the canonical name string. Locked at v0.15; new events are additive, never renamed.
const ( EventPreSend Event = "pre_send" EventPostSend Event = "post_send" EventOnTaskComplete Event = "on_task_complete" EventPreEdit Event = "pre_edit" EventPostEdit Event = "post_edit" EventPreBridgeAdd Event = "pre_bridge_add" EventPostRecipeApply Event = "post_recipe_apply" EventOnServerStart Event = "on_server_start" EventOnServerStop Event = "on_server_stop" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the process-wide hooks dispatcher. One per clawtool process; SetGlobal registers it. Nil manager → Emit is a no-op.
func New ¶
func New(cfg config.HooksConfig) *Manager
New wires a Manager from the config block. Nil-safe; an empty HooksConfig yields a Manager whose Emit is a no-op.