logical.ENVELOPE_SCHEMAconstno test imports itconst ENVELOPE_SCHEMA: "headless.envelope/1"The name and version of the document's shape: a reader checks it.
The machine's view of a run (commons headless 0003-headless-output FR-006, FR-007): one JSON document, with a fixed shape and order of keys, that says how the run ended, what it found and what it returned; and the same findings as SARIF 2.1.0 for the tools that read it. Nothing here is coloured, marked or cut to a width: a document is not drawn.
import { envelopeOf, jsonText } from "./envelope.ts";
import { outcomeOf } from "./outcome.ts";
jsonText(envelopeOf({ program: "tool", command: "status", outcome: outcomeOf({ n: 1 }), code: 0 })).startsWith("{"); // truelogical.ENVELOPE_SCHEMAconstno test imports itconst ENVELOPE_SCHEMA: "headless.envelope/1"The name and version of the document's shape: a reader checks it.
logical.Jsontypeno test imports ittype Json = null | boolean | number | string | readonly Json[] | { readonly [key: string]: Json };A JSON value.
logical.toJsonfunctionno test imports itfunction toJson(value: unknown): JsonA value as JSON: what JSON cannot say is made what it can (undefined properties are left out, a bigint is its digits as a string, a Date its ISO text, a number that is not finite null, a function or symbol left out), so that writing it never throws.
logical.Envelopetypeno test imports ittype Envelope = {
readonly schema: typeof ENVELOPE_SCHEMA;
readonly program: string;
readonly version?: string;
… (441 characters)type Envelope = {
readonly schema: typeof ENVELOPE_SCHEMA;
readonly program: string;
readonly version?: string;
readonly command: string;
readonly ok: boolean;
readonly exit: { readonly code: number; readonly name: string };
readonly counts: Counts;
readonly problems: readonly Problem[];
readonly outcomes: readonly string[];
readonly hints: readonly Hint[];
readonly next: readonly string[];
readonly data: Json;
};The document a run ends with.
logical.EnvelopeInputtypeno test imports ittype EnvelopeInput = {
readonly program: string;
readonly version?: string;
/** The words of the command as typed (`work build`); empty for the program itself. */
readonly command: string;
readonly outcome: Outcome;
/** The status the run ends with. */
readonly code: number;
};What an envelope is made from.
logical.envelopeOffunctionno test imports itfunction envelopeOf(i: EnvelopeInput): EnvelopeThe envelope of a run. ok is whether nothing failed; exit.name is the table's name of the status, or other.
logical.jsonTextfunctionno test imports itfunction jsonText(e: Envelope): stringThe envelope as the one document a run writes: indented, ending in a newline.
logical.SarifInputtypeno test imports ittype SarifInput = { readonly program: string; readonly version?: string; readonly outcome: Outcome };What SARIF takes of a run.
logical.sarifOffunctionno test imports itfunction sarifOf(i: SarifInput): JsonA SARIF 2.1.0 log of a run's findings (those it returned, else those its failures and warnings make).
logical.sarifTextfunctionno test imports itfunction sarifText(i: SarifInput): stringSARIF as the one document a run writes.
ENVELOPE_SCHEMAconstconst ENVELOPE_SCHEMA: "headless.envelope/1"The name and version of the document's shape: a reader checks it.
Jsontypetype Json = null | boolean | number | string | readonly Json[] | { readonly [key: string]: Json };A JSON value.
toJsonfunctionfunction toJson(value: unknown): JsonA value as JSON: what JSON cannot say is made what it can (undefined properties are left out, a bigint is its digits as a string, a Date its ISO text, a number that is not finite null, a function or symbol left out), so that writing it never throws.
Envelopetypeno test imports ittype Envelope = {
readonly schema: typeof ENVELOPE_SCHEMA;
readonly program: string;
readonly version?: string;
… (441 characters)type Envelope = {
readonly schema: typeof ENVELOPE_SCHEMA;
readonly program: string;
readonly version?: string;
readonly command: string;
readonly ok: boolean;
readonly exit: { readonly code: number; readonly name: string };
readonly counts: Counts;
readonly problems: readonly Problem[];
readonly outcomes: readonly string[];
readonly hints: readonly Hint[];
readonly next: readonly string[];
readonly data: Json;
};The document a run ends with.
EnvelopeInputtypeno test imports ittype EnvelopeInput = {
readonly program: string;
readonly version?: string;
/** The words of the command as typed (`work build`); empty for the program itself. */
readonly command: string;
readonly outcome: Outcome;
/** The status the run ends with. */
readonly code: number;
};What an envelope is made from.
envelopeOffunctionfunction envelopeOf(i: EnvelopeInput): EnvelopeThe envelope of a run. ok is whether nothing failed; exit.name is the table's name of the status, or other.
jsonTextfunctionfunction jsonText(e: Envelope): stringThe envelope as the one document a run writes: indented, ending in a newline.
SarifInputtypeno test imports ittype SarifInput = { readonly program: string; readonly version?: string; readonly outcome: Outcome };What SARIF takes of a run.
sarifOffunctionfunction sarifOf(i: SarifInput): JsonA SARIF 2.1.0 log of a run's findings (those it returned, else those its failures and warnings make).
sarifTextfunctionfunction sarifText(i: SarifInput): stringSARIF as the one document a run writes.