conflictPairs
What tcm diff <conflicted name> compares: the base's definition with each side's (without a base, the two).
import type { Conflict } from "#codebase/tcmts/cli/merge"; import { shortHash } from "#codebase/tcmts/core/hash"; export function conflictPairs(c: Conflict): { from: string; to: string; title: string }[] { const as = (s: Conflict["sides"][number]) => `${s.side ?? "one side"}${s.label ? ` (${s.label})` : ""} ${shortHash(s.hash)}`; const [a, b] = [c.sides[0]!, c.sides[1]!]; return c.base ? c.sides.map((s) => ({ from: c.base!, to: s.hash, title: `${c.key}: base ${shortHash(c.base!)} → ${as(s)}`, })) : [ { from: a.hash, to: b.hash, title: `${c.key}: ${as(a)} → ${as(b)} (the merge base isn't known)`, }, ]; }