mantish/ help / docs
Join the waitlist

The JSON document

The versioned mantish-review document — envelope, counts, files, hunks and lines.

Last updated

sh
mantish diff main...feature --format json

One JSON object on one line, written to stdout, against a published schema: diff-output-v1.schema.json. It is a public contract, not a dump of Mantish's internals — new fields may be added, but schemaVersion changes before anything existing does.

Envelope

json
{
  "schemaVersion": 1,
  "format": "mantish-review",
  "engineVersion": "0.21.0",
  "patchApplicable": false,
  "target": { "…": "what was compared" },
  "selection": { "…": "how it was judged" },
  "summary": { "…": "counts" },
  "analysisComplete": true,
  "filtered": true,
  "files": []
}
FieldMeaning
patchApplicableAlways false. This is a filtered review; do not feed it to git apply.
analysisCompleteEvery file received semantic analysis — independent of deliberate filtering.
filteredA rule or whitespace mode may have left content out.

target

json
{
  "mode": "repository",
  "scope": "range",
  "before": "main",
  "after": "feature",
  "baseCommit": "9f1c…",
  "headCommit": "4b41…",
  "comparison": "merge-base",
  "includesUntracked": false,
  "capture": "commits"
}

mode is files, directories, repository or pull-request; scope narrows it to files, directories, working-tree, commit, range or pull-request. comparison is merge-base for a range and null otherwise. For mantish pr diff both are pull-request: before is the target branch, after the source branch, baseCommit the merge base and headCommit the head the pull request was read at. capture is commits when everything was read at resolved commit ids, and disk when it was read from the filesystem while the command ran (files, directories, the working tree) — a working-tree capture is not an atomic snapshot, and includesUntracked says whether untracked files are in it. baseCommit is null for an unborn HEAD and for a root commit's empty tree.

selection

The tag sets, whitespaceMode, context and presentationFingerprint the document was judged under — the engine's answer, including policies you did not name yourself. One document is always produced under one fingerprint; if the settings change mid-run, the comparison is taken again.

summary

CountWhat it counts
filesListedEvery file in the comparison, whatever became of it
changedFilesFiles that still hold something to look at (this is what --exit-code reads)
visibleEditsSource edits present in the output
omittedEditsSource edits left out entirely because every change explaining them was hidden
mixedEditsEdits where visible logic and hidden noise share a line, kept and marked
unclassifiedEditsDiffering regions semantic analysis did not explain — never treated as noise
hiddenChangesChange records the selection hid (not the same as omitted edits)
lineEndingChangesAligned lines whose terminator changed, counted only under whitespace=exact
unanalysedFilesFiles without semantic analysis (binary, too large, unsupported)
ignoredFilesFiles a file-ignore rule matched

The same words mean the same things in every format.

files[]

json
{
  "path": "Order.new.cs",
  "beforePath": "Order.cs",
  "afterPath": "Order.new.cs",
  "status": "modified",
  "language": "csharp",
  "analysis": { "complete": true, "reason": null, "textCompared": true },
  "before": { "lineCount": 20, "finalNewline": true, "eol": "lf", "byteOrderMark": null },
  "after": { "lineCount": 21, "finalNewline": true, "eol": "lf", "byteOrderMark": null },
  "counts": {
    "visibleEdits": 2,
    "omittedEdits": 1,
    "mixedEdits": 1,
    "hiddenChanges": 2,
    "unclassifiedEdits": 0,
    "lineEndingChanges": 0
  },
  "hiddenReasons": { "whitespace": 2 },
  "hunks": []
}

Files are in path order, and a file whose every edit was hidden is still here — with an empty hunks array and the counts that explain it. status is added, deleted, modified or renamed; beforePath or afterPath is null for a side that does not exist. analysis.reason is binary, too-large, ignored, withheld, unsupported-language, parser-fallback, parse-error or timeout — the engine stopped the file's analysis at its per-file budget, and the file was not compared; the rest of the comparison is unaffected. parse-error is a file one side of which does not parse — a closing brace lost mid-edit, say: it is compared, and its structure read as far as the parser could recover it, but its analysis is not complete (complete: false). withheld is a file whose content your rules keep from coding agents (Ignored files): listed with its path and status, never compared. (lines-only, a file compared line by line because no statistics were asked for and nothing could be hidden, never appears here: the JSON document always asks for the full analysis.) eol is lf, crlf, mixed or none. byteOrderMark is the byte-order mark the side opens with — utf-8, utf-16le, utf-16be, utf-32le or utf-32be — or null for none. No line shows a mark, so a file present on both sides whose two marks differ counts in changedFiles whatever the whitespace mode: a JSON parser that refuses a mark, or a script whose shebang it hides, breaks on that change alone.

hunks[]

json
{
  "beforeStart": 3,
  "beforeCount": 5,
  "afterStart": 3,
  "afterCount": 6,
  "mixed": false,
  "changes": [
    {
      "type": "modified",
      "tags": ["logic"],
      "confidence": 0.9,
      "presentation": { "state": "shown", "reason": null, "rules": [] },
      "description": "modified code",
      "replacement": null,
      "renames": [],
      "renameCoverage": null
    }
  ],
  "lines": [
    {
      "kind": "context",
      "beforeLine": 3,
      "afterLine": 3,
      "text": "    public decimal Total()"
    },
    {
      "kind": "remove",
      "beforeLine": 5,
      "afterLine": null,
      "text": "        return _lines.Sum(l => l.Price);"
    },
    {
      "kind": "add",
      "beforeLine": null,
      "afterLine": 5,
      "text": "        return _lines.Sum(l => l.Price * l.Qty);"
    }
  ]
}

Line numbers are 1-based and are the original source coordinates. text is the exact source line without its terminator — per-file finalNewline and eol carry the terminator facts. Each visible source line appears once in its hunk, context comes only from genuinely unchanged aligned lines, and a hunk never spans an omitted edit. presentation.state is shown, muted or spotlight.

A change's renames are the declarations it renamed: label is what a client shows (Function renamed: undeclared → looked_up), before and after the two names, id the declaration pair — the same on every change that carries the rename — and basis what proved it: declaration-pair, resolved-binding, or declared-in-pull-request for a use of a declaration another file renamed. renameCoverage says how much of the change they explain: complete when they account for all of it, partial when it also holds an edit no rename explains — a function deleted and another added in its place each carry the rename, and are still the deletion and the addition — and null for a change that carries no rename.

Reading it

sh
mantish diff main...feature --format json | jq '.summary'
mantish diff main...feature --format json | jq -r '.files[] | select(.counts.omittedEdits > 0) | .path'
mantish diff main...feature --format json | jq -r '.files[].hunks[].changes[] | select(.presentation.state == "spotlight") | .description'

Check analysisComplete and filtered before concluding that nothing else changed.

Was this page helpful?