Documentation
¶
Index ¶
Constants ¶
const SchemaVersion = 1
SchemaVersion is the version of the JSON envelope below. Consumers — CI pipelines, the planned editor extension — parse this, so it is versioned from the first release that emits it rather than after the first breaking change.
Bump it only for a breaking change to an envelope's `data` shape, and record what changed in docs/json-output.md.
Variables ¶
This section is empty.
Functions ¶
func Print ¶
Print dispatches to JSON or Table output based on format. For table output, the caller must provide headers and a toRow function.
func PrintEnvelope ¶ added in v2.1.0
PrintEnvelope writes a versioned envelope. kind names the payload shape, e.g. "diff".
Types ¶
type Envelope ¶ added in v2.1.0
type Envelope struct {
SchemaVersion int `json:"schemaVersion"`
Kind string `json:"kind"`
Data any `json:"data"`
}
Envelope wraps machine-readable output in a self-describing, versioned structure.
Commands that predate this print their payload bare. New commands whose output is a contract — anything CI or an editor consumes — use the envelope, so a consumer can tell which shape it is reading instead of guessing.