JSON report contract

The fields of what the ascribe commands write with --format json, from their JSON Schemas.

For AI agents: the documentation index is at llms.txt, and this page is available as Markdown.

The commands that take --format json each write one JSON document, and this contract gives each document’s fields, as tables generated from its schema. The schemas are JSON Schema (draft 2020-12), generated from the code that writes the documents, so the two can’t disagree. Each release’s schemas are in the schemas/ folder at the release’s tag. The command reference says what each command does, with an example of its document.

Ascribe (in main, not yet released, 0.4.6)

The schemas are in @ascribed/cli too, as @ascribed/cli/schemas/<name>.schema.json, so a project that pins the package has the schemas of the version it runs. A schema’s $id is its address at the release’s tag, such as https://raw.githubusercontent.com/ascribed-dev/ascribe/v{version}/schemas/check.schema.json, which never changes.

Every document follows these rules:

  • schema_version changes only when a field is removed or changes meaning. Fields can be added without a new version, so ignore fields you don’t know. The schemas allow fields they don’t list.
  • A field whose values are a fixed set of names, such as a diagnostic’s severity or next, may gain a value without a new version. A reader treats a value it doesn’t know as the field says: an unknown severity as advice, which never fails a check.
  • A field the schema doesn’t list as required is left out when it has no value. A required field that can be null is always written.
  • Keys are snake_case, and so are the names a field’s values are. That holds for every JSON document Ascribe writes, the JSON output and the files a build records among them; only the language server’s and the MCP server’s messages are camelCase, as their protocols are.
  • ascribe_version is the release of Ascribe that wrote the document, such as 0.4.5, in every command’s document, so a tool can compare it. A binary built from a checkout writes its release too; ascribe --version says which build it is.

Reading the tables

Each command’s section has tables generated from the schema it links. The first is the document’s own fields; then there’s one for each type a field names, such as Range, in the order they’re first named. A field that’s an object, or a list of objects, has its fields as rows below it, under its path, such as diagnostics[].file; a type named once has its fields there too, and no table of its own.

  • Type is the field’s JSON type: string, integer, boolean, object, a type’s name, T[] for a list, [T, T] for a list of fixed length, { [name]: T } for an object of names, "value" for a constant, and A | B for either. any takes any value.
  • Required says whether the field is always written. A field that isn’t is left out when it has no value.
  • Nullable says whether a required field can be null.

A type that’s one of several kinds of object, such as a block, has a table of the fields every kind has, then one for each kind, named by the field that tells them apart: `type` is `"heading"`. A type that’s one of several names has a table of the names.

The pages

The pages are grouped as the ascribe.toml reference is, by what the commands are for:

ascribe check and ascribe build

The fields of schemas/check.schema.json:

CheckReport: What ascribe check --format json and ascribe build --format json write: one document, whatever the outcome. Fields can be added without a new schema_version, so a reader ignores fields it doesn’t know.

