Structured Output
Machine-readable JSON, SARIF, and NDJSON output contracts
Diagnostic-producing commands emit a shared schema 2.0 envelope. In structured mode, stdout contains exactly one parseable document; progress and status text go to stderr. Early failures also produce an envelope.
calor --input file.calr --format json
calor --input file.calr --format sarif
calor lint file.calr --format json
calor watch src/ --format json
Root compile supports -f; on lint, spell out --format because -f means
--fix. Watch produces NDJSON: one compact envelope per line for every rebuild.
Envelope Shape
{
"version": "2.0",
"command": "verify",
"diagnostics": [
{
"code": "Calor0712",
"message": "Postcondition refuted",
"severity": "warning",
"location": { "file": "Math.calr", "line": 4, "column": 5 },
"declarationId": "f001",
"verification": {
"status": "refuted",
"counterexample": {
"bindings": [{ "name": "x", "value": "1" }]
}
}
}
],
"summary": { "total": 1, "errors": 0, "warnings": 1, "info": 0 },
"data": {}
}
Fields that do not apply are omitted. diagnostics[].fix.edits[] carries
machine-applicable, 1-based, end-exclusive source edits when a diagnostic has a
fix. Command-specific results live under data.
Conversion Output
The C# → Calor surfaces report in three shapes:
| Surface | Document | Conversion issues | Per-file result |
|---|---|---|---|
calor convert --format json | Envelope on stdout; the text report goes to stderr | diagnostics[]: Calor1343, message prefixed with the feature name | data.losses[] and data.conversionPaths |
calor migrate --report <file>.json | Envelope written to the report file | Calor1343 diagnostics | data.fileResults[].losses[] and .conversionPaths |
MCP calor_convert | The tool's own result object | top-level issues[] (envelope-form Calor1343 entries) | lossSummary.locations[] and lossSummary.paths |
MCP calor_migrate (phase: "convert") | The tool's own result object | perFile[].errors[] and perFile[].warnings[] | perFile[].losses[] and perFile[].conversionPaths |
MCP calor_batch (action: "convert") | The tool's own result object | files[].issues[] | files[].conversionPaths |
conversionPaths.outcome (native, preserved, lossy, unverified, refused) is the field
to test. unverified means the file was written under --lossy but its C# failed
the round-trip compile check; conversionPaths.roundTrip says whether that check
ran (verified, failed, deferred, not-run). The native construct counts (nativeConversionCount,
lossSummary.nativeConversions) also count constructs of a type a rescue later
replaced with C#. See Which mechanism kept the C#
for the per-surface defaults.
Exit codes do not change with the output format: tools must inspect both the process exit code and the document. See Envelope Schema for field-level details.