Skip to main content

Machine Outputs

Four machine-readable formats, one flag: --format=json, --format=llm, --format=markdown, and --format=ndjson. All are stable and deterministic. Same input, same output.

JSON

differens main..feature --format=json prints one document with everything: the per-file narrated changes and the cross-file moves.
Schema notes:
  • perFile is an array of SemanticChange objects: description, filePath, and the full action (typed EditAction, containment context chain included, nearest ancestor first).
  • crossFileMoves is a flattened summary of kind, name, source, destination, and whether the node was edited in transit.
  • Hash values are serialized as integers. The JSON replacer handles bigint as a precaution, though hashes currently fit in 53-bit safe integers.

LLM

--format=llm is a compact, self-contained document. It costs less than the raw diff it replaces. Each named change gets one line, each file is named once, and unnamed churn collapses into a tally. Every named change carries its source line, so a model can read twenty lines of context instead of the whole file.
Line grammar: Pipe it straight into a model:

Markdown

--format=markdown is a changelog you can drop into a PR description: one ## heading per file, one bullet per change.
Empty changesets render as _no logical changes_.

NDJSON (streaming)

--format=ndjson is the streaming format: one JSON object per changed file, printed the moment that file’s diff finishes, always in input order. A long changeset starts producing output while the later files are still matching.
Per-line shape:
  • filePath: which file this object covers.
  • changes: narrated changes for that file, description plus the typed action, same shape as the perFile entries in the JSON format.
  • Unchanged files produce no line, matching the other formats.
Cross-file moves need the whole changeset, so when any exist they trail as one final object:
Consumers filter per-file lines with select(.filePath) and read the trailer with select(.crossFileMoves).