Field Type Required Nullable Description
schema_version integer yes no The version of this schema. It changes only when a field is removed or changes meaning.
ascribe_version string yes no The release of Ascribe that wrote it, as 0.4.5.
error string yes yes Why the project couldn’t be checked (exit code 2), or null. When it isn’t null, diagnostics holds what was found first: the content model’s problems.
files_checked integer yes no How many source files were checked: the project’s.
files_reported integer yes no How many of them the report covers: the source files in the paths named, or every one when no path was.
builds_checked string[] yes no The builds whose page-level checks ran, in ascribe.toml’s order: every build, the ones named with --build, or the editor’s with --editor-build. Empty when the project couldn’t be checked.
diagnostics object[] yes no Every diagnostic, in file order, and in source order within a file; advice after the errors and warnings, in the same order. With paths, only those that count for them. With --summary, none: see truncated.
diagnostics[].code string yes no The code, such as ASC036.
diagnostics[].slug string yes no The diagnostic’s name, such as link-target-missing.
diagnostics[].severity string yes no error, warning, or advice. Advice never fails the command. More severities may be added; a reader treats one it doesn’t know as it treats advice.
diagnostics[].next string yes no The kind of next step: fix when Ascribe can make the edit, choose when the writer picks among things Ascribe can list, write when it needs writing or judgment, outside when nothing in the source can fix it, and review when it may be fine as it is.
diagnostics[].message string yes no What’s wrong, and what to do about it.
diagnostics[].file string yes no The file, relative to the project root (the folder of ascribe.toml), with / separators. ascribe.toml for a content-model problem.
diagnostics[].range Range yes no Where in the file.
diagnostics[].related object[] yes no Other places that explain it.
diagnostics[].related[].file string yes no The file, as a diagnostic’s file is.
diagnostics[].related[].range Range yes no Where in the file.
diagnostics[].related[].message string yes no What it has to do with the diagnostic.
diagnostics[].fixes object[] yes no Edits that would fix it.
diagnostics[].fixes[].title string yes no What the fix does.
diagnostics[].fixes[].file string yes no The file the edits are in, as a diagnostic’s file is.
diagnostics[].fixes[].edits object[] yes no The edits, each replacing the text of its range.
diagnostics[].fixes[].edits[].range Range yes no The text it replaces.
diagnostics[].fixes[].edits[].new_text string yes no The text that replaces it.
diagnostics[].fixes[].applicability string yes no safe when applying the edits as they are can’t change what the page says and leaves nothing to decide; unsafe otherwise.
diagnostics[].builds string[] yes no The builds a page-level diagnostic appears in, in ascribe.toml’s order. Empty for a file-level diagnostic, and for one in content no build publishes. With --build, only that build.
diagnostics[].unpublished boolean yes no Whether it’s in content that no build publishes.
diagnostics[].help string yes no How to fix it, in general: the diagnostics reference’s advice for its code, in Markdown, whose links are the docs’ permalinks, such as https://ascribed-dev.com/go/22-checks/.
diagnostics[].docs string yes no The address of its entry in the diagnostics reference: the docs’ permalink for its code, such as https://ascribed-dev.com/go/ASC036/, which forwards to the entry wherever it is.
diagnostics[].repeats integer yes no For a problem in included content reported because one of its related places is in a path named: at how many other includes it’s reported too, collapsed into this one. 0 otherwise.
diagnostics[].rule string no no The rule of the program that found it, such as Ascribe.Repeated from Vale, for a prose diagnostic. Absent for Ascribe’s own.
truncated boolean yes no Whether diagnostics leaves some out. It does with --summary, which lists none.
shown integer yes no How many diagnostics diagnostics lists.
total integer yes no How many diagnostics there are.
next_command string yes yes The command that lists the ones left out, when truncated; null otherwise.
summary object yes no How many errors, warnings, and advice.
summary.errors integer yes no How many errors.
summary.warnings integer yes no How many warnings.
summary.advice integer yes no How many advice.
summary.acknowledged integer no no How many problems are acknowledged as intended. Left out when there are none.
summary.baselined integer no no How many problems are baselined, listed in ascribe.baseline, which diagnostics leaves out and which are advice. Left out when there are none, and with --no-baseline.
summary.by_code object[] no no With --summary: how many diagnostics have each code, most first.
summary.by_code[].code string yes no The code, such as ASC036.
summary.by_code[].slug string yes no The diagnostic’s name, such as link-target-missing.
summary.by_code[].severity string yes no error, warning, or advice.
summary.by_code[].count integer yes no How many.
summary.by_file object[] no no With --summary: how many diagnostics are in each file, most first.
summary.by_file[].file string yes no The file, as a diagnostic’s file is.
summary.by_file[].errors integer yes no How many errors.
summary.by_file[].warnings integer yes no How many warnings.
summary.by_file[].advice integer yes no How many advice.
acknowledged object[] no no The problems acknowledged as intended, which diagnostics leaves out and which don’t fail the command, in file order. Left out when there are none, and with --summary.
acknowledged[].code string yes no The code of the check that found it, such as ASC036.
acknowledged[].slug string yes no The check’s name.
acknowledged[].message string yes no What the check found.
acknowledged[].file string yes no The file, as a diagnostic’s file is.
acknowledged[].range Range yes no Where in the file.
acknowledged[].builds string[] yes no The builds it appears in, as a diagnostic’s builds are.
acknowledged[].reason string yes no Why it’s intended: the acknowledgement’s reason.
acknowledged[].at object yes no Where the acknowledgement is written.
acknowledged[].at.file string yes no The file, as a diagnostic’s file is.
acknowledged[].at.range Range yes no Where in the file.
fixed object[] no no With --fix, the safe fixes it applied, in file order and, within a file, in the order of their diagnostics; the rest of the report is the check after them. With --dry-run, the fixes it would apply, none of which was, and the check is of the files as they are. Left out when there’s none.
fixed[].code string yes no The code of the diagnostic it fixed, such as ASC036.
fixed[].slug string yes no The diagnostic’s name.
fixed[].title string yes no What the fix did.
fixed[].file string yes no The file it changed, as a diagnostic’s file is.

