@self-review/core 2.0.3 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +441 -0
- package/dist/chunk-5SGPWHGH.cjs +106 -0
- package/dist/chunk-5SGPWHGH.cjs.map +1 -0
- package/dist/chunk-6OEFXBIZ.cjs +5212 -0
- package/dist/chunk-6OEFXBIZ.cjs.map +1 -0
- package/dist/chunk-6X3PJHP5.cjs +416 -0
- package/dist/chunk-6X3PJHP5.cjs.map +1 -0
- package/dist/chunk-CJQEOLI3.js +37 -0
- package/dist/chunk-CJQEOLI3.js.map +1 -0
- package/dist/chunk-IG2YF5LH.js +416 -0
- package/dist/chunk-IG2YF5LH.js.map +1 -0
- package/dist/chunk-IX226KG4.js +106 -0
- package/dist/chunk-IX226KG4.js.map +1 -0
- package/dist/chunk-LSLCQQBN.cjs +3684 -0
- package/dist/chunk-LSLCQQBN.cjs.map +1 -0
- package/dist/chunk-MOYO4RIX.js +3684 -0
- package/dist/chunk-MOYO4RIX.js.map +1 -0
- package/dist/chunk-TOUYY7I6.js +5212 -0
- package/dist/chunk-TOUYY7I6.js.map +1 -0
- package/dist/chunk-VOYTFLPH.cjs +37 -0
- package/dist/chunk-VOYTFLPH.cjs.map +1 -0
- package/dist/filesystem.cjs +56 -0
- package/dist/filesystem.cjs.map +1 -0
- package/dist/filesystem.d.cts +22 -0
- package/dist/filesystem.d.ts +22 -0
- package/dist/filesystem.js +56 -0
- package/dist/index.cjs +348 -6192
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -1332
- package/dist/index.d.ts +80 -1332
- package/dist/index.js +234 -5172
- package/dist/index.js.map +1 -1
- package/dist/node-scan-fs-CaufzUZR.d.cts +5 -0
- package/dist/node-scan-fs-DcHI_BYB.d.ts +5 -0
- package/dist/operations-Bqhi9EBH.d.ts +765 -0
- package/dist/operations-UyiUD2Nx.d.cts +765 -0
- package/dist/operations.cjs +91 -0
- package/dist/operations.cjs.map +1 -0
- package/dist/operations.d.cts +6 -0
- package/dist/operations.d.ts +6 -0
- package/dist/operations.js +91 -0
- package/dist/resume-worker.cjs +152 -0
- package/dist/resume-worker.cjs.map +1 -0
- package/dist/resume-worker.d.cts +56 -0
- package/dist/resume-worker.d.ts +56 -0
- package/dist/resume-worker.js +152 -0
- package/dist/resume-worker.js.map +1 -0
- package/dist/review-request-validation-VJG7XZiE.d.cts +62 -0
- package/dist/review-request-validation-VJG7XZiE.d.ts +62 -0
- package/dist/review-xml-decoder-COgRtfkf.d.cts +33 -0
- package/dist/review-xml-decoder-COgRtfkf.d.ts +33 -0
- package/dist/source-identity-CQpAzugz.d.cts +959 -0
- package/dist/source-identity-CQpAzugz.d.ts +959 -0
- package/dist/validation.cjs +67 -0
- package/dist/validation.cjs.map +1 -0
- package/dist/validation.d.cts +30 -0
- package/dist/validation.d.ts +30 -0
- package/dist/validation.js +67 -0
- package/dist/validation.js.map +1 -0
- package/package.json +44 -3
- package/dist/chunk-4YO2MI6B.js +0 -269
- package/dist/chunk-4YO2MI6B.js.map +0 -1
- package/dist/chunk-QHS36X6T.js +0 -450
- package/dist/chunk-QHS36X6T.js.map +0 -1
- package/dist/diff-parser-B6S3KG5T.js +0 -9
- package/dist/git-N5HVNPKQ.js +0 -24
- /package/dist/{diff-parser-B6S3KG5T.js.map → filesystem.js.map} +0 -0
- /package/dist/{git-N5HVNPKQ.js.map → operations.js.map} +0 -0
package/dist/chunk-QHS36X6T.js
DELETED
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseDiffWithDiagnostics
|
|
3
|
-
} from "./chunk-4YO2MI6B.js";
|
|
4
|
-
|
|
5
|
-
// src/git.ts
|
|
6
|
-
import { execFile } from "child_process";
|
|
7
|
-
import { promisify as promisify2 } from "util";
|
|
8
|
-
|
|
9
|
-
// src/synthetic-diff.ts
|
|
10
|
-
import { closeSync as closeSync2, constants as constants2, fstatSync as fstatSync2, lstatSync, openSync as openSync2, readlinkSync } from "fs";
|
|
11
|
-
import { join } from "path";
|
|
12
|
-
|
|
13
|
-
// src/bounded-read.ts
|
|
14
|
-
import { closeSync, constants, fstatSync, openSync, read, readSync } from "fs";
|
|
15
|
-
import { open } from "fs/promises";
|
|
16
|
-
import { promisify } from "util";
|
|
17
|
-
var READ_FLAGS = constants.O_RDONLY | (constants.O_NONBLOCK ?? 0);
|
|
18
|
-
var readAsync = promisify(read);
|
|
19
|
-
function openFlags(options) {
|
|
20
|
-
return options.noFollow ? READ_FLAGS | constants.O_NOFOLLOW : READ_FLAGS;
|
|
21
|
-
}
|
|
22
|
-
async function readFileWithinBudget(path, maxBytes, options = {}) {
|
|
23
|
-
const handle = await open(path, openFlags(options));
|
|
24
|
-
try {
|
|
25
|
-
const stats = await handle.stat();
|
|
26
|
-
if (!stats.isFile()) return { kind: "not-regular" };
|
|
27
|
-
return await readDescriptorWithinBudget(handle.fd, stats, maxBytes);
|
|
28
|
-
} finally {
|
|
29
|
-
await handle.close();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async function readDescriptorWithinBudget(fd, stats, maxBytes) {
|
|
33
|
-
if (stats.size > maxBytes) return { kind: "too-large", size: stats.size };
|
|
34
|
-
let buffer = Buffer.alloc(initialCapacity(stats.size, maxBytes));
|
|
35
|
-
let filled = 0;
|
|
36
|
-
for (; ; ) {
|
|
37
|
-
const { bytesRead } = await readAsync(fd, buffer, filled, buffer.length - filled, null);
|
|
38
|
-
if (bytesRead === 0) break;
|
|
39
|
-
filled += bytesRead;
|
|
40
|
-
if (filled === buffer.length) {
|
|
41
|
-
if (buffer.length > maxBytes) break;
|
|
42
|
-
buffer = grow(buffer, maxBytes);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (filled > maxBytes) return { kind: "too-large", size: Math.max(filled, stats.size) };
|
|
46
|
-
return { kind: "ok", content: buffer.subarray(0, filled) };
|
|
47
|
-
}
|
|
48
|
-
function readFileWithinBudgetSync(path, maxBytes, options = {}) {
|
|
49
|
-
const fd = openSync(path, openFlags(options));
|
|
50
|
-
try {
|
|
51
|
-
const stats = fstatSync(fd);
|
|
52
|
-
if (!stats.isFile()) return { kind: "not-regular" };
|
|
53
|
-
if (stats.size > maxBytes) return { kind: "too-large", size: stats.size };
|
|
54
|
-
let buffer = Buffer.alloc(initialCapacity(stats.size, maxBytes));
|
|
55
|
-
let filled = 0;
|
|
56
|
-
for (; ; ) {
|
|
57
|
-
filled += readInto(fd, buffer, filled, buffer.length - filled);
|
|
58
|
-
if (filled < buffer.length || buffer.length > maxBytes) break;
|
|
59
|
-
buffer = grow(buffer, maxBytes);
|
|
60
|
-
}
|
|
61
|
-
if (filled > maxBytes) return { kind: "too-large", size: Math.max(filled, stats.size) };
|
|
62
|
-
return { kind: "ok", content: buffer.subarray(0, filled) };
|
|
63
|
-
} finally {
|
|
64
|
-
closeSync(fd);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function initialCapacity(size, maxBytes) {
|
|
68
|
-
return Math.min(size, maxBytes) + 1;
|
|
69
|
-
}
|
|
70
|
-
function grow(buffer, maxBytes) {
|
|
71
|
-
const next = Buffer.alloc(Math.min(buffer.length * 2, maxBytes + 1));
|
|
72
|
-
buffer.copy(next);
|
|
73
|
-
return next;
|
|
74
|
-
}
|
|
75
|
-
function readInto(fd, buffer, offset, length) {
|
|
76
|
-
let filled = 0;
|
|
77
|
-
while (filled < length) {
|
|
78
|
-
const bytesRead = readSync(fd, buffer, offset + filled, length - filled, null);
|
|
79
|
-
if (bytesRead === 0) break;
|
|
80
|
-
filled += bytesRead;
|
|
81
|
-
}
|
|
82
|
-
return filled;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// src/input-budgets.ts
|
|
86
|
-
var KIB = 1024;
|
|
87
|
-
var MIB = 1024 * KIB;
|
|
88
|
-
var MAX_SOURCE_ENTRIES = 5e4;
|
|
89
|
-
var BINARY_SNIFF_BYTES = 8 * KIB;
|
|
90
|
-
var MAX_SOURCE_FILE_BYTES = 5 * MIB;
|
|
91
|
-
var MAX_SOURCE_TOTAL_BYTES = 64 * MIB;
|
|
92
|
-
var MAX_GIT_DIFF_OUTPUT_BYTES = 50 * MIB;
|
|
93
|
-
var MAX_GUIDE_BYTES = 1 * MIB;
|
|
94
|
-
var MAX_RESUME_XML_BYTES = 16 * MIB;
|
|
95
|
-
var MAX_RESUME_ATTACHMENTS = 1e3;
|
|
96
|
-
var MAX_IMAGE_BYTES = 10 * MIB;
|
|
97
|
-
var DEFAULT_SOURCE_BUDGETS = Object.freeze({
|
|
98
|
-
maxEntries: MAX_SOURCE_ENTRIES,
|
|
99
|
-
maxFileBytes: MAX_SOURCE_FILE_BYTES,
|
|
100
|
-
maxTotalBytes: MAX_SOURCE_TOTAL_BYTES,
|
|
101
|
-
maxGitDiffOutputBytes: MAX_GIT_DIFF_OUTPUT_BYTES
|
|
102
|
-
});
|
|
103
|
-
function resolveSourceBudgets(overrides = {}) {
|
|
104
|
-
return { ...DEFAULT_SOURCE_BUDGETS, ...overrides };
|
|
105
|
-
}
|
|
106
|
-
function formatBytes(bytes) {
|
|
107
|
-
if (bytes >= MIB) return `${trimFixed(bytes / MIB)} MiB`;
|
|
108
|
-
if (bytes >= KIB) return `${trimFixed(bytes / KIB)} KiB`;
|
|
109
|
-
return `${bytes} bytes`;
|
|
110
|
-
}
|
|
111
|
-
function trimFixed(value) {
|
|
112
|
-
return value.toFixed(1).replace(/\.0$/, "");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/synthetic-diff.ts
|
|
116
|
-
var C_STYLE_ESCAPES = {
|
|
117
|
-
7: "\\a",
|
|
118
|
-
8: "\\b",
|
|
119
|
-
9: "\\t",
|
|
120
|
-
10: "\\n",
|
|
121
|
-
11: "\\v",
|
|
122
|
-
12: "\\f",
|
|
123
|
-
13: "\\r",
|
|
124
|
-
34: '\\"',
|
|
125
|
-
92: "\\\\"
|
|
126
|
-
};
|
|
127
|
-
function needsQuoting(byte) {
|
|
128
|
-
return byte < 32 || byte >= 127 || byte === 34 || byte === 92;
|
|
129
|
-
}
|
|
130
|
-
function quoteGitPath(path) {
|
|
131
|
-
const bytes = Buffer.from(path, "utf-8");
|
|
132
|
-
if (!bytes.some(needsQuoting)) return path;
|
|
133
|
-
let quoted = '"';
|
|
134
|
-
for (const byte of bytes) {
|
|
135
|
-
const escape = C_STYLE_ESCAPES[byte];
|
|
136
|
-
if (escape) {
|
|
137
|
-
quoted += escape;
|
|
138
|
-
} else if (byte < 32 || byte >= 127) {
|
|
139
|
-
quoted += `\\${byte.toString(8).padStart(3, "0")}`;
|
|
140
|
-
} else {
|
|
141
|
-
quoted += String.fromCharCode(byte);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return `${quoted}"`;
|
|
145
|
-
}
|
|
146
|
-
var NO_FOLLOW_FLAGS = constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0) | (constants2.O_NONBLOCK ?? 0);
|
|
147
|
-
var FOLLOW_FLAGS = constants2.O_RDONLY | (constants2.O_NONBLOCK ?? 0);
|
|
148
|
-
function readSyntheticSource(fullPath, options = {}) {
|
|
149
|
-
const budgets = resolveSourceBudgets();
|
|
150
|
-
const {
|
|
151
|
-
followSymlinks = false,
|
|
152
|
-
maxFileBytes = budgets.maxFileBytes,
|
|
153
|
-
remainingBytes = budgets.maxTotalBytes
|
|
154
|
-
} = options;
|
|
155
|
-
if (!followSymlinks) {
|
|
156
|
-
let isLink;
|
|
157
|
-
try {
|
|
158
|
-
isLink = lstatSync(fullPath).isSymbolicLink();
|
|
159
|
-
} catch (error) {
|
|
160
|
-
return failure(error);
|
|
161
|
-
}
|
|
162
|
-
if (isLink) {
|
|
163
|
-
try {
|
|
164
|
-
const content = readlinkSync(fullPath, { encoding: "buffer" });
|
|
165
|
-
return { kind: "symlink", content, bytesRead: content.length };
|
|
166
|
-
} catch (error) {
|
|
167
|
-
return failure(error);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
let fd;
|
|
172
|
-
try {
|
|
173
|
-
fd = openSync2(fullPath, followSymlinks ? FOLLOW_FLAGS : NO_FOLLOW_FLAGS);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
return failure(error);
|
|
176
|
-
}
|
|
177
|
-
let bytesRead = 0;
|
|
178
|
-
try {
|
|
179
|
-
const stats = fstatSync2(fd);
|
|
180
|
-
if (!stats.isFile()) return { kind: "skip", bytesRead: 0 };
|
|
181
|
-
const size = stats.size;
|
|
182
|
-
const sniffLength = Math.min(size, BINARY_SNIFF_BYTES);
|
|
183
|
-
if (sniffLength > remainingBytes) return { kind: "over-total", size, bytesRead };
|
|
184
|
-
const sniff = Buffer.alloc(sniffLength);
|
|
185
|
-
bytesRead = readInto(fd, sniff, 0, sniffLength);
|
|
186
|
-
if (sniff.subarray(0, bytesRead).includes(0)) return { kind: "binary", bytesRead };
|
|
187
|
-
if (size > maxFileBytes) return { kind: "too-large", size, bytesRead };
|
|
188
|
-
if (size > remainingBytes) return { kind: "over-total", size, bytesRead };
|
|
189
|
-
const content = Buffer.alloc(size);
|
|
190
|
-
sniff.copy(content, 0, 0, bytesRead);
|
|
191
|
-
bytesRead += readInto(fd, content, bytesRead, size - bytesRead);
|
|
192
|
-
return { kind: "text", content: content.subarray(0, bytesRead), bytesRead };
|
|
193
|
-
} catch (error) {
|
|
194
|
-
return failure(error, bytesRead);
|
|
195
|
-
} finally {
|
|
196
|
-
closeSync2(fd);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function failure(error, bytesRead = 0) {
|
|
200
|
-
const code = error?.code ?? "unknown error";
|
|
201
|
-
if (code === "ENOENT" || code === "ENOTDIR" || code === "ELOOP") {
|
|
202
|
-
return { kind: "skip", bytesRead: 0 };
|
|
203
|
-
}
|
|
204
|
-
return { kind: "unreadable", code, bytesRead };
|
|
205
|
-
}
|
|
206
|
-
function generateSyntheticDiffs(paths, rootDir, options = {}) {
|
|
207
|
-
const budgets = resolveSourceBudgets(options.budgets);
|
|
208
|
-
const diffs = [];
|
|
209
|
-
const omitted = /* @__PURE__ */ new Map();
|
|
210
|
-
const tooLarge = [];
|
|
211
|
-
const overTotal = [];
|
|
212
|
-
const unreadable = [];
|
|
213
|
-
let totalRead = 0;
|
|
214
|
-
let totalExhausted = false;
|
|
215
|
-
for (const filePath of paths) {
|
|
216
|
-
const oldHeaderPath = quoteGitPath(`a/${filePath}`);
|
|
217
|
-
const newHeaderPath = quoteGitPath(`b/${filePath}`);
|
|
218
|
-
const header = `diff --git ${oldHeaderPath} ${newHeaderPath}
|
|
219
|
-
`;
|
|
220
|
-
if (totalExhausted) {
|
|
221
|
-
overTotal.push(filePath);
|
|
222
|
-
omitted.set(filePath, overTotalReason(budgets.maxTotalBytes));
|
|
223
|
-
diffs.push(`${header}new file mode 100644`);
|
|
224
|
-
continue;
|
|
225
|
-
}
|
|
226
|
-
const source = readSyntheticSource(join(rootDir, filePath), {
|
|
227
|
-
followSymlinks: options.followSymlinks,
|
|
228
|
-
maxFileBytes: budgets.maxFileBytes,
|
|
229
|
-
remainingBytes: budgets.maxTotalBytes - totalRead
|
|
230
|
-
});
|
|
231
|
-
totalRead += source.bytesRead;
|
|
232
|
-
switch (source.kind) {
|
|
233
|
-
case "skip":
|
|
234
|
-
continue;
|
|
235
|
-
case "unreadable":
|
|
236
|
-
unreadable.push(`${filePath} (${source.code})`);
|
|
237
|
-
continue;
|
|
238
|
-
case "binary":
|
|
239
|
-
diffs.push(
|
|
240
|
-
`${header}new file mode 100644
|
|
241
|
-
Binary files /dev/null and ${newHeaderPath} differ`
|
|
242
|
-
);
|
|
243
|
-
continue;
|
|
244
|
-
case "too-large":
|
|
245
|
-
tooLarge.push(filePath);
|
|
246
|
-
omitted.set(
|
|
247
|
-
filePath,
|
|
248
|
-
`Not loaded: this file is ${formatBytes(source.size)}, over the ${formatBytes(budgets.maxFileBytes)} per-file read budget.`
|
|
249
|
-
);
|
|
250
|
-
diffs.push(`${header}new file mode 100644`);
|
|
251
|
-
continue;
|
|
252
|
-
case "over-total":
|
|
253
|
-
totalExhausted = true;
|
|
254
|
-
overTotal.push(filePath);
|
|
255
|
-
omitted.set(filePath, overTotalReason(budgets.maxTotalBytes));
|
|
256
|
-
diffs.push(`${header}new file mode 100644`);
|
|
257
|
-
continue;
|
|
258
|
-
case "symlink":
|
|
259
|
-
diffs.push(addedTextDiff(header, newHeaderPath, "120000", source.content));
|
|
260
|
-
continue;
|
|
261
|
-
case "text":
|
|
262
|
-
diffs.push(addedTextDiff(header, newHeaderPath, "100644", source.content));
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
const diagnostics = [];
|
|
267
|
-
if (tooLarge.length > 0) {
|
|
268
|
-
diagnostics.push(
|
|
269
|
-
`${countFiles(tooLarge.length)} over the ${formatBytes(budgets.maxFileBytes)} per-file read budget ${tooLarge.length === 1 ? "is" : "are"} listed without content: ` + listPaths(tooLarge)
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
if (overTotal.length > 0) {
|
|
273
|
-
diagnostics.push(
|
|
274
|
-
`The ${formatBytes(budgets.maxTotalBytes)} total read budget for this review ran out; ${countFiles(overTotal.length)} ${overTotal.length === 1 ? "is" : "are"} listed without content: ${listPaths(overTotal)}`
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
if (unreadable.length > 0) {
|
|
278
|
-
diagnostics.push(
|
|
279
|
-
`${countFiles(unreadable.length)} could not be read and ${unreadable.length === 1 ? "is" : "are"} not shown: ${listPaths(unreadable)}`
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
return { diff: diffs.join("\n"), omitted, diagnostics };
|
|
283
|
-
}
|
|
284
|
-
function loadSyntheticFiles(paths, rootDir, options = {}) {
|
|
285
|
-
const { diff, omitted, diagnostics } = generateSyntheticDiffs(paths, rootDir, options);
|
|
286
|
-
const parsed = parseDiffWithDiagnostics(diff);
|
|
287
|
-
for (const file of parsed.files) {
|
|
288
|
-
const reason = omitted.get(file.newPath);
|
|
289
|
-
if (reason !== void 0) file.omittedReason = reason;
|
|
290
|
-
}
|
|
291
|
-
return { files: parsed.files, diagnostics: [...diagnostics, ...parsed.diagnostics] };
|
|
292
|
-
}
|
|
293
|
-
function addedTextDiff(header, newHeaderPath, mode, content) {
|
|
294
|
-
const text = content.toString("utf-8");
|
|
295
|
-
const lines = text.split("\n");
|
|
296
|
-
if (lines.length > 0 && lines[lines.length - 1] === "") {
|
|
297
|
-
lines.pop();
|
|
298
|
-
}
|
|
299
|
-
const lineCount = lines.length;
|
|
300
|
-
const addedLines = lines.map((line) => `+${line}`).join("\n");
|
|
301
|
-
let diff = header + `new file mode ${mode}
|
|
302
|
-
--- /dev/null
|
|
303
|
-
+++ ${newHeaderPath}
|
|
304
|
-
@@ -0,0 +1,${lineCount} @@
|
|
305
|
-
` + addedLines;
|
|
306
|
-
if (text.length > 0 && !text.endsWith("\n")) {
|
|
307
|
-
diff += "\n\";
|
|
308
|
-
}
|
|
309
|
-
return diff;
|
|
310
|
-
}
|
|
311
|
-
function overTotalReason(maxTotalBytes) {
|
|
312
|
-
return `Not loaded: the ${formatBytes(maxTotalBytes)} total read budget for this review ran out before this file.`;
|
|
313
|
-
}
|
|
314
|
-
var LISTED_PATHS = 10;
|
|
315
|
-
function listPaths(paths) {
|
|
316
|
-
const shown = paths.slice(0, LISTED_PATHS).join(", ");
|
|
317
|
-
const rest = paths.length - LISTED_PATHS;
|
|
318
|
-
return rest > 0 ? `${shown}, and ${rest} more` : shown;
|
|
319
|
-
}
|
|
320
|
-
function countFiles(count) {
|
|
321
|
-
return `${count} ${count === 1 ? "file" : "files"}`;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// src/git.ts
|
|
325
|
-
var execFileAsync = promisify2(execFile);
|
|
326
|
-
function stripTrailingNewline(text) {
|
|
327
|
-
return text.replace(/\r?\n$/, "");
|
|
328
|
-
}
|
|
329
|
-
async function getRepoRootAsync(cwd) {
|
|
330
|
-
try {
|
|
331
|
-
const { stdout } = await execFileAsync("git", ["rev-parse", "--show-toplevel"], {
|
|
332
|
-
timeout: 1e4,
|
|
333
|
-
// 10 second timeout
|
|
334
|
-
cwd
|
|
335
|
-
});
|
|
336
|
-
return stripTrailingNewline(stdout);
|
|
337
|
-
} catch (error) {
|
|
338
|
-
if (error instanceof Error) {
|
|
339
|
-
console.error(`Error getting repository root: ${error.message}`);
|
|
340
|
-
} else {
|
|
341
|
-
console.error("Error getting repository root: unknown error");
|
|
342
|
-
}
|
|
343
|
-
throw error;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
var PARSER_COMPATIBLE_GIT_CONFIG = [
|
|
347
|
-
"-c",
|
|
348
|
-
"color.ui=never",
|
|
349
|
-
"-c",
|
|
350
|
-
"diff.noprefix=false",
|
|
351
|
-
"-c",
|
|
352
|
-
"diff.mnemonicPrefix=false",
|
|
353
|
-
// Untracked enumeration, context expansion and Apply all resolve paths against the root.
|
|
354
|
-
"-c",
|
|
355
|
-
"diff.relative=false"
|
|
356
|
-
];
|
|
357
|
-
var PARSER_COMPATIBLE_DIFF_FLAGS = [
|
|
358
|
-
"--no-color",
|
|
359
|
-
"--no-ext-diff",
|
|
360
|
-
"--no-textconv",
|
|
361
|
-
"--src-prefix=a/",
|
|
362
|
-
"--dst-prefix=b/"
|
|
363
|
-
];
|
|
364
|
-
function withParserCompatibleDiffArgs(args) {
|
|
365
|
-
const separator = args.indexOf("--");
|
|
366
|
-
if (separator === -1) {
|
|
367
|
-
return [...args, ...PARSER_COMPATIBLE_DIFF_FLAGS];
|
|
368
|
-
}
|
|
369
|
-
return [...args.slice(0, separator), ...PARSER_COMPATIBLE_DIFF_FLAGS, ...args.slice(separator)];
|
|
370
|
-
}
|
|
371
|
-
async function runGitDiffAsync(args, cwd, maxOutputBytes = MAX_GIT_DIFF_OUTPUT_BYTES) {
|
|
372
|
-
try {
|
|
373
|
-
const { stdout } = await execFileAsync(
|
|
374
|
-
"git",
|
|
375
|
-
[...PARSER_COMPATIBLE_GIT_CONFIG, "diff", ...withParserCompatibleDiffArgs(args)],
|
|
376
|
-
{
|
|
377
|
-
maxBuffer: maxOutputBytes,
|
|
378
|
-
timeout: 3e4,
|
|
379
|
-
// 30 second timeout
|
|
380
|
-
cwd
|
|
381
|
-
}
|
|
382
|
-
);
|
|
383
|
-
return stdout;
|
|
384
|
-
} catch (error) {
|
|
385
|
-
if (error instanceof Error) {
|
|
386
|
-
console.error(`Error running git diff: ${error.message}`);
|
|
387
|
-
} else {
|
|
388
|
-
console.error("Error running git diff: unknown error");
|
|
389
|
-
}
|
|
390
|
-
throw error;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
async function getUntrackedFilesAsync(repoRoot) {
|
|
394
|
-
try {
|
|
395
|
-
const { stdout } = await execFileAsync(
|
|
396
|
-
"git",
|
|
397
|
-
["ls-files", "--others", "--exclude-standard", "-z"],
|
|
398
|
-
{
|
|
399
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
400
|
-
timeout: 1e4,
|
|
401
|
-
cwd: repoRoot
|
|
402
|
-
}
|
|
403
|
-
);
|
|
404
|
-
return stdout.split("\0").filter((name) => name.length > 0);
|
|
405
|
-
} catch (error) {
|
|
406
|
-
if (error instanceof Error) {
|
|
407
|
-
console.error(`Warning: Failed to list untracked files: ${error.message}`);
|
|
408
|
-
} else {
|
|
409
|
-
console.error("Warning: Failed to list untracked files: unknown error");
|
|
410
|
-
}
|
|
411
|
-
return [];
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
function isOutputLimitError(error) {
|
|
415
|
-
return error?.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
416
|
-
}
|
|
417
|
-
function generateUntrackedDiffs(paths, repoRoot, options = {}) {
|
|
418
|
-
return generateSyntheticDiffs(paths, repoRoot, { ...options, followSymlinks: false });
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
export {
|
|
422
|
-
READ_FLAGS,
|
|
423
|
-
readFileWithinBudget,
|
|
424
|
-
readDescriptorWithinBudget,
|
|
425
|
-
readFileWithinBudgetSync,
|
|
426
|
-
MAX_SOURCE_ENTRIES,
|
|
427
|
-
BINARY_SNIFF_BYTES,
|
|
428
|
-
MAX_SOURCE_FILE_BYTES,
|
|
429
|
-
MAX_SOURCE_TOTAL_BYTES,
|
|
430
|
-
MAX_GIT_DIFF_OUTPUT_BYTES,
|
|
431
|
-
MAX_GUIDE_BYTES,
|
|
432
|
-
MAX_RESUME_XML_BYTES,
|
|
433
|
-
MAX_RESUME_ATTACHMENTS,
|
|
434
|
-
MAX_IMAGE_BYTES,
|
|
435
|
-
DEFAULT_SOURCE_BUDGETS,
|
|
436
|
-
resolveSourceBudgets,
|
|
437
|
-
formatBytes,
|
|
438
|
-
generateSyntheticDiffs,
|
|
439
|
-
loadSyntheticFiles,
|
|
440
|
-
stripTrailingNewline,
|
|
441
|
-
getRepoRootAsync,
|
|
442
|
-
PARSER_COMPATIBLE_GIT_CONFIG,
|
|
443
|
-
PARSER_COMPATIBLE_DIFF_FLAGS,
|
|
444
|
-
withParserCompatibleDiffArgs,
|
|
445
|
-
runGitDiffAsync,
|
|
446
|
-
getUntrackedFilesAsync,
|
|
447
|
-
isOutputLimitError,
|
|
448
|
-
generateUntrackedDiffs
|
|
449
|
-
};
|
|
450
|
-
//# sourceMappingURL=chunk-QHS36X6T.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/git.ts","../src/synthetic-diff.ts","../src/bounded-read.ts","../src/input-budgets.ts"],"sourcesContent":["// Git command execution. Helpers reject rather than exit; front ends report failures.\n\nimport { execFile } from 'child_process';\nimport { promisify } from 'util';\nimport {\n generateSyntheticDiffs,\n type SyntheticDiffOptions,\n type SyntheticDiffResult,\n} from './synthetic-diff';\nimport { MAX_GIT_DIFF_OUTPUT_BYTES } from './input-budgets';\n\nconst execFileAsync = promisify(execFile);\n\n/**\n * Strip only the single trailing newline git appends to command output.\n * A plain `.trim()` also eats leading/trailing whitespace that is part of\n * the actual path (e.g. a repository root with a trailing space), reporting\n * a path that does not exist on disk.\n */\nexport function stripTrailingNewline(text: string): string {\n return text.replace(/\\r?\\n$/, '');\n}\n\n/** Rejects when git is missing or `cwd` is not inside a repository. */\nexport async function getRepoRootAsync(cwd?: string): Promise<string> {\n try {\n const { stdout } = await execFileAsync('git', ['rev-parse', '--show-toplevel'], {\n timeout: 10000, // 10 second timeout\n cwd,\n });\n return stripTrailingNewline(stdout);\n } catch (error) {\n if (error instanceof Error) {\n console.error(`Error getting repository root: ${error.message}`);\n } else {\n console.error('Error getting repository root: unknown error');\n }\n throw error;\n }\n}\n\n/**\n * Config overrides, placed before `diff`, that keep output parseable whatever the user's config\n * says.\n */\nexport const PARSER_COMPATIBLE_GIT_CONFIG: readonly string[] = [\n '-c',\n 'color.ui=never',\n '-c',\n 'diff.noprefix=false',\n '-c',\n 'diff.mnemonicPrefix=false',\n // Untracked enumeration, context expansion and Apply all resolve paths against the root.\n '-c',\n 'diff.relative=false',\n];\n\n/** Appended after the user's options so a user `--color=always` or `--no-prefix` loses. */\nexport const PARSER_COMPATIBLE_DIFF_FLAGS: readonly string[] = [\n '--no-color',\n '--no-ext-diff',\n '--no-textconv',\n '--src-prefix=a/',\n '--dst-prefix=b/',\n];\n\n/** Inserts the flags after every user option and before `--`. */\nexport function withParserCompatibleDiffArgs(args: readonly string[]): string[] {\n const separator = args.indexOf('--');\n if (separator === -1) {\n return [...args, ...PARSER_COMPATIBLE_DIFF_FLAGS];\n }\n return [...args.slice(0, separator), ...PARSER_COMPATIBLE_DIFF_FLAGS, ...args.slice(separator)];\n}\n\n/**\n * The one entry point for every `git diff` (load, expansion, remote), so the\n * parser-compatible normalization applies uniformly. Output past `maxOutputBytes`\n * rejects with an error {@link isOutputLimitError} recognizes.\n */\nexport async function runGitDiffAsync(\n args: string[],\n cwd?: string,\n maxOutputBytes: number = MAX_GIT_DIFF_OUTPUT_BYTES\n): Promise<string> {\n try {\n const { stdout } = await execFileAsync(\n 'git',\n [...PARSER_COMPATIBLE_GIT_CONFIG, 'diff', ...withParserCompatibleDiffArgs(args)],\n {\n maxBuffer: maxOutputBytes,\n timeout: 30000, // 30 second timeout\n cwd,\n }\n );\n return stdout;\n } catch (error) {\n if (error instanceof Error) {\n console.error(`Error running git diff: ${error.message}`);\n } else {\n console.error('Error running git diff: unknown error');\n }\n throw error;\n }\n}\n\n/**\n * Get list of untracked files (respects .gitignore).\n *\n * Pass the repository root. `git ls-files` reports paths relative to the\n * directory it runs in and lists that subtree only, while `git diff` reports\n * root-relative paths for the whole repository from anywhere inside it. Run\n * anywhere else and the names match neither the diff nor the root the files\n * are read from.\n *\n * `-z` keeps the names literal. NUL termination survives newlines in\n * filenames, and it turns off the C-style quoting git otherwise applies to\n * control characters and non-ASCII bytes.\n */\nexport async function getUntrackedFilesAsync(repoRoot?: string): Promise<string[]> {\n try {\n const { stdout } = await execFileAsync(\n 'git',\n ['ls-files', '--others', '--exclude-standard', '-z'],\n {\n maxBuffer: 10 * 1024 * 1024,\n timeout: 10000,\n cwd: repoRoot,\n }\n );\n return stdout.split('\\0').filter(name => name.length > 0);\n } catch (error) {\n if (error instanceof Error) {\n console.error(`Warning: Failed to list untracked files: ${error.message}`);\n } else {\n console.error('Warning: Failed to list untracked files: unknown error');\n }\n return [];\n }\n}\n\n/** True when a child process exceeded `maxBuffer`: a budget hit, not a git failure. */\nexport function isOutputLimitError(error: unknown): boolean {\n return (error as NodeJS.ErrnoException | undefined)?.code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER';\n}\n\n/**\n * Generate synthetic unified diffs for untracked files so they can be\n * parsed by the existing diff parser. Untracked symlinks are described by\n * their link text, never followed.\n */\nexport function generateUntrackedDiffs(\n paths: string[],\n repoRoot: string,\n options: SyntheticDiffOptions = {}\n): SyntheticDiffResult {\n return generateSyntheticDiffs(paths, repoRoot, { ...options, followSymlinks: false });\n}\n","// packages/core/src/synthetic-diff.ts\n// Generates synthetic unified diffs for files that aren't tracked by git.\n// Reusable by both git untracked file handling and directory-based scanning.\n//\n// Reads are bounded first (input-budgets.ts). A file over budget is still listed, with no\n// content and an `omittedReason`, and named in the diagnostics.\n\nimport { closeSync, constants, fstatSync, lstatSync, openSync, readlinkSync } from 'fs';\nimport { join } from 'path';\nimport type { DiffFile } from './types';\nimport { parseDiffWithDiagnostics } from './diff-parser';\nimport { readInto } from './bounded-read';\nimport {\n BINARY_SNIFF_BYTES,\n formatBytes,\n resolveSourceBudgets,\n type SourceBudgets,\n} from './input-budgets';\n\n// C-style escapes git emits for the characters that have one.\nconst C_STYLE_ESCAPES: Record<number, string> = {\n 0x07: '\\\\a',\n 0x08: '\\\\b',\n 0x09: '\\\\t',\n 0x0a: '\\\\n',\n 0x0b: '\\\\v',\n 0x0c: '\\\\f',\n 0x0d: '\\\\r',\n 0x22: '\\\\\"',\n 0x5c: '\\\\\\\\',\n};\n\nfunction needsQuoting(byte: number): boolean {\n return byte < 0x20 || byte >= 0x7f || byte === 0x22 || byte === 0x5c;\n}\n\n/**\n * Encode a path the way git writes it in diff headers. A plain path goes out\n * verbatim. Anything else becomes a double-quoted C-style token with control\n * characters, quotes, backslashes and non-ASCII UTF-8 bytes escaped.\n *\n * This inverts `decodeGitPath` in diff-parser.ts. Without it, a filename\n * containing a newline ends the header line mid-name and the parser recovers\n * a name no file on disk answers to.\n */\nexport function quoteGitPath(path: string): string {\n const bytes = Buffer.from(path, 'utf-8');\n if (!bytes.some(needsQuoting)) return path;\n\n let quoted = '\"';\n for (const byte of bytes) {\n const escape = C_STYLE_ESCAPES[byte];\n if (escape) {\n quoted += escape;\n } else if (byte < 0x20 || byte >= 0x7f) {\n quoted += `\\\\${byte.toString(8).padStart(3, '0')}`;\n } else {\n quoted += String.fromCharCode(byte);\n }\n }\n return `${quoted}\"`;\n}\n\nexport interface SyntheticDiffOptions {\n /**\n * Only for a path the reviewer named explicitly (single-file review); enumerated paths never\n * follow links.\n */\n followSymlinks?: boolean;\n budgets?: Partial<SourceBudgets>;\n}\n\nexport interface SyntheticDiffResult {\n diff: string;\n /**\n * Files listed without content, by literal relative path, with the sentence the viewer shows\n * instead.\n */\n omitted: Map<string, string>;\n diagnostics: string[];\n}\n\n/**\n * What a bounded look at one path found. `skip` is gone, a directory or a special file; `symlink`\n * carries its own text, as git stores it.\n */\nexport type SyntheticSource =\n | { kind: 'skip'; bytesRead: 0 }\n | { kind: 'unreadable'; code: string; bytesRead: number }\n | { kind: 'symlink'; content: Buffer; bytesRead: number }\n | { kind: 'binary'; bytesRead: number }\n | { kind: 'text'; content: Buffer; bytesRead: number }\n | { kind: 'too-large'; size: number; bytesRead: number }\n | { kind: 'over-total'; size: number; bytesRead: number };\n\n/** Read-only, never following a final symlink, never blocking on a FIFO. */\nconst NO_FOLLOW_FLAGS =\n constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0);\nconst FOLLOW_FLAGS = constants.O_RDONLY | (constants.O_NONBLOCK ?? 0);\n\n/**\n * Nothing past the sniff prefix is read unless the file is text and fits `maxFileBytes` and\n * `remainingBytes`.\n */\nexport function readSyntheticSource(\n fullPath: string,\n options: { followSymlinks?: boolean; maxFileBytes?: number; remainingBytes?: number } = {}\n): SyntheticSource {\n const budgets = resolveSourceBudgets();\n const {\n followSymlinks = false,\n maxFileBytes = budgets.maxFileBytes,\n remainingBytes = budgets.maxTotalBytes,\n } = options;\n\n if (!followSymlinks) {\n let isLink: boolean;\n try {\n isLink = lstatSync(fullPath).isSymbolicLink();\n } catch (error) {\n return failure(error);\n }\n if (isLink) {\n // Git stores a link as its target path; never read what it points at.\n try {\n const content = readlinkSync(fullPath, { encoding: 'buffer' });\n return { kind: 'symlink', content, bytesRead: content.length };\n } catch (error) {\n return failure(error);\n }\n }\n }\n\n let fd: number;\n try {\n fd = openSync(fullPath, followSymlinks ? FOLLOW_FLAGS : NO_FOLLOW_FLAGS);\n } catch (error) {\n return failure(error);\n }\n let bytesRead = 0;\n try {\n // Decide on the open descriptor, so a path swapped after lstat cannot differ.\n const stats = fstatSync(fd);\n if (!stats.isFile()) return { kind: 'skip', bytesRead: 0 };\n const size = stats.size;\n\n const sniffLength = Math.min(size, BINARY_SNIFF_BYTES);\n if (sniffLength > remainingBytes) return { kind: 'over-total', size, bytesRead };\n const sniff = Buffer.alloc(sniffLength);\n bytesRead = readInto(fd, sniff, 0, sniffLength);\n if (sniff.subarray(0, bytesRead).includes(0)) return { kind: 'binary', bytesRead };\n\n if (size > maxFileBytes) return { kind: 'too-large', size, bytesRead };\n if (size > remainingBytes) return { kind: 'over-total', size, bytesRead };\n\n // Read no more than the fstat size: a growing file is reviewed as measured.\n const content = Buffer.alloc(size);\n sniff.copy(content, 0, 0, bytesRead);\n bytesRead += readInto(fd, content, bytesRead, size - bytesRead);\n return { kind: 'text', content: content.subarray(0, bytesRead), bytesRead };\n } catch (error) {\n return failure(error, bytesRead);\n } finally {\n closeSync(fd);\n }\n}\n\nfunction failure(error: unknown, bytesRead = 0): SyntheticSource {\n const code = (error as NodeJS.ErrnoException | undefined)?.code ?? 'unknown error';\n // Gone or no longer a directory between listing and reading, or a link swapped in (O_NOFOLLOW).\n if (code === 'ENOENT' || code === 'ENOTDIR' || code === 'ELOOP') {\n return { kind: 'skip', bytesRead: 0 };\n }\n return { kind: 'unreadable', code, bytesRead };\n}\n\n/**\n * Generate synthetic unified diffs for a list of file paths so they can be\n * parsed by the existing diff parser. Each file is treated as a new addition.\n *\n * @param paths - Literal relative file paths (e.g. \"src/foo.ts\"), resolved\n * against rootDir and never git-quoted on the way in\n * @param rootDir - Absolute path to the root directory the paths are relative to\n * @returns The diff text, the files listed without content, and diagnostics\n */\nexport function generateSyntheticDiffs(\n paths: string[],\n rootDir: string,\n options: SyntheticDiffOptions = {}\n): SyntheticDiffResult {\n const budgets = resolveSourceBudgets(options.budgets);\n const diffs: string[] = [];\n const omitted = new Map<string, string>();\n const tooLarge: string[] = [];\n const overTotal: string[] = [];\n const unreadable: string[] = [];\n let totalRead = 0;\n let totalExhausted = false;\n\n for (const filePath of paths) {\n // Git quotes the prefixed path as a whole (\"a/name\"), not the name alone.\n const oldHeaderPath = quoteGitPath(`a/${filePath}`);\n const newHeaderPath = quoteGitPath(`b/${filePath}`);\n const header = `diff --git ${oldHeaderPath} ${newHeaderPath}\\n`;\n\n if (totalExhausted) {\n // Nothing more is read once the aggregate is spent: the cut is one point in the list.\n overTotal.push(filePath);\n omitted.set(filePath, overTotalReason(budgets.maxTotalBytes));\n diffs.push(`${header}new file mode 100644`);\n continue;\n }\n\n const source = readSyntheticSource(join(rootDir, filePath), {\n followSymlinks: options.followSymlinks,\n maxFileBytes: budgets.maxFileBytes,\n remainingBytes: budgets.maxTotalBytes - totalRead,\n });\n totalRead += source.bytesRead;\n\n switch (source.kind) {\n case 'skip':\n continue;\n case 'unreadable':\n unreadable.push(`${filePath} (${source.code})`);\n continue;\n case 'binary':\n diffs.push(\n `${header}new file mode 100644\\n` + `Binary files /dev/null and ${newHeaderPath} differ`\n );\n continue;\n case 'too-large':\n tooLarge.push(filePath);\n omitted.set(\n filePath,\n `Not loaded: this file is ${formatBytes(source.size)}, over the ` +\n `${formatBytes(budgets.maxFileBytes)} per-file read budget.`\n );\n diffs.push(`${header}new file mode 100644`);\n continue;\n case 'over-total':\n totalExhausted = true;\n overTotal.push(filePath);\n omitted.set(filePath, overTotalReason(budgets.maxTotalBytes));\n diffs.push(`${header}new file mode 100644`);\n continue;\n case 'symlink':\n diffs.push(addedTextDiff(header, newHeaderPath, '120000', source.content));\n continue;\n case 'text':\n diffs.push(addedTextDiff(header, newHeaderPath, '100644', source.content));\n continue;\n }\n }\n\n const diagnostics: string[] = [];\n if (tooLarge.length > 0) {\n diagnostics.push(\n `${countFiles(tooLarge.length)} over the ${formatBytes(budgets.maxFileBytes)} per-file ` +\n `read budget ${tooLarge.length === 1 ? 'is' : 'are'} listed without content: ` +\n listPaths(tooLarge)\n );\n }\n if (overTotal.length > 0) {\n diagnostics.push(\n `The ${formatBytes(budgets.maxTotalBytes)} total read budget for this review ran out; ` +\n `${countFiles(overTotal.length)} ${overTotal.length === 1 ? 'is' : 'are'} listed ` +\n `without content: ${listPaths(overTotal)}`\n );\n }\n if (unreadable.length > 0) {\n diagnostics.push(\n `${countFiles(unreadable.length)} could not be read and ` +\n `${unreadable.length === 1 ? 'is' : 'are'} not shown: ${listPaths(unreadable)}`\n );\n }\n\n return { diff: diffs.join('\\n'), omitted, diagnostics };\n}\n\n/** Builds and parses in one step, setting `omittedReason` on files listed without content. */\nexport function loadSyntheticFiles(\n paths: string[],\n rootDir: string,\n options: SyntheticDiffOptions = {}\n): { files: DiffFile[]; diagnostics: string[] } {\n const { diff, omitted, diagnostics } = generateSyntheticDiffs(paths, rootDir, options);\n const parsed = parseDiffWithDiagnostics(diff);\n for (const file of parsed.files) {\n const reason = omitted.get(file.newPath);\n if (reason !== undefined) file.omittedReason = reason;\n }\n return { files: parsed.files, diagnostics: [...diagnostics, ...parsed.diagnostics] };\n}\n\nfunction addedTextDiff(\n header: string,\n newHeaderPath: string,\n mode: string,\n content: Buffer\n): string {\n const text = content.toString('utf-8');\n const lines = text.split('\\n');\n\n // Remove trailing empty string from split if file ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === '') {\n lines.pop();\n }\n\n const lineCount = lines.length;\n const addedLines = lines.map(line => `+${line}`).join('\\n');\n\n let diff =\n header +\n `new file mode ${mode}\\n` +\n `--- /dev/null\\n` +\n `+++ ${newHeaderPath}\\n` +\n `@@ -0,0 +1,${lineCount} @@\\n` +\n addedLines;\n\n // Indicate missing newline at end of file\n if (text.length > 0 && !text.endsWith('\\n')) {\n diff += '\\n\\\';\n }\n return diff;\n}\n\nfunction overTotalReason(maxTotalBytes: number): string {\n return (\n `Not loaded: the ${formatBytes(maxTotalBytes)} total read budget for this review ` +\n 'ran out before this file.'\n );\n}\n\nconst LISTED_PATHS = 10;\n\nfunction listPaths(paths: string[]): string {\n const shown = paths.slice(0, LISTED_PATHS).join(', ');\n const rest = paths.length - LISTED_PATHS;\n return rest > 0 ? `${shown}, and ${rest} more` : shown;\n}\n\nfunction countFiles(count: number): string {\n return `${count} ${count === 1 ? 'file' : 'files'}`;\n}\n","// packages/core/src/bounded-read.ts\n// Whole-file reads within a byte budget, decided on the open descriptor before anything is allocated.\n\nimport { closeSync, constants, fstatSync, openSync, read, readSync } from 'fs';\nimport type { Stats } from 'fs';\nimport { open } from 'fs/promises';\nimport { promisify } from 'util';\n\n/** Filesystem errors (ENOENT, EACCES, ...) throw. */\nexport type BoundedReadResult =\n | { kind: 'ok'; content: Buffer }\n | { kind: 'too-large'; size: number }\n /** A directory, FIFO, socket or device: nothing was read. */\n | { kind: 'not-regular' };\n\n/** O_NONBLOCK keeps a FIFO from stalling the open until a writer appears; Windows lacks it. */\nexport const READ_FLAGS = constants.O_RDONLY | (constants.O_NONBLOCK ?? 0);\n\nexport interface BoundedReadOptions {\n /** Covers the leaf only; ancestors are the caller's job (`openContainedFile`). */\n noFollow?: boolean;\n}\n\nconst readAsync = promisify(read);\n\nfunction openFlags(options: BoundedReadOptions): number {\n return options.noFollow ? READ_FLAGS | constants.O_NOFOLLOW : READ_FLAGS;\n}\n\nexport async function readFileWithinBudget(\n path: string,\n maxBytes: number,\n options: BoundedReadOptions = {}\n): Promise<BoundedReadResult> {\n const handle = await open(path, openFlags(options));\n try {\n const stats = await handle.stat();\n if (!stats.isFile()) return { kind: 'not-regular' };\n return await readDescriptorWithinBudget(handle.fd, stats, maxBytes);\n } finally {\n await handle.close();\n }\n}\n\n/** {@link readFileWithinBudget} on a regular file the caller opened and `fstat`ed. */\nexport async function readDescriptorWithinBudget(\n fd: number,\n stats: Stats,\n maxBytes: number\n): Promise<Exclude<BoundedReadResult, { kind: 'not-regular' }>> {\n if (stats.size > maxBytes) return { kind: 'too-large', size: stats.size };\n\n let buffer: Buffer = Buffer.alloc(initialCapacity(stats.size, maxBytes));\n let filled = 0;\n for (;;) {\n const { bytesRead } = await readAsync(fd, buffer, filled, buffer.length - filled, null);\n if (bytesRead === 0) break;\n filled += bytesRead;\n if (filled === buffer.length) {\n // The file grew since fstat: keep going up to budget + 1.\n if (buffer.length > maxBytes) break;\n buffer = grow(buffer, maxBytes);\n }\n }\n if (filled > maxBytes) return { kind: 'too-large', size: Math.max(filled, stats.size) };\n return { kind: 'ok', content: buffer.subarray(0, filled) };\n}\n\nexport function readFileWithinBudgetSync(\n path: string,\n maxBytes: number,\n options: BoundedReadOptions = {}\n): BoundedReadResult {\n const fd = openSync(path, openFlags(options));\n try {\n const stats = fstatSync(fd);\n if (!stats.isFile()) return { kind: 'not-regular' };\n if (stats.size > maxBytes) return { kind: 'too-large', size: stats.size };\n\n let buffer: Buffer = Buffer.alloc(initialCapacity(stats.size, maxBytes));\n let filled = 0;\n for (;;) {\n filled += readInto(fd, buffer, filled, buffer.length - filled);\n if (filled < buffer.length || buffer.length > maxBytes) break;\n buffer = grow(buffer, maxBytes);\n }\n if (filled > maxBytes) return { kind: 'too-large', size: Math.max(filled, stats.size) };\n return { kind: 'ok', content: buffer.subarray(0, filled) };\n } finally {\n closeSync(fd);\n }\n}\n\n/** One byte past the fstat size, so growth since is noticed; never more than budget + 1. */\nfunction initialCapacity(size: number, maxBytes: number): number {\n return Math.min(size, maxBytes) + 1;\n}\n\nfunction grow(buffer: Buffer, maxBytes: number): Buffer {\n const next = Buffer.alloc(Math.min(buffer.length * 2, maxBytes + 1));\n buffer.copy(next);\n return next;\n}\n\n/** Fill `buffer[offset, offset + length)`, stopping early only at end of file. */\nexport function readInto(fd: number, buffer: Buffer, offset: number, length: number): number {\n let filled = 0;\n while (filled < length) {\n const bytesRead = readSync(fd, buffer, offset + filled, length - filled, null);\n if (bytesRead === 0) break;\n filled += bytesRead;\n }\n return filled;\n}\n","// Safety budgets, checked before the expensive step. Unlike the transport thresholds\n// (`max-files`, `max-total-lines`), these are deliberately not configurable.\n// Exceeding one surfaces as a diagnostic, a guide warning or `input-too-large`.\n\nconst KIB = 1024;\nconst MIB = 1024 * KIB;\n\n/**\n * Entries one directory walk (or untracked-file listing) may examine; ignored directories are\n * pruned first.\n */\nexport const MAX_SOURCE_ENTRIES = 50_000;\n\n/** Prefix sampled for a NUL byte to decide a file is binary. */\nexport const BINARY_SNIFF_BYTES = 8 * KIB;\n\n/**\n * Largest text file read into a synthetic diff; a larger one is listed without content and named in\n * a diagnostic.\n */\nexport const MAX_SOURCE_FILE_BYTES = 5 * MIB;\n\n/** Total bytes one synthetic-diff build may read, binary sniffs included. */\nexport const MAX_SOURCE_TOTAL_BYTES = 64 * MIB;\n\n/** Most bytes of `git diff` output captured from one invocation (the child process `maxBuffer`). */\nexport const MAX_GIT_DIFF_OUTPUT_BYTES = 50 * MIB;\n\n/** Largest guide sidecar the loader will read. */\nexport const MAX_GUIDE_BYTES = 1 * MIB;\n\n/**\n * Largest review document `--resume-from` will read (text and attachment references, never bytes).\n */\nexport const MAX_RESUME_XML_BYTES = 16 * MIB;\n\n/** Most attachment references one resumed document may carry; bounds the reads it can ask for. */\nexport const MAX_RESUME_ATTACHMENTS = 1_000;\n\n/** Largest image read for a rendered preview or a comment attachment. */\nexport const MAX_IMAGE_BYTES = 10 * MIB;\n\n/**\n * The source-loading budgets as one value; overrides are for tests and embedders, never user\n * config.\n */\nexport interface SourceBudgets {\n maxEntries: number;\n maxFileBytes: number;\n maxTotalBytes: number;\n maxGitDiffOutputBytes: number;\n}\n\nexport const DEFAULT_SOURCE_BUDGETS: Readonly<SourceBudgets> = Object.freeze({\n maxEntries: MAX_SOURCE_ENTRIES,\n maxFileBytes: MAX_SOURCE_FILE_BYTES,\n maxTotalBytes: MAX_SOURCE_TOTAL_BYTES,\n maxGitDiffOutputBytes: MAX_GIT_DIFF_OUTPUT_BYTES,\n});\n\nexport function resolveSourceBudgets(overrides: Partial<SourceBudgets> = {}): SourceBudgets {\n return { ...DEFAULT_SOURCE_BUDGETS, ...overrides };\n}\n\n/** `5 MiB`, `7.3 MiB`, `812 KiB`, `100 bytes`. */\nexport function formatBytes(bytes: number): string {\n if (bytes >= MIB) return `${trimFixed(bytes / MIB)} MiB`;\n if (bytes >= KIB) return `${trimFixed(bytes / KIB)} KiB`;\n return `${bytes} bytes`;\n}\n\nfunction trimFixed(value: number): string {\n return value.toFixed(1).replace(/\\.0$/, '');\n}\n"],"mappings":";;;;;AAEA,SAAS,gBAAgB;AACzB,SAAS,aAAAA,kBAAiB;;;ACI1B,SAAS,aAAAC,YAAW,aAAAC,YAAW,aAAAC,YAAW,WAAW,YAAAC,WAAU,oBAAoB;AACnF,SAAS,YAAY;;;ACLrB,SAAS,WAAW,WAAW,WAAW,UAAU,MAAM,gBAAgB;AAE1E,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAUnB,IAAM,aAAa,UAAU,YAAY,UAAU,cAAc;AAOxE,IAAM,YAAY,UAAU,IAAI;AAEhC,SAAS,UAAU,SAAqC;AACtD,SAAO,QAAQ,WAAW,aAAa,UAAU,aAAa;AAChE;AAEA,eAAsB,qBACpB,MACA,UACA,UAA8B,CAAC,GACH;AAC5B,QAAM,SAAS,MAAM,KAAK,MAAM,UAAU,OAAO,CAAC;AAClD,MAAI;AACF,UAAM,QAAQ,MAAM,OAAO,KAAK;AAChC,QAAI,CAAC,MAAM,OAAO,EAAG,QAAO,EAAE,MAAM,cAAc;AAClD,WAAO,MAAM,2BAA2B,OAAO,IAAI,OAAO,QAAQ;AAAA,EACpE,UAAE;AACA,UAAM,OAAO,MAAM;AAAA,EACrB;AACF;AAGA,eAAsB,2BACpB,IACA,OACA,UAC8D;AAC9D,MAAI,MAAM,OAAO,SAAU,QAAO,EAAE,MAAM,aAAa,MAAM,MAAM,KAAK;AAExE,MAAI,SAAiB,OAAO,MAAM,gBAAgB,MAAM,MAAM,QAAQ,CAAC;AACvE,MAAI,SAAS;AACb,aAAS;AACP,UAAM,EAAE,UAAU,IAAI,MAAM,UAAU,IAAI,QAAQ,QAAQ,OAAO,SAAS,QAAQ,IAAI;AACtF,QAAI,cAAc,EAAG;AACrB,cAAU;AACV,QAAI,WAAW,OAAO,QAAQ;AAE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AQ,KAAK,SAAS,CAAC;AAAA,EAC1D,SAAS,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,cAAQ,MAAM,4CAA4C,MAAM,OAAO,EAAE;AAAA,IAC3E,OAAO;AACL,cAAQ,MAAM,wDAAwD;AAAA,IACxE;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAGO,SAAS,mBAAmB,OAAyB;AAC1D,SAAQ,OAA6C,SAAS;AAChE;AAOO,SAAS,uBACd,OACA,UACA,UAAgC,CAAC,GACZ;AACrB,SAAO,uBAAuB,OAAO,UAAU,EAAE,GAAG,SAAS,gBAAgB,MAAM,CAAC;AACtF;","names":["promisify","closeSync","constants","fstatSync","openSync","constants","openSync","fstatSync","closeSync","promisify"]}
|
package/dist/git-N5HVNPKQ.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PARSER_COMPATIBLE_DIFF_FLAGS,
|
|
3
|
-
PARSER_COMPATIBLE_GIT_CONFIG,
|
|
4
|
-
generateUntrackedDiffs,
|
|
5
|
-
getRepoRootAsync,
|
|
6
|
-
getUntrackedFilesAsync,
|
|
7
|
-
isOutputLimitError,
|
|
8
|
-
runGitDiffAsync,
|
|
9
|
-
stripTrailingNewline,
|
|
10
|
-
withParserCompatibleDiffArgs
|
|
11
|
-
} from "./chunk-QHS36X6T.js";
|
|
12
|
-
import "./chunk-4YO2MI6B.js";
|
|
13
|
-
export {
|
|
14
|
-
PARSER_COMPATIBLE_DIFF_FLAGS,
|
|
15
|
-
PARSER_COMPATIBLE_GIT_CONFIG,
|
|
16
|
-
generateUntrackedDiffs,
|
|
17
|
-
getRepoRootAsync,
|
|
18
|
-
getUntrackedFilesAsync,
|
|
19
|
-
isOutputLimitError,
|
|
20
|
-
runGitDiffAsync,
|
|
21
|
-
stripTrailingNewline,
|
|
22
|
-
withParserCompatibleDiffArgs
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=git-N5HVNPKQ.js.map
|
|
File without changes
|
|
File without changes
|