codiedev 0.7.1 → 0.7.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/dist/commands/reverseTicket.js +28 -1
- package/dist/mcp.js +34 -2
- package/package.json +1 -1
|
@@ -215,15 +215,41 @@ async function runBranchMode(opts) {
|
|
|
215
215
|
console.error(`No commits on ${branch} ahead of ${baseRef} — make a commit first.`);
|
|
216
216
|
process.exit(1);
|
|
217
217
|
}
|
|
218
|
+
// Filter generated/lockfile noise from the diff body. The --stat (collected
|
|
219
|
+
// separately) still includes every file untouched, so excluded files still
|
|
220
|
+
// surface in the ticket's "Other files touched" section.
|
|
221
|
+
const isNoise = (p) => /(^|\/)(node_modules|dist|build|\.next|\.turbo|coverage|out)\//.test(p) ||
|
|
222
|
+
/(^|\/)package-lock\.json$/.test(p) ||
|
|
223
|
+
/(^|\/)yarn\.lock$/.test(p) ||
|
|
224
|
+
/(^|\/)pnpm-lock\.yaml$/.test(p) ||
|
|
225
|
+
/(^|\/)bun\.lock(b)?$/.test(p) ||
|
|
226
|
+
/(^|\/)Cargo\.lock$/.test(p) ||
|
|
227
|
+
/(^|\/)Gemfile\.lock$/.test(p) ||
|
|
228
|
+
/(^|\/)poetry\.lock$/.test(p) ||
|
|
229
|
+
/(^|\/)go\.sum$/.test(p);
|
|
218
230
|
const filesRaw = git(`diff --name-only ${baseSha}...HEAD`);
|
|
219
231
|
const filesChanged = filesRaw ? filesRaw.split("\n").filter(Boolean) : [];
|
|
220
232
|
if (filesChanged.length === 0) {
|
|
221
233
|
console.error(`No files changed between ${baseRef} and ${branch} — nothing to write up.`);
|
|
222
234
|
process.exit(1);
|
|
223
235
|
}
|
|
236
|
+
let stat = "";
|
|
237
|
+
try {
|
|
238
|
+
stat = git(`diff --stat=200 ${baseSha}...HEAD`).slice(0, 8_000);
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
// best effort
|
|
242
|
+
}
|
|
224
243
|
let diff = "";
|
|
225
244
|
try {
|
|
226
|
-
|
|
245
|
+
const sourceFiles = filesChanged.filter((f) => !isNoise(f));
|
|
246
|
+
if (sourceFiles.length > 0) {
|
|
247
|
+
const pathspecArgs = sourceFiles.map((f) => `'${f.replace(/'/g, "'\\''")}'`).join(" ");
|
|
248
|
+
diff = git(`diff ${baseSha}...HEAD -- ${pathspecArgs}`).slice(0, 40_000);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
diff = git(`diff ${baseSha}...HEAD`).slice(0, 40_000);
|
|
252
|
+
}
|
|
227
253
|
}
|
|
228
254
|
catch {
|
|
229
255
|
// best effort
|
|
@@ -266,6 +292,7 @@ async function runBranchMode(opts) {
|
|
|
266
292
|
authorEmail,
|
|
267
293
|
filesChanged,
|
|
268
294
|
diff: diff || undefined,
|
|
295
|
+
stat: stat || undefined,
|
|
269
296
|
},
|
|
270
297
|
forcedArtifactKey: opts.forcedKey,
|
|
271
298
|
},
|
package/dist/mcp.js
CHANGED
|
@@ -1089,15 +1089,46 @@ async function handleReverseTicket(args, config) {
|
|
|
1089
1089
|
if (baseSha === headSha) {
|
|
1090
1090
|
throw new Error(`No commits on ${branch} ahead of ${baseRef} — make a commit first.`);
|
|
1091
1091
|
}
|
|
1092
|
+
// Filter generated/lockfile noise so the LLM's diff budget gets spent on
|
|
1093
|
+
// real source. The --stat block (collected separately below) still includes
|
|
1094
|
+
// every file untouched, so excluded files still appear in the ticket's
|
|
1095
|
+
// "Other files touched" section if relevant.
|
|
1096
|
+
const isNoise = (p) => /(^|\/)(node_modules|dist|build|\.next|\.turbo|coverage|out)\//.test(p) ||
|
|
1097
|
+
/(^|\/)package-lock\.json$/.test(p) ||
|
|
1098
|
+
/(^|\/)yarn\.lock$/.test(p) ||
|
|
1099
|
+
/(^|\/)pnpm-lock\.yaml$/.test(p) ||
|
|
1100
|
+
/(^|\/)bun\.lock(b)?$/.test(p) ||
|
|
1101
|
+
/(^|\/)Cargo\.lock$/.test(p) ||
|
|
1102
|
+
/(^|\/)Gemfile\.lock$/.test(p) ||
|
|
1103
|
+
/(^|\/)poetry\.lock$/.test(p) ||
|
|
1104
|
+
/(^|\/)go\.sum$/.test(p);
|
|
1092
1105
|
const filesRaw = git(`diff --name-only ${baseSha}...HEAD`);
|
|
1093
1106
|
const filesChanged = filesRaw ? filesRaw.split("\n").filter(Boolean) : [];
|
|
1094
1107
|
if (filesChanged.length === 0) {
|
|
1095
1108
|
throw new Error(`No files changed between ${baseRef} and ${branch} — nothing to write up.`);
|
|
1096
1109
|
}
|
|
1097
|
-
//
|
|
1110
|
+
// Always capture --stat — compact (path + line counts), fits even for huge
|
|
1111
|
+
// PRs, and serves as the writer's ground truth for "every file touched"
|
|
1112
|
+
// when the diff body below is truncated.
|
|
1113
|
+
let stat = "";
|
|
1114
|
+
try {
|
|
1115
|
+
stat = git(`diff --stat=200 ${baseSha}...HEAD`).slice(0, 8_000);
|
|
1116
|
+
}
|
|
1117
|
+
catch {
|
|
1118
|
+
// Best effort.
|
|
1119
|
+
}
|
|
1120
|
+
// Diff body: 40k cap, noise-filtered via pathspec exclusions so lockfiles
|
|
1121
|
+
// and generated dirs don't eat the budget.
|
|
1098
1122
|
let diff = "";
|
|
1099
1123
|
try {
|
|
1100
|
-
|
|
1124
|
+
const sourceFiles = filesChanged.filter((f) => !isNoise(f));
|
|
1125
|
+
if (sourceFiles.length > 0) {
|
|
1126
|
+
const pathspecArgs = sourceFiles.map((f) => `'${f.replace(/'/g, "'\\''")}'`).join(" ");
|
|
1127
|
+
diff = git(`diff ${baseSha}...HEAD -- ${pathspecArgs}`).slice(0, 40_000);
|
|
1128
|
+
}
|
|
1129
|
+
else {
|
|
1130
|
+
diff = git(`diff ${baseSha}...HEAD`).slice(0, 40_000);
|
|
1131
|
+
}
|
|
1101
1132
|
}
|
|
1102
1133
|
catch {
|
|
1103
1134
|
// Best effort.
|
|
@@ -1132,6 +1163,7 @@ async function handleReverseTicket(args, config) {
|
|
|
1132
1163
|
authorEmail,
|
|
1133
1164
|
filesChanged,
|
|
1134
1165
|
diff: diff || undefined,
|
|
1166
|
+
stat: stat || undefined,
|
|
1135
1167
|
},
|
|
1136
1168
|
forcedArtifactKey: forcedKey,
|
|
1137
1169
|
},
|
package/package.json
CHANGED