Choosing a format
How --format auto decides, which flags belong to which format, and what the exit codes mean.
mantish diff --format auto|tui|diff|json|side-by-side|markdown
| Format | For |
|---|---|
auto | The default: tui when stdin and stdout are terminals, else diff |
tui | The interactive review |
diff | Compact unified-style text — the default for pipes, and for coding agents |
json | One versioned document for tools — coordinates, tags, counts, coverage |
side-by-side | Two columns for a person reading command output |
markdown | A summary plus one fenced diff block per file, to paste into a PR or doc |
There is no agent detection and no terminal sniffing beyond that one rule: pipe it and you get text, run it in a terminal and you get the UI. --format tui without a terminal is an error, not a fallback.
See text formats and the JSON document.
Which flag goes with which format
| Flag | Applies to | Default | Range |
|---|---|---|---|
-U, --context N | text formats | 3 | 0 – 10 000 |
--width N | side-by-side only | 160 | 40 or more |
--stats | diff, side-by-side, markdown | off | |
--exit-code | text formats only | off | |
--inline --split | tui only | ||
--collapse --no-collapse, --words --lines, --syntax --no-syntax, --show-muted | tui only |
Passing a display flag with a text format, --stats with json — whose document always holds its statistics — or --context / --width / --exit-code / --stats with the review is refused, naming the flag. This is on purpose: a flag that silently did nothing would be a bug report waiting to happen. Settings inherited from a profile are simply not applied where they mean nothing, so one profile can hold settings for several formats.
Exit codes
| Code | Meaning |
|---|---|
0 | It worked — even when there are changes |
1 | Only with --exit-code: changes remained after filtering |
2 | Anything failed — bad flags, no engine, unreadable file. stdout is empty |
130/143 | Interrupted (Ctrl+C) or terminated; the signal is named on stderr |
mantish diff main...feature --format json --exit-code > review.json || echo "something to review"
With --exit-code, a file counts as changed while it still holds something to look at: an addition, deletion or rename; a visible or unclassified edit; text that could not be compared (binary, too large); or, under --whitespace exact, a line whose terminator changed. Changes you hid do not make it exit 1 — they are reported in the omission counts instead.
Guarantees of every text format
- UTF-8, no ANSI colour, no spinners, no update notices, no timestamps.
- Stable ordering for identical inputs, configuration and engine version.
- Characters a terminal could act on are escaped (
diff,side-by-side,markdown) or written as lossless\uescapes (json). - Nothing is written to stdout until the whole document has been rendered successfully — a failed or interrupted run leaves stdout empty rather than half a document.
- No credentials, server URLs or unrelated settings appear in the metadata.