mantish/ help / docs
Join the waitlist

Choosing a format

How --format auto decides, which flags belong to which format, and what the exit codes mean.

Last updated

sh
mantish diff --format auto|tui|diff|json|side-by-side|markdown
FormatFor
autoThe default: tui when stdin and stdout are terminals, else diff
tuiThe interactive review
diffCompact unified-style text — the default for pipes, and for coding agents
jsonOne versioned document for tools — coordinates, tags, counts, coverage
side-by-sideTwo columns for a person reading command output
markdownA 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

FlagApplies toDefaultRange
-U, --context Ntext formats30 – 10 000
--width Nside-by-side only16040 or more
--statsdiff, side-by-side, markdownoff
--exit-codetext formats onlyoff
--inline --splittui only
--collapse --no-collapse, --words --lines, --syntax --no-syntax, --show-mutedtui 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

CodeMeaning
0It worked — even when there are changes
1Only with --exit-code: changes remained after filtering
2Anything failed — bad flags, no engine, unreadable file. stdout is empty
130/143Interrupted (Ctrl+C) or terminated; the signal is named on stderr
sh
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 \u escapes (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.
Was this page helpful?