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

Method diff

packages/shell/src/filesystem.ts:1370–1388  ·  view source on GitHub ↗
(pathA: string, pathB: string)

Source from the content-addressed store, hash-verified

1368 // ── Diff ───────────────────────────────────────────────────────
1369
1370 async diff(pathA: string, pathB: string): Promise<string> {
1371 const contentA = await this.readFile(pathA);
1372 if (contentA === null) throw new Error(`ENOENT: no such file: ${pathA}`);
1373 const contentB = await this.readFile(pathB);
1374 if (contentB === null) throw new Error(`ENOENT: no such file: ${pathB}`);
1375 const linesA = contentA.split("\n").length;
1376 const linesB = contentB.split("\n").length;
1377 if (linesA > MAX_DIFF_LINES || linesB > MAX_DIFF_LINES) {
1378 throw new Error(
1379 `EFBIG: files too large for diff (max ${MAX_DIFF_LINES} lines)`
1380 );
1381 }
1382 return unifiedDiff(
1383 contentA,
1384 contentB,
1385 normalizePath(pathA),
1386 normalizePath(pathB)
1387 );
1388 }
1389
1390 async diffContent(path: string, newContent: string): Promise<string> {
1391 const existing = await this.readFile(path);

Callers

nothing calls this directly

Calls 3

readFileMethod · 0.95
unifiedDiffFunction · 0.70
normalizePathFunction · 0.70

Tested by

no test coverage detected