Every trs command supports six output formats. Pick the one that matches the consumer: humans / agents read compact, scripts read json/csv/tsv, pipelines sometimes want raw passthrough.
| Flag | Name | Who it’s for |
|---|---|---|
| (default) | compact | humans + agents, terse single-pass form |
--json |
JSON | scripts, dashboards, anything structured |
--csv |
CSV | spreadsheets, basic data import |
--tsv |
TSV | tab-friendly tooling (cut -f, spreadsheets) |
--agent |
agent-optimized markdown | LLMs specifically, same compact form with marker syntax for section parsing |
--raw |
raw passthrough | unchanged, no compression, still tracked in stats |
Before the command a flag is always trs’s: trs --json git status.
After the command it is trs’s only when trs has a formatter for that
command and the command does not take the flag itself, so
trs git status --json and trs --json git status are equivalent.
Otherwise the flag belongs to the command and is passed on untouched:
gh run list --json id,url, git log --raw, npm ls --json,
rg --stats. After a bare -- nothing is trs’s. When in doubt, put the
flag before the command.
A command that was asked for a machine format (--json, --porcelain,
--format json, -o=json) is printed byte for byte, and so is any output
that is one JSON document, whatever command produced it (curl, gh api,
kubectl -o json). trs does not collapse spaces, fold repeats or cut long
lines in it.
--jsonStdout holds one JSON document, with no text footer after it, for every run of
a program and every command with JSON output.
Output that is already a JSON object stays one. A JSON array the program
printed is left as written. Anything else is wrapped as
{"output": "...", "success": true}, and a command that never started
prints {"error": true, "success": false, "exit_code": 127, "message": "..."}.
On Windows every trs command starts programs through cmd, so a missing one
is an ordinary failed run with cmd’s exit 1 and message.
Those commands print the same document when they fail, and so does a usage
error, with exit 2.
--help and --version keep their text. The commands that print text
(init, uninstall, upgrade, report, output-saver, debug-info,
history, ingest, discover, audit-docs) are wrapped like any program:
output holds what they printed and stderr their notes and progress.
They get no stdin under --json. A prompt with no answer does nothing and
exits 1 with a hint (--yes for uninstall and upgrade); this holds
without --json too, whenever stdin is closed. Answering n is not a failure.
A command line trs cannot read (an argument that is not UTF-8) runs as typed
and is wrapped the same way, cut like any passthrough; put trs flags before the
program there. A trs command given such an argument exits 2 and says so.
On failure success is false, exit_code holds the real status and
full_output is the path to the raw output. A cut output also gets
full_output. Objects trs changes are re-serialized, so their keys come out
sorted. The exit status of trs matches in every case.
Stderr the summary did not read goes in a stderr key, cleaned and cut like
any passthrough, so 2>&1 still parses. A cut adds full_output. A JSON array
the program printed, or an object with its own stderr key, leaves that stderr
on stderr.
trs run, trs is-clean and trs err report a failure in that document alone,
with nothing on stderr, so 2>&1 still parses. trs err prints
{"lines": [...], "errors": 1, "warnings": 0, "total_lines": 2, "success": false}.
With --csv or --tsv it prints a kind,line table, where kind is error,
warning, context or output, and the header alone when nothing matched.
$ trs git status
main [ahead 1]
unstaged (3):
M src/main.rs
M src/lib.rs
A src/new.rs
$ trs git status --json
{
"branch": "main",
"ahead": 1,
"behind": 0,
"unstaged": [
{ "path": "src/main.rs", "status": "M" },
{ "path": "src/lib.rs", "status": "M" },
{ "path": "src/new.rs", "status": "A" }
]
}
$ trs git status --csv
status,path,new_path,section
M,src/main.rs,,staged
M,src/lib.rs,,unstaged
A,src/new.rs,,staged
Identical to CSV but with tabs as separators. Preferred when the
data itself might contain commas. A tab, newline or carriage return inside a
field prints as \t, \n or \r, so a row stays one line with its columns.
The form is for reading: a literal \n in the data looks the same.
A table holds every row: db, search, grep and err skip the limits they
apply to compact output, and trs search --limit still applies. The trs replace
summary goes to stderr. A failed command keeps its table, with the exit code as the
verdict. Output with no columns of its own (a command trs has no table for,
grep without file names, clean, trim, html2md, the admin commands)
prints as a one-column line table: a line header, then each line of the
output as one row, unfolded and never cut. raw, rewrite (a hook’s
protocol) and a command line with a non-UTF-8 argument print as they are.
$ trs git status --agent
### git status
- branch: main
- ahead: 1
- unstaged:
- M src/main.rs
- M src/lib.rs
- A src/new.rs
The agent format is closest to compact but uses explicit Markdown headings and bullet syntax. Useful when the agent is parsing the output to extract specific fields via pattern matching.
$ trs git status --raw
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: src/main.rs
modified: src/lib.rs
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/new.rs
no changes added to commit (use "git add" and "git commit -a" to commit them)
Raw bypasses the parser entirely and emits the tool’s native output.
Still gets tracked in trs stats with the raw size as input
(for anomaly detection in the dashboard).
trs stats --json | jq
and similar pipelines.Built-in trs commands (trs json, trs search, trs stats, etc.)
produce the same six formats via the same flags.
Wrapped commands (trs git status, trs cargo test, etc.) produce
the six formats from the parsed structured output. For commands that
fall to the generic compression path (no dedicated parser), only
compact and raw are meaningful, json/csv/tsv are skipped with a
warning since there’s no structured data to serialize.
docs/support/commands.md: which
commands have dedicated parsers (and thus full format support) vs
generic fallback.docs/features/stats.md, trs stats --json format
example with the full schema.