/** * CLI glue for the `contextatlas validate-extraction` subcommand * (v0.7.1 Step 1.1.b.0 + Q1.1.G.α — substrate-equivalence closure * mechanical floor at /index-atlas Skill surface per Path D * architecture). * * Parallel pattern to cli-validate-adrs.ts (v0.7 Step 2.3.c.0 closure * for generate-adrs Skill surface). Closes v0.8 Step 1.1.b empirical * falsification of v0.7 Step 2.3.b.0 substrate-equivalence claim by * adding a mechanical depth-floor + coverage gate at the CLI * boundary. * * Reads atlas.json (per config.atlas.path) and validates against * extraction-quality invariants distinct from shape (validate-atlas * canonical schema; runs upstream) and distinct from depth-of-ADR- * authoring (validate-adrs; ADR shape): * * 1. adr_claims_present — atlas has ≥ 1 claim with * `source.startsWith("adr:")`. An atlas with zero ADR claims * is structurally empty (failed extraction at the canonical * load-bearing source). * * 2. adr_depth_floor — per ADR source, claim count ≥ 8. * Calibration substrate (v0.8 Stage 2.a CLI empirical at three * reference repos): hono 154/12=12.83, httpx 130/10=13.00, * cobra 132/11=12.00 → mean 12.6 → conservative floor at ~64% * = 8. Per-ADR floor (not aggregate) catches shallow extraction * at any single ADR, mirroring the per-cell pattern Phase-9 * methodology surfaced. * * 3. source_coverage — for each ADR-shaped entry in source_shas * (path ending in .md or .rst), ≥ 1 claim has matching * source_path. An ADR source in source_shas with 0 claims * indicates silent extraction failure at that ADR (extraction * call skipped or returned empty claims array). Catches the * v0.8 Step 1.1.b Stream A regression pattern (Skill walked * ADRs but failed to produce claims per ADR). * * Scoped to ADR-shaped keys per v0.7.2 substrate-currency * calibration: empirical evidence at first v0.7.1 run showed * Stream B + Stream C populate source_shas for every walked * source regardless of claim production (Stream B walks all * source files; most lack exported-with-docstring symbols and * produce 0 claims. Stream C walks all filtered commits; most * lack architectural-intent body and produce 0 claims). The * empirical claim-producing rate varies by stream; only Stream * A reliably produces claims per source by design (extraction * prompt against substantive ADR prose). * * Per-stream coverage at Phase B iteration is the SKILL.md substrate * concern (not validator domain) — if Phase A skips a stream * entirely, source_shas reflects the skip and source_coverage check * cannot detect it from atlas alone. Phase A iteration discipline * is enforced at SKILL.md scaffolding level (mandatory before * Phase B). Per-stream-coverage validator extension is a v0.8+ * candidate if empirical evidence surfaces Phase A bypass under * Path D substrate. * * Used as MANDATORY GATE (Phase C extended) in /index-atlas Skill * workflow after validate-atlas + before resolve-symbols. Mechanical * floor for substrate-equivalence claim per v0.7.1 ADR-02 amendment * §index-atlas substrate-equivalence closure. * * Exit codes: * 0 — atlas passes all extraction-quality invariants * 2 — one or more invariants fail; structured remediation to * stderr with per-invariant guidance */ export type ValidateExtractionExitCode = 0 | 2; export interface ValidateExtractionCliOptions { configRoot: string; configFile: string | null; /** Test seam: stdout writer. */ writeStdout?: (chunk: string) => void; /** Test seam: stderr writer. */ writeStderr?: (chunk: string) => void; } export interface ValidateExtractionCliResult { exitCode: ValidateExtractionExitCode; errors: readonly string[]; } /** * Per-ADR claims-count floor. Calibration substrate from v0.8 Stage * 2.a CLI empirical at three reference repos: * - hono 154 ADR claims / 12 ADRs = 12.83 claims/ADR * - httpx 130 ADR claims / 10 ADRs = 13.00 claims/ADR * - cobra 132 ADR claims / 11 ADRs = 12.00 claims/ADR * - mean ~12.6 claims/ADR * Conservative threshold at ~64% of mean = 8 claims/ADR. Catches * the ~3x depth gap empirically observed at v0.8 Step 1.1.b Skill * extraction (52 ADR claims / 12 ADRs = 4.3 claims/ADR at hono) * while leaving headroom for genuinely sparse ADRs. */ export declare const PER_ADR_CLAIMS_FLOOR = 8; /** * Atlas shape we read for extraction-quality validation. Intentionally * minimal — full canonical AtlasFileV1 shape validation is the * concern of `validate-atlas` (run upstream as workflow Phase C step * 1). This validator presumes the atlas has already validated shape. */ export interface AtlasForValidation { readonly version?: unknown; readonly source_shas?: Record; readonly claims?: ReadonlyArray<{ readonly source?: string; readonly source_path?: string; }>; } /** * Run the validate-extraction subcommand. Never throws — all error * paths map to exit codes + structured remediation. */ export declare function runValidateExtractionSubcommand(options: ValidateExtractionCliOptions): Promise; /** * Validate an atlas against extraction-quality invariants. Returns * array of error strings (empty when atlas passes all invariants). * * Pure function — exported for unit-test seam parallel to * `validateAdrShape` in cli-validate-adrs.ts. */ export declare function validateExtractionShape(atlas: AtlasForValidation): string[]; //# sourceMappingURL=cli-validate-extraction.d.ts.map