(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.