Documentation
¶
Overview ¶
Package gate runs a quest's auto gates and records their observed results. qm is the verifier of auto gates: it runs the check and reads the verdict. The agent never passes a gate; the human checks toggle gates and stamps done. Supported auto gates are cmd:<shell> plus a small set of GitHub PR gates backed by structured gh JSON. Results are transient and observed, so they live in a runtime sidecar (sidecar.go), never in the quest JSON.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QuestResults ¶
type QuestResults struct {
QuestID string `json:"quest_id"`
Gates map[string]Result `json:"gates"`
}
QuestResults is the latest auto-gate results for one quest, keyed by gate name. It is observed, transient runtime state — it lives in the sidecar, never in the quest JSON.
func (QuestResults) RanAtMap ¶ added in v0.3.21
func (q QuestResults) RanAtMap() map[string]time.Time
RanAtMap projects the results to gate-name → observation time, so renderers can show how fresh each verdict is. Zero times (legacy sidecar files) are omitted.
func (QuestResults) StatusMap ¶
func (q QuestResults) StatusMap() map[string]string
StatusMap projects the results to gate-name → status string, the shape the renderer overlays onto the detail pane (pass/fail/error).
type Result ¶
type Result struct {
Gate string `json:"gate"`
Status Status `json:"status"`
Output string `json:"output,omitempty"` // combined stdout+stderr (snippet)
RanAt time.Time `json:"ran_at"`
}
Result is one auto-gate run's observed outcome.
func RunCheck ¶
RunCheck runs a gate's check in worktree and classifies the verdict. The shell for cmd:<shell> checks and gh for github:* checks run with worktree as their working directory, under ctx — so a stalled gh call or a hanging cmd: gate is cancelled when the loop is stopped (Ctrl-C) or a per-gate deadline fires, instead of wedging the whole quest loop. The runner fabricates nothing; it only observes the check the quest authored.
func (Result) Misconfigured ¶
Misconfigured reports whether the result is a broken check rather than a real failure — surfaced distinctly so it announces itself instead of masquerading as the gate being unmet.
type Sidecar ¶
type Sidecar struct {
// contains filtered or unexported fields
}
Sidecar is the runtime store of auto-gate results, one JSON file per quest at <dir>/<id>.json. dir is under qm's dotfiles (a sibling of the quest store), never a repo. The quest JSON is never touched by a check run.
func NewSidecar ¶
NewSidecar returns a sidecar rooted at dir (created lazily on Save).
type Status ¶
type Status string
Status is the verdict of an auto-gate run.
const ( // StatusPass means the check ran and exited zero. StatusPass Status = "pass" // StatusFail means the check ran and exited nonzero — legitimately unmet. StatusFail Status = "fail" // StatusError means the check did not execute to a real verdict: a broken // or misconfigured check (command not found, not executable, unsupported // check type). It must never be mistaken for a real failure. StatusError Status = "error" )