MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / convertNewFileToUnifiedDiff

Function convertNewFileToUnifiedDiff

src/core/diff/stats.ts:65–71  ·  view source on GitHub ↗
(content: string, filePath?: string)

Source from the content-addressed store, hash-verified

63 * Trailing newline is ignored for line counting and emission.
64 */
65export function convertNewFileToUnifiedDiff(content: string, filePath?: string): string {
66 const newFileName = filePath || "file"
67 // Normalize EOLs; rely on library for unified patch formatting
68 const normalized = (content || "").replace(/\r\n/g, "\n")
69 // Old file is empty (/dev/null), new file has content; zero context to show all lines as additions
70 return createTwoFilesPatch("/dev/null", newFileName, "", normalized, undefined, undefined, { context: 0 })
71}

Callers 1

executeMethod · 0.90

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected