@open-tomato/rafa 0.53.0 → 0.54.0

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/index.js CHANGED
@@ -37,6 +37,7 @@ import {
37
37
  STAMPED_COLUMNS,
38
38
  SessionConflictError,
39
39
  SessionRecordError,
40
+ WIRE_CONTRACT_VERSION,
40
41
  WIRE_FORMAT,
41
42
  WIRE_VERSION,
42
43
  WireExportRefusal,
@@ -60,10 +61,12 @@ import {
60
61
  openSqliteStore,
61
62
  planSchema,
62
63
  readReplacedStoreIds,
64
+ readRepositoryFacts,
63
65
  readSession,
64
66
  readSessions,
65
67
  readStoreMeta,
66
68
  readStoreSchema,
69
+ readingKey,
67
70
  refuseUnownedDevelopmentWrite,
68
71
  runClaude,
69
72
  runClaudeCaptured,
@@ -83,7 +86,7 @@ import {
83
86
  withSqliteStore,
84
87
  writeNames,
85
88
  writeSqliteStore
86
- } from "./index-anvmm83x.js";
89
+ } from "./index-mkhbaye7.js";
87
90
  import {
88
91
  ACTION_SHAPE,
89
92
  CONFIG_DEFAULTS,
@@ -99,7 +102,7 @@ import {
99
102
  renderTitle,
100
103
  suggestedEnvironment,
101
104
  titleRoundTrips
102
- } from "./index-78zcdjf5.js";
105
+ } from "./index-d772zq3m.js";
103
106
  import {
104
107
  ABSENT,
105
108
  ACCEPT_REFS_FLAG,
@@ -271,7 +274,7 @@ import {
271
274
  writeHopRecord,
272
275
  writePositionFile,
273
276
  writeRefsBlock
274
- } from "./index-kqz8x8g9.js";
277
+ } from "./index-waawdjq2.js";
275
278
  import {
276
279
  BLOCKER_GAP,
277
280
  PLAN_BLOCK_KINDS,
@@ -322,8 +325,9 @@ import {
322
325
  normalizeRemote,
323
326
  parseWorkingTree,
324
327
  registerAdapters,
325
- restoreAdapters
326
- } from "./index-rkrsdes6.js";
328
+ restoreAdapters,
329
+ shellQuote
330
+ } from "./index-8rr1etrx.js";
327
331
  import {
328
332
  activeOutput,
329
333
  activeOutputMode,
@@ -9330,10 +9334,14 @@ function selectSync(repoRoot, config, registry = CORE_ADAPTER_REGISTRY) {
9330
9334
 
9331
9335
  // packages/rafa-effort/src/effort/sync/contact.ts
9332
9336
  var HUB_UNREACHABLE = "HubUnreachable";
9337
+ var HUB_CONTRACT_MISMATCH = "HubContractMismatch";
9333
9338
  var OPENING = "effort sync";
9334
9339
  function isHubUnreachable(error) {
9335
9340
  return error instanceof Error && error.name === HUB_UNREACHABLE;
9336
9341
  }
9342
+ function isHubContractMismatch(error) {
9343
+ return error instanceof Error && error.name === HUB_CONTRACT_MISMATCH;
9344
+ }
9337
9345
  function firstLine3(text) {
9338
9346
  return text.split(`
9339
9347
  `).map((line) => line.trim()).find((line) => line !== "") ?? describeValue(text);
@@ -9362,6 +9370,7 @@ function createHubContact(input, seams = {}) {
9362
9370
  const strategy = strategyOf(config.effortSync);
9363
9371
  let selection = null;
9364
9372
  let toldUnreachable = false;
9373
+ let toldMismatch = false;
9365
9374
  const pullRequest = Object.freeze({
9366
9375
  from: null,
9367
9376
  dryRun: false,
@@ -9380,6 +9389,13 @@ function createHubContact(input, seams = {}) {
9380
9389
  return { outcome: "done", result: await run2() };
9381
9390
  } catch (error) {
9382
9391
  const problem = messageOf(error);
9392
+ if (isHubContractMismatch(error)) {
9393
+ const line = firstLine3(problem);
9394
+ if (!toldMismatch)
9395
+ input.warn(line);
9396
+ toldMismatch = true;
9397
+ return { outcome: "mismatch", problem: line };
9398
+ }
9383
9399
  if (!isHubUnreachable(error)) {
9384
9400
  input.warn(`${OPENING}: ${direction} over ${strategy} failed: ${problem}`);
9385
9401
  return { outcome: "failed", problem };
@@ -9398,7 +9414,7 @@ function createHubContact(input, seams = {}) {
9398
9414
  return { state: "unselected", strategy, problem: answer2.problem };
9399
9415
  const { sync } = answer2;
9400
9416
  const push = direction === "push-then-pull" ? await attempt("push", () => sync.push({ to: null })) : null;
9401
- const pull = push?.outcome === "unreachable" ? { outcome: "skipped" } : await attempt("pull", () => sync.pull(pullRequest));
9417
+ const pull = push?.outcome === "unreachable" || push?.outcome === "mismatch" ? { outcome: "skipped" } : await attempt("pull", () => sync.pull(pullRequest));
9402
9418
  return { state: "contacted", strategy, push, pull };
9403
9419
  };
9404
9420
  return Object.freeze({
@@ -10162,7 +10178,7 @@ function tasksFrom(facts, fromIndex) {
10162
10178
  function failingNames(planStub, planCi) {
10163
10179
  if (planStub === null)
10164
10180
  return [];
10165
- const names = new Set(planCi.filter((row) => row.planStub === planStub).flatMap(({ failing }) => failing));
10181
+ const names = new Set(planCi.filter(({ row }) => row.planStub === planStub).flatMap(({ row }) => row.failing));
10166
10182
  return [...names].map((text) => ({ source: "plan-ci", sessionId: null, taskLine: null, field: "failing", text }));
10167
10183
  }
10168
10184
  function findRecurrences(strings, facts, fromIndex, planCi) {
@@ -10214,12 +10230,20 @@ function rowOf3(stored) {
10214
10230
  readAt: stored.read_at
10215
10231
  };
10216
10232
  }
10217
- function readPlanCi(repoRoot, planStub) {
10233
+ function readPlanCiFacts(repoRoot, planStub) {
10218
10234
  const path2 = sqliteStorePath(repoRoot);
10219
10235
  if (!existsSync7(path2))
10220
10236
  return [];
10221
- const rows = withSqliteStore(path2, "read", false, (db) => planStub === undefined ? db.query(`${SELECT_COLUMNS} ORDER BY seq`).all() : db.query(`${SELECT_COLUMNS} WHERE plan_stub = ? ORDER BY seq`).all(planStub));
10222
- return rows.map(rowOf3);
10237
+ return withSqliteStore(path2, "read", false, (db) => {
10238
+ const stored = db.query(SELECT_COLUMNS).all();
10239
+ const byKey = new Map(stored.map((row) => [readingKey("plan_ci", { pr: row.pr, head_sha: row.head_sha, read_at: row.read_at }), row]));
10240
+ return readRepositoryFacts(db, "plan_ci").flatMap((fact) => {
10241
+ const canonical = byKey.get(fact.canonical.key);
10242
+ if (canonical === undefined || planStub !== undefined && canonical.plan_stub !== planStub)
10243
+ return [];
10244
+ return [{ row: rowOf3(canonical), sightings: fact.sightings, origins: fact.origins, lastSighting: fact.lastSighting }];
10245
+ });
10246
+ });
10223
10247
  }
10224
10248
 
10225
10249
  // packages/rafa/src/effort/store/reports.ts
@@ -10408,8 +10432,8 @@ function readSkillFacts(repoRoot, plans) {
10408
10432
  const rows = readSessionRows(sqliteStorePath(repoRoot));
10409
10433
  const invoked = invocationsBySession(readSkillInvocations(repoRoot));
10410
10434
  const planCi = new Map;
10411
- for (const row of readPlanCi(repoRoot))
10412
- planCi.set(row.planStub, [...planCi.get(row.planStub) ?? [], row]);
10435
+ for (const fact of readPlanCiFacts(repoRoot))
10436
+ planCi.set(fact.row.planStub, [...planCi.get(fact.row.planStub) ?? [], fact]);
10413
10437
  return reports.map((report) => {
10414
10438
  const offer = rows.offers.get(report.sessionId);
10415
10439
  return {
@@ -10604,8 +10628,14 @@ function armOf(resolver, facts, match, failureStrings, artifacts) {
10604
10628
  m2: m2Of(known)
10605
10629
  };
10606
10630
  }
10607
- function latestReading(readings) {
10608
- return readings.reduce((latest, reading) => latest === null || reading.readAt >= latest.readAt ? reading : latest, null);
10631
+ function isCurrentOver(fact, current) {
10632
+ if (fact.lastSighting !== current.lastSighting)
10633
+ return fact.lastSighting > current.lastSighting;
10634
+ return fact.row.verdict === "red" || current.row.verdict !== "red";
10635
+ }
10636
+ function currentReading(facts) {
10637
+ const current = facts.reduce((picked, fact) => picked === null || isCurrentOver(fact, picked) ? fact : picked, null);
10638
+ return current?.row ?? null;
10609
10639
  }
10610
10640
  function skillsReportOf(facts, failureStrings, artifacts) {
10611
10641
  const plans = [...groupBy(facts, ({ planStub }) => planStub)].map(([planStub, planFacts]) => {
@@ -10614,7 +10644,7 @@ function skillsReportOf(facts, failureStrings, artifacts) {
10614
10644
  return {
10615
10645
  planStub,
10616
10646
  sessions: planFacts.length,
10617
- planCi: latestReading(planFacts[0]?.planCi ?? []),
10647
+ planCi: currentReading(planFacts[0]?.planCi ?? []),
10618
10648
  resolvers: arms.map(([resolver, armFacts]) => armOf(resolver, armFacts, match, failureStrings, artifacts))
10619
10649
  };
10620
10650
  });
@@ -14193,14 +14223,6 @@ function worktreeDirAt(projectRoot, worktreeDir) {
14193
14223
  return resolve11(projectRoot, worktreeDir);
14194
14224
  }
14195
14225
 
14196
- // packages/rafa/src/utils/shell.ts
14197
- var PLAIN_WORD = /^[A-Za-z0-9._:/-]+$/;
14198
- var QUOTE = "'";
14199
- var QUOTED_QUOTE = "'\\''";
14200
- function shellQuote(word) {
14201
- return PLAIN_WORD.test(word) ? word : QUOTE + word.split(QUOTE).join(QUOTED_QUOTE) + QUOTE;
14202
- }
14203
-
14204
14226
  // packages/rafa-pr/src/pr/checks.ts
14205
14227
  var PASSING_STATES = new Set(["SUCCESS", "SKIPPED", "NEUTRAL"]);
14206
14228
  var FAILING_STATES = new Set([
@@ -16258,6 +16280,24 @@ function outputFileFor(junitFile) {
16258
16280
  const stem = name.endsWith(JUNIT_SUFFIX) ? name.slice(0, -JUNIT_SUFFIX.length) : name.slice(0, name.length - extname(name).length);
16259
16281
  return join31(dirname12(junitFile), `${stem}${OUTPUT_SUFFIX}`);
16260
16282
  }
16283
+ var RED_OUTPUT_SUFFIX = ".red.output.txt";
16284
+ function redOutputFileFor(junitFile, sha) {
16285
+ const outputFile = outputFileFor(junitFile);
16286
+ return `${outputFile.slice(0, -OUTPUT_SUFFIX.length)}.${sha}${RED_OUTPUT_SUFFIX}`;
16287
+ }
16288
+ function readSuiteHead(cwd) {
16289
+ const proc = Bun.spawnSync(["git", "rev-parse", "HEAD"], { cwd, stdin: "ignore", stdout: "pipe", stderr: "ignore" });
16290
+ if (proc.exitCode !== 0)
16291
+ return null;
16292
+ const sha = proc.stdout.toString().trim();
16293
+ return sha === "" ? null : sha;
16294
+ }
16295
+ function keepRedOutput(options, text) {
16296
+ const sha = (options.readHead ?? readSuiteHead)(options.cwd);
16297
+ if (sha === null)
16298
+ return;
16299
+ writeFileSync7(redOutputFileFor(options.junitFile, sha), text);
16300
+ }
16261
16301
  function suiteEnv(base2) {
16262
16302
  return Object.fromEntries(Object.entries(base2).filter(([key]) => !SUITE_ENV_REMOVED.includes(key)));
16263
16303
  }
@@ -16419,14 +16459,18 @@ async function runSuite(options) {
16419
16459
  const { exitCode, stderr, timedOut } = await spawn(command, { cwd: options.cwd, env });
16420
16460
  const { junit, failures: named, files, cases } = readJunit(options.junitFile);
16421
16461
  const failedCases = parseFailedCases(stderr, failingFilesOf(named));
16422
- writeFileSync7(outputFile, suiteOutputText(stderr, failedCases));
16462
+ const outputText = suiteOutputText(stderr, failedCases);
16463
+ writeFileSync7(outputFile, outputText);
16423
16464
  const { summary, errors } = readSummary2(stderr);
16424
16465
  const failures = withErrorLines(named, failedCases);
16425
16466
  const unhandled = parseUnhandled(stderr);
16426
16467
  const outputTail = readOutputTail(stderr);
16427
16468
  const deadline = timedOut === undefined ? {} : { timedOut };
16428
16469
  const result = { command, exitCode, summary, failures, errors, junit, unhandled, outputTail, fileOrder: [files], cases, ...deadline };
16429
- return readNoTestFiles(stderr) ? { ...result, noTestFiles: true } : result;
16470
+ const noTestFiles = readNoTestFiles(stderr);
16471
+ if (exitCode !== 0 && !noTestFiles)
16472
+ keepRedOutput(options, outputText);
16473
+ return noTestFiles ? { ...result, noTestFiles: true } : result;
16430
16474
  }
16431
16475
 
16432
16476
  // packages/rafa-pr/src/triage/base-run.ts
@@ -16613,6 +16657,9 @@ function testFailureOf(bug) {
16613
16657
  evidence: evidenceOf(null, artifactLines)
16614
16658
  };
16615
16659
  }
16660
+ function failedCaseNamesIn(capture) {
16661
+ return linesOf3(capture).map((line) => FAIL_LINE.exec(line)?.[1]).filter((name) => name !== undefined);
16662
+ }
16616
16663
 
16617
16664
  // packages/rafa/src/triage/bug-key.ts
16618
16665
  var KEY_SEPARATOR = ": ";
@@ -16881,7 +16928,11 @@ function issueText(opening, values, redact) {
16881
16928
  `) + `
16882
16929
  `;
16883
16930
  }
16931
+ // packages/rafa-pr/src/triage/kind-route.ts
16932
+ import { readFileSync as readFileSync24 } from "fs";
16933
+
16884
16934
  // packages/rafa-pr/src/triage/leftover-repair.ts
16935
+ import { createHash as createHash4 } from "crypto";
16885
16936
  import { readFileSync as readFileSync22 } from "fs";
16886
16937
 
16887
16938
  // packages/rafa/src/utils/tracker.ts
@@ -17038,12 +17089,37 @@ var LEFTOVER_AGENTS = Object.freeze({
17038
17089
  });
17039
17090
  var LEFTOVER_MARKER = "<!-- leftover -->";
17040
17091
  var LEFTOVER_REPAIR = /^Repair the own-(?:fallout|gap) leftover: .*\s<!-- leftover -->$/;
17092
+ var KEY_HASH_LENGTH = 12;
17093
+ var KEYED_MARKER = /\s<!-- leftover((?: (?:key|symbol)=\S+)+) --> <!-- leftover -->$/;
17094
+ var MARKER_PART = / (key|symbol)=(\S+)/g;
17041
17095
  var KIND_SENTENCE = Object.freeze({
17042
17096
  "own-fallout": "An earlier task of this plan broke this, and the triage read it as the plan's own fallout",
17043
17097
  "own-gap": "This plan built this and left it unfinished, in files the plan's commits touched"
17044
17098
  });
17099
+ function leftoverKeyHash(key) {
17100
+ return createHash4("sha256").update(key).digest("hex").slice(0, KEY_HASH_LENGTH);
17101
+ }
17102
+ function textOrNull(text) {
17103
+ return typeof text === "string" && text.trim().length > 0 ? text : null;
17104
+ }
17105
+ function leftoverMarkerPartsOf(entry) {
17106
+ const key = textOrNull(entry.key);
17107
+ const symbol = textOrNull(entry.symbol);
17108
+ return {
17109
+ key: key === null ? null : leftoverKeyHash(key),
17110
+ symbol: symbol === null ? null : encodeURIComponent(symbol.trim())
17111
+ };
17112
+ }
17113
+ function markersOf(entry) {
17114
+ const parts = leftoverMarkerPartsOf(entry);
17115
+ const written = [
17116
+ ...parts.key === null ? [] : [`key=${parts.key}`],
17117
+ ...parts.symbol === null ? [] : [`symbol=${parts.symbol}`]
17118
+ ];
17119
+ return written.length === 0 ? LEFTOVER_MARKER : `<!-- leftover ${written.join(" ")} --> ${LEFTOVER_MARKER}`;
17120
+ }
17045
17121
  function leftoverSentence(entry) {
17046
- return `Repair the ${entry.kind} leftover: ${escapeBlockerText(entry.what.trim())} ${LEFTOVER_MARKER}`;
17122
+ return `Repair the ${entry.kind} leftover: ${escapeBlockerText(entry.what.trim())} ${markersOf(entry)}`;
17047
17123
  }
17048
17124
  function leftoverBlocker(entry) {
17049
17125
  const artifact = entry.artifact === null || entry.artifact.trim().length === 0 ? "" : ` The artifact that showed it: ${entry.artifact.trim()}`;
@@ -17059,6 +17135,16 @@ function leftoverRepairTask(entry) {
17059
17135
  function isLeftoverRepairTask(text) {
17060
17136
  return LEFTOVER_REPAIR.test(text.trim());
17061
17137
  }
17138
+ function leftoverMarkerPartsIn(text) {
17139
+ const sentence = text.trim();
17140
+ if (!isLeftoverRepairTask(sentence))
17141
+ return null;
17142
+ const found = KEYED_MARKER.exec(sentence)?.[1];
17143
+ if (found === undefined)
17144
+ return null;
17145
+ const parts = new Map([...found.matchAll(MARKER_PART)].map((part) => [part[1], part[2] ?? null]));
17146
+ return { key: parts.get("key") ?? null, symbol: parts.get("symbol") ?? null };
17147
+ }
17062
17148
  function countIn(trackerContent) {
17063
17149
  return listTrackerTasks(trackerContent).filter((task) => isLeftoverRepairTask(parseTaskDeclaration(task.task).text)).length;
17064
17150
  }
@@ -17067,6 +17153,9 @@ function leftoverCap(retries) {
17067
17153
  }
17068
17154
  function insertLeftoverRepair(trackerPath, entry, retries) {
17069
17155
  const content = readFileSync22(trackerPath, "utf8");
17156
+ const joined = joinOf(content, entry);
17157
+ if (joined !== null)
17158
+ return joined;
17070
17159
  const cap = leftoverCap(retries);
17071
17160
  const count = countIn(content);
17072
17161
  if (count >= cap)
@@ -17074,12 +17163,146 @@ function insertLeftoverRepair(trackerPath, entry, retries) {
17074
17163
  const firstOpen = listTrackerTasks(content).find((task) => task.status !== "done")?.lineNum ?? null;
17075
17164
  return { inserted: true, line: insertTrackerTask(trackerPath, leftoverRepairTask(entry), firstOpen) };
17076
17165
  }
17166
+ function matchOf(held, wanted) {
17167
+ if (wanted.key !== null && held.key === wanted.key)
17168
+ return "key";
17169
+ if (wanted.symbol !== null && held.symbol === wanted.symbol)
17170
+ return "symbol";
17171
+ return null;
17172
+ }
17173
+ function joinOf(trackerContent, entry) {
17174
+ const wanted = leftoverMarkerPartsOf(entry);
17175
+ if (wanted.key === null && wanted.symbol === null)
17176
+ return null;
17177
+ for (const task of listTrackerTasks(trackerContent)) {
17178
+ if (task.status === "done")
17179
+ continue;
17180
+ const held = leftoverMarkerPartsIn(parseTaskDeclaration(task.task).text);
17181
+ const by = held === null ? null : matchOf(held, wanted);
17182
+ if (by !== null)
17183
+ return { inserted: false, joined: true, line: task.lineNum, by };
17184
+ }
17185
+ return null;
17186
+ }
17187
+
17188
+ // packages/rafa-pr/src/triage/own-check.ts
17189
+ import { basename as basename8, extname as extname2, isAbsolute as isAbsolute8 } from "path";
17190
+
17191
+ // packages/rafa-pr/src/triage/runner-evidence.ts
17192
+ import { readdirSync as readdirSync8, readFileSync as readFileSync23 } from "fs";
17193
+ import { join as join33 } from "path";
17194
+ var SUITE_DIR = "suite";
17195
+ var MIN_SHOWN_COMMIT = 7;
17196
+ var FULL_SHA = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
17197
+ var STEP_REPAIR = /^Repair the red (task|stage|pre-wrap-up) step at commit ([0-9a-f]+)$/;
17198
+ function namesIn(dir, directories) {
17199
+ try {
17200
+ return readdirSync8(dir, { withFileTypes: true }).filter((entry) => directories ? entry.isDirectory() : entry.isFile()).map((entry) => entry.name).sort();
17201
+ } catch (error) {
17202
+ if (error.code === "ENOENT")
17203
+ return null;
17204
+ return `the folder ${dir} could not be read: ${messageOf(error)}`;
17205
+ }
17206
+ }
17207
+ function captureNameOf(name) {
17208
+ if (!name.endsWith(RED_OUTPUT_SUFFIX))
17209
+ return null;
17210
+ const rest = name.slice(0, -RED_OUTPUT_SUFFIX.length);
17211
+ const dot = rest.lastIndexOf(".");
17212
+ if (dot <= 0)
17213
+ return null;
17214
+ const sha = rest.slice(dot + 1);
17215
+ return FULL_SHA.test(sha) ? { step: rest.slice(0, dot), sha } : null;
17216
+ }
17217
+ function wantedShas(at) {
17218
+ const all = [...at.head === null ? [] : [at.head], ...at.commits ?? []];
17219
+ return new Set(all.map((sha) => sha.trim().toLowerCase()));
17220
+ }
17221
+ function capturesIn(suite, wanted) {
17222
+ const names = namesIn(suite, false);
17223
+ if (names === null)
17224
+ return { captures: [], problems: [] };
17225
+ if (typeof names === "string")
17226
+ return { captures: [], problems: [names] };
17227
+ const captures = [];
17228
+ const problems = [];
17229
+ for (const name of names) {
17230
+ const found = captureNameOf(name);
17231
+ if (found === null || !wanted.has(found.sha))
17232
+ continue;
17233
+ const file = join33(suite, name);
17234
+ try {
17235
+ captures.push({ file, ...found, cases: failedCaseNamesIn(readFileSync23(file, "utf8")) });
17236
+ } catch (error) {
17237
+ problems.push(`the kept capture ${file} could not be read: ${messageOf(error)}`);
17238
+ }
17239
+ }
17240
+ return { captures, problems };
17241
+ }
17242
+ function readKeptCaptures(repoRoot, at) {
17243
+ const wanted = wantedShas(at);
17244
+ if (wanted.size === 0)
17245
+ return { captures: [], problems: [] };
17246
+ const root = runsDir(repoRoot);
17247
+ const sessions = namesIn(root, true);
17248
+ if (sessions === null)
17249
+ return { captures: [], problems: [] };
17250
+ if (typeof sessions === "string")
17251
+ return { captures: [], problems: [sessions] };
17252
+ const read = sessions.map((session) => capturesIn(join33(root, session, SUITE_DIR), wanted));
17253
+ return {
17254
+ captures: read.flatMap((one) => one.captures),
17255
+ problems: read.flatMap((one) => one.problems)
17256
+ };
17257
+ }
17258
+ function captureHolding(captures, name) {
17259
+ return captures.find((capture) => capture.cases.includes(name)) ?? null;
17260
+ }
17261
+ function stepRepairOf(task, sha) {
17262
+ const text = parseTaskDeclaration(task.task).text.trim();
17263
+ const found = STEP_REPAIR.exec(text);
17264
+ if (found === null)
17265
+ return null;
17266
+ const shown2 = found[2];
17267
+ if (shown2.length < MIN_SHOWN_COMMIT || !sha.startsWith(shown2))
17268
+ return null;
17269
+ return { line: task.lineNum, text, kind: found[1], shown: shown2 };
17270
+ }
17271
+ function stepRepairFor(trackerContent, sha) {
17272
+ const commit = sha.trim().toLowerCase();
17273
+ const found = listTrackerTasks(trackerContent).map((task) => stepRepairOf(task, commit)).filter((repair) => repair !== null);
17274
+ return found.at(-1) ?? null;
17275
+ }
17276
+
17277
+ // packages/rafa-pr/src/triage/symbols.ts
17278
+ var MIN_SYMBOL_LENGTH = 6;
17279
+ var ISSUE_REF = /#\d+\b/g;
17280
+ var SYMBOL_SHAPES = [
17281
+ /`([^`\n]+)`/g,
17282
+ /(?<!\p{L})'([^'\n]+)'/gu,
17283
+ /(?<!\p{L})"([^"\n]+)"/gu,
17284
+ /\(([^()\n]+)\)/g,
17285
+ /\b([a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+)\b/g,
17286
+ /\b([A-Z][a-z0-9]+(?:[A-Z][a-z0-9]*)+)\b/g,
17287
+ /\b([A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+)\b/g
17288
+ ];
17289
+ function foundBy(shape, text) {
17290
+ return [...text.matchAll(shape)].map((match) => ({
17291
+ symbol: (match[1] ?? "").trim(),
17292
+ index: match.index
17293
+ }));
17294
+ }
17295
+ function symbolsOf(entry) {
17296
+ const text = `${entry.what ?? ""}
17297
+ ${entry.artifact ?? ""}`.replace(ISSUE_REF, " ");
17298
+ const found = SYMBOL_SHAPES.flatMap((shape) => foundBy(shape, text)).filter(({ symbol }) => symbol.length >= MIN_SYMBOL_LENGTH).sort((a, b) => a.index - b.index);
17299
+ return [...new Set(found.map(({ symbol }) => symbol))];
17300
+ }
17077
17301
 
17078
17302
  // packages/rafa-pr/src/triage/own-check.ts
17079
- import { basename as basename8, isAbsolute as isAbsolute8 } from "path";
17080
17303
  var CHECKED_KINDS = ["bug", "own-fallout", "own-gap"];
17081
17304
  function answer2(kind, row, reason) {
17082
- return { kind, inherited: false, row, reason };
17305
+ return { kind, inherited: false, row, reason, symbol: null, capture: null };
17083
17306
  }
17084
17307
  function namedTestOf(entry) {
17085
17308
  const failure2 = testFailureOf(entry);
@@ -17106,25 +17329,86 @@ function checkTest(name, readings) {
17106
17329
  kind: "bug",
17107
17330
  inherited: true,
17108
17331
  row: "red-on-both",
17109
- reason: `The case ${name} is red on the plan's base and its head, so the plan inherited it.`
17332
+ reason: `The case ${name} is red on the plan's base and its head, so the plan inherited it.`,
17333
+ symbol: null,
17334
+ capture: null
17110
17335
  };
17111
17336
  }
17112
17337
  return answer2("own-fallout", "fallout", `The case ${name} is green on the plan's base and red on its head.`);
17113
17338
  }
17114
- function withoutDotSlash(path2) {
17115
- return path2.replace(/^(?:\.\/)+/, "");
17339
+ var SHOWN_COMMIT = 12;
17340
+ function checkCaptured(tested, name, captures) {
17341
+ if (tested.row === "red-on-both")
17342
+ return tested;
17343
+ const capture = captureHolding(captures, name);
17344
+ if (capture === null)
17345
+ return tested;
17346
+ if (tested.row === "fallout")
17347
+ return { ...tested, capture };
17348
+ const shown2 = capture.sha.slice(0, SHOWN_COMMIT);
17349
+ return {
17350
+ ...answer2("own-fallout", "step-capture", `The case ${name} is red in the ${capture.step} step's capture kept at commit ${shown2}, so it reads as own-fallout.`),
17351
+ capture
17352
+ };
17116
17353
  }
17117
- function isPlanFile(path2, files) {
17118
- const named = withoutDotSlash(path2);
17354
+ var RELATIVE_PREFIX = /^(?:\.\.?\/)+/;
17355
+ var HAS_EXTENSION = /\.[^./]+$/;
17356
+ var SOURCE_EXTENSIONS = new Map([
17357
+ [".js", ".ts"],
17358
+ [".mjs", ".mts"],
17359
+ [".jsx", ".tsx"]
17360
+ ]);
17361
+ function namesFile(path2) {
17362
+ return HAS_EXTENSION.test(path2.split("/").at(-1) ?? "");
17363
+ }
17364
+ function spellingsOf(path2) {
17365
+ const emitted = extname2(path2);
17366
+ const source = SOURCE_EXTENSIONS.get(emitted);
17367
+ return source === undefined ? [path2] : [path2, `${path2.slice(0, -emitted.length)}${source}`];
17368
+ }
17369
+ function isPlanSpelling(named, relative10, files) {
17119
17370
  if (files.includes(named))
17120
17371
  return true;
17372
+ if (relative10)
17373
+ return files.some((file) => file.endsWith(`/${named}`));
17121
17374
  if (isAbsolute8(named))
17122
17375
  return files.some((file) => named.endsWith(`/${file}`));
17123
17376
  return !named.includes("/") && files.some((file) => basename8(file) === named);
17124
17377
  }
17378
+ function isPlanFile(path2, files) {
17379
+ const relative10 = RELATIVE_PREFIX.test(path2);
17380
+ const named = path2.replace(RELATIVE_PREFIX, "");
17381
+ return spellingsOf(named).some((spelling) => isPlanSpelling(spelling, relative10, files));
17382
+ }
17383
+ var IDENTIFIER_CHAR = /[\p{L}\p{N}_$]/u;
17384
+ var REGEXP_SYNTAX = /[.*+?^${}()|[\]\\/]/g;
17385
+ function symbolPattern(symbol) {
17386
+ const before = IDENTIFIER_CHAR.test(symbol.at(0) ?? "") ? "(?<![\\p{L}\\p{N}_$])" : "";
17387
+ const after = IDENTIFIER_CHAR.test(symbol.at(-1) ?? "") ? "(?![\\p{L}\\p{N}_$])" : "";
17388
+ return new RegExp(`${before}${symbol.replace(REGEXP_SYNTAX, "\\$&")}${after}`, "u");
17389
+ }
17390
+ function addedSymbolOf(entry, added) {
17391
+ return symbolsOf(entry).find((symbol) => {
17392
+ const pattern = symbolPattern(symbol);
17393
+ return added.some((line) => pattern.test(line));
17394
+ }) ?? null;
17395
+ }
17396
+ function checkOutside(entry, outside, planFiles, text) {
17397
+ const outsideAnswer = answer2("bug", "file-outside-plan", `${outside} is not one of the plan's files, so it reads as a bug.`);
17398
+ if (planFiles.added === null || testFilesIn(text).length > 0)
17399
+ return outsideAnswer;
17400
+ const symbol = addedSymbolOf(entry, planFiles.added);
17401
+ if (symbol === null)
17402
+ return outsideAnswer;
17403
+ return {
17404
+ ...answer2("own-gap", "plan-symbol", `${outside} is not one of the plan's files, but the plan's commits added ${symbol}, so it reads as own-gap.`),
17405
+ symbol
17406
+ };
17407
+ }
17125
17408
  function checkFiles(entry, planFiles) {
17126
- const paths = pathsNamedIn(`${entry.what ?? ""}
17127
- ${entry.artifact ?? ""}`);
17409
+ const text = `${entry.what ?? ""}
17410
+ ${entry.artifact ?? ""}`;
17411
+ const paths = pathsNamedIn(text).filter(namesFile);
17128
17412
  if (paths.length === 0) {
17129
17413
  return answer2(entry.kind, "nothing-named", "The entry names no test case and no path, so it is taken as said.");
17130
17414
  }
@@ -17132,9 +17416,8 @@ ${entry.artifact ?? ""}`);
17132
17416
  return answer2("bug", "files-unread", `The plan's files were not read, so it reads as a bug. ${planFiles.problem}`);
17133
17417
  }
17134
17418
  const outside = paths.find((path2) => !isPlanFile(path2, planFiles.files));
17135
- if (outside !== undefined) {
17136
- return answer2("bug", "file-outside-plan", `${outside} is not one of the plan's files, so it reads as a bug.`);
17137
- }
17419
+ if (outside !== undefined)
17420
+ return checkOutside(entry, outside, planFiles, text);
17138
17421
  return answer2("own-gap", "plan-files", "Every path the entry names is one of the plan's files.");
17139
17422
  }
17140
17423
  function checkKind2(input) {
@@ -17145,7 +17428,8 @@ function checkKind2(input) {
17145
17428
  const failure2 = testFailureOf(entry);
17146
17429
  if (failure2 === null)
17147
17430
  return checkFiles(entry, input.planFiles);
17148
- return checkTest(failure2.name, failure2.file === null ? null : input.readings);
17431
+ const tested = checkTest(failure2.name, failure2.file === null ? null : input.readings);
17432
+ return checkCaptured(tested, failure2.name, input.captures ?? []);
17149
17433
  }
17150
17434
 
17151
17435
  // packages/rafa-pr/src/triage/kind-route.ts
@@ -17210,21 +17494,47 @@ function routeDocs(entry, context) {
17210
17494
  });
17211
17495
  }
17212
17496
  }
17213
- function routeLeftover(entry, kind, trackerPath, retries) {
17214
- const artifact = artifactOf(entry.bug);
17497
+ function stepRepairOf2(capture, trackerPath) {
17498
+ if (capture === null)
17499
+ return null;
17500
+ let content;
17215
17501
  try {
17216
- const inserted = insertLeftoverRepair(trackerPath, {
17217
- kind,
17218
- what: entry.redact(entry.what),
17219
- artifact: artifact === null ? null : entry.redact(artifact)
17220
- }, retries);
17221
- return inserted.inserted ? settledRow(entry, "public", "repair", kind, { repairLine: inserted.line }) : settledRow(entry, "public", "follow-up", kind);
17502
+ content = readFileSync24(trackerPath, "utf8");
17503
+ } catch {
17504
+ return null;
17505
+ }
17506
+ return stepRepairFor(content, capture.sha);
17507
+ }
17508
+ function routeLeftover(entry, check, trackerPath, retries) {
17509
+ const { kind } = check;
17510
+ const joined = stepRepairOf2(check.capture, trackerPath);
17511
+ if (joined !== null)
17512
+ return settledRow(entry, "public", "repair", kind, { repairLine: joined.line, joined: true });
17513
+ try {
17514
+ return leftoverRow(entry, kind, insertLeftoverRepair(trackerPath, leftoverEntryOf(entry, check, trackerPath), retries));
17222
17515
  } catch (error) {
17223
17516
  return settledRow(entry, "public", "follow-up", kind, {
17224
17517
  problem: entry.redact(`out_of_scope_bugs[${entry.index}]: the repair task was not inserted, so it is a follow-up: ${messageOf(error)}`)
17225
17518
  });
17226
17519
  }
17227
17520
  }
17521
+ function leftoverEntryOf(entry, check, trackerPath) {
17522
+ const reported = artifactOf(entry.bug);
17523
+ const artifact = reported === null ? null : entry.redact(reported);
17524
+ const what = entry.redact(entry.what);
17525
+ return {
17526
+ kind: check.kind,
17527
+ what,
17528
+ artifact,
17529
+ key: artifact === null ? null : bugKeyOf(trackerPath, artifact, what),
17530
+ symbol: check.symbol === null ? null : entry.redact(check.symbol)
17531
+ };
17532
+ }
17533
+ function leftoverRow(entry, kind, done) {
17534
+ if (done.inserted)
17535
+ return settledRow(entry, "public", "repair", kind, { repairLine: done.line });
17536
+ return "joined" in done ? settledRow(entry, "public", "repair", kind, { repairLine: done.line, joined: true }) : settledRow(entry, "public", "follow-up", kind);
17537
+ }
17228
17538
  function routeChecked(entry, check, context, options) {
17229
17539
  switch (check.kind) {
17230
17540
  case "bug":
@@ -17239,7 +17549,7 @@ function routeChecked(entry, check, context, options) {
17239
17549
  return settledRow(entry, "public", "pr-body", "convention");
17240
17550
  case "own-fallout":
17241
17551
  case "own-gap":
17242
- return routeLeftover(entry, check.kind, context.trackerPath, options.retries);
17552
+ return routeLeftover(entry, { ...check, kind: check.kind }, context.trackerPath, options.retries);
17243
17553
  }
17244
17554
  }
17245
17555
  async function routeByKind(entry, context) {
@@ -17248,11 +17558,22 @@ async function routeByKind(entry, context) {
17248
17558
  return KINDS_OFF;
17249
17559
  if (entry.bug.security !== false)
17250
17560
  return { settled: false, kind: entry.bug.kind, inherited: false };
17251
- return routeChecked(entry, await checkedKindOf(entry.bug, options), context, options);
17561
+ return routeChecked(entry, await checkedKindOf(entry.bug, options, context.repoRoot), context, options);
17562
+ }
17563
+ var NO_CAPTURES = Object.freeze({ captures: [], problems: [] });
17564
+ function capturesOf(bug, options, repoRoot) {
17565
+ if (repoRoot === undefined || !CHECKED_KINDS.includes(bug.kind) || testFailureOf(bug) === null)
17566
+ return NO_CAPTURES;
17567
+ return readKeptCaptures(repoRoot, {
17568
+ head: options.head,
17569
+ commits: options.planFiles.ok ? options.planFiles.commits : null
17570
+ });
17252
17571
  }
17253
- async function checkedKindOf(bug, options) {
17572
+ async function checkedKindOf(bug, options, repoRoot) {
17254
17573
  const readings = await readingsOf(bug, options);
17255
- return checkKind2({ entry: bug, readings, planFiles: options.planFiles });
17574
+ const kept = capturesOf(bug, options, repoRoot);
17575
+ const check = checkKind2({ entry: bug, readings, planFiles: options.planFiles, captures: kept.captures });
17576
+ return kept.problems.length === 0 ? check : { ...check, reason: `${check.reason} Kept captures skipped: ${kept.problems.join("; ")}.` };
17256
17577
  }
17257
17578
  // packages/rafa-pr/src/triage/plan-commits.ts
17258
17579
  var REMOTE3 = "origin";
@@ -17274,6 +17595,33 @@ function readPlanBase(git, base2) {
17274
17595
  problem: said === "" ? `HEAD shares no history with ${remoteBase}.` : saying(`Could not read the merge base of HEAD and ${remoteBase}`, said)
17275
17596
  };
17276
17597
  }
17598
+ function addedLinesOf(patch) {
17599
+ const added = [];
17600
+ let inHunk = false;
17601
+ for (const line of patch.split(`
17602
+ `)) {
17603
+ if (line.startsWith("diff --git "))
17604
+ inHunk = false;
17605
+ else if (line.startsWith("@@"))
17606
+ inHunk = true;
17607
+ else if (inHunk && line.startsWith("+"))
17608
+ added.push(line.slice(1));
17609
+ }
17610
+ return added;
17611
+ }
17612
+ function readAdded(git, planBase) {
17613
+ const read = git(["diff", "-U0", "--no-color", planBase, "HEAD", "--"]);
17614
+ return read.ok ? { added: addedLinesOf(read.stdout), addedProblem: null } : { added: null, addedProblem: saying(`Could not read the lines added between ${planBase} and HEAD`, gitSaid(read)) };
17615
+ }
17616
+ function readCommits(git, planBase) {
17617
+ const read = git(["rev-list", `${planBase}..HEAD`]);
17618
+ if (!read.ok) {
17619
+ return { commits: null, commitsProblem: saying(`Could not list the commits between ${planBase} and HEAD`, gitSaid(read)) };
17620
+ }
17621
+ const commits = read.stdout.split(`
17622
+ `).filter((sha) => sha !== "");
17623
+ return { commits, commitsProblem: null };
17624
+ }
17277
17625
  function readPlanFiles(git, planBase) {
17278
17626
  if (planBase.trim() === "")
17279
17627
  return { ok: false, problem: "No plan base was given to read the plan's files from." };
@@ -17282,7 +17630,7 @@ function readPlanFiles(git, planBase) {
17282
17630
  return { ok: false, problem: saying(`Could not list the files changed between ${planBase} and HEAD`, gitSaid(read)) };
17283
17631
  }
17284
17632
  const files = read.stdout.split("\x00").filter((path2) => path2 !== "");
17285
- return { ok: true, files };
17633
+ return { ok: true, files, ...readAdded(git, planBase), ...readCommits(git, planBase) };
17286
17634
  }
17287
17635
  // packages/rafa-pr/src/triage/similarity.ts
17288
17636
  import { basename as basename9 } from "path";
@@ -17392,7 +17740,7 @@ function rankedCandidates(report2, record, openBugs, weights) {
17392
17740
  }
17393
17741
  // packages/rafa-pr/src/triage/triage.ts
17394
17742
  import { homedir as homedir8 } from "os";
17395
- import { join as join34 } from "path";
17743
+ import { join as join35 } from "path";
17396
17744
 
17397
17745
  // packages/rafa/src/effort/store/machine-fault.ts
17398
17746
  var BUILD_FAILURE = /\b(?:abort(?:ed|s)?|broke|broken|crash(?:ed|es)?|error|errors|fail(?:ed|ing|s|ure|ures)?|unusable)\b/iu;
@@ -17497,7 +17845,7 @@ function nonBlankText(value) {
17497
17845
  return `is ${describeValue3(value)}, not a string`;
17498
17846
  return value.trim().length === 0 ? "is blank" : null;
17499
17847
  }
17500
- function textOrNull(value) {
17848
+ function textOrNull2(value) {
17501
17849
  return value === null || typeof value === "string" ? null : `is ${describeValue3(value)}, not a string or null`;
17502
17850
  }
17503
17851
  function optionalText3(value) {
@@ -17510,7 +17858,7 @@ var REF_FIELDS = [
17510
17858
  ["opt", safeInteger],
17511
17859
  ["kind", nonBlankText],
17512
17860
  ["externalId", nonBlankText],
17513
- ["url", textOrNull],
17861
+ ["url", textOrNull2],
17514
17862
  ["module", optionalText3],
17515
17863
  ["repo", optionalText3]
17516
17864
  ];
@@ -17626,22 +17974,22 @@ function readTrackerRef(repoRoot, artifact) {
17626
17974
  import { relative as relative11, resolve as resolve14, sep as sep4 } from "path";
17627
17975
 
17628
17976
  // packages/rafa/src/project/package-of.ts
17629
- import { existsSync as existsSync22, readFileSync as readFileSync23 } from "fs";
17630
- import { dirname as dirname13, isAbsolute as isAbsolute9, join as join33, relative as relative10, resolve as resolve13 } from "path";
17977
+ import { existsSync as existsSync22, readFileSync as readFileSync25 } from "fs";
17978
+ import { dirname as dirname13, isAbsolute as isAbsolute9, join as join34, relative as relative10, resolve as resolve13 } from "path";
17631
17979
  var DISK_PACKAGE_FILE_SYSTEM = Object.freeze({
17632
17980
  exists: (path2) => existsSync22(path2),
17633
- readFile: (path2) => readFileSync23(path2, "utf8")
17981
+ readFile: (path2) => readFileSync25(path2, "utf8")
17634
17982
  });
17635
17983
  var PACKAGE_MANIFESTS = Object.freeze(["package.json"]);
17636
17984
  function isInside2(root, path2) {
17637
17985
  const steps = relative10(root, path2);
17638
17986
  return steps === "" || !steps.startsWith("..") && !isAbsolute9(steps);
17639
17987
  }
17640
- function textOrNull2(value) {
17988
+ function textOrNull3(value) {
17641
17989
  return typeof value === "string" && value.trim() !== "" ? value : null;
17642
17990
  }
17643
17991
  function ownerAt(dir, root, fs2) {
17644
- const file = PACKAGE_MANIFESTS.map((name) => join33(dir, name)).find((path2) => fs2.exists(path2));
17992
+ const file = PACKAGE_MANIFESTS.map((name) => join34(dir, name)).find((path2) => fs2.exists(path2));
17645
17993
  if (file === undefined)
17646
17994
  return null;
17647
17995
  try {
@@ -17649,8 +17997,8 @@ function ownerAt(dir, root, fs2) {
17649
17997
  if (typeof manifest !== "object" || manifest === null)
17650
17998
  return null;
17651
17999
  const { name, version } = manifest;
17652
- const named = textOrNull2(name);
17653
- return named === null ? null : { name: named, version: textOrNull2(version), dir: relative10(root, dir) || "." };
18000
+ const named = textOrNull3(name);
18001
+ return named === null ? null : { name: named, version: textOrNull3(version), dir: relative10(root, dir) || "." };
17654
18002
  } catch {
17655
18003
  return null;
17656
18004
  }
@@ -17903,10 +18251,10 @@ function triageStaleDocs(staleDocs, redact) {
17903
18251
  }
17904
18252
 
17905
18253
  // packages/rafa-pr/src/triage/triage.ts
17906
- var PRIVATE_TRIAGE_DIR = join34(".rafa", "triage", "private");
18254
+ var PRIVATE_TRIAGE_DIR = join35(".rafa", "triage", "private");
17907
18255
  var BLOCKER_SEPARATOR = "; ";
17908
18256
  function privateTriageDir(repoRoot) {
17909
- return join34(repoRoot, PRIVATE_TRIAGE_DIR);
18257
+ return join35(repoRoot, PRIVATE_TRIAGE_DIR);
17910
18258
  }
17911
18259
  function createPrivateTriageTracker(repoRoot, options = {}) {
17912
18260
  return createLocalTracker({
@@ -18024,13 +18372,13 @@ function resultOf(run, action, fields = {}) {
18024
18372
  ...fields
18025
18373
  };
18026
18374
  }
18027
- async function settle(run, action, ref2, foundBy, supersedes) {
18375
+ async function settle(run, action, ref2, foundBy2, supersedes) {
18028
18376
  const { store } = run.route;
18029
18377
  const { key } = run.filing;
18030
18378
  if (store === null || key === null)
18031
- return resultOf(run, action, { ref: ref2, foundBy });
18379
+ return resultOf(run, action, { ref: ref2, foundBy: foundBy2 });
18032
18380
  const stored = await step(run, "storing the reference", () => store(key, ref2, supersedes));
18033
- return stored.ok ? resultOf(run, action, { ref: ref2, foundBy, stored: stored.value }) : resultOf(run, action, { ref: ref2, foundBy, problem: stored.problem });
18381
+ return stored.ok ? resultOf(run, action, { ref: ref2, foundBy: foundBy2, stored: stored.value }) : resultOf(run, action, { ref: ref2, foundBy: foundBy2, problem: stored.problem });
18034
18382
  }
18035
18383
  async function fileNew(run, extras = {}) {
18036
18384
  const { filing } = run;
@@ -18038,11 +18386,11 @@ async function fileNew(run, extras = {}) {
18038
18386
  const created = await step(run, `the ${run.route.channel} tracker create`, () => run.route.tracker.create(draft));
18039
18387
  return created.ok ? settle(run, "filed", created.value, null, extras.supersedes) : resultOf(run, "failed", { problem: created.problem });
18040
18388
  }
18041
- async function commentOn(run, ref2, foundBy, action = "commented", comment = run.filing.comment) {
18389
+ async function commentOn(run, ref2, foundBy2, action = "commented", comment = run.filing.comment) {
18042
18390
  const commented = await step(run, `the ${run.route.channel} tracker comment`, () => run.route.tracker.comment(ref2, comment));
18043
18391
  if (!commented.ok)
18044
- return resultOf(run, "failed", { ref: ref2, foundBy, problem: commented.problem });
18045
- return foundBy === "store" ? resultOf(run, action, { ref: ref2, foundBy }) : settle(run, action, ref2, foundBy);
18392
+ return resultOf(run, "failed", { ref: ref2, foundBy: foundBy2, problem: commented.problem });
18393
+ return foundBy2 === "store" ? resultOf(run, action, { ref: ref2, foundBy: foundBy2 }) : settle(run, action, ref2, foundBy2);
18046
18394
  }
18047
18395
  async function lookUp2(run, key, searchText) {
18048
18396
  const { route, filing } = run;
@@ -18067,13 +18415,13 @@ async function lookUp2(run, key, searchText) {
18067
18415
  };
18068
18416
  }
18069
18417
  var COMPLETED_ISSUE_STATES = ["done", "released"];
18070
- async function answerRecurrence(run, { ref: ref2, foundBy }) {
18418
+ async function answerRecurrence(run, { ref: ref2, foundBy: foundBy2 }) {
18071
18419
  if (!run.route.readsState)
18072
- return commentOn(run, ref2, foundBy);
18420
+ return commentOn(run, ref2, foundBy2);
18073
18421
  const issue4 = await step(run, `the ${run.route.channel} tracker get`, () => run.route.tracker.get(ref2));
18074
18422
  if (!issue4.ok)
18075
- return resultOf(run, "failed", { ref: ref2, foundBy, problem: issue4.problem });
18076
- return COMPLETED_ISSUE_STATES.includes(issue4.value.state) ? fileNew(run, { supersedes: ref2 }) : commentOn(run, ref2, foundBy);
18423
+ return resultOf(run, "failed", { ref: ref2, foundBy: foundBy2, problem: issue4.problem });
18424
+ return COMPLETED_ISSUE_STATES.includes(issue4.value.state) ? fileNew(run, { supersedes: ref2 }) : commentOn(run, ref2, foundBy2);
18077
18425
  }
18078
18426
  async function commentOnNearest(run, nearest, threshold) {
18079
18427
  const opening = similarCommentOpening(nearest.score, threshold);
@@ -18114,13 +18462,13 @@ async function triageInherited(run, commented) {
18114
18462
  return resultOf(run, "failed", { problem: found.problem });
18115
18463
  if (found.value === null)
18116
18464
  return resultOf(run, "inherited");
18117
- const { ref: ref2, foundBy } = found.value;
18465
+ const { ref: ref2, foundBy: foundBy2 } = found.value;
18118
18466
  const issue4 = await step(run, `the ${run.route.channel} tracker get`, () => run.route.tracker.get(ref2));
18119
18467
  if (!issue4.ok)
18120
- return resultOf(run, "failed", { ref: ref2, foundBy, problem: issue4.problem });
18468
+ return resultOf(run, "failed", { ref: ref2, foundBy: foundBy2, problem: issue4.problem });
18121
18469
  if (!isOpenIssueState(issue4.value.state))
18122
18470
  return resultOf(run, "inherited");
18123
- const result = await commentOn(run, ref2, foundBy, "inherited");
18471
+ const result = await commentOn(run, ref2, foundBy2, "inherited");
18124
18472
  if (result.action === "inherited")
18125
18473
  commented.add(key);
18126
18474
  return result;
@@ -18613,10 +18961,10 @@ var REMOTE_BRANCH_FORMAT = [
18613
18961
 
18614
18962
  // packages/rafa-run/src/start/loop-events.ts
18615
18963
  import { appendFileSync, mkdirSync as mkdirSync5 } from "fs";
18616
- import { join as join35 } from "path";
18964
+ import { join as join36 } from "path";
18617
18965
 
18618
18966
  // packages/rafa-run/src/start/suite-blocker.ts
18619
- import { readFileSync as readFileSync24, writeFileSync as writeFileSync8 } from "fs";
18967
+ import { readFileSync as readFileSync26, writeFileSync as writeFileSync8 } from "fs";
18620
18968
 
18621
18969
  // packages/rafa-run/src/start/suite-outside-case.ts
18622
18970
  import { constants } from "os";
@@ -18862,7 +19210,7 @@ function blockRepairAgain(trackerPath, content, line, blocker) {
18862
19210
  return writeTrackerBlocker(trackerPath, line, blocker) ? { line, inserted: false } : null;
18863
19211
  }
18864
19212
  function writeRepairTask(trackerPath, blocker, site) {
18865
- const content = readFileSync24(trackerPath, "utf8");
19213
+ const content = readFileSync26(trackerPath, "utf8");
18866
19214
  const { tasks } = parsePlan(content);
18867
19215
  const existing = existingRepairOf(tasks, site);
18868
19216
  if (existing !== null)
@@ -18934,7 +19282,7 @@ function eventsFilePath(root, sessionId) {
18934
19282
  if (!isSessionId(sessionId)) {
18935
19283
  throw new Error(`events file: unusable session id ${JSON.stringify(sessionId)}`);
18936
19284
  }
18937
- return join35(runsDir(root), `${sessionId}${EVENTS_EXTENSION}`);
19285
+ return join36(runsDir(root), `${sessionId}${EVENTS_EXTENSION}`);
18938
19286
  }
18939
19287
  function bindEventsFile(root, sessionId, warn2 = (line) => {
18940
19288
  process.stderr.write(line);
@@ -18985,7 +19333,7 @@ function injectionPlace(trackerContent, taskInfo) {
18985
19333
  }
18986
19334
  async function taskTokens(checkout, sessionId, home) {
18987
19335
  try {
18988
- const { usage } = await readSessionLog(join35(sessionLogDir(checkout, home), `${sessionId}.jsonl`));
19336
+ const { usage } = await readSessionLog(join36(sessionLogDir(checkout, home), `${sessionId}.jsonl`));
18989
19337
  return usage.inputTokens + usage.cacheCreationInputTokens + usage.outputTokens;
18990
19338
  } catch {
18991
19339
  return null;
@@ -19528,7 +19876,7 @@ function refuseArgumentAliases(args) {
19528
19876
  }
19529
19877
  }
19530
19878
  }
19531
- function spellingsOf(flags) {
19879
+ function spellingsOf2(flags) {
19532
19880
  const owners = new Map;
19533
19881
  const claim = (spelling, name) => {
19534
19882
  const owner = owners.get(spelling);
@@ -19582,7 +19930,7 @@ function readLine2(argv, record) {
19582
19930
  function parseArgs(argv, spec = {}) {
19583
19931
  const { args = [], flags: flagSpecs = [] } = spec;
19584
19932
  refuseArgumentAliases(args);
19585
- const spellings = spellingsOf(flagSpecs);
19933
+ const spellings = spellingsOf2(flagSpecs);
19586
19934
  const flags = {};
19587
19935
  const positional = readLine2(argv, (spelling, value) => {
19588
19936
  flags[spellings.get(spelling) ?? spelling] = value;
@@ -19604,21 +19952,21 @@ function parseArgs(argv, spec = {}) {
19604
19952
  import { rmSync as rmSync5 } from "fs";
19605
19953
 
19606
19954
  // packages/rafa-run/src/plan/list.ts
19607
- import { existsSync as existsSync24, readdirSync as readdirSync8, readFileSync as readFileSync25 } from "fs";
19608
- import { join as join36 } from "path";
19955
+ import { existsSync as existsSync24, readdirSync as readdirSync9, readFileSync as readFileSync27 } from "fs";
19956
+ import { join as join37 } from "path";
19609
19957
  function listing(dir, stub) {
19610
- const plan = join36(dir, planFileName(stub, false));
19611
- const trackerPath = join36(dir, planFileName(stub, true));
19958
+ const plan = join37(dir, planFileName(stub, false));
19959
+ const trackerPath = join37(dir, planFileName(stub, true));
19612
19960
  const tracker = isFile(trackerPath) ? trackerPath : null;
19613
- const planModel = parsePlan(readFileSync25(plan, "utf8"));
19614
- const counted4 = tracker === null ? planModel : parsePlan(readFileSync25(tracker, "utf8"));
19961
+ const planModel = parsePlan(readFileSync27(plan, "utf8"));
19962
+ const counted4 = tracker === null ? planModel : parsePlan(readFileSync27(tracker, "utf8"));
19615
19963
  return { stub, plan, tracker, tasks: countTasks(counted4.tasks), issues: planModel.issues.length };
19616
19964
  }
19617
19965
  function listPlans(plans) {
19618
19966
  const dir = plans.path;
19619
19967
  if (!existsSync24(dir))
19620
19968
  return { dir, plans: [] };
19621
- const stubs = readdirSync8(dir).filter((name) => isFile(join36(dir, name))).map((name) => stubOfPlanFile(name)).filter((stub) => stub !== null).sort((a, b) => a.localeCompare(b));
19969
+ const stubs = readdirSync9(dir).filter((name) => isFile(join37(dir, name))).map((name) => stubOfPlanFile(name)).filter((stub) => stub !== null).sort((a, b) => a.localeCompare(b));
19622
19970
  return { dir, plans: stubs.map((stub) => listing(dir, stub)) };
19623
19971
  }
19624
19972
 
@@ -20969,11 +21317,11 @@ function storeRuleLine(file, problem) {
20969
21317
  return `${file}:${String(problem.line)}: ${problem.kind}: ${problem.text}`;
20970
21318
  }
20971
21319
  // packages/rafa-run/src/preflight/first-dispatch.ts
20972
- import { readFileSync as readFileSync26 } from "fs";
21320
+ import { readFileSync as readFileSync28 } from "fs";
20973
21321
  var TICKED_TASK = /^- \[[xX]\] (.+)/;
20974
21322
  function readIfReadable(path3) {
20975
21323
  try {
20976
- return readFileSync26(path3, "utf8");
21324
+ return readFileSync28(path3, "utf8");
20977
21325
  } catch {
20978
21326
  return null;
20979
21327
  }
@@ -20999,14 +21347,14 @@ function isFirstDispatch(planPath) {
20999
21347
  return tracker === null || !hasTickedTask(tracker);
21000
21348
  }
21001
21349
  // packages/rafa/src/project/bin-path.ts
21002
- import { delimiter as delimiter2, isAbsolute as isAbsolute10, join as join37, resolve as resolve15 } from "path";
21003
- var RAFA_BIN_DIR = join37(SCOPE_DIR, "bin");
21004
- var BUN_BIN_DIR = join37(".bun", "bin");
21350
+ import { delimiter as delimiter2, isAbsolute as isAbsolute10, join as join38, resolve as resolve15 } from "path";
21351
+ var RAFA_BIN_DIR = join38(SCOPE_DIR, "bin");
21352
+ var BUN_BIN_DIR = join38(".bun", "bin");
21005
21353
 
21006
21354
  // packages/rafa-run/src/start/runtime.ts
21007
- import { existsSync as existsSync25, readdirSync as readdirSync9, realpathSync as realpathSync2, statSync as statSync8 } from "fs";
21355
+ import { existsSync as existsSync25, readdirSync as readdirSync10, realpathSync as realpathSync2, statSync as statSync8 } from "fs";
21008
21356
  import { homedir as homedir9 } from "os";
21009
- import { isAbsolute as isAbsolute11, join as join38, relative as relative13, resolve as resolve16, sep as sep5 } from "path";
21357
+ import { isAbsolute as isAbsolute11, join as join39, relative as relative13, resolve as resolve16, sep as sep5 } from "path";
21010
21358
 
21011
21359
  // packages/rafa-run/src/start/session.ts
21012
21360
  import { randomUUID as randomUUID6 } from "crypto";
@@ -21252,7 +21600,7 @@ function resolveRuntime(value, places) {
21252
21600
  throw refusal4([`\u274C Refusing to start: \`--runtime\` names no runtime. Spell it ${SPELLING}.`]);
21253
21601
  }
21254
21602
  const isVersion = VERSION_SHAPE2.test(value);
21255
- const named = isVersion ? join38(places.home, RUNTIME_SUBDIR, value, RUNTIME_ENTRY) : resolve16(places.cwd, value);
21603
+ const named = isVersion ? join39(places.home, RUNTIME_SUBDIR, value, RUNTIME_ENTRY) : resolve16(places.cwd, value);
21256
21604
  refuseInsideSource(value, named, places);
21257
21605
  const entry = entryOf2(value, named, isVersion, places.home);
21258
21606
  const real = realpathSync2(entry);
@@ -21263,7 +21611,7 @@ function entryOf2(value, named, isVersion, home) {
21263
21611
  if (isVersion) {
21264
21612
  if (isFile4(named))
21265
21613
  return named;
21266
- const root = join38(home, RUNTIME_SUBDIR);
21614
+ const root = join39(home, RUNTIME_SUBDIR);
21267
21615
  const installed = installedVersions(root);
21268
21616
  throw refusal4([
21269
21617
  `\u274C Refusing to start: \`--runtime=${value}\` names no installed runtime: ${named} is no file.`,
@@ -21272,7 +21620,7 @@ function entryOf2(value, named, isVersion, home) {
21272
21620
  }
21273
21621
  if (isFile4(named))
21274
21622
  return named;
21275
- const inside = join38(named, RUNTIME_ENTRY);
21623
+ const inside = join39(named, RUNTIME_ENTRY);
21276
21624
  if (isDirectory(named) && isFile4(inside))
21277
21625
  return inside;
21278
21626
  throw refusal4([
@@ -21290,7 +21638,7 @@ function refuseInsideSource(value, path3, places) {
21290
21638
  ]);
21291
21639
  }
21292
21640
  function sourceDirs({ cwd, root }) {
21293
- const dirs = [join38(cwd, SOURCE_DIR), join38(root, SOURCE_DIR)];
21641
+ const dirs = [join39(cwd, SOURCE_DIR), join39(root, SOURCE_DIR)];
21294
21642
  const real = dirs.filter((dir) => existsSync25(dir)).map((dir) => realpathSync2(dir));
21295
21643
  return [...new Set([...dirs, ...real])];
21296
21644
  }
@@ -21300,7 +21648,7 @@ function isInside3(path3, dir) {
21300
21648
  }
21301
21649
  function installedVersions(root) {
21302
21650
  try {
21303
- return readdirSync9(root).filter((name) => isFile4(join38(root, name, RUNTIME_ENTRY))).sort((a, b) => a.localeCompare(b));
21651
+ return readdirSync10(root).filter((name) => isFile4(join39(root, name, RUNTIME_ENTRY))).sort((a, b) => a.localeCompare(b));
21304
21652
  } catch {
21305
21653
  return [];
21306
21654
  }
@@ -21639,7 +21987,7 @@ function haltIfWrapUpMoved(options, seams = {}) {
21639
21987
  }
21640
21988
  // packages/rafa/src/project/roots.ts
21641
21989
  import { spawnSync as spawnSync2 } from "child_process";
21642
- import { accessSync, constants as constants2, readFileSync as readFileSync27, statSync as statSync9 } from "fs";
21990
+ import { accessSync, constants as constants2, readFileSync as readFileSync29, statSync as statSync9 } from "fs";
21643
21991
  var REFUSED_ROOTS = Object.freeze([
21644
21992
  { path: "/", why: "is the filesystem root" },
21645
21993
  { path: "/var", why: "holds system state" },
@@ -21657,7 +22005,7 @@ var MONOREPO_MARKER_FILES = Object.freeze([
21657
22005
  ]);
21658
22006
  var DISK_ROOTS_FILE_SYSTEM = Object.freeze({
21659
22007
  ...DISK_FILE_SYSTEM,
21660
- readFile: (path3) => readFileSync27(path3, "utf8"),
22008
+ readFile: (path3) => readFileSync29(path3, "utf8"),
21661
22009
  isDirectory: (path3) => statSync9(path3).isDirectory(),
21662
22010
  assertWritable: (path3) => accessSync(path3, constants2.W_OK)
21663
22011
  });
@@ -21930,8 +22278,8 @@ function parseDecision(output) {
21930
22278
  }
21931
22279
 
21932
22280
  // packages/rafa-run/src/start/decision-prompt.ts
21933
- import { existsSync as existsSync27, readFileSync as readFileSync28 } from "fs";
21934
- import { dirname as dirname14, join as join39, resolve as resolve17 } from "path";
22281
+ import { existsSync as existsSync27, readFileSync as readFileSync30 } from "fs";
22282
+ import { dirname as dirname14, join as join40, resolve as resolve17 } from "path";
21935
22283
  import { fileURLToPath as fileURLToPath4 } from "url";
21936
22284
  var MODULE_DIR4 = dirname14(fileURLToPath4(import.meta.url));
21937
22285
  var DECISION_PROMPT_FILE = "continue-decision-prompt.md";
@@ -21955,7 +22303,7 @@ function chooseRetrySections(template, retriesLeft) {
21955
22303
  var NO_HOLDS = "(no reason was recorded)";
21956
22304
  var NO_OPEN_TASKS = "(no open task is left)";
21957
22305
  function bundledCandidates(file, moduleDir = MODULE_DIR4) {
21958
- return [join39(moduleDir, file), join39(moduleDir, "..", "..", "..", "..", "src", file)];
22306
+ return [join40(moduleDir, file), join40(moduleDir, "..", "..", "..", "..", "src", file)];
21959
22307
  }
21960
22308
  function readBundledFile(file, moduleDir = MODULE_DIR4) {
21961
22309
  const candidates = bundledCandidates(file, moduleDir);
@@ -21963,13 +22311,13 @@ function readBundledFile(file, moduleDir = MODULE_DIR4) {
21963
22311
  if (found === undefined) {
21964
22312
  throw new Error(`loop continue: ${file} is missing: no file at ${candidates.join(" or ")}`);
21965
22313
  }
21966
- return readFileSync28(found, "utf8");
22314
+ return readFileSync30(found, "utf8");
21967
22315
  }
21968
22316
  function readProjectFile(path3) {
21969
22317
  if (!existsSync27(path3))
21970
22318
  return { text: null };
21971
22319
  try {
21972
- return { text: readFileSync28(path3, "utf8") };
22320
+ return { text: readFileSync30(path3, "utf8") };
21973
22321
  } catch (error) {
21974
22322
  const message = error instanceof Error ? error.message : String(error);
21975
22323
  return { refusal: `loop.continue.criteria cannot be read at ${path3}: ${message}` };
@@ -22157,7 +22505,7 @@ class LoopEnd extends CommandExit {
22157
22505
  }
22158
22506
  }
22159
22507
  // packages/rafa-run/src/start/continue-run.ts
22160
- import { existsSync as existsSync28, readFileSync as readFileSync29 } from "fs";
22508
+ import { existsSync as existsSync28, readFileSync as readFileSync31 } from "fs";
22161
22509
 
22162
22510
  // packages/rafa-run/src/start/decision-session.ts
22163
22511
  import { randomUUID as randomUUID7 } from "crypto";
@@ -22350,7 +22698,7 @@ function whenOf(stop) {
22350
22698
  function openingList(seed, trackerPath) {
22351
22699
  if (seed.length === 0)
22352
22700
  return seed;
22353
- const kept = existsSync28(trackerPath) ? seedFrom(seed, readFileSync29(trackerPath, "utf8")) : [];
22701
+ const kept = existsSync28(trackerPath) ? seedFrom(seed, readFileSync31(trackerPath, "utf8")) : [];
22354
22702
  const back = seed.length - kept.length;
22355
22703
  if (back > 0) {
22356
22704
  activeOutput().info(`\u21A9\uFE0F ${back} task(s) the last --continue run passed over no longer read [BLOCKED], so this run takes them again.`);
@@ -22378,7 +22726,7 @@ function createRunDecisions(options) {
22378
22726
  const mode = options.mode ?? activeOutputMode;
22379
22727
  let directive = options.continueArgs.directive;
22380
22728
  let firstPass = true;
22381
- const readTracker = () => readFileSync29(trackerPath, "utf8");
22729
+ const readTracker = () => readFileSync31(trackerPath, "utf8");
22382
22730
  let list = openingList(options.seed, trackerPath);
22383
22731
  const deferred = new Set;
22384
22732
  const passedOver = new Set;
@@ -22873,7 +23221,7 @@ function describeTaskReportRecord(record) {
22873
23221
 
22874
23222
  // packages/rafa/src/utils/progress.ts
22875
23223
  import { existsSync as existsSync30, writeFileSync as writeFileSync9 } from "fs";
22876
- import { join as join40 } from "path";
23224
+ import { join as join41 } from "path";
22877
23225
  var PROGRESS_FILE_NAME = "progress.txt";
22878
23226
  var PROGRESS_CAP_BYTES = 16000;
22879
23227
  var LISTED_FIELDS = [
@@ -22915,7 +23263,7 @@ var ESCAPED_CODE_POINTS = new Set([
22915
23263
  8233
22916
23264
  ]);
22917
23265
  function progressFilePath(repoRoot) {
22918
- return join40(repoRoot, PROGRESS_FILE_NAME);
23266
+ return join41(repoRoot, PROGRESS_FILE_NAME);
22919
23267
  }
22920
23268
  function escapeValue(value) {
22921
23269
  let escaped = "";
@@ -23097,9 +23445,9 @@ function renderInheritedSection(failures) {
23097
23445
 
23098
23446
  // packages/rafa-run/src/start/preflight.ts
23099
23447
  import { randomUUID as randomUUID10 } from "crypto";
23100
- import { existsSync as existsSync32, readFileSync as readFileSync30 } from "fs";
23448
+ import { existsSync as existsSync32, readFileSync as readFileSync32 } from "fs";
23101
23449
  import { homedir as homedir10 } from "os";
23102
- import { basename as basename10, join as join41 } from "path";
23450
+ import { basename as basename10, join as join42 } from "path";
23103
23451
 
23104
23452
  // packages/rafa/src/effort/store/schema-report.ts
23105
23453
  import { existsSync as existsSync31 } from "fs";
@@ -23420,13 +23768,13 @@ async function markInDevelopment(claim, board, firstDispatch) {
23420
23768
  }
23421
23769
 
23422
23770
  // packages/rafa-run/src/start/preflight-drift.ts
23423
- import { readdirSync as readdirSync10 } from "fs";
23771
+ import { readdirSync as readdirSync11 } from "fs";
23424
23772
  var DRIFT_EVERY = 2;
23425
23773
  var RECORD_EXTENSION3 = ".json";
23426
23774
  function countRunRecords(root) {
23427
23775
  let names;
23428
23776
  try {
23429
- names = readdirSync10(runsDir(root));
23777
+ names = readdirSync11(runsDir(root));
23430
23778
  } catch (error) {
23431
23779
  if (errorCode(error) === "ENOENT")
23432
23780
  return 0;
@@ -23501,7 +23849,7 @@ function agentSourcePath(planPath) {
23501
23849
  }
23502
23850
  function readIfReadable2(path3) {
23503
23851
  try {
23504
- return readFileSync30(path3, "utf8");
23852
+ return readFileSync32(path3, "utf8");
23505
23853
  } catch {
23506
23854
  return null;
23507
23855
  }
@@ -23653,7 +24001,7 @@ function announceReminders(planPath, reminders) {
23653
24001
  function announceUnknownMigrations(repoRoot) {
23654
24002
  const output = activeOutput();
23655
24003
  try {
23656
- const report2 = readSchemaReport(join41(effortStoreDir(repoRoot), SQLITE_STORE_FILE_NAME));
24004
+ const report2 = readSchemaReport(join42(effortStoreDir(repoRoot), SQLITE_STORE_FILE_NAME));
23657
24005
  for (const migration of unknownAdditive(report2))
23658
24006
  output.warn(unknownAdditiveWarning(migration));
23659
24007
  } catch (error) {
@@ -23727,7 +24075,7 @@ async function runStartPreflight(options) {
23727
24075
  // packages/rafa-run/src/start/type-step.ts
23728
24076
  import { closeSync as closeSync2, existsSync as existsSync33, mkdtempSync as mkdtempSync2, openSync as openSync2, readSync as readSync2, realpathSync as realpathSync4, rmSync as rmSync6, symlinkSync as symlinkSync2, writeFileSync as writeFileSync10 } from "fs";
23729
24077
  import { tmpdir as tmpdir2 } from "os";
23730
- import { basename as basename11, dirname as dirname15, join as join42, relative as relative14, resolve as resolve18, sep as sep6 } from "path";
24078
+ import { basename as basename11, dirname as dirname15, join as join43, relative as relative14, resolve as resolve18, sep as sep6 } from "path";
23731
24079
  var TEST_FILE_SUFFIX = ".test.ts";
23732
24080
  var TSC_FLAGS = ["--noEmit", "--pretty", "false"];
23733
24081
  var CANNOT_START_CODES = [126, 127];
@@ -23801,8 +24149,8 @@ function findNodeModules(checkout, git) {
23801
24149
  const stop = walkStop(git);
23802
24150
  const top = stop !== null && isUnder(start, stop) ? stop : start;
23803
24151
  for (let dir = start;; dir = dirname15(dir)) {
23804
- const modules = join42(dir, NODE_MODULES2);
23805
- if (existsSync33(join42(modules, ...TSC_BIN)))
24152
+ const modules = join43(dir, NODE_MODULES2);
24153
+ if (existsSync33(join43(modules, ...TSC_BIN)))
23806
24154
  return modules;
23807
24155
  if (dir === top || dirname15(dir) === dir)
23808
24156
  return null;
@@ -23811,9 +24159,9 @@ function findNodeModules(checkout, git) {
23811
24159
  function scratchTsconfigFields(tree, files, modules) {
23812
24160
  const root = resolve18(tree);
23813
24161
  return {
23814
- extends: join42(root, "tsconfig.json"),
23815
- compilerOptions: { typeRoots: [join42(resolve18(modules), "@types")] },
23816
- files: files.map((file) => join42(root, file)),
24162
+ extends: join43(root, "tsconfig.json"),
24163
+ compilerOptions: { typeRoots: [join43(resolve18(modules), "@types")] },
24164
+ files: files.map((file) => join43(root, file)),
23817
24165
  include: []
23818
24166
  };
23819
24167
  }
@@ -23822,13 +24170,13 @@ function scratchTsconfig(tree, files, modules) {
23822
24170
  `;
23823
24171
  }
23824
24172
  function tscArgv(modules, scratch) {
23825
- return [join42(modules, ...TSC_BIN), "-p", scratch, ...TSC_FLAGS];
24173
+ return [join43(modules, ...TSC_BIN), "-p", scratch, ...TSC_FLAGS];
23826
24174
  }
23827
24175
  function modulesFor(checkout, git) {
23828
- return findNodeModules(checkout, git) ?? join42(resolve18(checkout), NODE_MODULES2);
24176
+ return findNodeModules(checkout, git) ?? join43(resolve18(checkout), NODE_MODULES2);
23829
24177
  }
23830
24178
  function readTypeCheckRecipe(checkout, git) {
23831
- if (!existsSync33(join42(checkout, "tsconfig.json")))
24179
+ if (!existsSync33(join43(checkout, "tsconfig.json")))
23832
24180
  return null;
23833
24181
  const modules = findNodeModules(checkout, git);
23834
24182
  return modules === null ? null : { checkout, modules };
@@ -23923,8 +24271,8 @@ ${run.stderr}`.split(`
23923
24271
  `).map((line) => line.trim()).find((line) => line !== "");
23924
24272
  }
23925
24273
  async function checkTree(input, modules, tree, files) {
23926
- const scratchDir = mkdtempSync2(join42(tmpdir2(), "rafa-type-step-"));
23927
- const scratch = join42(scratchDir, SCRATCH_NAME);
24274
+ const scratchDir = mkdtempSync2(join43(tmpdir2(), "rafa-type-step-"));
24275
+ const scratch = join43(scratchDir, SCRATCH_NAME);
23928
24276
  try {
23929
24277
  writeFileSync10(scratch, scratchTsconfig(tree, files, modules), "utf8");
23930
24278
  let run;
@@ -23951,17 +24299,17 @@ async function checkTree(input, modules, tree, files) {
23951
24299
  }
23952
24300
  }
23953
24301
  async function inBaseTree(input, label, modules, check) {
23954
- const parent = mkdtempSync2(join42(tmpdir2(), "rafa-type-base-"));
23955
- const tree = join42(parent, "tree");
24302
+ const parent = mkdtempSync2(join43(tmpdir2(), "rafa-type-base-"));
24303
+ const tree = join43(parent, "tree");
23956
24304
  try {
23957
24305
  const added = input.git(["worktree", "add", "--detach", tree, input.base]);
23958
24306
  if (!added.ok) {
23959
24307
  activeOutput().warn(`\u26A0\uFE0F The ${label} could not check out ${input.base} (${gitSaid(added) || "nothing said"}); it reads no error as new.`);
23960
24308
  return null;
23961
24309
  }
23962
- if (existsSync33(modules) && !existsSync33(join42(tree, NODE_MODULES2)))
23963
- symlinkSync2(modules, join42(tree, NODE_MODULES2));
23964
- if (!existsSync33(join42(tree, "tsconfig.json")))
24310
+ if (existsSync33(modules) && !existsSync33(join43(tree, NODE_MODULES2)))
24311
+ symlinkSync2(modules, join43(tree, NODE_MODULES2));
24312
+ if (!existsSync33(join43(tree, "tsconfig.json")))
23965
24313
  return { kind: "read", errors: [] };
23966
24314
  return await check(tree);
23967
24315
  } finally {
@@ -23997,13 +24345,13 @@ function interrupted(label) {
23997
24345
  return INTERRUPTED2;
23998
24346
  }
23999
24347
  function cannotStart(label, modules, run) {
24000
- const tsc = join42(modules, ...TSC_BIN);
24348
+ const tsc = join43(modules, ...TSC_BIN);
24001
24349
  const blocker = cannotStartBlockerText(label, tsc, run.run, run.said, scriptInterpreter(tsc));
24002
24350
  activeOutput().warn(`\u26A0\uFE0F ${blocker}`);
24003
24351
  return { ran: false, red: false, interrupted: false, cannotStart: true, blocker };
24004
24352
  }
24005
24353
  function filesToCheck(input, label) {
24006
- if (!existsSync33(join42(input.checkout, "tsconfig.json"))) {
24354
+ if (!existsSync33(join43(input.checkout, "tsconfig.json"))) {
24007
24355
  activeOutput().info(`\uD83D\uDD0E ${label}: no tsconfig.json at the checkout root; nothing to type-check.`);
24008
24356
  return null;
24009
24357
  }
@@ -24737,13 +25085,13 @@ async function handleRedChecks(io, branch, prNumber, rows) {
24737
25085
  return "next";
24738
25086
  }
24739
25087
  // packages/rafa-run/src/start/risk-total.ts
24740
- import { readFileSync as readFileSync31 } from "fs";
25088
+ import { readFileSync as readFileSync33 } from "fs";
24741
25089
  function spawningRunners(root) {
24742
25090
  return { git: createGitRunner(root), gh: createGhRunner({ cwd: root }) };
24743
25091
  }
24744
25092
  async function readRiskTotalLine(input, seams = {}) {
24745
25093
  const makeRunners = seams.runners ?? spawningRunners;
24746
- const report2 = await assessPlanRisk({ path: input.planPath, text: readFileSync31(input.planPath, "utf8") }, {
25094
+ const report2 = await assessPlanRisk({ path: input.planPath, text: readFileSync33(input.planPath, "utf8") }, {
24747
25095
  repoRoot: input.repoRoot,
24748
25096
  home: input.home,
24749
25097
  settingSources: input.config.settingSources,
@@ -25091,7 +25439,7 @@ async function runWorktreeSetup(request, seams = {}) {
25091
25439
 
25092
25440
  // packages/rafa-run/src/start/worktree.ts
25093
25441
  import { realpathSync as realpathSync5 } from "fs";
25094
- import { join as join43, resolve as resolve20 } from "path";
25442
+ import { join as join44, resolve as resolve20 } from "path";
25095
25443
 
25096
25444
  // packages/rafa-run/src/start/claim-catch-up.ts
25097
25445
  var OWN_COMMIT_FORMAT = "--format=%H%x09%P%x09%s";
@@ -25195,7 +25543,7 @@ var INDENT4 = " ";
25195
25543
  var UNTOUCHED = `${INDENT4}The main checkout's branch and working tree were not touched.`;
25196
25544
  var DEFAULT_WORKTREE_SEAMS = Object.freeze({});
25197
25545
  function worktreePathFor(projectRoot, worktreeDir, stub) {
25198
- return join43(worktreeDirAt(projectRoot, worktreeDir), stub);
25546
+ return join44(worktreeDirAt(projectRoot, worktreeDir), stub);
25199
25547
  }
25200
25548
  function addStep(route, plan, path3) {
25201
25549
  const label = `add the worktree for ${plan.branch} at ${path3}`;
@@ -25500,7 +25848,7 @@ function haltBeforeSession(options, seams = {}) {
25500
25848
  return moved;
25501
25849
  }
25502
25850
  // packages/rafa-run/src/start/stale-docs.ts
25503
- import { existsSync as existsSync35, readFileSync as readFileSync32 } from "fs";
25851
+ import { existsSync as existsSync35, readFileSync as readFileSync34 } from "fs";
25504
25852
  import { homedir as homedir11 } from "os";
25505
25853
  import { resolve as resolvePath } from "path";
25506
25854
  var LINE_PREFIX = "Stale docs: ";
@@ -25510,7 +25858,7 @@ function localVersion(checkout, versionFile) {
25510
25858
  if (!existsSync35(path3))
25511
25859
  return null;
25512
25860
  try {
25513
- return readManifestVersion(readFileSync32(path3, "utf8"));
25861
+ return readManifestVersion(readFileSync34(path3, "utf8"));
25514
25862
  } catch {
25515
25863
  return null;
25516
25864
  }
@@ -25567,7 +25915,7 @@ function resultLine(result, text) {
25567
25915
  }
25568
25916
  var PLAN_TITLE = /^# Plan:[ \t]*(.*?)[ \t]*\r?$/m;
25569
25917
  function readDocUpdatePlan(planPath) {
25570
- const markdown = readFileSync32(planPath, "utf8");
25918
+ const markdown = readFileSync34(planPath, "utf8");
25571
25919
  if (PLAN_TITLE.exec(markdown)?.[1] !== DOC_UPDATE_TITLE)
25572
25920
  return null;
25573
25921
  return { issue: parsePlan(markdown).header.issue };
@@ -25795,13 +26143,13 @@ function announceRunStepOnly(items) {
25795
26143
  activeOutput().warn(` ${line}`);
25796
26144
  }
25797
26145
  // packages/rafa-run/src/start/suite-step.ts
25798
- import { readFileSync as readFileSync38 } from "fs";
26146
+ import { readFileSync as readFileSync40 } from "fs";
25799
26147
  import { constants as constants3 } from "os";
25800
- import { basename as basename14, join as join49 } from "path";
26148
+ import { basename as basename14, join as join50 } from "path";
25801
26149
 
25802
26150
  // packages/rafa-run/src/suite/baseline.ts
25803
- import { existsSync as existsSync36, mkdirSync as mkdirSync6, readFileSync as readFileSync33, renameSync as renameSync2, writeFileSync as writeFileSync11 } from "fs";
25804
- import { basename as basename12, dirname as dirname16, join as join44 } from "path";
26151
+ import { existsSync as existsSync36, mkdirSync as mkdirSync6, readFileSync as readFileSync35, renameSync as renameSync2, writeFileSync as writeFileSync11 } from "fs";
26152
+ import { basename as basename12, dirname as dirname16, join as join45 } from "path";
25805
26153
  var BASELINE_VERSION = 1;
25806
26154
  var BASELINE_FILE_PREFIX = "SUITE_BASELINE";
25807
26155
  var PLAN_FILE_NAME2 = /^PLAN(?:_TRACKER)?(-.+)?\.md$/;
@@ -25811,7 +26159,7 @@ function baselinePathFor(trackerPath) {
25811
26159
  if (match === null) {
25812
26160
  throw new RangeError(`baselinePathFor: ${trackerPath} is not a PLAN or PLAN_TRACKER file`);
25813
26161
  }
25814
- return join44(dirname16(trackerPath), `${BASELINE_FILE_PREFIX}${match[1] ?? ""}.json`);
26162
+ return join45(dirname16(trackerPath), `${BASELINE_FILE_PREFIX}${match[1] ?? ""}.json`);
25815
26163
  }
25816
26164
  function copyFailure(failure2) {
25817
26165
  return failure2.message === undefined ? { file: failure2.file, name: failure2.name } : { file: failure2.file, name: failure2.name, message: failure2.message };
@@ -25880,7 +26228,7 @@ function readBaseline(path3) {
25880
26228
  return { state: "missing" };
25881
26229
  let text;
25882
26230
  try {
25883
- text = readFileSync33(path3, "utf8");
26231
+ text = readFileSync35(path3, "utf8");
25884
26232
  } catch (error) {
25885
26233
  const reason = error instanceof Error ? error.message : String(error);
25886
26234
  return { state: "unreadable", reason };
@@ -25975,8 +26323,8 @@ async function readPlanOwns(options) {
25975
26323
  }
25976
26324
 
25977
26325
  // packages/rafa-run/src/suite/scope.ts
25978
- import { existsSync as existsSync37, readdirSync as readdirSync11, readFileSync as readFileSync34 } from "fs";
25979
- import { isAbsolute as isAbsolute13, join as join45, relative as relative15, sep as sep7 } from "path";
26326
+ import { existsSync as existsSync37, readdirSync as readdirSync12, readFileSync as readFileSync36 } from "fs";
26327
+ import { isAbsolute as isAbsolute13, join as join46, relative as relative15, sep as sep7 } from "path";
25980
26328
  var BUNFIG_FILE = "bunfig.toml";
25981
26329
  var TEST_FILE_NAME = /[._](?:test|spec)\.(?:tsx?|jsx?|[cm][jt]s)$/;
25982
26330
  var DEPENDENCY_FOLDER = "node_modules";
@@ -26007,11 +26355,11 @@ function preloadFilesOf(text, root) {
26007
26355
  return paths.filter((path3) => path3 !== null);
26008
26356
  }
26009
26357
  function readPreloadFiles(root) {
26010
- const path3 = join45(root, BUNFIG_FILE);
26358
+ const path3 = join46(root, BUNFIG_FILE);
26011
26359
  if (!existsSync37(path3))
26012
26360
  return { state: "missing", files: [] };
26013
26361
  try {
26014
- return { state: "read", files: preloadFilesOf(readFileSync34(path3, "utf8"), root) };
26362
+ return { state: "read", files: preloadFilesOf(readFileSync36(path3, "utf8"), root) };
26015
26363
  } catch (error) {
26016
26364
  const reason = error instanceof Error ? error.message : String(error);
26017
26365
  return { state: "unreadable", files: [], reason };
@@ -26020,7 +26368,7 @@ function readPreloadFiles(root) {
26020
26368
  function listTestFiles(root) {
26021
26369
  const found = [];
26022
26370
  const walk = (folder) => {
26023
- for (const entry of readdirSync11(join45(root, folder), { withFileTypes: true })) {
26371
+ for (const entry of readdirSync12(join46(root, folder), { withFileTypes: true })) {
26024
26372
  const path3 = folder === "" ? entry.name : `${folder}/${entry.name}`;
26025
26373
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== DEPENDENCY_FOLDER)
26026
26374
  walk(path3);
@@ -26034,7 +26382,7 @@ function listTestFiles(root) {
26034
26382
 
26035
26383
  // packages/rafa-run/src/start/lint-step.ts
26036
26384
  import { existsSync as existsSync38 } from "fs";
26037
- import { join as join46, relative as relative16 } from "path";
26385
+ import { join as join47, relative as relative16 } from "path";
26038
26386
  var LINT_COMMAND = ["bunx", "eslint", "--no-warn-ignored"];
26039
26387
  var LINT_REPORT_FLAGS = ["--format", "json"];
26040
26388
  var ESLINT_CONFIG_FILES = [
@@ -26063,7 +26411,7 @@ async function runEslint(options) {
26063
26411
  return { exitCode, stdout, stderr };
26064
26412
  }
26065
26413
  function hasEslintConfig(checkout) {
26066
- return ESLINT_CONFIG_FILES.some((name) => existsSync38(join46(checkout, name)));
26414
+ return ESLINT_CONFIG_FILES.some((name) => existsSync38(join47(checkout, name)));
26067
26415
  }
26068
26416
  function readLintFiles(git, base2) {
26069
26417
  const result = git(["diff", "--name-only", "-z", "--no-renames", "--diff-filter=d", base2, "HEAD"]);
@@ -26167,11 +26515,11 @@ async function runLintStep(input) {
26167
26515
  }
26168
26516
 
26169
26517
  // packages/rafa-run/src/start/suite-retake-alone.ts
26170
- import { join as join47, relative as relative17 } from "path";
26518
+ import { join as join48, relative as relative17 } from "path";
26171
26519
  var RETAKE_ALONE_MAX_FILES = 20;
26172
26520
  var STEP_ONLY_BEFORE = 5;
26173
26521
  function aloneJunitFileFor(repoRoot, sessionId, kind, nth) {
26174
- return join47(runsDir(repoRoot), sessionId, "suite", `${kind}-alone-${nth}.junit.xml`);
26522
+ return join48(runsDir(repoRoot), sessionId, "suite", `${kind}-alone-${nth}.junit.xml`);
26175
26523
  }
26176
26524
  function placeOf(file, orders) {
26177
26525
  for (const [run, order] of orders.entries()) {
@@ -26295,14 +26643,14 @@ function announceStepOnly(context, settling) {
26295
26643
  }
26296
26644
 
26297
26645
  // packages/rafa-run/src/start/suite-stage-ledger.ts
26298
- import { existsSync as existsSync39, mkdirSync as mkdirSync7, readFileSync as readFileSync35, renameSync as renameSync3, writeFileSync as writeFileSync12 } from "fs";
26299
- import { basename as basename13, dirname as dirname17, join as join48 } from "path";
26646
+ import { existsSync as existsSync39, mkdirSync as mkdirSync7, readFileSync as readFileSync37, renameSync as renameSync3, writeFileSync as writeFileSync12 } from "fs";
26647
+ import { basename as basename13, dirname as dirname17, join as join49 } from "path";
26300
26648
  var STAGE_LEDGER_PREFIX = "SUITE_STAGES";
26301
26649
  var STAGE_LEDGER_VERSION = 1;
26302
26650
  function stageLedgerPathFor(trackerPath) {
26303
26651
  const baselinePath = baselinePathFor(trackerPath);
26304
26652
  const name = basename13(baselinePath).replace(BASELINE_FILE_PREFIX, STAGE_LEDGER_PREFIX);
26305
- return join48(dirname17(baselinePath), name);
26653
+ return join49(dirname17(baselinePath), name);
26306
26654
  }
26307
26655
  function isLedgerEntry(value) {
26308
26656
  if (typeof value !== "object" || value === null)
@@ -26330,7 +26678,7 @@ function readStageLedger(path3) {
26330
26678
  return [];
26331
26679
  let parsed;
26332
26680
  try {
26333
- parsed = parseLedger(readFileSync35(path3, "utf8"));
26681
+ parsed = parseLedger(readFileSync37(path3, "utf8"));
26334
26682
  } catch (error) {
26335
26683
  parsed = messageOf(error);
26336
26684
  }
@@ -26376,7 +26724,7 @@ function dueStages(trackerContent, ledger) {
26376
26724
  }
26377
26725
 
26378
26726
  // packages/rafa-run/src/start/suite-stage-step.ts
26379
- import { readFileSync as readFileSync36 } from "fs";
26727
+ import { readFileSync as readFileSync38 } from "fs";
26380
26728
 
26381
26729
  // packages/rafa-run/src/suite/checks.ts
26382
26730
  var NO_CHECK = Object.freeze({ kind: "none", reason: "no-check" });
@@ -26624,7 +26972,7 @@ async function runStageStep(context, stage2, baseline) {
26624
26972
  }
26625
26973
  async function runDueStageSteps(context, baseline) {
26626
26974
  const ledger = readStageLedger(stageLedgerPathFor(context.trackerPath));
26627
- const due = dueStages(readFileSync36(context.trackerPath, "utf8"), ledger);
26975
+ const due = dueStages(readFileSync38(context.trackerPath, "utf8"), ledger);
26628
26976
  const outcomes = [];
26629
26977
  for (const stage2 of due) {
26630
26978
  const outcome = await runStageStep(context, stage2, baseline);
@@ -26636,7 +26984,7 @@ async function runDueStageSteps(context, baseline) {
26636
26984
  }
26637
26985
 
26638
26986
  // packages/rafa-run/src/start/sweep-timing.ts
26639
- import { existsSync as existsSync40, readFileSync as readFileSync37 } from "fs";
26987
+ import { existsSync as existsSync40, readFileSync as readFileSync39 } from "fs";
26640
26988
  var SLOW_SWEEP_SECONDS = 10;
26641
26989
  var SUITE_TAG = /<(\/?)testsuite\b([^>]*?)(\/?)>/g;
26642
26990
  function fileTimeOf(attributes) {
@@ -26679,7 +27027,7 @@ function readFileTimes(path3) {
26679
27027
  if (!existsSync40(path3))
26680
27028
  return [];
26681
27029
  try {
26682
- return parseJunitFileTimes(readFileSync37(path3, "utf8")) ?? [];
27030
+ return parseJunitFileTimes(readFileSync39(path3, "utf8")) ?? [];
26683
27031
  } catch {
26684
27032
  return [];
26685
27033
  }
@@ -26844,10 +27192,10 @@ function seamsOf(context) {
26844
27192
  };
26845
27193
  }
26846
27194
  function junitFileFor(repoRoot, sessionId, kind) {
26847
- return join49(runsDir(repoRoot), sessionId, "suite", `${kind}.junit.xml`);
27195
+ return join50(runsDir(repoRoot), sessionId, "suite", `${kind}.junit.xml`);
26848
27196
  }
26849
27197
  function alwaysRunJunitFileFor(repoRoot, sessionId, kind = "task") {
26850
- return join49(runsDir(repoRoot), sessionId, "suite", `${kind}-always-run.junit.xml`);
27198
+ return join50(runsDir(repoRoot), sessionId, "suite", `${kind}-always-run.junit.xml`);
26851
27199
  }
26852
27200
  function readHead(git) {
26853
27201
  const result = git(["rev-parse", "--verify", "HEAD^{commit}"]);
@@ -27019,7 +27367,7 @@ async function ensureBaseline(context) {
27019
27367
  activeOutput().warn(`\u26A0\uFE0F Could not write ${basename14(path3)} (${messageOf(error)}); the next run records the baseline again.`);
27020
27368
  }
27021
27369
  const outcome = settleStep(context, seams, settling);
27022
- const covered = completeStages(readFileSync38(context.trackerPath, "utf8"));
27370
+ const covered = completeStages(readFileSync40(context.trackerPath, "utf8"));
27023
27371
  addToLedger(context.trackerPath, covered.map((stage2) => ({ ...stage2, commit, via: "baseline" })));
27024
27372
  return { baseline, step: outcome.step, interrupted: false, halted: false };
27025
27373
  }
@@ -27505,10 +27853,16 @@ function inheritedNote(bug, name, where, failure2) {
27505
27853
  const comment = bug.ref === null ? "" : `, and ${issueName2(bug.ref)} on ${where}, found by ${foundByText(bug)}, was commented on`;
27506
27854
  return `${name}: inherited: ${test}; nothing was filed${comment}.`;
27507
27855
  }
27856
+ function repairText(bug) {
27857
+ if (bug.joined === true) {
27858
+ return bug.repairLine === undefined ? "it joined a repair task already in the tracker" : `it joined the repair task at tracker line ${bug.repairLine + 1}, already in the tracker`;
27859
+ }
27860
+ return bug.repairLine === undefined ? "a repair task was added above the next plan task" : `a repair task was added at tracker line ${bug.repairLine + 1}, above the next plan task`;
27861
+ }
27508
27862
  function settledText(bug) {
27509
27863
  switch (bug.action) {
27510
27864
  case "repair":
27511
- return bug.repairLine === undefined ? "a repair task was added above the next plan task" : `a repair task was added at tracker line ${bug.repairLine + 1}, above the next plan task`;
27865
+ return repairText(bug);
27512
27866
  case "follow-up":
27513
27867
  return bug.problem === null ? "held for this plan's follow-up issue, past its cap on repair tasks" : "held for this plan's follow-up issue";
27514
27868
  case "pr-body":
@@ -28273,7 +28627,7 @@ async function finishRelease(input, seams = {}) {
28273
28627
  }
28274
28628
 
28275
28629
  // packages/rafa-run/src/start/runner-pr.ts
28276
- import { readFileSync as readFileSync39 } from "fs";
28630
+ import { readFileSync as readFileSync41 } from "fs";
28277
28631
  import path3 from "path";
28278
28632
  var RELEASE_NOTES_HEADING = "## Release notes";
28279
28633
  var UNFINISHED_WRAP_UP_LINE = "> \u26A0\uFE0F The wrap-up did not finish: no wrap-up session opened this pull request, so the loop opened it. Check that the base is merged in, the release notes were rewritten and the lessons were promoted before merging.";
@@ -28306,7 +28660,7 @@ function fragmentNotesIn(checkout, fragment) {
28306
28660
  return [];
28307
28661
  let text;
28308
28662
  try {
28309
- text = readFileSync39(path3.resolve(checkout, fragment), "utf8");
28663
+ text = readFileSync41(path3.resolve(checkout, fragment), "utf8");
28310
28664
  } catch {
28311
28665
  return [];
28312
28666
  }
@@ -29091,8 +29445,8 @@ import path7 from "path";
29091
29445
  import { fileURLToPath as fileURLToPath5 } from "url";
29092
29446
 
29093
29447
  // src/commands/plan/bundled-check.ts
29094
- import { readdirSync as readdirSync12, readFileSync as readFileSync40, realpathSync as realpathSync6, statSync as statSync10, writeFileSync as writeFileSync13 } from "fs";
29095
- import { basename as basename15, isAbsolute as isAbsolute15, join as join50, relative as relative19, resolve as resolve21, sep as sep8 } from "path";
29448
+ import { readdirSync as readdirSync13, readFileSync as readFileSync42, realpathSync as realpathSync6, statSync as statSync10, writeFileSync as writeFileSync13 } from "fs";
29449
+ import { basename as basename15, isAbsolute as isAbsolute15, join as join51, relative as relative19, resolve as resolve21, sep as sep8 } from "path";
29096
29450
  var SOURCE_DIR2 = "src";
29097
29451
  var CODE_SPAN6 = /`([^`]+)`/gu;
29098
29452
  var PATH_LIKE = /^\S+$/u;
@@ -29117,11 +29471,11 @@ function bundledAgents(root) {
29117
29471
  function bundledSkills(root) {
29118
29472
  if (root === null)
29119
29473
  return [];
29120
- return readdirSync12(root).filter((name) => isFilePath(join50(root, name, SKILL_FILE2))).sort((a, b) => a.localeCompare(b));
29474
+ return readdirSync13(root).filter((name) => isFilePath(join51(root, name, SKILL_FILE2))).sort((a, b) => a.localeCompare(b));
29121
29475
  }
29122
29476
  function readBundle(repoRoot) {
29123
- const agentsRoot = realPathOrNull(join50(repoRoot, SOURCE_DIR2, BUNDLED_AGENTS_DIR));
29124
- const skillsRoot = realPathOrNull(join50(repoRoot, SOURCE_DIR2, BUNDLED_SKILLS_DIR));
29477
+ const agentsRoot = realPathOrNull(join51(repoRoot, SOURCE_DIR2, BUNDLED_AGENTS_DIR));
29478
+ const skillsRoot = realPathOrNull(join51(repoRoot, SOURCE_DIR2, BUNDLED_SKILLS_DIR));
29125
29479
  return { agentsRoot, skillsRoot, agents: bundledAgents(agentsRoot), skills: bundledSkills(skillsRoot) };
29126
29480
  }
29127
29481
  function skillHolding(bundle, realPath2) {
@@ -29188,7 +29542,7 @@ function tierPinItem(edit, planFileName2) {
29188
29542
  }
29189
29543
  function readOrNull(path4) {
29190
29544
  try {
29191
- return readFileSync40(path4, "utf8");
29545
+ return readFileSync42(path4, "utf8");
29192
29546
  } catch (error) {
29193
29547
  const isAbsent = typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
29194
29548
  if (isAbsent)
@@ -29241,7 +29595,7 @@ function notePlanBundledEdits(repoRoot, generated, output = activeOutput()) {
29241
29595
  const planFile = resolve21(repoRoot, generated.planPath);
29242
29596
  if (!isFile(planFile))
29243
29597
  return generated;
29244
- const edits = findBundledEdits(readFileSync40(planFile, "utf8"), { repoRoot });
29598
+ const edits = findBundledEdits(readFileSync42(planFile, "utf8"), { repoRoot });
29245
29599
  if (edits.length === 0)
29246
29600
  return generated;
29247
29601
  const file = generated.prerequisitesPath ?? prerequisitesPathForPlan(generated.planPath);
@@ -29460,7 +29814,7 @@ function createPlanBlockedOffer(seams = DEFAULT_BLOCKED_SEAMS) {
29460
29814
 
29461
29815
  // src/commands/plan/ready-offer.ts
29462
29816
  var runIssueReadyLazily = async (options) => {
29463
- const { runIssueReady: run } = await import("./ready-cnzcnv4d.js");
29817
+ const { runIssueReady: run } = await import("./ready-9e1pyxdh.js");
29464
29818
  return run(options);
29465
29819
  };
29466
29820
  var DEFAULT_OFFER_SEAMS = Object.freeze({});
@@ -29572,10 +29926,10 @@ async function resolveCreateSpec(options, seams = DEFAULT_ROUTE_SEAMS) {
29572
29926
  }
29573
29927
 
29574
29928
  // src/commands/plan/store-check.ts
29575
- import { mkdirSync as mkdirSync8, readFileSync as readFileSync41, renameSync as renameSync4 } from "fs";
29929
+ import { mkdirSync as mkdirSync8, readFileSync as readFileSync43, renameSync as renameSync4 } from "fs";
29576
29930
  import { basename as basename16, dirname as dirname18, resolve as resolve22 } from "path";
29577
29931
  function readFileOrNull(path6) {
29578
- return path6 !== null && isFile(path6) ? readFileSync41(path6, "utf8") : null;
29932
+ return path6 !== null && isFile(path6) ? readFileSync43(path6, "utf8") : null;
29579
29933
  }
29580
29934
  function checkStoreRules(file, markdown) {
29581
29935
  const prerequisitesPath = prerequisitesPathForPlan(file);
@@ -29602,7 +29956,7 @@ function enforceStoreRules(repoRoot, generated, output = activeOutput()) {
29602
29956
  const planFile = resolve22(repoRoot, generated.planPath);
29603
29957
  if (!isFile(planFile))
29604
29958
  return;
29605
- const problems = checkStoreRules(planFile, readFileSync41(planFile, "utf8"));
29959
+ const problems = checkStoreRules(planFile, readFileSync43(planFile, "utf8"));
29606
29960
  if (problems.length === 0)
29607
29961
  return;
29608
29962
  const prerequisites = generated.prerequisitesPath ?? prerequisitesPathForPlan(generated.planPath);
@@ -29681,13 +30035,13 @@ function stretchRulesReader(env, repoRoot) {
29681
30035
  import { homedir as homedir15 } from "os";
29682
30036
 
29683
30037
  // src/notices/notices.ts
29684
- import { mkdirSync as mkdirSync9, readFileSync as readFileSync42, writeFileSync as writeFileSync14 } from "fs";
29685
- import { dirname as dirname19, join as join51 } from "path";
30038
+ import { mkdirSync as mkdirSync9, readFileSync as readFileSync44, writeFileSync as writeFileSync14 } from "fs";
30039
+ import { dirname as dirname19, join as join52 } from "path";
29686
30040
  var NOTICE_IDS = Object.freeze(["alpha", "danger"]);
29687
30041
  var FEEDBACK_URL = "https://github.com/open-tomato/rafa/issues/new/choose";
29688
30042
  var ROADMAP_URL = "https://github.com/open-tomato/rafa/issues/31";
29689
30043
  function noticesPath(home) {
29690
- return join51(home, ".rafa", "notices.json");
30044
+ return join52(home, ".rafa", "notices.json");
29691
30045
  }
29692
30046
  function isNoticeId(value) {
29693
30047
  return typeof value === "string" && NOTICE_IDS.includes(value);
@@ -29695,7 +30049,7 @@ function isNoticeId(value) {
29695
30049
  function readDismissed(home) {
29696
30050
  let raw;
29697
30051
  try {
29698
- raw = readFileSync42(noticesPath(home), "utf8");
30052
+ raw = readFileSync44(noticesPath(home), "utf8");
29699
30053
  } catch {
29700
30054
  return [];
29701
30055
  }
@@ -30080,7 +30434,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
30080
30434
 
30081
30435
  // src/learning/plan-stage-links.ts
30082
30436
  import { readdir as readdir2, readFile as readFile6 } from "fs/promises";
30083
- import { join as join52 } from "path";
30437
+ import { join as join53 } from "path";
30084
30438
  var PLAN_FILE = /^PLAN-.+\.md$/;
30085
30439
  var FENCE_RUN = /^( {0,3})(`{3,}|~{3,})/;
30086
30440
  var CLOSING_FENCE = /^ {0,3}(`{3,}|~{3,})[ \t]*$/;
@@ -30158,7 +30512,7 @@ async function readPlanStageLinks(plansDir, options = {}) {
30158
30512
  const warn2 = options.warn ?? warnPassedOver;
30159
30513
  const links = [];
30160
30514
  for (const name of await planFileNames(plansDir)) {
30161
- const reading = await readPlanFile(join52(plansDir, name), name);
30515
+ const reading = await readPlanFile(join53(plansDir, name), name);
30162
30516
  if ("skipped" in reading) {
30163
30517
  warn2(`Plan file ${name} passed over: it ${reading.skipped}.`);
30164
30518
  continue;
@@ -30620,6 +30974,7 @@ export {
30620
30974
  WireExportRefusal,
30621
30975
  WIRE_VERSION,
30622
30976
  WIRE_FORMAT,
30977
+ WIRE_CONTRACT_VERSION,
30623
30978
  TRUSTED_PERMISSIONS,
30624
30979
  ScopeError,
30625
30980
  SYNC_STRATEGIES,