@quikit/quikpilot-runner 9.2.0-rc.5 → 9.2.0-rc.6
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 +1 -1
- package/dist/index.js +166 -107
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ coverage check, protected paths). A test file that already existed may only be a
|
|
|
53
53
|
must stay, in the same order, and the only change is one block of whole new lines that declares a new test (`it`, `test` or
|
|
54
54
|
`describe`) or new `import` lines, placed before the matched text, after it or between two of its lines (JavaScript and
|
|
55
55
|
TypeScript files; other languages keep the older rule of new text before or after the match). Anything else is answered
|
|
56
|
-
`protected`, an ordinary result the AI reads and tries again from, so a test is never weakened to make code pass. Before its first turn the loop is shown the files the plan named for each target and the files each existing target imports
|
|
56
|
+
`protected`, an ordinary result the AI reads and tries again from, so a test is never weakened to make code pass. Before its first turn the loop is shown the files the plan named for each target, then the EXISTING TESTS of the code it will change (the test file beside each code target, and each existing test target itself, as LF text so an edit can match it), then the files each existing target imports
|
|
57
57
|
(one hop, JavaScript and TypeScript, the same scan and the same limits as the one-file-at-a-time path: 40,000 characters a file
|
|
58
58
|
and 60,000 in all, never a denied path, never the targets themselves), so the project's own names, values and rates are in front
|
|
59
59
|
of it instead of being guessed; the run's context record lists them like the one-file path's. The AI cannot finish before it has
|
package/dist/index.js
CHANGED
|
@@ -1220,12 +1220,148 @@ function buildCodegenLoopRecord(loop) {
|
|
|
1220
1220
|
|
|
1221
1221
|
// src/codegenLoopContext.ts
|
|
1222
1222
|
var import_node_fs2 = require("node:fs");
|
|
1223
|
+
|
|
1224
|
+
// src/overlapCheck.ts
|
|
1225
|
+
var TEST_PATH_RE = /(\.(test|spec)\.[jt]sx?$)|(^|\/)(__tests__|tests?)\//i;
|
|
1226
|
+
function isTestTarget(path) {
|
|
1227
|
+
return TEST_PATH_RE.test(path);
|
|
1228
|
+
}
|
|
1229
|
+
var STOPWORDS = /* @__PURE__ */ new Set([
|
|
1230
|
+
"a",
|
|
1231
|
+
"an",
|
|
1232
|
+
"the",
|
|
1233
|
+
"is",
|
|
1234
|
+
"are",
|
|
1235
|
+
"was",
|
|
1236
|
+
"were",
|
|
1237
|
+
"be",
|
|
1238
|
+
"been",
|
|
1239
|
+
"being",
|
|
1240
|
+
"of",
|
|
1241
|
+
"to",
|
|
1242
|
+
"in",
|
|
1243
|
+
"on",
|
|
1244
|
+
"for",
|
|
1245
|
+
"with",
|
|
1246
|
+
"at",
|
|
1247
|
+
"by",
|
|
1248
|
+
"from",
|
|
1249
|
+
"as",
|
|
1250
|
+
"and",
|
|
1251
|
+
"or",
|
|
1252
|
+
"not",
|
|
1253
|
+
"no",
|
|
1254
|
+
"nor",
|
|
1255
|
+
"this",
|
|
1256
|
+
"that",
|
|
1257
|
+
"these",
|
|
1258
|
+
"those",
|
|
1259
|
+
"it",
|
|
1260
|
+
"its",
|
|
1261
|
+
"cannot",
|
|
1262
|
+
"can't",
|
|
1263
|
+
"should",
|
|
1264
|
+
"must",
|
|
1265
|
+
"may",
|
|
1266
|
+
"will",
|
|
1267
|
+
"shall",
|
|
1268
|
+
"when",
|
|
1269
|
+
"if",
|
|
1270
|
+
"than",
|
|
1271
|
+
"then",
|
|
1272
|
+
"so",
|
|
1273
|
+
"do",
|
|
1274
|
+
"does",
|
|
1275
|
+
"did"
|
|
1276
|
+
]);
|
|
1277
|
+
var MIN_WORD_LENGTH = 3;
|
|
1278
|
+
function significantWords(step) {
|
|
1279
|
+
return new Set(
|
|
1280
|
+
step.toLowerCase().replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length >= MIN_WORD_LENGTH && !STOPWORDS.has(w))
|
|
1281
|
+
);
|
|
1282
|
+
}
|
|
1283
|
+
function jaccard(a, b) {
|
|
1284
|
+
if (a.size === 0 || b.size === 0) return 0;
|
|
1285
|
+
let intersection = 0;
|
|
1286
|
+
for (const w of a) if (b.has(w)) intersection++;
|
|
1287
|
+
const union = a.size + b.size - intersection;
|
|
1288
|
+
return intersection / union;
|
|
1289
|
+
}
|
|
1290
|
+
function normalizedStep(step) {
|
|
1291
|
+
return step.trim().toLowerCase().replace(/\s+/g, " ");
|
|
1292
|
+
}
|
|
1293
|
+
var OVERLAP_THRESHOLD = 0.5;
|
|
1294
|
+
function findOverlappingSteps(targets) {
|
|
1295
|
+
const items = targets.flatMap(
|
|
1296
|
+
(target) => target.planStepsImplemented.map((step) => ({
|
|
1297
|
+
target: target.path,
|
|
1298
|
+
step,
|
|
1299
|
+
words: significantWords(step)
|
|
1300
|
+
}))
|
|
1301
|
+
);
|
|
1302
|
+
const warnings = [];
|
|
1303
|
+
for (let i = 0; i < items.length; i++) {
|
|
1304
|
+
for (let j = i + 1; j < items.length; j++) {
|
|
1305
|
+
if (items[i].target === items[j].target) continue;
|
|
1306
|
+
if (isTestTarget(items[i].target) || isTestTarget(items[j].target)) continue;
|
|
1307
|
+
if (jaccard(items[i].words, items[j].words) >= OVERLAP_THRESHOLD) {
|
|
1308
|
+
warnings.push({
|
|
1309
|
+
targetA: items[i].target,
|
|
1310
|
+
stepA: items[i].step,
|
|
1311
|
+
targetB: items[j].target,
|
|
1312
|
+
stepB: items[j].step,
|
|
1313
|
+
severity: normalizedStep(items[i].step) === normalizedStep(items[j].step) ? "identical" : "similar"
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
return warnings;
|
|
1319
|
+
}
|
|
1320
|
+
function describeOverlapWarnings(warnings) {
|
|
1321
|
+
return warnings.map(
|
|
1322
|
+
(w) => `${w.targetA} and ${w.targetB} both implement what looks like the same rule \u2014 "${w.stepA}" / "${w.stepB}". Check these aren't two independent implementations of the same behavior.`
|
|
1323
|
+
);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
// src/codegenLoopContext.ts
|
|
1327
|
+
var TEST_NAME_RE = /^(.+)\.(?:test|spec)\.[cm]?[jt]sx?$/i;
|
|
1328
|
+
var CODE_NAME_RE = /^(.+)\.[cm]?[jt]sx?$/i;
|
|
1329
|
+
function dirOf(path) {
|
|
1330
|
+
const i = path.lastIndexOf("/");
|
|
1331
|
+
return i === -1 ? "" : path.slice(0, i);
|
|
1332
|
+
}
|
|
1333
|
+
function baseOf(path) {
|
|
1334
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
1335
|
+
}
|
|
1336
|
+
function parentOf(dir) {
|
|
1337
|
+
return dir === "" ? "" : dirOf(dir);
|
|
1338
|
+
}
|
|
1339
|
+
function pairedTestPaths(codePath, listing) {
|
|
1340
|
+
if (isTestTarget(codePath)) return [];
|
|
1341
|
+
const m = CODE_NAME_RE.exec(baseOf(codePath));
|
|
1342
|
+
if (!m) return [];
|
|
1343
|
+
const stem = m[1].toLowerCase();
|
|
1344
|
+
const dir = dirOf(codePath);
|
|
1345
|
+
const parent = parentOf(dir);
|
|
1346
|
+
const join6 = (d, leaf) => d === "" ? leaf : `${d}/${leaf}`;
|
|
1347
|
+
const homes = /* @__PURE__ */ new Set([dir, join6(dir, "__tests__"), join6(parent, "__tests__"), join6(parent, "tests"), join6(parent, "test")]);
|
|
1348
|
+
const found = [];
|
|
1349
|
+
for (const path of listing) {
|
|
1350
|
+
if (!homes.has(dirOf(path))) continue;
|
|
1351
|
+
const t = TEST_NAME_RE.exec(baseOf(path));
|
|
1352
|
+
if (t && t[1].toLowerCase() === stem) found.push(path);
|
|
1353
|
+
}
|
|
1354
|
+
return found.sort();
|
|
1355
|
+
}
|
|
1356
|
+
function asLf(text) {
|
|
1357
|
+
return toLf(text.charCodeAt(0) === 65279 ? text.slice(1) : text);
|
|
1358
|
+
}
|
|
1223
1359
|
function collectLoopContext(p) {
|
|
1224
1360
|
const readFile = p.readFile ?? ((path) => (0, import_node_fs2.readFileSync)(path, "utf8"));
|
|
1225
1361
|
const listing = new Set(p.listing);
|
|
1226
|
-
const
|
|
1227
|
-
const seen = new Set(targetPaths);
|
|
1362
|
+
const seen = new Set(p.targets.filter((t) => !(t.kind === "EXISTING" && isTestTarget(t.path))).map((t) => t.path));
|
|
1228
1363
|
const entries = [];
|
|
1364
|
+
const testPaths = [];
|
|
1229
1365
|
const records = [];
|
|
1230
1366
|
let total = 0;
|
|
1231
1367
|
for (const target of p.targets) {
|
|
@@ -1258,6 +1394,30 @@ function collectLoopContext(p) {
|
|
|
1258
1394
|
total += content.length;
|
|
1259
1395
|
}
|
|
1260
1396
|
}
|
|
1397
|
+
const wantedTests = target.kind !== "EXISTING" ? [] : isTestTarget(target.path) ? [target.path] : pairedTestPaths(target.path, listing);
|
|
1398
|
+
for (const path of wantedTests) {
|
|
1399
|
+
if (seen.has(path)) continue;
|
|
1400
|
+
seen.add(path);
|
|
1401
|
+
if (matchesDeniedPath(path, p.deniedPaths)) {
|
|
1402
|
+
skipped.push({ path, reason: "denied" });
|
|
1403
|
+
continue;
|
|
1404
|
+
}
|
|
1405
|
+
let content;
|
|
1406
|
+
try {
|
|
1407
|
+
content = asLf(readFile(path));
|
|
1408
|
+
} catch {
|
|
1409
|
+
skipped.push({ path, reason: "unreadable" });
|
|
1410
|
+
continue;
|
|
1411
|
+
}
|
|
1412
|
+
if (content.length > MAX_ADDED_FILE_CHARS) skipped.push({ path, reason: "too large" });
|
|
1413
|
+
else if (total + content.length > MAX_ADDED_CONTEXT_CHARS) skipped.push({ path, reason: "over budget" });
|
|
1414
|
+
else {
|
|
1415
|
+
entries.push({ path, content });
|
|
1416
|
+
added.push(path);
|
|
1417
|
+
testPaths.push(path);
|
|
1418
|
+
total += content.length;
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1261
1421
|
let importedPaths = [];
|
|
1262
1422
|
let aliasImports = 0;
|
|
1263
1423
|
if (target.kind === "EXISTING") {
|
|
@@ -1299,7 +1459,7 @@ function collectLoopContext(p) {
|
|
|
1299
1459
|
...aliasImports > 0 ? { aliasImports } : {}
|
|
1300
1460
|
});
|
|
1301
1461
|
}
|
|
1302
|
-
return { entries, records };
|
|
1462
|
+
return { entries, testPaths, records };
|
|
1303
1463
|
}
|
|
1304
1464
|
|
|
1305
1465
|
// src/addOnly.ts
|
|
@@ -2573,108 +2733,6 @@ async function runCodegenLoop(args, deps) {
|
|
|
2573
2733
|
}
|
|
2574
2734
|
}
|
|
2575
2735
|
|
|
2576
|
-
// src/overlapCheck.ts
|
|
2577
|
-
var TEST_PATH_RE = /(\.(test|spec)\.[jt]sx?$)|(^|\/)(__tests__|tests?)\//i;
|
|
2578
|
-
function isTestTarget(path) {
|
|
2579
|
-
return TEST_PATH_RE.test(path);
|
|
2580
|
-
}
|
|
2581
|
-
var STOPWORDS = /* @__PURE__ */ new Set([
|
|
2582
|
-
"a",
|
|
2583
|
-
"an",
|
|
2584
|
-
"the",
|
|
2585
|
-
"is",
|
|
2586
|
-
"are",
|
|
2587
|
-
"was",
|
|
2588
|
-
"were",
|
|
2589
|
-
"be",
|
|
2590
|
-
"been",
|
|
2591
|
-
"being",
|
|
2592
|
-
"of",
|
|
2593
|
-
"to",
|
|
2594
|
-
"in",
|
|
2595
|
-
"on",
|
|
2596
|
-
"for",
|
|
2597
|
-
"with",
|
|
2598
|
-
"at",
|
|
2599
|
-
"by",
|
|
2600
|
-
"from",
|
|
2601
|
-
"as",
|
|
2602
|
-
"and",
|
|
2603
|
-
"or",
|
|
2604
|
-
"not",
|
|
2605
|
-
"no",
|
|
2606
|
-
"nor",
|
|
2607
|
-
"this",
|
|
2608
|
-
"that",
|
|
2609
|
-
"these",
|
|
2610
|
-
"those",
|
|
2611
|
-
"it",
|
|
2612
|
-
"its",
|
|
2613
|
-
"cannot",
|
|
2614
|
-
"can't",
|
|
2615
|
-
"should",
|
|
2616
|
-
"must",
|
|
2617
|
-
"may",
|
|
2618
|
-
"will",
|
|
2619
|
-
"shall",
|
|
2620
|
-
"when",
|
|
2621
|
-
"if",
|
|
2622
|
-
"than",
|
|
2623
|
-
"then",
|
|
2624
|
-
"so",
|
|
2625
|
-
"do",
|
|
2626
|
-
"does",
|
|
2627
|
-
"did"
|
|
2628
|
-
]);
|
|
2629
|
-
var MIN_WORD_LENGTH = 3;
|
|
2630
|
-
function significantWords(step) {
|
|
2631
|
-
return new Set(
|
|
2632
|
-
step.toLowerCase().replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length >= MIN_WORD_LENGTH && !STOPWORDS.has(w))
|
|
2633
|
-
);
|
|
2634
|
-
}
|
|
2635
|
-
function jaccard(a, b) {
|
|
2636
|
-
if (a.size === 0 || b.size === 0) return 0;
|
|
2637
|
-
let intersection = 0;
|
|
2638
|
-
for (const w of a) if (b.has(w)) intersection++;
|
|
2639
|
-
const union = a.size + b.size - intersection;
|
|
2640
|
-
return intersection / union;
|
|
2641
|
-
}
|
|
2642
|
-
function normalizedStep(step) {
|
|
2643
|
-
return step.trim().toLowerCase().replace(/\s+/g, " ");
|
|
2644
|
-
}
|
|
2645
|
-
var OVERLAP_THRESHOLD = 0.5;
|
|
2646
|
-
function findOverlappingSteps(targets) {
|
|
2647
|
-
const items = targets.flatMap(
|
|
2648
|
-
(target) => target.planStepsImplemented.map((step) => ({
|
|
2649
|
-
target: target.path,
|
|
2650
|
-
step,
|
|
2651
|
-
words: significantWords(step)
|
|
2652
|
-
}))
|
|
2653
|
-
);
|
|
2654
|
-
const warnings = [];
|
|
2655
|
-
for (let i = 0; i < items.length; i++) {
|
|
2656
|
-
for (let j = i + 1; j < items.length; j++) {
|
|
2657
|
-
if (items[i].target === items[j].target) continue;
|
|
2658
|
-
if (isTestTarget(items[i].target) || isTestTarget(items[j].target)) continue;
|
|
2659
|
-
if (jaccard(items[i].words, items[j].words) >= OVERLAP_THRESHOLD) {
|
|
2660
|
-
warnings.push({
|
|
2661
|
-
targetA: items[i].target,
|
|
2662
|
-
stepA: items[i].step,
|
|
2663
|
-
targetB: items[j].target,
|
|
2664
|
-
stepB: items[j].step,
|
|
2665
|
-
severity: normalizedStep(items[i].step) === normalizedStep(items[j].step) ? "identical" : "similar"
|
|
2666
|
-
});
|
|
2667
|
-
}
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
|
-
return warnings;
|
|
2671
|
-
}
|
|
2672
|
-
function describeOverlapWarnings(warnings) {
|
|
2673
|
-
return warnings.map(
|
|
2674
|
-
(w) => `${w.targetA} and ${w.targetB} both implement what looks like the same rule \u2014 "${w.stepA}" / "${w.stepB}". Check these aren't two independent implementations of the same behavior.`
|
|
2675
|
-
);
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
2736
|
// src/codegenStep.ts
|
|
2679
2737
|
var MAX_PROTECTED_PATHS_ON_WIRE = 300;
|
|
2680
2738
|
async function postCodegenTurn(gateway, contextData, signal) {
|
|
@@ -2764,7 +2822,8 @@ async function runCodegenStep(p) {
|
|
|
2764
2822
|
event: "codegen.loop_context",
|
|
2765
2823
|
files: context.entries.length,
|
|
2766
2824
|
chars: context.entries.reduce((n, e) => n + e.content.length, 0),
|
|
2767
|
-
paths: context.entries.map((e) => e.path)
|
|
2825
|
+
paths: context.entries.map((e) => e.path),
|
|
2826
|
+
existingTests: context.testPaths
|
|
2768
2827
|
})
|
|
2769
2828
|
);
|
|
2770
2829
|
try {
|
|
@@ -3548,7 +3607,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
3548
3607
|
var REPORT_COPY = "final-test-report.xml";
|
|
3549
3608
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
3550
3609
|
var MAX_FILES = 200;
|
|
3551
|
-
var RUNNER_VERSION = true ? "9.2.0-rc.
|
|
3610
|
+
var RUNNER_VERSION = true ? "9.2.0-rc.6" : "dev";
|
|
3552
3611
|
function safeDestination(base, repoPath) {
|
|
3553
3612
|
if (!repoPath || (0, import_node_path9.isAbsolute)(repoPath)) return null;
|
|
3554
3613
|
const destination = (0, import_node_path9.resolve)(base, repoPath);
|