Documentation
¶
Overview ¶
Package hooks runs captured workspace scripts around Node-owned tool execution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchesTool ¶
func MatchesTool(script protocol.HooksScript, tool string) bool
MatchesTool reports whether a hook script applies to the named tool. An empty tool filter matches every tool for backward compatibility. Filter entries match exact tool names or trailing-wildcard prefixes (e.g. "git_*").
func Validate ¶
func Validate(settings protocol.HooksSettings) error
Types ¶
type Binding ¶
type Binding struct {
// contains filtered or unexported fields
}
type Capture ¶
type Capture struct {
Node protocol.NodeID
Project protocol.ProjectID
Worktree protocol.WorktreeID
Session protocol.SessionID
Turn protocol.TurnID
Cwd string
Settings protocol.HooksSettings
Admitted bool
Stop context.Context
Claim func(context.Context, protocol.TurnID, protocol.HooksPhase, uint64) error
Finish func(context.Context, protocol.TurnID, protocol.HooksPhase, uint64, protocol.ProcessOutcome, error) error
Launch func(ctx context.Context, command string, timeoutMs uint64, environment map[string]string, stdin string) (protocol.ProcessCompletion, error)
}
Capture contains immutable admission data and callbacks into Node ownership. Claim and Finish must commit through the existing storage writer. Launch must run outside that transaction and retain its own native process ownership.
type Entry ¶
type Entry struct {
ID string
Phase protocol.HooksPhase
Script protocol.HooksScript
}
func Scripts ¶
func Scripts(settings protocol.HooksSettings, phase protocol.HooksPhase) []Entry
func ScriptsForTool ¶
func ScriptsForTool(settings protocol.HooksSettings, phase protocol.HooksPhase, tool string) []Entry
ScriptsForTool returns enabled hook scripts for a tool phase that match the given tool name.