hooks

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Validate

func Validate(settings protocol.HooksSettings) error

Types

type Binding

type Binding struct {
	// contains filtered or unexported fields
}

func New

func New(input Capture) *Binding

New freezes every script value so later settings updates affect new turns only.

func (*Binding) After

func (b *Binding) After(ctx context.Context, tool, call string, success bool)

func (*Binding) Before

func (b *Binding) Before(ctx context.Context, tool, call string) error

func (*Binding) Complete

func (b *Binding) Complete(ctx context.Context, status string) error

func (*Binding) WrapsTools

func (b *Binding) WrapsTools() bool

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL