/** * The governance log (#560, ADR 0160): the RAID log's risks and * assumptions as the model holds them, derived the way the responsibility * matrix is derived and never authored. One row per risk or assumption: * its owner and status, what it threatens or bears on, what mitigates it, * the latest review attestation, what it supersedes, and the groupings it * aggregates into (an adopter's severity or likelihood classes, which the * engine carries without knowing the scale). Issues and open questions are * the adopter's and the interrogation's; the engine never sees an issue. * * Deterministic: identical inputs give identical bytes, so CI can diff it. */ import type { ResolvedProfileContext, SemanticGraph } from './compiler.js'; import { type GovernanceType } from './governance-kinds.js'; export interface GovernanceSource { readonly path: string; readonly line: number; } export interface GovernanceRef { readonly id: string; readonly name: string; } /** The latest review attestation on a row, by date. */ export interface GovernanceReview { readonly topic: string; readonly on: string; readonly by: string; readonly source: GovernanceSource; } export interface GovernanceRow { readonly subject: string; readonly name: string; readonly kind: string; readonly type: GovernanceType; readonly status: string | null; readonly description?: string; readonly owner: GovernanceRef | null; /** A risk's outgoing `influence` targets: what it threatens. */ readonly threatens: readonly GovernanceRef[]; /** An assumption's outgoing `association` targets: what it bears on. */ readonly bearsOn: readonly GovernanceRef[]; /** Incoming `influence` or `association` sources on a risk: what mitigates it. */ readonly mitigatedBy: readonly GovernanceRef[]; readonly review: GovernanceReview | null; readonly supersedes: readonly string[]; /** The groupings that aggregate this row: an adopter's rating classes. */ readonly groupedBy: readonly GovernanceRef[]; } export interface GovernanceLog { readonly format: 'yarramate/governance/v1'; readonly workspace: string; readonly summary: { readonly rows: number; readonly risks: number; readonly assumptions: number; readonly unowned: number; readonly unmitigated: number; readonly unconfirmed: number; readonly unreviewed: number; }; readonly rows: readonly GovernanceRow[]; readonly gaps: { /** Rows with no owner. */ readonly unowned: readonly string[]; /** Current risks nothing mitigates. */ readonly unmitigated: readonly string[]; /** Assumptions with no `assumption-confirmed` attestation. */ readonly unconfirmed: readonly string[]; /** Risks with no `risk-reviewed` attestation. How old is too old is the adopter's. */ readonly unreviewed: readonly string[]; }; } export interface GovernanceOptions { /** The subjects that may get a row; absent, every risk and assumption. */ readonly rows?: readonly string[]; } export declare function buildGovernanceLog(workspace: string, graph: SemanticGraph, profileContext: ResolvedProfileContext, options?: GovernanceOptions): GovernanceLog; /** The log as one markdown table a person reads, with the gaps under it. */ export declare function renderGovernanceMarkdown(log: GovernanceLog): string;