/** * Line/word diff helpers (no deps). LCS-based for readable patches. */ export type DiffOpType = 'equal' | 'insert' | 'delete'; export type DiffOp = { type: DiffOpType; value: string; /** 1-based line number in the "before" text */ oldLine?: number; /** 1-based line number in the "after" text */ newLine?: number; }; export type SplitRow = { left: { type: 'equal' | 'delete' | 'empty'; text: string; line?: number; } | null; right: { type: 'equal' | 'insert' | 'empty'; text: string; line?: number; } | null; /** Word-level parts when both sides are a change pair */ leftParts?: DiffPart[]; rightParts?: DiffPart[]; }; export type DiffPart = { text: string; changed: boolean; }; export type DiffStats = { additions: number; deletions: number; unchanged: number; }; /** Line-level diff via LCS backtrack. */ export declare function diffLines(before: string, after: string): DiffOp[]; /** Word-level parts highlighting differences between two strings. */ export declare function diffWords(before: string, after: string): { left: DiffPart[]; right: DiffPart[]; }; export declare function diffStats(ops: DiffOp[]): DiffStats; /** * Build side-by-side rows. Consecutive delete+insert pairs become a single * modification row with optional word highlighting. */ export declare function toSplitRows(ops: DiffOp[], wordDiff?: boolean): SplitRow[];