/** * Research Traceability — Bidirectional links between findings and specs. * * Maintains a reverse index: finding ID -> spec names[]. * Updated on every spec save. Queryable for coverage and orphan detection. */ import type { AnySpec } from "../specs/types.js"; import type { ResearchFinding } from "./engine.js"; export interface TraceabilityIndex { findingToSpecs: Record; specToFindings: Record; updatedAt: string; } export declare class ResearchTraceability { private index; private indexPath; constructor(memoireDir: string); load(): Promise; save(): Promise; onSpecSaved(spec: AnySpec): Promise; onSpecRemoved(specName: string): Promise; getSpecsForFinding(findingId: string): string[]; getFindingsForSpec(specName: string): string[]; getOrphanedFindings(allFindings: ResearchFinding[]): ResearchFinding[]; getCoverage(specNames: string[]): { covered: number; total: number; ratio: number; }; getIndex(): TraceabilityIndex; } export interface SpecTraceEntry { spec: string; type: string; cited: string[]; resolved: Array<{ id: string; statement: string; confidence: string; }>; unresolved: string[]; backed: boolean; } export interface TraceabilityReport { generatedAt: string; /** Specs that can carry researchBacking (components + pages). */ totalSpecs: number; backedSpecs: number; unbackedSpecs: number; /** Citations pointing at finding ids that no longer exist in the store. */ staleCitations: number; /** backedSpecs / totalSpecs as 0-100; null when there is nothing to measure. */ coverage: number | null; storeAvailable: boolean; entries: SpecTraceEntry[]; } export declare function buildTraceabilityReport(specs: AnySpec[], findings: ResearchFinding[] | null): TraceabilityReport;