| 63 | * Trailing newline is ignored for line counting and emission. |
| 64 | */ |
| 65 | export 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 | } |