Skip to content

Consume results programmatically

A gate that only passes or fails is the floor. Once manni meta is running, the same data behind the pass/fail decision can feed other tools. That means dashboards, PR bots, content catalogs, and custom checks, without re-parsing documents yourself.

manni meta exposes its results three ways, each suited to a different integration style:

  • --format json: a single structured object per run, for pipelines that shell out and parse stdout.
  • The get command: pull specific metadata field values out of files, for scripts that need a few values rather than a full validation report.
  • The TypeScript API: call manni meta’s command cores directly from Node.js, for tools built on top of it.

manni meta validate --format json prints one JSON object to stdout describing the whole run. It is the path for any tool that runs manni meta as a subprocess and reads its output.

Terminal window
npx -y @hawkeyexl/manni meta validate "docs/**/*.md" --format json

The object has a summary and a results array:

{
"summary": {
"files": 1,
"passed": 0,
"failed": 1,
"errors": 1
},
"results": [
{
"file": "bad-timestamp.md",
"format": "markdown",
"ok": false,
"schemas": ["google:okf:0.1"],
"errors": [
{
"schema": "google:okf:0.1",
"instancePath": "/timestamp",
"message": "must match format \"date-time\"",
"keyword": "format",
"subject": "date-time",
"line": 4
}
]
}
]
}

The fields:

  • summary: run-wide counts: files checked, passed, failed, and the total errors across all files.
  • results: one object per file: file (the path as manni meta saw it), format (the extractor that read it), ok, schemas (the resolved schema set), and errors.
  • Each error carries schema, the schema id that produced it, and instancePath, a JSON Pointer to the field, or "" for the document root. It also carries message, keyword and subject. Finally line, 1-based, when manni meta can locate it, and col, 1-based, when the format can supply one.

The output is plain (never colorized) and goes to stdout, so it pipes cleanly into jq. List the files that failed:

Terminal window
npx -y @hawkeyexl/manni meta validate "docs/**/*.md" --format json \
| jq -r '.results[] | select(.ok == false) | .file'

Flatten every error into a file:line message line for a log:

Terminal window
npx -y @hawkeyexl/manni meta validate "docs/**/*.md" --format json \
| jq -r '.results[] | .file as $f
| .errors[] | "\($f):\(.line // "?") \(.message)"'

Read just the summary counts:

Terminal window
npx -y @hawkeyexl/manni meta validate "docs/**/*.md" --format json | jq '.summary'
  1. A subprocess in any language? Use --format json and parse stdout. It is language-agnostic and the most stable surface.

  2. A shell script that needs a few field values? Use get; it is purpose-built for pulling named fields without a full validation report.

  3. A Node.js or TypeScript tool? Call the API. You skip process spawning and stdout parsing, and you get typed results.