Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRootCmd ¶
NewRootCmd creates the root cobra command.
Types ¶
type HookRunner ¶
type HookRunner struct {
// Now returns the current time; tests override for deterministic
// LastEvent fields.
Now func() time.Time
// Store reads and updates session manifests. Hook handlers use it to
// capture agent-native resume IDs as they appear.
Store hookManifestStore
// TmuxClient writes captured IDs into the tmux session environment.
TmuxClient hookTmuxEnvironmentSetter
// LoadTranscriptTail returns up to ~64 KiB from the end of a Claude
// transcript_path file. Returns (nil, nil) if the file is missing or
// unreadable; Stop hooks must remain best-effort when transcripts lag.
LoadTranscriptTail func(path string) ([]byte, error)
// Update applies a tracker-style locked read-modify-write to the
// session's state.json. Returning false from mutate skips the disk
// write (used for the hot-path conditional flush).
Update func(sessionID string, mutate func(*state.SessionState) bool) error
// AppendEvent appends one line to state.jsonl. Best-effort: a write
// failure here is logged but does not fail the hook.
AppendEvent func(sessionID string, ev state.StateEvent) error
// UpdateAndLog folds the event append and the state.json
// read-modify-write into a single flock-guarded critical section: it
// always appends ev, then conditionally writes state.json when mutate
// returns true. Hot-path handlers use this instead of an AppendEvent +
// Update pair to take one lock per event instead of two.
UpdateAndLog func(sessionID string, ev state.StateEvent, mutate func(*state.SessionState) bool) error
}
HookRunner is the dependency surface used by the hook subcommand. It exists for testability: tests can substitute fakes for the file-system side effects without touching real disks. Production wiring goes through the default implementation backed by internal/state.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.