@quikit/quikpilot-runner 9.2.0-rc.3 → 9.2.0-rc.4
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 +8 -4
- package/dist/index.js +82 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,12 +49,16 @@ over several short turns the AI may use five tools, the three read-only ones abo
|
|
|
49
49
|
text in an existing file; the text must match exactly one place) and `write_file` (create a new file). Every change is held in
|
|
50
50
|
memory and nothing is written to the checkout until the AI says it is finished, and then the result goes through exactly the
|
|
51
51
|
checks a one-file-at-a-time run goes through (scope, overlap, test placement, format, lint, the regression gate, the
|
|
52
|
-
coverage check, protected paths). A test file that already existed may only be added to:
|
|
53
|
-
|
|
52
|
+
coverage check, protected paths). A test file that already existed may only be added to: every character of the matched text
|
|
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
|
+
`describe`) or new `import` lines, placed before the matched text, after it or between two of its lines (JavaScript and
|
|
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. The AI cannot finish before it has
|
|
54
57
|
changed something and written a test for every case it was given. If the loop cannot finish for an ordinary reason (an
|
|
55
58
|
older runtime, a timeout, a refused edit it cannot recover from, a cut-short file) everything it held is thrown away and the
|
|
56
|
-
files are written one at a time, and the run's warnings say so
|
|
57
|
-
retried
|
|
59
|
+
files are written one at a time, and the run's warnings say so. A budget or credential refusal from the AI Runtime is never
|
|
60
|
+
retried (the one-at-a-time attempt would be refused again or paid for twice). A protected path is refused to the AI as an
|
|
61
|
+
ordinary answer, never read, listed or written, and the run carries on. Limits are told to the AI as ordinary answers: 20 turns, 40 actions, 60,000 characters read, 120,000 written, and the
|
|
58
62
|
same 90,000-token ceiling per turn. The callback gains an optional `codegenLoop` record (paths, counts, statuses and the AI's
|
|
59
63
|
short note per step; never file text) that QuikProjects shows as "What QuikPilot did". Without the variable nothing
|
|
60
64
|
changes. The workflow file is unchanged; the `env:` line is the only edit, and it is optional. The AI Runtime must have
|
package/dist/index.js
CHANGED
|
@@ -1218,6 +1218,79 @@ function buildCodegenLoopRecord(loop) {
|
|
|
1218
1218
|
};
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
|
+
// src/addOnly.ts
|
|
1222
|
+
var JS_FAMILY = /\.(?:[cm]?[jt]sx?)$/i;
|
|
1223
|
+
var DECLARES_TEST = /^[ \t]*(?:it|test|describe)\b/m;
|
|
1224
|
+
var IMPORT_LINE = /^\s*import\b/;
|
|
1225
|
+
function usesLooseRule(path) {
|
|
1226
|
+
return JS_FAMILY.test(path);
|
|
1227
|
+
}
|
|
1228
|
+
function bracketsBalance(text) {
|
|
1229
|
+
const stack = [];
|
|
1230
|
+
const pairs = { ")": "(", "]": "[", "}": "{" };
|
|
1231
|
+
let i = 0;
|
|
1232
|
+
while (i < text.length) {
|
|
1233
|
+
const c = text[i];
|
|
1234
|
+
const next = text[i + 1];
|
|
1235
|
+
if (c === "/" && next === "/") {
|
|
1236
|
+
const nl = text.indexOf("\n", i);
|
|
1237
|
+
i = nl === -1 ? text.length : nl + 1;
|
|
1238
|
+
continue;
|
|
1239
|
+
}
|
|
1240
|
+
if (c === "/" && next === "*") {
|
|
1241
|
+
const end = text.indexOf("*/", i + 2);
|
|
1242
|
+
if (end === -1) return false;
|
|
1243
|
+
i = end + 2;
|
|
1244
|
+
continue;
|
|
1245
|
+
}
|
|
1246
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
1247
|
+
let j = i + 1;
|
|
1248
|
+
while (j < text.length && text[j] !== c) {
|
|
1249
|
+
if (text[j] === "\\") j++;
|
|
1250
|
+
if (c !== "`" && text[j] === "\n") return false;
|
|
1251
|
+
j++;
|
|
1252
|
+
}
|
|
1253
|
+
if (j >= text.length) return false;
|
|
1254
|
+
i = j + 1;
|
|
1255
|
+
continue;
|
|
1256
|
+
}
|
|
1257
|
+
if (c === "(" || c === "[" || c === "{") stack.push(c);
|
|
1258
|
+
else if (c === ")" || c === "]" || c === "}") {
|
|
1259
|
+
if (stack.pop() !== pairs[c]) return false;
|
|
1260
|
+
}
|
|
1261
|
+
i++;
|
|
1262
|
+
}
|
|
1263
|
+
return stack.length === 0;
|
|
1264
|
+
}
|
|
1265
|
+
function onlyImports(text) {
|
|
1266
|
+
const lines = text.split("\n").filter((l) => l.trim().length > 0);
|
|
1267
|
+
return lines.length > 0 && lines.every((l) => IMPORT_LINE.test(l));
|
|
1268
|
+
}
|
|
1269
|
+
function isNewTestCode(added) {
|
|
1270
|
+
return DECLARES_TEST.test(added) && bracketsBalance(added) || onlyImports(added);
|
|
1271
|
+
}
|
|
1272
|
+
function placementOk(find, k, added) {
|
|
1273
|
+
if (added === "") return true;
|
|
1274
|
+
const wholeLines = k === 0 ? added.endsWith("\n") : k === find.length ? find.endsWith("\n") || added.startsWith("\n") : find[k - 1] === "\n" && added.endsWith("\n");
|
|
1275
|
+
return wholeLines && isNewTestCode(added);
|
|
1276
|
+
}
|
|
1277
|
+
function strictEndsRule(find, replace) {
|
|
1278
|
+
return replace.startsWith(find) || replace.endsWith(find);
|
|
1279
|
+
}
|
|
1280
|
+
function isAddOnly(path, find, replace) {
|
|
1281
|
+
if (replace === find) return true;
|
|
1282
|
+
if (!usesLooseRule(path)) return strictEndsRule(find, replace);
|
|
1283
|
+
if (replace.length <= find.length) return false;
|
|
1284
|
+
const addedLength = replace.length - find.length;
|
|
1285
|
+
let common = 0;
|
|
1286
|
+
while (common < find.length && find.charCodeAt(common) === replace.charCodeAt(common)) common++;
|
|
1287
|
+
for (let k = common; k >= 0; k--) {
|
|
1288
|
+
if (!replace.endsWith(find.slice(k))) continue;
|
|
1289
|
+
if (placementOk(find, k, replace.slice(k, k + addedLength))) return true;
|
|
1290
|
+
}
|
|
1291
|
+
return false;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1221
1294
|
// src/targetingPaths.ts
|
|
1222
1295
|
var import_node_path3 = require("node:path");
|
|
1223
1296
|
var MAX_PATH_CHARS = 300;
|
|
@@ -1804,8 +1877,14 @@ function createCodegenWorkspace(args) {
|
|
|
1804
1877
|
lf = loaded.lf;
|
|
1805
1878
|
base = { ending: loaded.ending, bom: loaded.bom, originalLf: loaded.lf };
|
|
1806
1879
|
}
|
|
1807
|
-
if (protectedTests.has(path) && !(
|
|
1808
|
-
return {
|
|
1880
|
+
if (protectedTests.has(path) && !isAddOnly(path, find, replace)) {
|
|
1881
|
+
return {
|
|
1882
|
+
result: {
|
|
1883
|
+
status: "protected",
|
|
1884
|
+
reason: "existing_test",
|
|
1885
|
+
message: "An existing test can only be added to. Keep every character of the text you matched, in the same order, and add only whole new lines that declare a new test (it, test or describe), before the text, after it, or between two of its lines. To add a test to a block, match the last lines of that block and put the new test after them."
|
|
1886
|
+
}
|
|
1887
|
+
};
|
|
1809
1888
|
}
|
|
1810
1889
|
const applied = applyEdits(lf, [{ find, replace }]);
|
|
1811
1890
|
if (!applied.ok) {
|
|
@@ -3374,7 +3453,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
3374
3453
|
var REPORT_COPY = "final-test-report.xml";
|
|
3375
3454
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
3376
3455
|
var MAX_FILES = 200;
|
|
3377
|
-
var RUNNER_VERSION = true ? "9.2.0-rc.
|
|
3456
|
+
var RUNNER_VERSION = true ? "9.2.0-rc.4" : "dev";
|
|
3378
3457
|
function safeDestination(base, repoPath) {
|
|
3379
3458
|
if (!repoPath || (0, import_node_path9.isAbsolute)(repoPath)) return null;
|
|
3380
3459
|
const destination = (0, import_node_path9.resolve)(base, repoPath);
|