@quikit/quikpilot-runner 9.2.0-rc.4 → 9.2.0-rc.5

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 CHANGED
@@ -53,7 +53,10 @@ 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. The AI cannot finish before it has
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
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
+ 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
+ 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
57
60
  changed something and written a test for every case it was given. If the loop cannot finish for an ordinary reason (an
58
61
  older runtime, a timeout, a refused edit it cannot recover from, a cut-short file) everything it held is thrown away and the
59
62
  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
package/dist/index.js CHANGED
@@ -1218,6 +1218,90 @@ function buildCodegenLoopRecord(loop) {
1218
1218
  };
1219
1219
  }
1220
1220
 
1221
+ // src/codegenLoopContext.ts
1222
+ var import_node_fs2 = require("node:fs");
1223
+ function collectLoopContext(p) {
1224
+ const readFile = p.readFile ?? ((path) => (0, import_node_fs2.readFileSync)(path, "utf8"));
1225
+ const listing = new Set(p.listing);
1226
+ const targetPaths = new Set(p.targets.map((t) => t.path));
1227
+ const seen = new Set(targetPaths);
1228
+ const entries = [];
1229
+ const records = [];
1230
+ let total = 0;
1231
+ for (const target of p.targets) {
1232
+ const named = target.contextPaths ?? [];
1233
+ const added = [];
1234
+ const skipped = [];
1235
+ for (const path of named) {
1236
+ if (seen.has(path)) continue;
1237
+ seen.add(path);
1238
+ if (matchesDeniedPath(path, p.deniedPaths)) {
1239
+ skipped.push({ path, reason: "denied" });
1240
+ continue;
1241
+ }
1242
+ if (!listing.has(path)) {
1243
+ skipped.push({ path, reason: "not in workspace" });
1244
+ continue;
1245
+ }
1246
+ let content;
1247
+ try {
1248
+ content = readFile(path);
1249
+ } catch {
1250
+ skipped.push({ path, reason: "unreadable" });
1251
+ continue;
1252
+ }
1253
+ if (content.length > MAX_ADDED_FILE_CHARS) skipped.push({ path, reason: "too large" });
1254
+ else if (total + content.length > MAX_ADDED_CONTEXT_CHARS) skipped.push({ path, reason: "over budget" });
1255
+ else {
1256
+ entries.push({ path, content });
1257
+ added.push(path);
1258
+ total += content.length;
1259
+ }
1260
+ }
1261
+ let importedPaths = [];
1262
+ let aliasImports = 0;
1263
+ if (target.kind === "EXISTING") {
1264
+ let source = null;
1265
+ try {
1266
+ source = readFile(target.path);
1267
+ } catch {
1268
+ skipped.push({ path: target.path, reason: "import: unreadable" });
1269
+ }
1270
+ if (source !== null) {
1271
+ const imports = collectImportContext({
1272
+ targetPath: target.path,
1273
+ source,
1274
+ alreadyNamed: seen,
1275
+ deniedPaths: p.deniedPaths,
1276
+ listing,
1277
+ readFile,
1278
+ maxFileChars: MAX_ADDED_FILE_CHARS,
1279
+ maxTotalChars: MAX_ADDED_CONTEXT_CHARS,
1280
+ spentChars: total
1281
+ });
1282
+ for (const e of imports.entries) {
1283
+ entries.push(e);
1284
+ added.push(e.path);
1285
+ seen.add(e.path);
1286
+ total += e.content.length;
1287
+ }
1288
+ skipped.push(...imports.skipped);
1289
+ importedPaths = imports.importedPaths;
1290
+ aliasImports = imports.aliasImports;
1291
+ }
1292
+ }
1293
+ records.push({
1294
+ targetPath: target.path,
1295
+ contextPaths: named,
1296
+ addedPaths: added,
1297
+ skipped,
1298
+ ...importedPaths.length > 0 ? { importedPaths } : {},
1299
+ ...aliasImports > 0 ? { aliasImports } : {}
1300
+ });
1301
+ }
1302
+ return { entries, records };
1303
+ }
1304
+
1221
1305
  // src/addOnly.ts
