/** * `aidlc compliance check` — assess a change against installed pack controls. * * **The central rule: absence of assessment is never a pass.** * * A control's `fails_when` is prose, pinned per control by a human, and no code * evaluates prose. So controls declare `check_kind`: a `mechanical` control carries * a `pattern` this module applies to the diff itself; an `agent` control can only be * assessed in a review session, and its outcome is read from the compliance findings * stream. * * The failure mode this design exists to prevent: if `check` merely read the * agent-written stream, then in continuous integration — no agent, no * `*.compliance.md` — it would find nothing wrong and exit 0 on every change. The * exit-1 gate could never fire, and the surface a buyer pays for would be * permanently, silently green. So an unassessed control is reported as * `pending-agent-review`, and under `--enforce` that exits 2 rather than 0. * * `--enforce` is per-invocation and reads no config. `compliance.enforce` governs * phase transitions only. One key for both would mean a team wanting a failing * pull-request check had to also accept blocking every local phase transition. * * Exit codes: * 0 nothing failing and nothing pending, or advisory mode * 1 a failing critical control under `--enforce` * 2 usage error, pack-load error, or an unassessed control under `--enforce` * * Requirements: compliance-packs/AC-35, AC-36, AC-79, AC-80, AC-86, AC-87, * AC-102, AC-103 */ import type { Control } from './types.js'; /** What was established about one control for this change. */ export type ControlOutcome = { control: string; packId: string; status: 'no-issues'; how: 'mechanical' | 'agent'; } | { control: string; packId: string; status: 'failing'; how: 'mechanical' | 'agent'; severity: Control['severity']; detail: string; } | { control: string; packId: string; status: 'pending-agent-review'; how: 'agent'; }; /** Result of a check run. */ export interface CheckResult { /** One outcome per applicable control. */ controls: ControlOutcome[]; /** Whether `--enforce` was passed. */ enforce: boolean; /** Non-fatal problems worth printing. */ warnings: string[]; /** Fatal problems: an installed pack that will not load. */ errors: string[]; /** The git ref the diff was taken against, or null for the working tree. */ diffRef: string | null; exitCode: 0 | 1 | 2; } export interface CheckOptions { /** Assess the diff against this git ref instead of the working tree. */ diffRef?: string; /** Raise the exit code on a failing or unassessed control. */ enforce?: boolean; } /** * Check a change against every installed pack's controls. * * Never throws. A pack that will not load is an error and exit 2, never an empty * result — a check that reported nothing wrong because it could not read its own * rules would be the worst possible outcome. */ export declare function checkDiff(projectRoot: string, opts?: CheckOptions): CheckResult; //# sourceMappingURL=check.d.ts.map