/** * Shared types for the constitution module. * * Requirements: project-constitution/AC-7, project-constitution/AC-10 * * @module */ /** One vision statement, identified by its own content (design D1). */ export interface Statement { /** `V-` followed by the first 8 hex characters of sha256(normalized text). */ readonly id: string; /** The statement as extracted, normalized (trimmed, whitespace collapsed). */ readonly text: string; /** How many times this exact normalized text appeared in the source (AC-9). */ readonly occurrences: number; } /** The committed record of what the vision document said when last imported. */ export interface Snapshot { /** Source location, relative to the project root so the file stays portable. */ readonly sourcePath: string; /** sha256 of the source *bytes*, not of the extracted text. */ readonly sourceSha256: string; /** ISO 8601 UTC. */ readonly extractedAt: string; /** Which reader produced the text. */ readonly extractor: Extractor; readonly statements: readonly Statement[]; } export type Extractor = 'docx' | 'text'; /** Why an extraction could not happen. Ordered as the checks run (NFR-3). */ export type ExtractFailure = 'out-of-bounds' | 'missing' | 'unsupported-format' | 'too-large' | 'not-a-docx' | 'entry-too-large'; export type ExtractResult = { readonly ok: true; readonly text: string; readonly extractor: Extractor; /** sha256 of the source bytes. */ readonly sha256: string; /** Path relative to the project root. */ readonly relativePath: string; } | { readonly ok: false; readonly reason: ExtractFailure; readonly detail: string; }; /** One `IN-` or `NOT-` line parsed out of `constitution.md`. */ export interface Entry { /** `IN-3`, `NOT-1`. */ readonly id: string; readonly kind: 'in-scope' | 'prohibition'; /** Every `V-…` id the line cites, in order of appearance. */ readonly cites: readonly string[]; /** 1-indexed line in `constitution.md`. */ readonly line: number; } /** * What `aidlc constitution check` found. * * `state` distinguishes "evaluated, no drift" from the two situations where no * comparison was possible — reporting those explicitly is the point (AC-15). */ export interface CheckReport { readonly state: 'ok' | 'no-snapshot' | 'source-missing' | 'source-unreadable'; readonly source_path: string | null; /** Statement ids in the source now and not in the snapshot. */ readonly added: readonly string[]; /** Statement ids in the snapshot and no longer in the source. */ readonly removed: readonly string[]; /** Constitution entries citing a removed id (AC-13). */ readonly affected_entries: readonly AffectedEntry[]; /** Present only when `state` is not `ok`. */ readonly detail?: string; } export interface AffectedEntry { /** `NOT-2`. */ readonly entry: string; /** The removed statement id it cites. */ readonly cites: string; readonly line: number; } //# sourceMappingURL=types.d.ts.map