/** * Baseline ratchet — snapshot advisory findings as {fingerprint, file} entries * so subsequent audits surface only the delta (new / fixed / known). * * Spec 18 — R1: The baseline file (.codeauditor.baseline.json) is committed * to the user's repo. Invariants are never baselined — declared laws are * enforced on all code, always. */ import type { Violation } from './types.js'; export interface BaselineEntry { /** SHA-256 fingerprint of [analyzer, rule, file, symbol]. */ fingerprint: string; /** File path at time of snapshot — used for scoped-match correctness. */ file: string; } export interface BaselineMetadata { /** Tool version from package.json at snapshot time. */ toolVersion: string; /** Total advisory findings in the baseline (excludes invariants). */ totalFindings: number; /** Per-analyzer finding counts. */ analyzerCounts: Record; /** Corpus stats at snapshot time. */ corpusStats: { files: number; functions: number; }; } export interface Baseline { /** Schema version for forward-compatibility. */ schemaVersion: 3; /** ISO-8601 timestamp of snapshot creation. */ created: string; /** Advisory finding entries (no invariants). */ entries: BaselineEntry[]; /** Snapshot metadata. */ metadata: BaselineMetadata; } export interface ClassifiedFindings { /** Findings whose fingerprints are absent from the baseline. */ new: Violation[]; /** Findings whose fingerprints are present in the baseline. */ known: Violation[]; /** Baseline entries with no matching finding in this run. */ fixed: BaselineEntry[]; } /** * Load an existing baseline file from the project root. * Returns null if no baseline file exists or it fails to parse. */ export declare function loadBaseline(projectRoot: string): Baseline | null; /** * Write the baseline file to the project root. */ export declare function saveBaseline(projectRoot: string, baseline: Baseline): void; /** * Build a Baseline from a set of advisory violations. * Invariant findings are excluded — invariants are never baselined. */ export declare function createBaselineFromFindings(violations: Violation[], metadata: BaselineMetadata): Baseline; /** * Classify violations against a baseline. * * - **new**: fingerprint absent from baseline * - **known**: fingerprint present in baseline * - **fixed**: baseline entries with no matching violation in this run * * When `scopedFiles` is provided (e.g. a `changed` run), `fixed` is computed * only among baseline entries whose file is in scope — preventing a scoped * run from classifying all untouched entries as "fixed." * * Scoped entries not in the file list are excluded entirely from the result; * they are neither new, known, nor fixed for this run. */ export declare function matchFindings(violations: Violation[], baseline: Baseline, scopedFiles?: string[]): ClassifiedFindings; /** * Compare current and previous baselines to compute what changed. * Returns counts for reporting during re-snapshot. */ export declare function diffBaselines(previous: Baseline, current: Baseline): { absorbed: number; fixed: number; total: number; }; /** * Hash the baseline fingerprint set for a stable identifier. * Used in AuditResult.metadata.baseline.hash for ledger integration (Spec 11). */ export declare function hashBaseline(baseline: Baseline): string; export declare const BaselineManager: { load: typeof loadBaseline; save: typeof saveBaseline; createFromFindings: typeof createBaselineFromFindings; matchFindings: typeof matchFindings; diffBaselines: typeof diffBaselines; hashBaseline: typeof hashBaseline; }; //# sourceMappingURL=baseline.d.ts.map