Expand description
Canonical JSON envelope for harn CLI commands.
Every --json mode returns a JsonEnvelope<T> — a versioned
wrapper that exposes schemaVersion, ok, and either data or
error. Soft signals attach as warnings so ok: true stays
stable as long as the command succeeds.
Schema versions are per-command and monotonically increasing.
catalog returns the registry consumed by harn --json-schemas.
New commands extend the catalog (and bump their own
JsonOutput::SCHEMA_VERSION) when their JSON shape changes in a
way agents need to detect.
See epic #1753 (--json everywhere) for the broader contract.
Structs§
- Json
Envelope - Versioned wrapper for every
--jsonCLI output. All five fields are always serialized so consumers can rely on a flat shape: missing payloads surface asnulland the emptywarningsarray is[]rather than absent. - Json
Error - Json
Warning - Schema
Entry - One row of the
harn --json-schemascatalog.schema_jsonis inline when small; richer schemas live behind a futureschema_urlfield documented per-command.
Constants§
- CATALOG_
SCHEMA_ VERSION - Schema version of the
harn --json-schemascatalog itself. Bump when the shape ofSchemaEntryor the catalog envelope changes.
Traits§
- Json
Output - Implemented by every CLI command that exposes a
--jsonmode. The associatedSCHEMA_VERSIONis also surfaced incatalogso agents can negotiate per-command compatibility without parsing every payload.
Functions§
- catalog
- Static catalog of commands that already emit a stable JSON shape.
- to_
string_ pretty - Encode an envelope as JSON. Uses pretty form so humans tailing the
terminal can still read it; agents
jq-pipe either form.