Documentation
¶
Overview ¶
Package hooks dispatches observe-only lifecycle commands.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher starts matching hook commands asynchronously and tracks them for process-exit draining.
func New ¶
func New(entries []config.Hook, warnings io.Writer) *Dispatcher
New returns a dispatcher for one resolved profile.
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(payload Payload)
Dispatch starts every hook matching payload.Event. It never waits for a command and never returns hook failures to the caller.
func (*Dispatcher) Drain ¶
func (d *Dispatcher) Drain()
Drain waits for all commands already dispatched. Each command remains bounded by its configured timeout.
type Payload ¶
type Payload struct {
Event string `json:"event"`
PRURL string `json:"pr_url"`
RunID string `json:"run_id"`
Outcome string `json:"outcome,omitempty"`
Profile string `json:"profile"`
PassNumber int `json:"pass_number"`
ArtifactDir string `json:"artifact_dir"`
DryRun bool `json:"dry_run"`
ReviewerID string `json:"reviewer_id,omitempty"`
ReviewerStatus string `json:"reviewer_status,omitempty"`
ActionKind string `json:"action_kind,omitempty"`
ActionMarker string `json:"action_marker,omitempty"`
Agents []string `json:"agents,omitempty"`
Models map[string]string `json:"models,omitempty"`
}
Payload is the stable JSON document written to a hook's stdin. Outcome is set only for terminal events. The remaining optional fields are specific to selection, reviewer, and posting events.
Example ¶
payload, _ := json.Marshal(Payload{Event: "run.started", PRURL: "https://github.com/acme/repo/pull/7", Profile: "work"})
fmt.Println(string(payload))
Output: {"event":"run.started","pr_url":"https://github.com/acme/repo/pull/7","run_id":"","profile":"work","pass_number":0,"artifact_dir":"","dry_run":false}