/** * Shared diff computation utilities for the edit tool. * Used by both edit.ts (for execution) and tool-execution.ts (for preview rendering). */ export declare function detectLineEnding(content: string): "\r\n" | "\n"; export declare function normalizeToLF(text: string): string; export declare function restoreLineEndings(text: string, ending: "\r\n" | "\n"): string; /** * Normalize text for fuzzy matching. Applies only semantically-safe * whitespace/visibility transformations: * - Strip trailing whitespace from each line * - Normalize special Unicode spaces to a regular space * * Intentionally does NOT perform NFKC compatibility decomposition, smart-quote * → straight-quote, or dash/hyphen substitutions: those transformations make * semantically different code match silently. Matching across those characters * requires the oldText to use the exact same characters as the file. */ export declare function normalizeForFuzzyMatch(text: string): string; export interface FuzzyMatchResult { /** Whether a match was found */ found: boolean; /** The index where the match starts in the original content */ index: number; /** Length of the matched text in the original content */ matchLength: number; /** Whether fuzzy matching was used (false = exact match) */ usedFuzzyMatch: boolean; /** The original content to use for replacement operations. */ contentForReplacement: string; } export interface Edit { oldText: string; newText: string; } export interface AppliedEditsResult { baseContent: string; newContent: string; /** True if any edit was matched via a non-exact (line-trimmed or normalized) strategy. */ usedFuzzyMatch: boolean; } export declare function fuzzyFindText(content: string, oldText: string): FuzzyMatchResult; /** Strip UTF-8 BOM if present, return both the BOM (if any) and the text without it */ export declare function stripBom(content: string): { bom: string; text: string; }; /** * Apply one or more exact-text replacements to LF-normalized content. * * All edits are matched against the same original content. Replacements are * then applied in reverse order so offsets remain stable. If any edit needs * fuzzy matching, the operation runs in fuzzy-normalized content space to * preserve current single-edit behavior. */ export declare function applyEditsToNormalizedContent(normalizedContent: string, edits: Edit[], path: string): AppliedEditsResult; /** Generate a standard unified patch. */ export declare function generateUnifiedPatch(path: string, oldContent: string, newContent: string, contextLines?: number): string; /** * Generate a display-oriented diff string with line numbers and context. * Returns both the diff string and the first changed line number (in the new file). */ export declare function generateDiffString(oldContent: string, newContent: string, contextLines?: number): { diff: string; firstChangedLine: number | undefined; }; export interface EditDiffResult { diff: string; firstChangedLine: number | undefined; } export interface EditDiffError { error: string; } /** * Compute the diff for one or more edit operations without applying them. * Used for preview rendering in the TUI before the tool executes. */ export declare function computeEditsDiff(path: string, edits: Edit[], cwd: string): Promise; /** * Compute the diff for a single edit operation without applying it. * Kept as a convenience wrapper for single-edit callers. */ export declare function computeEditDiff(path: string, oldText: string, newText: string, cwd: string): Promise; //# sourceMappingURL=edit-diff.d.ts.map