import { type Diagnostic, type WorkspaceSource } from '../compiler.js'; import { type ToolWorkspace } from './workspace.js'; /** * `yarramate check`, as one function over injected reads (ADR 0156). The * CLI hands it the filesystem and its resolved source set; `checkWorkspace` * hands it a store and a resolved manifest. The verdict, the diagnostics * and the counts are computed once, here, so the two cannot disagree. */ /** The published `yarramate/check-result/v1` document. */ export interface CheckResult { readonly format: 'yarramate/check-result/v1'; readonly ok: boolean; readonly diagnostics: readonly Diagnostic[]; readonly counted?: CheckCounts; readonly strict?: { readonly observations: number; readonly contradicted: number; }; } export interface CheckCounts { readonly documents: number; readonly concepts: number; readonly relationships: number; readonly states: number; } export interface CheckInput { /** The bytes at a path; throws when there is nothing there. */ readonly read: (path: string) => string; /** Whether a path exists, for the files a Core contract names optionally. */ readonly exists: (path: string) => boolean; /** The compiler's sources plus adapter mappings, in workspace order. */ readonly paths: readonly string[]; readonly projections: readonly string[]; readonly evidence: readonly string[]; readonly contracts: readonly string[]; readonly patterns: readonly string[]; readonly questions: readonly string[]; /** The base catalogue the workspace's own catalogues compose onto. */ readonly catalogueBase: WorkspaceSource; /** Contradicted evidence fails the check (YM901), as `--strict`. */ readonly strict?: boolean; /** * Whether a JSON Schema a Core contract names compiles. The CLI answers * with Ajv; a runtime without a schema compiler answers true for every * schema that parses, so a contract check there tests presence and * format, not validity. */ readonly schemaCompiles?: (schema: object) => boolean; } /** The result, plus what the CLI's human rendering needs beside it. */ export interface CheckEvaluation { readonly result: CheckResult; /** * The diagnostics a human reader sees when `ok` is false: the strict * findings when only strict failed, the base diagnostics otherwise. */ readonly shown: readonly Diagnostic[]; /** The base check passed and only `--strict` failed. */ readonly strictOnly: boolean; /** Category counts for the "Checked ..." line; absent when the check failed. */ readonly checked?: { readonly documents: number; readonly profiles: number; readonly patterns: number; readonly mappings: number; readonly projections: number; readonly evidence: number; readonly contracts: number; }; } export declare const checkSources: (input: CheckInput) => CheckEvaluation; export interface CheckOptions { /** Contradicted evidence fails the check (YM901), as `--strict`. */ readonly strict?: boolean; } /** * `yarramate check [--strict] --json`, path-free. Never a * ToolResult: `ok: false` with diagnostics IS the answer. A path the * workspace names but the store does not hold is reported as a refusal * diagnostic on the manifest rather than thrown, because a check that * throws has no verdict. */ export declare const checkWorkspace: (workspace: ToolWorkspace, options?: CheckOptions) => CheckResult;