1222
1306
  var JS_FAMILY = /\.(?:[cm]?[jt]sx?)$/i;
1223
1307
  var DECLARES_TEST = /^[ \t]*(?:it|test|describe)\b/m;
@@ -1326,7 +1410,7 @@ function buildVisibleListing(listing, deniedPaths) {
1326
1410
  }
1327
1411
 
1328
1412
  // src/targetingTools.ts
1329
- var import_node_fs2 = require("node:fs");
1413
+ var import_node_fs3 = require("node:fs");
1330
1414
  var import_node_path4 = require("node:path");
1331
1415
  var DEFAULT_LIMITS = {
1332
1416
  maxTurns: 12,
@@ -1351,20 +1435,20 @@ var DEFAULT_LIMITS = {
1351
1435
  maxPatternChars: 200
1352
1436
  };
1353
1437
  function createNodeToolFs(rootDir = process.cwd()) {
1354
- const rootReal = (0, import_node_fs2.realpathSync)(rootDir);
1438
+ const rootReal = (0, import_node_fs3.realpathSync)(rootDir);
1355
1439
  return {
1356
1440
  rootReal,
1357
1441
  lstat(rel) {
1358
- const s = (0, import_node_fs2.lstatSync)((0, import_node_path4.join)(rootDir, rel));
1442
+ const s = (0, import_node_fs3.lstatSync)((0, import_node_path4.join)(rootDir, rel));
1359
1443
  return { isSymlink: s.isSymbolicLink(), isFile: s.isFile(), size: s.size };
1360
1444
  },
1361
1445
  realpathInside(rel) {
1362
- const real = (0, import_node_fs2.realpathSync)((0, import_node_path4.join)(rootDir, rel));
1446
+ const real = (0, import_node_fs3.realpathSync)((0, import_node_path4.join)(rootDir, rel));
1363
1447
  const r = (0, import_node_path4.relative)(rootReal, real);
1364
1448
  return r !== "" && !r.startsWith("..") && !(0, import_node_path4.isAbsolute)(r);
1365
1449
  },
1366
1450
  readBytes(rel) {
1367
- return (0, import_node_fs2.readFileSync)((0, import_node_path4.join)(rootDir, rel));
1451
+ return (0, import_node_fs3.readFileSync)((0, import_node_path4.join)(rootDir, rel));
1368
1452
  }
1369
1453
  };
1370
1454
  }
@@ -1665,7 +1749,7 @@ function executeToolCall(call, env2, ledger) {
1665
1749
  }
1666
1750
 
1667
1751
  // src/workspaceOverlay.ts
1668
- var import_node_fs3 = require("node:fs");
1752
+ var import_node_fs4 = require("node:fs");
1669
1753
  var import_node_path5 = require("node:path");
1670
1754
  function createNodeWriteFs(rootDir = process.cwd()) {
1671
1755
  const base = createNodeToolFs(rootDir);
@@ -1679,7 +1763,7 @@ function createNodeWriteFs(rootDir = process.cwd()) {
1679
1763
  let dir = (0, import_node_path5.dirname)((0, import_node_path5.join)(rootDir, rel));
1680
1764
  for (; ; ) {
1681
1765
  try {
1682
- return inside((0, import_node_fs3.realpathSync)(dir));
1766
+ return inside((0, import_node_fs4.realpathSync)(dir));
1683
1767
  } catch {
1684
1768
  const up = (0, import_node_path5.dirname)(dir);
1685
1769
  if (up === dir) return false;
@@ -1689,7 +1773,7 @@ function createNodeWriteFs(rootDir = process.cwd()) {
1689
1773
  },
1690
1774
  exists(rel) {
1691
1775
  try {
1692
- (0, import_node_fs3.lstatSync)((0, import_node_path5.join)(rootDir, rel));
1776
+ (0, import_node_fs4.lstatSync)((0, import_node_path5.join)(rootDir, rel));
1693
1777
  return true;
1694
1778
  } catch {
1695
1779
  return false;
@@ -2617,7 +2701,7 @@ function protectedTestFiles(listing, testDiscovery) {
2617
2701
  }
2618
2702
  return [...found].sort();
2619
2703
  }
2620
- function buildCodegenLoopArgs(p) {
2704
+ function buildCodegenLoopArgs(p, context = collectLoopContext({ targets: p.targets, listing: p.workspaceListing, deniedPaths: p.deniedPaths, ...p.readFile ? { readFile: p.readFile } : {} })) {
2621
2705
  const skipped = new Set(p.skippedCases.map((s) => s.automationId));
2622
2706
  const claimed = /* @__PURE__ */ new Set();
2623
2707
  for (const t of p.targets) for (const id of t.automationIds ?? []) if (!skipped.has(id)) claimed.add(id);
@@ -2634,6 +2718,7 @@ function buildCodegenLoopArgs(p) {
2634
2718
  requiredTests,
2635
2719
  workspaceListing: p.workspaceListing
2636
2720
  };
2721
+ if (context.entries.length > 0) baseContext.contextContents = context.entries;
2637
2722
  if (p.deniedPaths.length > 0) baseContext.deniedPaths = p.deniedPaths;
2638
2723
  if (protectedTestPaths.length > 0) baseContext.protectedTestPaths = protectedTestPaths.slice(0, MAX_PROTECTED_PATHS_ON_WIRE);
2639
2724
  if (p.outOfScope.length > 0) baseContext.outOfScope = p.outOfScope;
@@ -2672,8 +2757,18 @@ function perFile(p) {
2672
2757
  }
2673
2758
  async function runCodegenStep(p) {
2674
2759
  if (p.mode !== "loop") return perFile(p);
2760
+ const context = collectLoopContext({ targets: p.targets, listing: p.workspaceListing, deniedPaths: p.deniedPaths, ...p.readFile ? { readFile: p.readFile } : {} });
2761
+ p.contextLog.push(...context.records);
2762
+ console.log(
2763
+ JSON.stringify({
2764
+ event: "codegen.loop_context",
2765
+ files: context.entries.length,
2766
+ chars: context.entries.reduce((n, e) => n + e.content.length, 0),
2767
+ paths: context.entries.map((e) => e.path)
2768
+ })
2769
+ );
2675
2770
  try {
2676
- const { results, summary } = await runCodegenLoop(buildCodegenLoopArgs(p), {
2771
+ const { results, summary } = await runCodegenLoop(buildCodegenLoopArgs(p, context), {
2677
2772
  post: (contextData, signal) => postCodegenTurn(p.gateway, contextData, signal),
2678
2773
  ...p.deps
2679
2774
  });
@@ -2705,7 +2800,7 @@ async function runCodegenStep(p) {
2705
2800
  }
2706
2801
 
2707
2802
  // src/dependencyCheck.ts
2708
- var import_node_fs4 = require("node:fs");
2803
+ var import_node_fs5 = require("node:fs");
2709
2804
  var import_node_path6 = require("node:path");
2710
2805
  var SCANNABLE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
2711
2806
  var IMPORT_RE = /(?:\bimport\b[^'"]*?\bfrom\s*|\bimport\s*\(\s*|\bexport\b[^'"]*?\bfrom\s*|\brequire\s*\(\s*|\bimport\s+)(['"])([^'"]+)\1/g;
@@ -2792,7 +2887,7 @@ function readDeclaredDependencies(results, workspaceRoot) {
2792
2887
  raw = generated.newContent;
2793
2888
  } else {
2794
2889
  try {
2795
- raw = (0, import_node_fs4.readFileSync)(packageJsonPath, "utf8");
2890
+ raw = (0, import_node_fs5.readFileSync)(packageJsonPath, "utf8");
2796
2891
  } catch {
2797
2892
  raw = null;
2798
2893
  }
@@ -2865,7 +2960,7 @@ function resolveAliasPrefixes(results, workspaceRoot) {
2865
2960
  raw = generated.newContent;
2866
2961
  } else {
2867
2962
  try {
2868
- raw = (0, import_node_fs4.readFileSync)(configPath, "utf8");
2963
+ raw = (0, import_node_fs5.readFileSync)(configPath, "utf8");
2869
2964
  } catch {
2870
2965
  raw = null;
2871
2966
  }
@@ -2955,21 +3050,21 @@ async function fetchPacket(packetUrl, runToken, githubRunId) {
2955
3050
  }
2956
3051
 
2957
3052
  // src/phase0.ts
2958
- var import_node_fs5 = require("node:fs");
3053
+ var import_node_fs6 = require("node:fs");
2959
3054
  function writePhase0Marker(runId) {
2960
- (0, import_node_fs5.mkdirSync)(".quikpilot", { recursive: true });
2961
- (0, import_node_fs5.appendFileSync)(".quikpilot/phase0-marker.txt", `QuikPilot Phase 0 skeleton marker for run ${runId}
3055
+ (0, import_node_fs6.mkdirSync)(".quikpilot", { recursive: true });
3056
+ (0, import_node_fs6.appendFileSync)(".quikpilot/phase0-marker.txt", `QuikPilot Phase 0 skeleton marker for run ${runId}
2962
3057
  `);
2963
3058
  }
2964
3059
 
2965
3060
  // src/quiktest.ts
2966
- var import_node_fs6 = require("node:fs");
3061
+ var import_node_fs7 = require("node:fs");
2967
3062
  var import_node_path7 = require("node:path");
2968
3063
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git"]);
2969
3064
  function walkForJUnitByName(dir) {
2970
3065
  let entries;
2971
3066
  try {
2972
- entries = (0, import_node_fs6.readdirSync)(dir);
3067
+ entries = (0, import_node_fs7.readdirSync)(dir);
2973
3068
  } catch {
2974
3069
  return null;
2975
3070
  }
@@ -2978,7 +3073,7 @@ function walkForJUnitByName(dir) {
2978
3073
  const full = (0, import_node_path7.join)(dir, entry);
2979
3074
  let stat;
2980
3075
  try {
2981
- stat = (0, import_node_fs6.statSync)(full);
3076
+ stat = (0, import_node_fs7.statSync)(full);
2982
3077
  } catch {
2983
3078
  continue;
2984
3079
  }
@@ -2994,7 +3089,7 @@ function walkForJUnitByName(dir) {
2994
3089
  function firstXmlIn(dir, namePattern) {
2995
3090
  let entries;
2996
3091
  try {
2997
- entries = (0, import_node_fs6.readdirSync)(dir);
3092
+ entries = (0, import_node_fs7.readdirSync)(dir);
2998
3093
  } catch {
2999
3094
  return null;
3000
3095
  }
@@ -3004,7 +3099,7 @@ function firstXmlIn(dir, namePattern) {
3004
3099
  function readTestReportBytes(cwd = process.cwd()) {
3005
3100
  try {
3006
3101
  const report = findJUnitReport(cwd);
3007
- return report ? (0, import_node_fs6.readFileSync)(report) : null;
3102
+ return report ? (0, import_node_fs7.readFileSync)(report) : null;
3008
3103
  } catch {
3009
3104
  return null;
3010
3105
  }
@@ -3034,8 +3129,8 @@ async function reportToQuikTest(params) {
3034
3129
  try {
3035
3130
  console.log(`reporting ${report}`);
3036
3131
  const ciUrl = buildCiUrl(githubServerUrl, githubRepository, githubRunId);
3037
- const { readFileSync: readFileSync8 } = await import("node:fs");
3038
- const body = readFileSync8(report);
3132
+ const { readFileSync: readFileSync9 } = await import("node:fs");
3133
+ const body = readFileSync9(report);
3039
3134
  let url = `${resultsUrl}?ciUrl=${encodeURIComponent(ciUrl)}&automationIdFormat=bracket`;
3040
3135
  if (generatedFiles) {
3041
3136
  url += `&generatedFiles=${encodeURIComponent(generatedFiles.join(","))}`;
@@ -3048,7 +3143,7 @@ async function reportToQuikTest(params) {
3048
3143
  if (!res.ok) {
3049
3144
  throw new Error(`QuikTest report POST failed: ${res.status} ${res.statusText}`);
3050
3145
  }
3051
- (0, import_node_fs6.rmSync)(report, { force: true });
3146
+ (0, import_node_fs7.rmSync)(report, { force: true });
3052
3147
  let unmatched = [];
3053
3148
  try {
3054
3149
  const json = await res.json();
@@ -3064,11 +3159,11 @@ async function reportToQuikTest(params) {
3064
3159
 
3065
3160
  // src/baselineCheck.ts
3066
3161
  var import_node_child_process3 = require("node:child_process");
3067
- var import_node_fs8 = require("node:fs");
3162
+ var import_node_fs9 = require("node:fs");
3068
3163
  var import_node_path8 = require("node:path");
3069
3164
 
3070
3165
  // src/regressionCheck.ts
3071
- var import_node_fs7 = require("node:fs");
3166
+ var import_node_fs8 = require("node:fs");
3072
3167
  var TESTCASE_RE = /<testcase\b([^>]*?)(?:\/>|>([\s\S]*?)<\/testcase>)/g;
3073
3168
  var NAME_ATTR_RE = /\bname="([^"]*)"/;
3074
3169
  var CLASSNAME_ATTR_RE = /\bclassname="([^"]*)"/;
@@ -3154,7 +3249,7 @@ function readJUnitOutcomes(cwd) {
3154
3249
  const report = findJUnitReport(cwd);
3155
3250
  if (!report) return null;
3156
3251
  try {
3157
- return parseJUnitOutcomes((0, import_node_fs7.readFileSync)(report, "utf8"));
3252
+ return parseJUnitOutcomes((0, import_node_fs8.readFileSync)(report, "utf8"));
3158
3253
  } catch {
3159
3254
  return null;
3160
3255
  }
@@ -3256,27 +3351,27 @@ function insideCheckout(cwd, path) {
3256
3351
  return rel === "" || rel.startsWith("..") || (0, import_node_path8.isAbsolute)(rel) ? null : abs;
3257
3352
  }
3258
3353
  function writeForCheck(abs, content) {
3259
- const original = (0, import_node_fs8.existsSync)(abs) ? (0, import_node_fs8.readFileSync)(abs) : null;
3354
+ const original = (0, import_node_fs9.existsSync)(abs) ? (0, import_node_fs9.readFileSync)(abs) : null;
3260
3355
  const createdDirs = [];
3261
3356
  if (original === null) {
3262
3357
  const missing = [];
3263
- for (let d = (0, import_node_path8.dirname)(abs); !(0, import_node_fs8.existsSync)(d); d = (0, import_node_path8.dirname)(d)) missing.push(d);
3358
+ for (let d = (0, import_node_path8.dirname)(abs); !(0, import_node_fs9.existsSync)(d); d = (0, import_node_path8.dirname)(d)) missing.push(d);
3264
3359
  for (const d of missing.reverse()) {
3265
- (0, import_node_fs8.mkdirSync)(d);
3360
+ (0, import_node_fs9.mkdirSync)(d);
3266
3361
  createdDirs.push(d);
3267
3362
  }
3268
3363
  }
3269
- (0, import_node_fs8.writeFileSync)(abs, content);
3364
+ (0, import_node_fs9.writeFileSync)(abs, content);
3270
3365
  return { abs, original, createdDirs };
3271
3366
  }
3272
3367
  function restore(written) {
3273
3368
  for (const file of [...written].reverse()) {
3274
3369
  try {
3275
- if (file.original !== null) (0, import_node_fs8.writeFileSync)(file.abs, file.original);
3276
- else (0, import_node_fs8.rmSync)(file.abs, { force: true });
3370
+ if (file.original !== null) (0, import_node_fs9.writeFileSync)(file.abs, file.original);
3371
+ else (0, import_node_fs9.rmSync)(file.abs, { force: true });
3277
3372
  for (const d of [...file.createdDirs].reverse()) {
3278
3373
  try {
3279
- (0, import_node_fs8.rmdirSync)(d);
3374
+ (0, import_node_fs9.rmdirSync)(d);
3280
3375
  } catch {
3281
3376
  }
3282
3377
  }
@@ -3300,7 +3395,7 @@ function untrackedFiles(cwd) {
3300
3395
  }
3301
3396
  var mtimeOf = (path) => {
3302
3397
  try {
3303
- return (0, import_node_fs8.statSync)(path).mtimeMs;
3398
+ return (0, import_node_fs9.statSync)(path).mtimeMs;
3304
3399
  } catch {
3305
3400
  return null;
3306
3401
  }
@@ -3314,7 +3409,7 @@ function decideCause(targets, results, cwd) {
3314
3409
  const abs = insideCheckout(cwd, t.path);
3315
3410
  if (next === void 0 || abs === null) return "ALREADY_TRUE";
3316
3411
  try {
3317
- if ((0, import_node_fs8.readFileSync)(abs, "utf8") !== next) return "ALREADY_TRUE";
3412
+ if ((0, import_node_fs9.readFileSync)(abs, "utf8") !== next) return "ALREADY_TRUE";
3318
3413
  } catch {
3319
3414
  return "ALREADY_TRUE";
3320
3415
  }
@@ -3390,7 +3485,7 @@ async function runBaselineCheck(params) {
3390
3485
  for (const file of untrackedAfter) {
3391
3486
  if (untrackedBefore.has(file)) continue;
3392
3487
  const abs = insideCheckout(cwd, file);
3393
- if (abs) (0, import_node_fs8.rmSync)(abs, { force: true });
3488
+ if (abs) (0, import_node_fs9.rmSync)(abs, { force: true });
3394
3489
  }
3395
3490
  }
3396
3491
  }
@@ -3411,7 +3506,7 @@ async function runBaselineCheck(params) {
3411
3506
  }
3412
3507
 
3413
3508
  // src/failureArtifact.ts
3414
- var import_node_fs9 = require("node:fs");
3509
+ var import_node_fs10 = require("node:fs");
3415
3510
  var import_node_path9 = require("node:path");
3416
3511
 
3417
3512
  // src/failureReason.ts
@@ -3453,7 +3548,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
3453
3548
  var REPORT_COPY = "final-test-report.xml";
3454
3549
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
3455
3550
  var MAX_FILES = 200;
3456
- var RUNNER_VERSION = true ? "9.2.0-rc.4" : "dev";
3551
+ var RUNNER_VERSION = true ? "9.2.0-rc.5" : "dev";
3457
3552
  function safeDestination(base, repoPath) {
3458
3553
  if (!repoPath || (0, import_node_path9.isAbsolute)(repoPath)) return null;
3459
3554
  const destination = (0, import_node_path9.resolve)(base, repoPath);
@@ -3465,8 +3560,8 @@ function writeFailureArtifact(input) {
3465
3560
  if (input.results.length === 0) return { written: false };
3466
3561
  try {
3467
3562
  const base = (0, import_node_path9.resolve)(input.cwd, FAILURE_ARTIFACT_DIR);
3468
- (0, import_node_fs9.rmSync)(base, { recursive: true, force: true });
3469
- (0, import_node_fs9.mkdirSync)(base, { recursive: true });
3563
+ (0, import_node_fs10.rmSync)(base, { recursive: true, force: true });
3564
+ (0, import_node_fs10.mkdirSync)(base, { recursive: true });
3470
3565
  const files = [];
3471
3566
  const skipped = [];
3472
3567
  for (const result of input.results) {
@@ -3475,8 +3570,8 @@ function writeFailureArtifact(input) {
3475
3570
  skipped.push(result.targetPath);
3476
3571
  continue;
3477
3572
  }
3478
- (0, import_node_fs9.mkdirSync)((0, import_node_path9.dirname)(destination), { recursive: true });
3479
- (0, import_node_fs9.writeFileSync)(destination, result.newContent);
3573
+ (0, import_node_fs10.mkdirSync)((0, import_node_path9.dirname)(destination), { recursive: true });
3574
+ (0, import_node_fs10.writeFileSync)(destination, result.newContent);
3480
3575
  files.push({ path: result.targetPath, bytes: Buffer.byteLength(result.newContent) });
3481
3576
  }
3482
3577
  let testReport = "none";
@@ -3484,7 +3579,7 @@ function writeFailureArtifact(input) {
3484
3579
  if (input.testReport.byteLength > MAX_REPORT_BYTES) {
3485
3580
  testReport = "too-large";
3486
3581
  } else {
3487
- (0, import_node_fs9.writeFileSync)((0, import_node_path9.join)(base, REPORT_COPY), input.testReport);
3582
+ (0, import_node_fs10.writeFileSync)((0, import_node_path9.join)(base, REPORT_COPY), input.testReport);
3488
3583
  testReport = "included";
3489
3584
  }
3490
3585
  }
@@ -3504,8 +3599,8 @@ function writeFailureArtifact(input) {
3504
3599
  failureReasons: input.failureReasons
3505
3600
  };
3506
3601
  const text = JSON.stringify(manifest, (_key, value) => typeof value === "string" ? scrubSecrets(value, input.secrets) : value, 2);
3507
- (0, import_node_fs9.writeFileSync)((0, import_node_path9.join)(base, "manifest.json"), text);
3508
- return { written: (0, import_node_fs9.existsSync)((0, import_node_path9.join)(base, "manifest.json")) };
3602
+ (0, import_node_fs10.writeFileSync)((0, import_node_path9.join)(base, "manifest.json"), text);
3603
+ return { written: (0, import_node_fs10.existsSync)((0, import_node_path9.join)(base, "manifest.json")) };
3509
3604
  } catch (err) {
3510
3605
  console.warn(`::warning::Could not keep the failed run's files: ${err instanceof Error ? err.message : String(err)}`);
3511
3606
  return { written: false };
@@ -3513,7 +3608,7 @@ function writeFailureArtifact(input) {
3513
3608
  }
3514
3609
 
3515
3610
  // src/scopeCheck.ts
3516
- var import_node_fs10 = require("node:fs");
3611
+ var import_node_fs11 = require("node:fs");
3517
3612
  var ROUTE_METHOD_RE = /\b(GET|POST|PUT|PATCH|DELETE)\b/i;
3518
3613
  var ROUTE_PATH_RE = /\/[A-Za-z0-9_\-{}[\]]+(?:\/[A-Za-z0-9_\-:{}[\]]+)+/;
3519
3614
  var ROUTE_EXPORT_RE = /\bexport\s+(?:async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)\s*\(/;
@@ -3570,7 +3665,7 @@ function checkApiScope(results, targets, apiChanges) {
3570
3665
  } else {
3571
3666
  let currentContent;
3572
3667
  try {
3573
- currentContent = (0, import_node_fs10.readFileSync)(targetPath, "utf8");
3668
+ currentContent = (0, import_node_fs11.readFileSync)(targetPath, "utf8");
3574
3669
  } catch {
3575
3670
  currentContent = "";
3576
3671
  }