/** * Verify runner — `specweave verify [id]`. * * Runs the project's verification commands (config `testing.commands[]`, else * auto-detected from package.json scripts test → lint → build, Cargo, pytest, * go), collects the AC table from spec.md and the ledger summary, and writes * `reports/verify.md` + `reports/verify.json`. `verify.json.ok` is the single * closure gate consulted by `specweave complete`. * * @module core/tasks/verify-runner */ import { type TaskBoard } from './task-board.js'; import { type AcAcceptance, type AcAcceptanceEntry, type AcWaiver } from './accepted-skip.js'; import type { AcceptedSkip } from './ledger.js'; export interface VerifyCommandResult { cmd: string; cwd?: string; source?: string; exit: number; tail: string; ms: number; } export interface VerifyReport { /** * Ready to close: every verification command exited 0 AND every acceptance * criterion in spec.md is met or skipped-accepted. Consulted by the closure gate. */ ok: boolean; ranAt: string; increment: string; commands: Array<{ cmd: string; exit: number; cwd?: string; source?: string; }>; strictClose?: { errors: string[]; }; /** * `done` counts met ACs (mixed ones included, since their tasks met them); * accepted skips never add to it. `skippedAccepted` counts ACs closed only * by accepted skips, `mixed` the met ACs that also carry one. */ acs: { total: number; done: number; skippedAccepted?: number; mixed?: number; items?: VerifyAcItem[]; }; tasks: { total: number; done: number; skipped: number; open: number; }; /** Skipped tasks with the mandatory reason from `specweave task skip`. */ skipped: Array<{ id: string; by?: string; reason?: string; }>; /** Every accepted skip in the ledger, oldest first (`specweave ac accept-skip`). */ acceptedSkips?: AcceptedSkip[]; /** Ledger lines that could not be parsed (BOM/CRLF are tolerated; this counts real junk). */ ledgerMalformed: number; /** Why verify passed with no commands to run (`specweave verify --reason`). */ reason?: string; } /** Message (and verify.md line) when there is nothing to run. */ export declare const NO_COMMANDS_MESSAGE = "no test commands configured"; /** * One AC in verify.json: whether it counts as done for the close gate, how * that was decided, and the tasks that cite it with their ledger status. * Readers use it to trace an AC to its tasks; `done` is declared status, not * proof that a test exercised it. */ export interface VerifyAcItem { id: string; done: boolean; via: 'checkbox' | 'ledger' | 'none'; tasks: Array<{ id: string; status: string; }>; /** met | mixed | skipped-accepted | open (core/tasks/accepted-skip.ts). */ acceptance: AcAcceptance; /** Accepted skips recorded for this AC; never verification. */ waivers: AcWaiver[]; /** Skipped-accepted although no task cites the AC; check nothing cites it in another form. */ uncovered?: boolean; } export interface AcEntry { id: string; done: boolean; text: string; /** How `done` was decided: ticked in spec.md, or every covering task is done in the ledger. */ via?: 'checkbox' | 'ledger'; /** Tasks that cite this AC, with their ledger status (set by deriveAcStatus). */ tasks?: Array<{ id: string; status: string; }>; } /** One-line human summary of open ACs, or undefined when nothing is open. */ export declare function describeUncheckedAcs(acs: { total: number; done: number; skippedAccepted?: number; }): string | undefined; /** The ACs declared in an increment's spec.md (empty when there is none). */ export declare function readSpecAcs(incrementDir: string): AcEntry[]; /** * Whether spec.md declares any AC at all, ticked, unticked or as a plain * `- AC-US1-01 — …` bullet (older specs). The no-AC close gate uses this, so * bullet-style specs are not mistaken for specs without a definition of done. */ export declare function specDeclaresAcs(incrementDir: string): boolean; /** * Derive AC completion from the ledger: an AC is met when it is ticked in * spec.md, or when at least one task covers it and every task covering it is * done or skipped with at least one done. Nobody has to tick checkboxes by * hand at close; a ticked box still counts, so hand-verified ACs keep working. */ export declare function deriveAcStatus(acs: AcEntry[], board: TaskBoard): AcEntry[]; /** Parse checkbox and legacy plain-bullet criteria from spec.md. */ export declare function parseSpecAcs(specContent: string): AcEntry[]; /** Verification commands: config `testing.commands` first, then stack auto-detection. */ export declare function detectVerifyCommands(projectRoot: string): { commands: string[]; source: string; }; export interface RunVerifyOptions { /** Override the command list (tests). */ commands?: string[]; timeoutMs?: number; leaseHours?: number; onCommand?: (cmd: string) => void; /** Accept an empty command list; recorded in verify.json as `reason`. */ reason?: string; } export interface RunVerifyResult { report: VerifyReport; results: VerifyCommandResult[]; acs: AcAcceptanceEntry[]; board: TaskBoard; source: string; mdPath: string; jsonPath: string; } export declare function runVerify(projectRoot: string, incrementId: string, incrementDir: string, opts?: RunVerifyOptions): Promise; export declare function renderVerifyMd(report: VerifyReport, results: VerifyCommandResult[], acs: Array, board: TaskBoard, source: string): string; /** Read reports/verify.json if present. */ export declare function readVerifyReport(incrementDir: string): VerifyReport | undefined; //# sourceMappingURL=verify-runner.d.ts.map