agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
41 lines (40 loc) • 2.02 kB
TypeScript
/**
* check:semantics CLI core (9.53.0 — the build gate).
*
* Pattern: humble shell (the tool-lint `cli.ts` precedent) —
* `bin/agentfootprint-check-semantics.mjs` is a 2-line wrapper;
* ALL behavior (arg parsing, catalog coercion, report, exit code)
* lives here so it is unit-testable without spawning a process.
* Role: `src/semantics/`. Reads ONE JSON file of tools + sample
* results, prints a report, returns the process exit code:
* 0 — report.ok (and, under --strict, zero warnings)
* 1 — findings failed the gate
* 2 — usage / input error (bad flags, unreadable file,
* unrecognized JSON shape, unknown resultClass)
*
* Consumers wire it beside their other gates (the `check:tools` convention):
*
* "check:semantics": "node scripts/dump-semantics-catalog.mjs && agentfootprint-check-semantics semantics-catalog.json"
*
* The catalog is sample results — what your MOCK tools return — because the
* gate judges result shapes, and a build must never run tools that touch
* live systems. A mock catalog is something this ecosystem already has
* everywhere the check matters.
*/
import { type SemanticsCatalogEntry } from './check.js';
export interface SemanticsCliIO {
readonly stdout: (line: string) => void;
readonly stderr: (line: string) => void;
}
/**
* Normalize the accepted JSON shapes to the checker's catalog. Throws (with
* a shape description) on unrecognized input — the CLI maps that to exit
* code 2. `resultClass` values are passed through untouched; the checker is
* the one owner of the closed-set refusal.
*/
export declare function coerceSemanticsCatalog(json: unknown): readonly SemanticsCatalogEntry[];
/**
* Run the gate CLI. Returns the exit code (never calls `process.exit` — the
* bin wrapper assigns it to `process.exitCode`).
*/
export declare function runCheckSemanticsCli(argv: readonly string[], io?: SemanticsCliIO): Promise<number>;