(a: string, b: string): DiffLine[] Generate a line-based diff between two strings using LCS algorithm.
a
the original/current content
stringb
the new/desired content
stringreturns
DiffLine[] array of diff lines with type annotations
Line-based diff utilities using LCS (Longest Common Subsequence).
6 declarations
(a: string, b: string): DiffLine[] Generate a line-based diff between two strings using LCS algorithm.
athe original/current content
stringbthe new/desired content
stringDiffLine[] array of diff lines with type annotations
DiffLine Line diff result
type'same' | 'add' | 'remove'linestring(diff: DiffLine[], context_lines?: number): DiffLine[] Filter diff to only include lines within N lines of context around changes.
diffthe full diff lines
DiffLine[]context_linesnumber of context lines to show around changes (default: 3)
number3DiffLine[] filtered diff with ellipsis markers for skipped regions
(diff: DiffLine[], current_path: string, desired_path: string, options?: FormatDiffOptions): string Format a diff for display.
diffthe diff lines to format
DiffLine[]current_pathpath label for "current" content
stringdesired_pathpath label for "desired" content
stringoptionsformatting options
{}string formatted diff string
FormatDiffOptions Format options for diff output.
prefixPrefix for each line (for indentation in plan output).
stringuse_colorWhether to use ANSI colors.
booleanmax_linesMaximum number of diff lines to show (0 = unlimited).
number(current: string, desired: string, path: string, options?: FormatDiffOptions): string | null Generate a formatted diff between two strings.
Combines diff_lines, filter_diff_context, and format_diff for convenience. Returns null if content is binary.
currentcurrent content
stringdesireddesired content
stringpathfile path for labels
stringoptionsformatting options
{}string | null formatted diff string, or null if binary