MCPcopy Create free account
hub / github.com/cloudflare/agents / unifiedDiff

Function unifiedDiff

packages/shell/src/filesystem.ts:1690–1703  ·  view source on GitHub ↗
(
  a: string,
  b: string,
  labelA: string,
  labelB: string,
  contextLines = 3
)

Source from the content-addressed store, hash-verified

1688// ── Diff helpers ─────────────────────────────────────────────────────
1689
1690function unifiedDiff(
1691 a: string,
1692 b: string,
1693 labelA: string,
1694 labelB: string,
1695 contextLines = 3
1696): string {
1697 if (a === b) return "";
1698
1699 const linesA = a.split("\n");
1700 const linesB = b.split("\n");
1701 const edits = myersDiff(linesA, linesB);
1702 return formatUnified(edits, linesA, linesB, labelA, labelB, contextLines);
1703}
1704
1705type Edit = {
1706 type: "keep" | "delete" | "insert";

Callers 2

diffMethod · 0.70
diffContentMethod · 0.70

Calls 2

myersDiffFunction · 0.70
formatUnifiedFunction · 0.70

Tested by

no test coverage detected