UNPKG

@capgo/cli

Version:
25 lines (24 loc) 897 B
/** * Line-by-line diff utilities for the workflow-file preview viewer. * * Uses a textbook longest-common-subsequence algorithm. O(m·n) time/space * which is fine for the workflow-file scale we expect (≤200 lines either * side); no dep needed. */ export type DiffKind = 'add' | 'del' | 'eq'; export interface DiffLine { kind: DiffKind; text: string; } /** * Compute a line-level diff between `before` and `after`. * * Returns an ordered list of lines where: * - `kind: 'eq'` → present in both, unchanged * - `kind: 'add'` → present only in `after` (will be added by the write) * - `kind: 'del'` → present only in `before` (will be removed by the write) * * When `before` is the empty string, every line in `after` is returned as * `add` — the natural "new file" rendering. */ export declare function diffLines(before: string, after: string): DiffLine[];