A format is how a command's output is written. readerly has four built in, and a tool can add its own. This page shows the acme check example from test/golden in each.
| Format | Picked for | Color | Writes |
|---|---|---|---|
text | A person at a terminal, CI, a pipe | When the color rule allows | Findings on stdout; prompts, progress and failures on stderr |
agent | A coding agent | Never | The report and failures on stdout, 8,000 characters by default |
json | --format json or --json | Never | One document on stdout, also on failure |
jsonl | --format jsonl | Never | One JSON record per line on stdout, as entries happen |
A verdict line, the diagnostics with a ├▶ ╰▶ tree for why and fix, then the next: lines. Errors print before warnings and infos. At a terminal it shows 50 rows by default and hides the rest behind a … N more line; CI, pipes and --full get every row. Diagnostics covers the layout.
A person at a terminal gets this on stdout, with the prompt ? Apply 2 safe fixes? (y/N) on stderr between the warning and the blank line:
✖ 2 errors, 1 warning in 212 files (0.8s)
error ACME001 src/app.ts:14:3 Route handler reads process.env at module scope
├▶ why: The value is fixed at build time
╰▶ fix: Read it inside the handler
error ACME004 src/db.ts:3:1 Top-level await in a server entry
╰▶ fix: Move the call into the plugin setup
warn ACME010 vite.config.ts:8:5 Alias shadows a workspace package
next: acme explain <code> (explains one code)The verdict on line 1, one line per diagnostic, no color, no glyphs and no prompts, under a budget. A coding agent gets:
acme check: failed. 2 errors, 1 warning in 212 files (0.8s).
error ACME001 src/app.ts:14:3 Route handler reads process.env at module scope. fix: Read it inside the handler
error ACME004 src/db.ts:3:1 Top-level await in a server entry. fix: Move the call into the plugin setup
warn ACME010 vite.config.ts:8:5 Alias shadows a workspace package
next: acme check --fix (applies 2 safe fixes)
next: acme explain <code> (explains one code)The prompt it couldn't ask became next: acme check --fix. Coding agents explains each part.
One document with schema, status, summary, diagnostics, result and next. out.log() lines are left out. acme check --format json prints:
{
"schema": "acme.check/v1",
"status": "failed",
"summary": {
"error": 2,
"warn": 1,
"info": 0
},
"diagnostics": [
{
"severity": "error",
"code": "ACME001",
"message": "Route handler reads process.env at module scope",
"why": "The value is fixed at build time",
"fix": "Read it inside the handler",
"file": "src/app.ts",
"line": 14,
"column": 3
},
{
"severity": "error",
"code": "ACME004",
"message": "Top-level await in a server entry",
"fix": "Move the call into the plugin setup",
"file": "src/db.ts",
"line": 3,
"column": 1
},
{
"severity": "warn",
"code": "ACME010",
"message": "Alias shadows a workspace package",
"file": "vite.config.ts",
"line": 8,
"column": 5
}
],
"result": {
"files": 212,
"durationMs": 840
},
"next": [
{
"command": "acme check --fix",
"reason": "applies 2 safe fixes"
},
{
"command": "acme explain <code>",
"reason": "explains one code"
}
]
}A version record first, one record per diagnostic, log or next step as the command reports it, and a result record last. Every record has a type. acme check --format jsonl prints:
{"type":"version","schema":"acme.check/v1","tool":"acme@1.2.0"}
{"type":"diagnostic","severity":"error","code":"ACME001","message":"Route handler reads process.env at module scope","why":"The value is fixed at build time","fix":"Read it inside the handler","file":"src/app.ts","line":14,"column":3}
{"type":"diagnostic","severity":"error","code":"ACME004","message":"Top-level await in a server entry","fix":"Move the call into the plugin setup","file":"src/db.ts","line":3,"column":1}
{"type":"diagnostic","severity":"warn","code":"ACME010","message":"Alias shadows a workspace package","file":"vite.config.ts","line":8,"column":5}
{"type":"next","message":"acme check --fix","reason":"applies 2 safe fixes"}
{"type":"next","message":"acme explain <code>","reason":"explains one code"}
{"type":"result","status":"failed","message":"2 errors, 1 warning in 212 files (0.8s)","data":{"files":212,"durationMs":840}}JSON and JSONL documents every field.
How readerly picks the format
Section titled "How readerly picks the format"resolveProfile() in src/profile.ts takes the first of these that is set:
--format <name>.--json, the same as--format json. When both are given,--formatwins.- The
<TOOL>_FORMATenvironment variable.formatEnvName(tool)gives its name: the tool name in upper case, with every character other than a letter or digit turned into_.acmereadsACME_FORMAT, andvite-doctorreadsVITE_DOCTOR_FORMAT. - Detection:
agentwhen the reader is an agent,textfor every other reader.
A <TOOL>_FORMAT value that is not a format is ignored, and --verbose says so:
format: text (ACME_FORMAT=yaml ignored, not one of text, agent, json, jsonl; detected pipe (stdout not a TTY))The format never changes who the reader is. --format text under an agent still prints no prompt. See Readers.
A bad --format
Section titled "A bad --format"An unknown --format value is a usage failure with exit code 2. readerly sets the bad flag aside, picks the format from the other flags and detection, and prints the failure in that format. In text it goes to stderr:
✖ --format yaml is not a format. Use one of: text, agent, json, jsonl.
╰▶ fix: Pass --format with one of: text, agent, json, jsonl.--format with no value prints the same failure, starting with --format needs a value.. Under an agent, the failure is the agent report on stdout, and with --json it is a JSON document with "status": "failed".
Your own formats
Section titled "Your own formats"A tool adds a format with formats, and renders it with renderers:
const out = createOut({
tool: "acme",
command: "check",
argv,
formats: ["count"],
renderers: {
count: { render: (run) => ({ stdout: `${run.counts.error}\n` }) },
},
});acme check --format count and ACME_FORMAT=count acme check both print the error count. The new name joins the list in the --format error, as in Use one of: text, agent, json, jsonl, count.. A format in formats without a renderer makes createOut throw No renderer for format count. when that format is picked. Custom renderers covers renderers and render.
GitHub annotations are not a format
Section titled "GitHub annotations are not a format"On GitHub Actions, the text format also writes ::error and ::warning workflow commands to stderr, and the runner shows them on the diff. They sit next to text, not in place of it, and no flag selects them. See GitHub Actions.