/** * 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; export interface Edit { oldText: string; newText: string; /** * When true, replace every occurrence of oldText instead of requiring it to * be unique. Default (false/undefined) keeps the uniqueness guardrail. */ replaceAll?: boolean; } export interface AppliedEditsResult { baseContent: string; newContent: string; } /** 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. * * Every match, however loosely it was found, is resolved back to a span of the * *original* content before anything is written. A fuzzy or indentation-tolerant * match therefore rewrites only the lines it landed on: the rest of the file * keeps its exact bytes, and the diff callers render from `baseContent` is the * real change on disk rather than a normalized-vs-normalized view of it. */ export declare function applyEditsToNormalizedContent(normalizedContent: string, edits: Edit[], path: string): AppliedEditsResult; /** * Generate a unified 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; //# sourceMappingURL=edit-diff.d.ts.map