/** * Deterministic, tested helpers for the contribution polish pass's SCOPE-LOCK * guard over MOVED maintainer code. * * When a run relocates a block of pre-existing maintainer code, that block * shows up in the base-vs-head diff as removed lines in one place and the SAME * lines added in another. Such a "pure move" must ship byte-for-byte — the * polish pass may never rewrite it. These helpers classify a unified diff's * added lines into relocated-verbatim ("moved") vs genuinely new, and check * that a later diff still preserves every moved line unchanged. * * Pure over diff text the caller has already produced (`git diff …`) — no I/O — * so it is unit-testable, the same house style as `commit-convention.ts`. The * bash copy in `ralph-run.sh` (`moved_hunks_preserved`) mirrors this logic. */ /** The added and removed line contents of a unified diff (headers excluded). */ export interface DiffLines { added: string[]; removed: string[]; } /** Classification of a diff's added lines against its removed lines. */ export interface MovedHunkReport { /** Added lines that also appear verbatim as a removed line (relocated code). */ movedLines: string[]; /** Added lines with no matching removed line (genuinely new or edited). */ newLines: string[]; /** * True when the diff is a PURE move: it adds at least one line and every * added line is a byte-for-byte relocation of a removed line (nothing new). */ pureMove: boolean; } /** * Split a unified diff into its added and removed line CONTENTS, byte-for-byte * (no trimming). File headers (`+++ `, `--- `) and hunk headers (`@@`) are * excluded; only body `+`/`-` lines contribute. The leading `+`/`-` is stripped * and the rest kept exactly as-is. */ export declare function parseDiffLines(diff: string): DiffLines; /** * Classify a base-vs-head diff. An added line is "moved" when it is present, * byte-for-byte, among the removed lines (consumed once per occurrence so a * line added twice but removed once counts one move and one new line). */ export declare function analyzeMovedHunks(diff: string): MovedHunkReport; /** * SCOPE-LOCK check for the polish pass: every line the BEFORE diff classified * as moved (relocated maintainer code) must still appear, byte-for-byte, among * the AFTER diff's added lines. Returns `true` when nothing was moved (no * protected code) or every moved line survives; `false` when the polish pass * mutated a moved line (so the caller must revert its edits). */ export declare function movedLinesPreserved(beforeDiff: string, afterDiff: string): boolean; //# sourceMappingURL=moved-hunk-purity.d.ts.map