| 232 | } |
| 233 | |
| 234 | function makePatch(fileIndex: number, hunksPerFile: number, linesPerHunk: number) { |
| 235 | const chunks: string[] = []; |
| 236 | for (let hunkIndex = 0; hunkIndex < hunksPerFile; hunkIndex += 1) { |
| 237 | const start = hunkIndex * (linesPerHunk + 3) + 1; |
| 238 | chunks.push(`@@ -${start},${linesPerHunk} +${start},${linesPerHunk} @@`); |
| 239 | for (let lineIndex = 0; lineIndex < linesPerHunk; lineIndex += 1) { |
| 240 | chunks.push(`-old_${fileIndex}_${hunkIndex}_${lineIndex} = ${lineIndex};`); |
| 241 | chunks.push(`+new_${fileIndex}_${hunkIndex}_${lineIndex} = ${lineIndex + 1};`); |
| 242 | chunks.push(` context_${fileIndex}_${hunkIndex}_${lineIndex}();`); |
| 243 | } |
| 244 | } |
| 245 | return chunks.join("\n"); |
| 246 | } |
| 247 | |
| 248 | function makeReviewFile(sessionId: string, fileIndex: number, options: CliOptions) { |
| 249 | const path = `src/${sessionId}/file-${fileIndex}.ts`; |