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

Method diffContent

packages/shell/src/filesystem.ts:1390–1402  ·  view source on GitHub ↗
(path: string, newContent: string)

Source from the content-addressed store, hash-verified

1388 }
1389
1390 async diffContent(path: string, newContent: string): Promise<string> {
1391 const existing = await this.readFile(path);
1392 if (existing === null) throw new Error(`ENOENT: no such file: ${path}`);
1393 const linesA = existing.split("\n").length;
1394 const linesB = newContent.split("\n").length;
1395 if (linesA > MAX_DIFF_LINES || linesB > MAX_DIFF_LINES) {
1396 throw new Error(
1397 `EFBIG: content too large for diff (max ${MAX_DIFF_LINES} lines)`
1398 );
1399 }
1400 const normalized = normalizePath(path);
1401 return unifiedDiff(existing, newContent, normalized, normalized);
1402 }
1403
1404 // ── Info ────────────────────────────────────────────────────────
1405

Callers

nothing calls this directly

Calls 3

readFileMethod · 0.95
normalizePathFunction · 0.70
unifiedDiffFunction · 0.70

Tested by

no test coverage detected