import type { Finding } from './types.js'; export declare const BASELINE_VERSION = "2.0"; export interface BaselineEntry { /** Stable v2 fingerprint. `hash` is retained for backwards compatibility. */ hash: string; fingerprint?: string; /** Canonical rule family without scanner-generated line suffixes. */ ruleId?: string; id: string; /** Portable path relative to the scanned project root for v2 baselines. */ file: string; /** Informational only in v2; line number is not part of the fingerprint. */ line?: number; title: string; severity: string; category: string; /** Normalized matched code used to distinguish repeated rule families. */ anchor?: string; } export interface Baseline { version: string; createdAt: string; findings: BaselineEntry[]; } /** * Scanner rules historically embedded source line numbers in some finding IDs * (for example `enc-des-81`). Those suffixes are location metadata, not rule * identity, and therefore must not invalidate a baseline after a refactor. * Upper-case catalog IDs such as `CRED-001` and `HIPAA-2026-001` are preserved. */ export declare function canonicalRuleId(id: string): string; /** * Build a stable semantic anchor from the matched source line. Context lines * are intentionally whitespace-normalized so formatting-only edits do not * create a new baseline finding. */ export declare function getFindingAnchor(finding: Finding): string; /** * Infer the checkout root from all real finding paths. This keeps the existing * `saveBaseline(path, findings)` API portable without requiring callers to pass * the scan root. When a caller knows the root, passing it explicitly is still * preferred. */ export declare function inferProjectRoot(findings: Finding[]): string; /** * Convert a finding path to a portable project-relative path. Virtual project * findings retain their stable symbolic names. */ export declare function normalizeFindingFile(finding: Finding, projectRoot?: string): string; /** * Generate the v2 finding fingerprint. Source line number is deliberately not * included. The fingerprint is based on portable file path, canonical rule * family, stable title, and matched-code anchor. */ export declare function generateFindingHash(finding: Finding, projectRoot?: string): string; /** * Create a baseline entry from a finding. */ export declare function createBaselineEntry(finding: Finding, projectRoot?: string): BaselineEntry; /** * Load baseline from file. */ export declare function loadBaseline(path: string): Promise; /** * Save a portable v2 baseline. `projectRoot` is optional for API compatibility; * when omitted it is inferred from the absolute finding paths. */ export declare function saveBaseline(path: string, findings: Finding[], projectRoot?: string): Promise; /** * Check if a finding exists in a baseline. */ export declare function isInBaseline(finding: Finding, baseline: Baseline, projectRoot?: string): boolean; /** * Apply baseline to findings. The root is inferred once for stable v2 hashing, * making a committed baseline portable between developer machines and CI. */ export declare function applyBaseline(findings: Finding[], baseline: Baseline | null, projectRoot?: string): Finding[]; /** * Get statistics about baseline application. */ export declare function getBaselineStats(findings: Finding[]): { total: number; baseline: number; new: number; }; //# sourceMappingURL=baseline.d.ts.map