Every command in the CLI supports two output modes: rich Spectre.Console rendering for human use, and clean JSON for AI agents, scripts, and piping.
By default, commands render data using Spectre.Console tables, panels, and color-coded statuses. When --json is passed (or APPVEYOR_OUTPUT=json is set), commands emit structured JSON to stdout with no ANSI escape codes.
| Context | Choice | Alternatives considered |
|---|---|---|
| Output format for AI agents | JSON via --json flag or env var |
YAML (adds complexity), plain text (hard to parse) |
| How to toggle | Per-command flag + global env var | Config file setting (less convenient for scripts) |
| Implementation | IOutputRenderer abstraction |
Per-command if/else (doesn't scale) |
appveyor project listrenders a Spectre table with rounded borders and column headersappveyor project list --jsonemits a JSON array to stdoutAPPVEYOR_OUTPUT=jsonmakes JSON the default for all commands (AI agents set this once)- Color-coded statuses: green for success, red for failed, blue for running, yellow for queued
- Detail views use key-value panels (e.g.
project getshows project metadata + last build)
- Table output shows all columns with proper alignment
- JSON output is valid JSON parseable by
jqandSystem.Text.Json -
--jsonflag works on every command -
APPVEYOR_OUTPUT=jsonenv var forces JSON output - No ANSI codes in JSON output
src/AppVeyorCli/Output/
IOutputRenderer.cs # Abstraction (RenderTable, RenderDetail, RenderJson, etc.)
ConsoleRenderer.cs # Spectre.Console implementation
JsonRenderer.cs # System.Text.Json implementation
OutputRendererFactory.cs # Selects renderer based on --json flag or env var