tcmts.cli.diff

Types

Change type
NameState type
A namespace at some point: name → the hashes it points to (more than one means conflicted). Types are keyed `path (type)`, so a type and a value sharing a path are compared, diffed and merged independently.
NamespaceDiff type
ReportLine type
A line of a diff report: pieces of text, each with its tone.
Tone type
How a piece of a diff report looks: the terminal colours it, the review page styles it.

Server

TONES Record<Tone, (s: string) => string>
diffReport (cb: Codebase, d: NamespaceDiff, before: NameState, after: NameState, title: string) => ReportLine[]
A diff as lines of text: what `tcm diff` prints and the review page shows.
printDiff (cb: Codebase, d: NamespaceDiff, before: NameState, after: NameState, title: string) => void
printReport (lines: ReportLine[]) => void
Report lines for the terminal.

Shared

TYPE_SUFFIX " (type)"
diffNamespaces (before: NameState, after: NameState, irOf: (hash: string) => string, texts?: { before: ReadonlyMap…
isEmpty (d: NamespaceDiff) => boolean
keyPath (key: string) => string
lineDiff (a: string[], b: string[]) => [" " | "+" | "-", string][]
Longest-common-subsequence line diff. Definitions are short, so O(n·m) is fine.
namesIn (state: NameState) => (hash: string) => string | undefined
stateKey (path: string, kind: DefKind) => string
stateOf (rows: NameRow[]) => NameState
substRefs (ir: IR, map: Map<string, string>, hit: Set<string>) => IR