Documentation
¶
Overview ¶
Package out renders every command result as a stable, machine-readable envelope. AI agents parse stdout; humans can ask for -o text.
Index ¶
Constants ¶
const ( ExitOK = 0 ExitError = 1 // generic / internal error ExitUsage = 2 // bad flags or arguments ExitNotFound = 3 // host, key, secret, job ... not found ExitConnect = 4 // ssh connection / auth / host-key failure ExitRemote = 5 // remote command ran but exited non-zero ExitPolicy = 6 // blocked by safety policy (needs --yes / --allow-dangerous) ExitTimeout = 7 // command or connection timed out ExitConflict = 8 // precondition failed (e.g. replace text not found / ambiguous) )
Exit codes are part of the public contract. Agents may branch on them.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope struct {
OK bool `json:"ok"`
Command string `json:"command"`
Data any `json:"data,omitempty"`
Error *Error `json:"error,omitempty"`
Meta Meta `json:"meta"`
}
Envelope is the single JSON object printed on stdout for every command.
type Error ¶
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
Hint string `json:"hint,omitempty"`
Exit int `json:"-"`
}
Error is a typed error carrying a stable code, an exit code and a hint that tells the agent how to recover.
type Printer ¶
type Printer struct {
Format string // json | text | yaml-ish not supported, keep it simple
Pretty bool
Version string
Start time.Time
DryRun bool
W io.Writer
}
Printer is configured once by the root command.