Range: A span of a file. end is just past its last character; an empty range (an insertion) has equal positions.

Field Type Required Nullable Description
start Pos yes no Its first character.
end Pos yes no Just past its last character.

Pos: A position in a file.

Field Type Required Nullable Description
line integer yes no The line, from 1.
column integer yes no The column, from 1, in Unicode characters (not bytes or UTF-16 units).
offset integer yes no The byte offset from the start of the file.

ascribe fmt

The fields of schemas/fmt.schema.json:

FmtReport: What ascribe fmt --format json writes: one document. Fields can be added without a new schema_version, so a reader ignores fields it doesn’t know.

Field Type Required Nullable Description
schema_version integer yes no The version of this schema. It changes only when a field is removed or changes meaning.
ascribe_version string yes no The release of Ascribe that wrote it, as 0.4.5.
written boolean yes no Whether the files were rewritten: false with --check or --dry-run, which write nothing.
files object[] yes no Each file that changed, or with --check or --dry-run would change, in path order, with the edits that format it.
files[].file string yes no The file, relative to the project root (the folder of ascribe.toml), with / separators; a file outside it as it was found.
files[].edits object[] yes no The edits, each replacing the text of its range in the file as it was before formatting. They don’t overlap, and are in file order.
files[].edits[].range object yes no The text it replaces.
files[].edits[].range.start Pos yes no Its first character.
files[].edits[].range.end Pos yes no Just past its last character.
files[].edits[].new_text string yes no The text that replaces it.
refused object[] yes no The files left alone because a symbolic link on the way to them leads to a file that isn’t a source file of the content root.
refused[].file string yes no The file, as a formatted file’s file is.
refused[].reason string yes no Why, as ascribe check words it.

Pos: A position in a file.

Field Type Required Nullable Description
line integer yes no The line, from 1.
column integer yes no The column, from 1, in Unicode characters (not bytes or UTF-16 units).
offset integer yes no The byte offset from the start of the file.

ascribe baseline write

The fields of schemas/baseline-write.schema.json:

BaselineWriteReport: What ascribe baseline write --format json writes.

Field Type Required Nullable Description
schema_version integer yes no The version of this schema. It changes only when a field is removed or changes meaning.
ascribe_version string yes no The release of Ascribe that wrote it, as 0.4.5.
file string yes no The file written, from the project’s folder: ascribe.baseline.
created boolean yes no Whether the project had no baseline, so this made one.
changed boolean yes no Whether the file changed: it’s new, or its text differs. With --dry-run, whether it would.
written boolean yes no Whether the file was written: it changed, without --dry-run.
entries integer yes no How many problems the baseline holds, after this.
files integer yes no How many files they’re in.
added integer yes no How many of them this added.
skipped object yes no How many errors and warnings it left out, which a baseline never holds.
skipped.errors integer yes no How many errors.
skipped.warnings integer yes no How many warnings.

ascribe baseline prune

The fields of schemas/baseline-prune.schema.json:

BaselinePruneReport: What ascribe baseline prune --format json writes.

Field Type Required Nullable Description
schema_version integer yes no The version of this schema. It changes only when a field is removed or changes meaning.
ascribe_version string yes no The release of Ascribe that wrote it, as 0.4.5.
file string yes no The file pruned, from the project’s folder: ascribe.baseline.
found boolean yes no Whether the project has a baseline. Without one, there’s nothing to prune, and nothing is written.
changed boolean yes no Whether the file changed: some entry was removed. With --dry-run, whether it would.
written boolean yes no Whether the file was written: it changed, without --dry-run.
entries integer yes no How many problems the baseline holds, after this.
files integer yes no How many files they’re in.
removed integer yes no How many entries it removed.

ascribe vale eject

The fields of schemas/vale-eject.schema.json:

ValeEjectReport: What ascribe vale eject --format json writes: the preset written out, and the files written.

Field Type Required Nullable Description
schema_version integer yes no The version of this schema. It changes only when a field is removed or changes meaning.
ascribe_version string yes no The release of Ascribe that wrote it, as 0.4.5.
preset string yes no The preset written out.
written string[] yes no The files written, from the project’s folder, /-separated, in the order they were written: ascribe.toml last. With --dry-run, the files it would write.
dry_run boolean yes no Whether it ran with --dry-run, and wrote nothing.