@self-review/core 1.45.0 → 2.0.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.
@@ -0,0 +1,269 @@
1
+ // src/diff-parser.ts
2
+ function parseDiff(rawDiff) {
3
+ return parseDiffWithDiagnostics(rawDiff).files;
4
+ }
5
+ function parseDiffWithDiagnostics(rawDiff) {
6
+ const diagnostics = [];
7
+ if (!rawDiff.trim()) {
8
+ return { files: [], diagnostics };
9
+ }
10
+ const lines = rawDiff.split("\n");
11
+ if (lines.length > 0 && lines[lines.length - 1] === "") {
12
+ lines.pop();
13
+ }
14
+ const files = [];
15
+ let currentFile = null;
16
+ let currentHunk = null;
17
+ let oldLineNumber = 0;
18
+ let newLineNumber = 0;
19
+ let remainingOld = 0;
20
+ let remainingNew = 0;
21
+ let hasModeChange = false;
22
+ let skippingSection = false;
23
+ function fileLabel() {
24
+ return currentFile?.newPath || currentFile?.oldPath || "<unknown file>";
25
+ }
26
+ function flushHunk() {
27
+ if (currentHunk && currentHunk.header && currentFile) {
28
+ if (remainingOld > 0 || remainingNew > 0) {
29
+ diagnostics.push(
30
+ `${fileLabel()}: hunk ${currentHunk.header} ended ${remainingOld} old and ${remainingNew} new lines short of its declared counts`
31
+ );
32
+ }
33
+ currentFile.hunks.push(currentHunk);
34
+ }
35
+ currentHunk = null;
36
+ remainingOld = 0;
37
+ remainingNew = 0;
38
+ }
39
+ function flushFile() {
40
+ flushHunk();
41
+ if (currentFile && (currentFile.oldPath || currentFile.newPath) && (currentFile.isBinary || currentFile.hunks.length > 0 || currentFile.changeType !== "modified" || hasModeChange)) {
42
+ files.push(currentFile);
43
+ }
44
+ currentFile = null;
45
+ hasModeChange = false;
46
+ skippingSection = false;
47
+ }
48
+ for (let i = 0; i < lines.length; i++) {
49
+ const line = lines[i];
50
+ if (line.startsWith("diff --git ")) {
51
+ flushFile();
52
+ const gitPaths = parseGitDiffHeader(line);
53
+ currentFile = {
54
+ oldPath: gitPaths.oldPath,
55
+ newPath: gitPaths.newPath,
56
+ changeType: "modified",
57
+ isBinary: false,
58
+ hunks: []
59
+ };
60
+ continue;
61
+ }
62
+ const combined = line.match(/^diff --(?:cc|combined) (.*)$/);
63
+ if (combined) {
64
+ flushFile();
65
+ const path = stripPrefix(decodeGitPath(combined[1]));
66
+ diagnostics.push(`${path}: combined (merge conflict) diff output is not supported`);
67
+ skippingSection = true;
68
+ continue;
69
+ }
70
+ if (skippingSection || !currentFile) continue;
71
+ if (line.startsWith("new file mode")) {
72
+ currentFile.changeType = "added";
73
+ currentFile.oldPath = "";
74
+ continue;
75
+ }
76
+ if (line.startsWith("deleted file mode")) {
77
+ currentFile.changeType = "deleted";
78
+ currentFile.newPath = "";
79
+ continue;
80
+ }
81
+ if (line.startsWith("new mode ")) {
82
+ hasModeChange = true;
83
+ continue;
84
+ }
85
+ if (line.startsWith("rename from ")) {
86
+ currentFile.changeType = "renamed";
87
+ currentFile.oldPath = decodeGitPath(line.substring("rename from ".length));
88
+ continue;
89
+ }
90
+ if (line.startsWith("rename to ")) {
91
+ currentFile.newPath = decodeGitPath(line.substring("rename to ".length));
92
+ continue;
93
+ }
94
+ if (line.startsWith("copy from ")) {
95
+ currentFile.changeType = "copied";
96
+ currentFile.oldPath = decodeGitPath(line.substring("copy from ".length));
97
+ continue;
98
+ }
99
+ if (line.startsWith("copy to ")) {
100
+ currentFile.newPath = decodeGitPath(line.substring("copy to ".length));
101
+ continue;
102
+ }
103
+ if (!currentHunk && line.startsWith("--- ")) {
104
+ const path = decodeGitPath(line.substring(4).split(" ")[0]);
105
+ currentFile.oldPath = path === "/dev/null" ? "" : stripPrefix(path);
106
+ continue;
107
+ }
108
+ if (!currentHunk && line.startsWith("+++ ")) {
109
+ const path = decodeGitPath(line.substring(4).split(" ")[0]);
110
+ currentFile.newPath = path === "/dev/null" ? "" : stripPrefix(path);
111
+ continue;
112
+ }
113
+ if (line.startsWith("Binary files ")) {
114
+ currentFile.isBinary = true;
115
+ continue;
116
+ }
117
+ if (line === "GIT binary patch") {
118
+ currentFile.isBinary = true;
119
+ skippingSection = true;
120
+ continue;
121
+ }
122
+ if (line.startsWith("@@")) {
123
+ flushHunk();
124
+ const match = line.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/);
125
+ if (!match) {
126
+ diagnostics.push(`${fileLabel()}: unrecognized hunk header "${line}"`);
127
+ continue;
128
+ }
129
+ const oldStart = parseInt(match[1], 10);
130
+ const oldLines = match[2] ? parseInt(match[2], 10) : 1;
131
+ const newStart = parseInt(match[3], 10);
132
+ const newLines = match[4] ? parseInt(match[4], 10) : 1;
133
+ currentHunk = {
134
+ header: line,
135
+ oldStart,
136
+ oldLines,
137
+ newStart,
138
+ newLines,
139
+ lines: []
140
+ };
141
+ oldLineNumber = oldStart;
142
+ newLineNumber = newStart;
143
+ remainingOld = oldLines;
144
+ remainingNew = newLines;
145
+ continue;
146
+ }
147
+ if (!currentHunk || !currentHunk.lines) continue;
148
+ if (line.startsWith("\\")) {
149
+ continue;
150
+ }
151
+ const marker = line.length === 0 ? " " : line[0];
152
+ const content = line.length === 0 ? "" : line.substring(1);
153
+ if (marker === "+") {
154
+ if (remainingNew <= 0) {
155
+ diagnostics.push(
156
+ `${fileLabel()}: line beyond the counts of hunk ${currentHunk.header}: "${line}"`
157
+ );
158
+ continue;
159
+ }
160
+ currentHunk.lines.push({
161
+ type: "addition",
162
+ oldLineNumber: null,
163
+ newLineNumber,
164
+ content
165
+ });
166
+ newLineNumber++;
167
+ remainingNew--;
168
+ } else if (marker === "-") {
169
+ if (remainingOld <= 0) {
170
+ diagnostics.push(
171
+ `${fileLabel()}: line beyond the counts of hunk ${currentHunk.header}: "${line}"`
172
+ );
173
+ continue;
174
+ }
175
+ currentHunk.lines.push({
176
+ type: "deletion",
177
+ oldLineNumber,
178
+ newLineNumber: null,
179
+ content
180
+ });
181
+ oldLineNumber++;
182
+ remainingOld--;
183
+ } else if (marker === " ") {
184
+ if (remainingOld <= 0 || remainingNew <= 0) {
185
+ diagnostics.push(
186
+ `${fileLabel()}: line beyond the counts of hunk ${currentHunk.header}: "${line}"`
187
+ );
188
+ continue;
189
+ }
190
+ currentHunk.lines.push({
191
+ type: "context",
192
+ oldLineNumber,
193
+ newLineNumber,
194
+ content
195
+ });
196
+ oldLineNumber++;
197
+ newLineNumber++;
198
+ remainingOld--;
199
+ remainingNew--;
200
+ } else {
201
+ diagnostics.push(
202
+ `${fileLabel()}: unrecognized line inside hunk ${currentHunk.header}: "${line}"`
203
+ );
204
+ }
205
+ }
206
+ flushFile();
207
+ return { files, diagnostics };
208
+ }
209
+ function stripPrefix(path) {
210
+ if (path.length > 2 && path[1] === "/") {
211
+ return path.substring(2);
212
+ }
213
+ return path;
214
+ }
215
+ var OCTAL_PATH_DECODER = new TextDecoder("utf-8");
216
+ function decodeGitPath(path) {
217
+ if (!path.startsWith('"') || !path.endsWith('"')) return path;
218
+ const escapes = {
219
+ a: "\x07",
220
+ b: "\b",
221
+ f: "\f",
222
+ n: "\n",
223
+ r: "\r",
224
+ t: " ",
225
+ v: "\v",
226
+ '"': '"',
227
+ "\\": "\\"
228
+ };
229
+ return path.slice(1, -1).replace(/(?:\\[0-7]{1,3})+|\\[abfnrtv"\\]/g, (escape) => {
230
+ if (/^\\[0-7]/.test(escape)) {
231
+ const bytes = escape.slice(1).split("\\").map((byte) => parseInt(byte, 8));
232
+ return OCTAL_PATH_DECODER.decode(Uint8Array.from(bytes));
233
+ }
234
+ return escapes[escape[1]];
235
+ });
236
+ }
237
+ function parseGitDiffHeader(line) {
238
+ const paths = line.substring("diff --git ".length);
239
+ const quotedOld = paths.match(/^("(?:\\.|[^"\\])*") (.+)$/);
240
+ const quotedNew = paths.match(/^(.+) ("(?:\\.|[^"\\])*")$/);
241
+ const quoted = quotedOld || quotedNew;
242
+ if (quoted) {
243
+ return {
244
+ oldPath: stripPrefix(decodeGitPath(quoted[1])),
245
+ newPath: stripPrefix(decodeGitPath(quoted[2]))
246
+ };
247
+ }
248
+ const separators = [...paths.matchAll(/ [bwico]\//g)];
249
+ const boundary = separators.find(
250
+ (match) => stripPrefix(paths.substring(0, match.index)) === stripPrefix(paths.substring(match.index + 1))
251
+ ) || separators[0];
252
+ if (!boundary) {
253
+ const bare = paths.split(" ");
254
+ if (bare.length === 2 && bare[0] === bare[1]) {
255
+ return { oldPath: bare[0], newPath: bare[1] };
256
+ }
257
+ return { oldPath: "", newPath: "" };
258
+ }
259
+ return {
260
+ oldPath: stripPrefix(paths.substring(0, boundary.index)),
261
+ newPath: stripPrefix(paths.substring(boundary.index + 1))
262
+ };
263
+ }
264
+
265
+ export {
266
+ parseDiff,
267
+ parseDiffWithDiagnostics
268
+ };
269
+ //# sourceMappingURL=chunk-4YO2MI6B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/diff-parser.ts"],"sourcesContent":["// packages/core/src/diff-parser.ts\n// Parse unified diff output into DiffFile[]\n\nimport { DiffFile, DiffHunk, ChangeType } from './types';\n\n/**\n * The files parsed, plus one diagnostic per piece of input that could not be represented\n * faithfully.\n */\nexport interface DiffParseResult {\n files: DiffFile[];\n diagnostics: string[];\n}\n\n/** Parse a unified diff, discarding diagnostics. Prefer {@link parseDiffWithDiagnostics}. */\nexport function parseDiff(rawDiff: string): DiffFile[] {\n return parseDiffWithDiagnostics(rawDiff).files;\n}\n\n/**\n * Parse `git diff` output (a/ b/ prefixes, no color). Every hunk is checked\n * against its `@@` counts; a line over them, a short hunk or an unprefixed line\n * is a diagnostic, never context. Empty lines in an open hunk are the one\n * leniency (`git apply` reads them as empty context). Combined output\n * (`diff --cc`) is reported and skipped.\n */\nexport function parseDiffWithDiagnostics(rawDiff: string): DiffParseResult {\n const diagnostics: string[] = [];\n if (!rawDiff.trim()) {\n return { files: [], diagnostics };\n }\n\n const lines = rawDiff.split('\\n');\n // The empty element after git's final newline is not a line of the last hunk.\n if (lines.length > 0 && lines[lines.length - 1] === '') {\n lines.pop();\n }\n\n const files: DiffFile[] = [];\n let currentFile: Partial<DiffFile> | null = null;\n let currentHunk: Partial<DiffHunk> | null = null;\n let oldLineNumber = 0;\n let newLineNumber = 0;\n let remainingOld = 0;\n let remainingNew = 0;\n let hasModeChange = false;\n // Inside a binary patch body or an unsupported combined section.\n let skippingSection = false;\n\n function fileLabel(): string {\n return currentFile?.newPath || currentFile?.oldPath || '<unknown file>';\n }\n\n function flushHunk(): void {\n if (currentHunk && currentHunk.header && currentFile) {\n if (remainingOld > 0 || remainingNew > 0) {\n diagnostics.push(\n `${fileLabel()}: hunk ${currentHunk.header} ended ${remainingOld} old and ` +\n `${remainingNew} new lines short of its declared counts`\n );\n }\n currentFile.hunks!.push(currentHunk as DiffHunk);\n }\n currentHunk = null;\n remainingOld = 0;\n remainingNew = 0;\n }\n\n function flushFile(): void {\n flushHunk();\n if (\n currentFile &&\n (currentFile.oldPath || currentFile.newPath) &&\n (currentFile.isBinary ||\n currentFile.hunks!.length > 0 ||\n currentFile.changeType !== 'modified' ||\n hasModeChange)\n ) {\n files.push(currentFile as DiffFile);\n }\n currentFile = null;\n hasModeChange = false;\n skippingSection = false;\n }\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n // Start of a new file\n if (line.startsWith('diff --git ')) {\n flushFile();\n\n // Extract paths from \"diff --git a/<old> b/<new>\" as fallback\n // for binary files that lack --- / +++ lines\n const gitPaths = parseGitDiffHeader(line);\n\n currentFile = {\n oldPath: gitPaths.oldPath,\n newPath: gitPaths.newPath,\n changeType: 'modified' as ChangeType,\n isBinary: false,\n hunks: [],\n };\n continue;\n }\n\n // Two parents against one result: no DiffFile can carry it.\n const combined = line.match(/^diff --(?:cc|combined) (.*)$/);\n if (combined) {\n flushFile();\n const path = stripPrefix(decodeGitPath(combined[1]));\n diagnostics.push(`${path}: combined (merge conflict) diff output is not supported`);\n skippingSection = true;\n continue;\n }\n\n if (skippingSection || !currentFile) continue;\n\n // Detect file mode changes\n if (line.startsWith('new file mode')) {\n currentFile.changeType = 'added';\n currentFile.oldPath = '';\n continue;\n }\n\n if (line.startsWith('deleted file mode')) {\n currentFile.changeType = 'deleted';\n currentFile.newPath = '';\n continue;\n }\n\n if (line.startsWith('new mode ')) {\n hasModeChange = true;\n continue;\n }\n\n if (line.startsWith('rename from ')) {\n currentFile.changeType = 'renamed';\n currentFile.oldPath = decodeGitPath(line.substring('rename from '.length));\n continue;\n }\n\n if (line.startsWith('rename to ')) {\n currentFile.newPath = decodeGitPath(line.substring('rename to '.length));\n continue;\n }\n\n if (line.startsWith('copy from ')) {\n currentFile.changeType = 'copied';\n currentFile.oldPath = decodeGitPath(line.substring('copy from '.length));\n continue;\n }\n\n if (line.startsWith('copy to ')) {\n currentFile.newPath = decodeGitPath(line.substring('copy to '.length));\n continue;\n }\n\n // Parse old file path\n if (!currentHunk && line.startsWith('--- ')) {\n const path = decodeGitPath(line.substring(4).split('\\t')[0]);\n currentFile.oldPath = path === '/dev/null' ? '' : stripPrefix(path);\n continue;\n }\n\n // Parse new file path\n if (!currentHunk && line.startsWith('+++ ')) {\n const path = decodeGitPath(line.substring(4).split('\\t')[0]);\n currentFile.newPath = path === '/dev/null' ? '' : stripPrefix(path);\n continue;\n }\n\n // Detect binary files\n if (line.startsWith('Binary files ')) {\n currentFile.isBinary = true;\n continue;\n }\n\n // `--binary` emits a base85 body after this marker; skip it.\n if (line === 'GIT binary patch') {\n currentFile.isBinary = true;\n skippingSection = true;\n continue;\n }\n\n // Parse hunk header\n if (line.startsWith('@@')) {\n flushHunk();\n\n // Parse hunk header: @@ -oldStart,oldLines +newStart,newLines @@ context\n const match = line.match(/^@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@(.*)$/);\n if (!match) {\n diagnostics.push(`${fileLabel()}: unrecognized hunk header \"${line}\"`);\n continue;\n }\n const oldStart = parseInt(match[1], 10);\n const oldLines = match[2] ? parseInt(match[2], 10) : 1;\n const newStart = parseInt(match[3], 10);\n const newLines = match[4] ? parseInt(match[4], 10) : 1;\n\n currentHunk = {\n header: line,\n oldStart,\n oldLines,\n newStart,\n newLines,\n lines: [],\n };\n\n oldLineNumber = oldStart;\n newLineNumber = newStart;\n remainingOld = oldLines;\n remainingNew = newLines;\n continue;\n }\n\n // Before the first hunk: file metadata.\n if (!currentHunk || !currentHunk.lines) continue;\n\n if (line.startsWith('\\\\')) {\n continue;\n }\n\n const marker = line.length === 0 ? ' ' : line[0];\n const content = line.length === 0 ? '' : line.substring(1);\n\n if (marker === '+') {\n if (remainingNew <= 0) {\n diagnostics.push(\n `${fileLabel()}: line beyond the counts of hunk ${currentHunk.header}: \"${line}\"`\n );\n continue;\n }\n currentHunk.lines.push({\n type: 'addition',\n oldLineNumber: null,\n newLineNumber: newLineNumber,\n content,\n });\n newLineNumber++;\n remainingNew--;\n } else if (marker === '-') {\n if (remainingOld <= 0) {\n diagnostics.push(\n `${fileLabel()}: line beyond the counts of hunk ${currentHunk.header}: \"${line}\"`\n );\n continue;\n }\n currentHunk.lines.push({\n type: 'deletion',\n oldLineNumber: oldLineNumber,\n newLineNumber: null,\n content,\n });\n oldLineNumber++;\n remainingOld--;\n } else if (marker === ' ') {\n if (remainingOld <= 0 || remainingNew <= 0) {\n diagnostics.push(\n `${fileLabel()}: line beyond the counts of hunk ${currentHunk.header}: \"${line}\"`\n );\n continue;\n }\n currentHunk.lines.push({\n type: 'context',\n oldLineNumber: oldLineNumber,\n newLineNumber: newLineNumber,\n content,\n });\n oldLineNumber++;\n newLineNumber++;\n remainingOld--;\n remainingNew--;\n } else {\n diagnostics.push(\n `${fileLabel()}: unrecognized line inside hunk ${currentHunk.header}: \"${line}\"`\n );\n }\n }\n\n // Save the last hunk and file\n flushFile();\n\n return { files, diagnostics };\n}\n\nfunction stripPrefix(path: string): string {\n // Remove single-character prefix (a/, b/, c/, i/, w/, etc.)\n // Git uses a/b by default, but mnemonicPrefix uses c/i/w/o\n if (path.length > 2 && path[1] === '/') {\n return path.substring(2);\n }\n return path;\n}\n\n// `TextDecoder`, not `Buffer`: this parser also runs in the browser (browser.ts).\nconst OCTAL_PATH_DECODER = new TextDecoder('utf-8');\n\nfunction decodeGitPath(path: string): string {\n if (!path.startsWith('\"') || !path.endsWith('\"')) return path;\n\n const escapes: Record<string, string> = {\n a: '\\x07',\n b: '\\b',\n f: '\\f',\n n: '\\n',\n r: '\\r',\n t: '\\t',\n v: '\\v',\n '\"': '\"',\n '\\\\': '\\\\',\n };\n return path.slice(1, -1).replace(/(?:\\\\[0-7]{1,3})+|\\\\[abfnrtv\"\\\\]/g, escape => {\n if (/^\\\\[0-7]/.test(escape)) {\n // Git quotes UTF-8 bytes as octal, so decode each run together.\n const bytes = escape\n .slice(1)\n .split('\\\\')\n .map(byte => parseInt(byte, 8));\n return OCTAL_PATH_DECODER.decode(Uint8Array.from(bytes));\n }\n return escapes[escape[1]];\n });\n}\n\nfunction parseGitDiffHeader(line: string): {\n oldPath: string;\n newPath: string;\n} {\n const paths = line.substring('diff --git '.length);\n // Quoted paths are single C-style tokens, even when they contain spaces.\n const quotedOld = paths.match(/^(\"(?:\\\\.|[^\"\\\\])*\") (.+)$/);\n const quotedNew = paths.match(/^(.+) (\"(?:\\\\.|[^\"\\\\])*\")$/);\n const quoted = quotedOld || quotedNew;\n if (quoted) {\n return {\n oldPath: stripPrefix(decodeGitPath(quoted[1])),\n newPath: stripPrefix(decodeGitPath(quoted[2])),\n };\n }\n\n // Unquoted names can contain spaces. Prefer a boundary whose two paths\n // agree; rename headers supply the exact paths when they differ.\n const separators = [...paths.matchAll(/ [bwico]\\//g)];\n const boundary =\n separators.find(\n match =>\n stripPrefix(paths.substring(0, match.index)) ===\n stripPrefix(paths.substring(match.index! + 1))\n ) || separators[0];\n if (!boundary) {\n // diff.noprefix: unambiguous only as two bare tokens naming the same path.\n const bare = paths.split(' ');\n if (bare.length === 2 && bare[0] === bare[1]) {\n return { oldPath: bare[0], newPath: bare[1] };\n }\n return { oldPath: '', newPath: '' };\n }\n\n return {\n oldPath: stripPrefix(paths.substring(0,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