export interface ChurnInput { file: string; /** Raw post-change file contents (used to read volatility + total lines). */ content: string; /** Added lines from the diff for this file (entire file). */ addedCount: number; /** Removed lines from the diff for this file (entire file). */ removedCount: number; /** Added lines from the diff that are in the BODY (post-frontmatter) region. */ bodyAddedCount?: number; /** Removed lines from the diff that are in the BODY (post-frontmatter) region. */ bodyRemovedCount?: number; } export interface ChurnFinding { file: string; volatility: 'stable' | 'evolving' | 'fast-moving' | null; totalLines: number; addedCount: number; removedCount: number; churnPct: number; /** True if this counts as a blocking failure (stable + over-threshold + no override). */ blocking: boolean; /** True if the PR body contained the override marker. */ overridden: boolean; } export interface ChurnOptions { /** * Labels currently applied to the PR. The gate honors the literal label * `override:anti-over-rewrite` (F-005). PR-body markers are explicitly * NOT honored because the bot can write the body but cannot apply labels. */ prLabels?: string[]; } export declare function evaluateChurn(inputs: ChurnInput[], opts?: ChurnOptions): ChurnFinding[]; /** * Parse a unified diff into per-file add/remove counts. Mirrors * `lint-unsourced.parseUnifiedDiff` in scope (knowledge entries only) so the * two gates pull the same set of files from the same diff input. */ export interface ChurnDiffResult { file: string; addedCount: number; removedCount: number; bodyAddedCount: number; bodyRemovedCount: number; } /** * Parse a unified diff into per-file add/remove counts. Returns raw counts; * body-only counts are derived later by `splitChurnByRegion` because they * require access to the post-change file content (to know where the * frontmatter ends). * * Round-7 F-001 replaces the round-6 state-machine approach (which * incorrectly flipped on the FIRST `---` line — i.e., the opening * boundary — instead of the second / closing one, miscounting most * frontmatter as body churn). The line-number-based filter in * splitChurnByRegion is more robust because it relies on the actual * file content, not on diff-content patterns. */ export declare function parseUnifiedDiffForChurn(diff: string): ChurnDiffResult[]; /** * Per-file content pair used by `splitChurnByRegion` to derive separate * frontmatter boundaries for added (new file) and removed (old file) * sides of the diff. Round-8 F-003 introduced the asymmetry: when * audit-apply ADDS frontmatter fields (hash / retrieved on first audit), * the new frontmatter is taller than the old, so using the new boundary * for `-` lines mis-classifies the first body lines as frontmatter and * under-counts removal churn. */ export interface ChurnFileContent { /** Post-change file content (the head / working-tree version). */ newContent: string; /** Pre-change file content (the base / origin/main version). Optional. */ oldContent?: string; } /** * Given the raw diff and per-file pre/post-change content, return body-only * add/remove counts. An added line is "body" iff its new-file line number * is past the NEW frontmatter end; a removed line is "body" iff its * old-file line number is past the OLD frontmatter end. */ export declare function splitChurnByRegion(diff: string, fileContents: Map): Map; //# sourceMappingURL=anti-over-rewrite.d.ts.map