/** * Core business logic for `cleo verify --explain` (T1013 / ADR-051 §2.3). * * Extracted from the CLI dispatch layer (packages/cleo) per ADR-057 D3: * "CLI is thin transport — domain logic lives in Core." * * {@link checkExplainVerification} accepts the raw gate-status view produced * by `validateGateVerify` and enriches it with: * - `gates[]` — per-gate `{name, state, timestamp}` records * - `evidence[]`— per-gate evidence atoms with re-validation status * - `blockers[]`— human-readable reasons why `cleo complete` cannot run * - `explanation`— multi-line text summary for human-readable output * * The dispatch handler in `packages/cleo/src/dispatch/domains/check.ts` is a * thin wrapper: it calls `validateGateVerify`, checks the error, then * delegates all rendering to this function. * * @task T1541 * @task T1013 * @task T1006 * @adr ADR-051 * @adr ADR-057 */ import type { EvidenceAtom } from '@cleocode/contracts'; /** * Raw gate-status data produced by `validateGateVerify` in view mode. * This is the shape of `raw.data` after a successful no-op call. */ export interface GateStatusRawData { taskId: string; title?: string; status?: string; verification?: { passed: boolean; round: number; gates: Record; evidence?: Record; failureLog?: unknown[]; lastUpdated?: string | null; }; requiredGates?: string[]; missingGates?: string[]; } /** * Per-gate state record included in the explain response. */ export interface GateStateRecord { /** Gate name (e.g. `"implemented"`, `"testsPassed"`). */ name: string; /** `"pass"` | `"fail"` | `"pending"` */ state: 'pass' | 'fail' | 'pending'; /** ISO 8601 timestamp of the last update, or `null` if not yet captured. */ timestamp: string | null; } /** * Per-gate evidence entry included in the explain response. */ export interface EvidenceEntry { /** Gate this evidence backs. */ gate: string; /** Evidence atoms for this gate. */ atoms: EvidenceAtom[]; /** ISO 8601 timestamp when evidence was captured. */ capturedAt: string; /** Agent that captured the evidence. */ capturedBy: string; /** True when CLEO_OWNER_OVERRIDE was used. */ override: boolean; /** Whether the evidence still matches filesystem / git state. */ stillValid: boolean; /** Atoms that failed re-validation, with the failure reason. */ failedAtoms: Array<{ kind: EvidenceAtom['kind']; reason: string; }>; } /** * Full explain result returned by {@link checkExplainVerification}. */ export interface ExplainVerificationResult { taskId: string; title: string | undefined; status: string | undefined; passed: boolean; round: number; /** Per-gate `{name, state, timestamp}` array (T1013). */ gates: GateStateRecord[]; /** Per-gate evidence with re-validation status (T1013). */ evidence: EvidenceEntry[]; /** Human-readable blockers preventing `cleo complete` (T1013). */ blockers: string[]; /** Back-compat: raw gate pass/fail map from the DB. */ gatesMap: Record; /** Back-compat: raw evidence map from the DB. */ evidenceMap: Record; requiredGates: string[]; missingGates: string[]; /** Multi-line text summary for human-readable output. */ explanation: string; } /** * Builds the enriched verify-explain response from a raw gate-status snapshot. * * This is the Core business logic for `cleo verify --explain` (T1013). The * CLI dispatch handler calls `validateGateVerify` to get `rawData`, validates * it did not error, then delegates all rendering to this function. * * @param rawData Raw data from a `validateGateVerify` view-mode call. * @param projectRoot Absolute path to the project root (needed for re-validation). * @param taskId Task ID (used in blocker messages). * @returns A fully-populated {@link ExplainVerificationResult}. * * @task T1541 * @task T1013 * @adr ADR-051 * @adr ADR-057 */ export declare function checkExplainVerification(rawData: GateStatusRawData, projectRoot: string, taskId: string): Promise; //# sourceMappingURL=explain.d.ts.map