/** * Score History — append-only ledger (.memoire/app-quality/history.jsonl) so * design debt is tracked over time, not just at a point in time. One JSON * object per line; capped so it never grows unbounded. * * Comparability rule: a run is only comparable to prior runs with the SAME * policy hash and a full (non-scoped) scan — comparing scores produced under * different thresholds, or from partial scans, is noise dressed as signal. */ import type { AppQualityDiagnosis } from "./engine.js"; export interface HistoryEntry { at: string; sha?: string; branch?: string; scope: "full" | "scoped"; policyHash?: string; score: number; categoryScores: Record; severityCounts: { critical: number; high: number; medium: number; low: number; }; } export interface RegressionCheck { comparable: boolean; reason?: string; previous?: HistoryEntry; delta?: number; regressed?: boolean; } export declare function historyPath(projectRoot: string): string; export declare function entryFromDiagnosis(diagnosis: AppQualityDiagnosis): HistoryEntry; /** Append a run to the ledger, stamping git SHA/branch when available. */ export declare function appendHistory(projectRoot: string, diagnosis: AppQualityDiagnosis): Promise; export declare function readHistory(projectRoot: string): Promise; /** * Compare the current run against the most recent COMPARABLE prior entry * (same policy hash, full scan). Returns comparable:false with a reason when * no honest comparison exists — callers must not fabricate a trend from * incomparable runs. */ export declare function checkRegression(current: HistoryEntry, history: HistoryEntry[], budget: number): RegressionCheck; /** Render a compact trend line for terminal display (oldest → newest, comparable entries only). */ export declare function renderTrend(history: HistoryEntry[], policyHash: string | undefined, limit?: number): string[];