MCPcopy Create free account
hub / github.com/modem-dev/hunk / makePatch

Function makePatch

scripts/daemon-memory-check.ts:234–246  ·  view source on GitHub ↗
(fileIndex: number, hunksPerFile: number, linesPerHunk: number)

Source from the content-addressed store, hash-verified

232}
233
234function 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
248function makeReviewFile(sessionId: string, fileIndex: number, options: CliOptions) {
249 const path = `src/${sessionId}/file-${fileIndex}.ts`;

Callers 1

makeReviewFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected