@open-tomato/rafa 0.46.0 → 0.48.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.
Files changed (94) hide show
  1. package/README.md +70 -37
  2. package/dist/adapters/logger/settings.d.ts +2 -2
  3. package/dist/bugs/places.d.ts +1 -1
  4. package/dist/bugs/record.d.ts +1 -1
  5. package/dist/bundled/skills/dev-planner/SKILL.md +2 -2
  6. package/dist/cli.js +73457 -72996
  7. package/dist/config/index.d.ts +5 -0
  8. package/dist/config/index.js +6 -4
  9. package/dist/config/shape.d.ts +20 -15
  10. package/dist/config/templates.d.ts +64 -0
  11. package/dist/config-registry.d.ts +21 -12
  12. package/dist/config-schema-board-project.d.ts +3 -3
  13. package/dist/config-schema-bugs.d.ts +3 -3
  14. package/dist/config-schema-checks.d.ts +114 -0
  15. package/dist/config-schema-errors.d.ts +3 -3
  16. package/dist/config-schema-features.d.ts +4 -4
  17. package/dist/config-schema-hub.d.ts +6 -4
  18. package/dist/config-schema-issues.d.ts +2 -2
  19. package/dist/config-schema-logger.d.ts +3 -3
  20. package/dist/config-schema-loop-continue.d.ts +3 -3
  21. package/dist/config-schema-loop-retries.d.ts +4 -4
  22. package/dist/config-schema-release.d.ts +23 -24
  23. package/dist/config-schema-tests.d.ts +35 -27
  24. package/dist/config-schema-triage.d.ts +3 -3
  25. package/dist/config-schema-wrap-up.d.ts +4 -4
  26. package/dist/core/command/command.d.ts +1 -1
  27. package/dist/core/command/confirm.d.ts +11 -5
  28. package/dist/core/command/global-flags.d.ts +25 -0
  29. package/dist/core/command/index.d.ts +47 -23
  30. package/dist/core/command/registry-types.d.ts +4 -4
  31. package/dist/core/command/shared-flags.d.ts +40 -0
  32. package/dist/core/command/types.d.ts +3 -2
  33. package/dist/core/config/branch-template.d.ts +2 -0
  34. package/dist/core/config/config-items.d.ts +1 -1
  35. package/dist/core/config/config-load-module.d.ts +43 -0
  36. package/dist/core/config/config-load.d.ts +43 -12
  37. package/dist/core/config/config-origins.d.ts +31 -30
  38. package/dist/core/config/config-schema.d.ts +11 -0
  39. package/dist/core/config/config-sections.d.ts +15 -14
  40. package/dist/core/config/config.d.ts +90 -25
  41. package/dist/core/config/core-section.d.ts +1 -1
  42. package/dist/core/config/default-routing.d.ts +1 -1
  43. package/dist/core/config/index.d.ts +14 -10
  44. package/dist/core/config/merge-method.d.ts +40 -0
  45. package/dist/core/config/scope.d.ts +2 -2
  46. package/dist/core/config/section.d.ts +81 -1
  47. package/dist/core/config/sections.d.ts +17 -6
  48. package/dist/core/git/gh-runner.d.ts +1 -1
  49. package/dist/core/git/git.d.ts +34 -0
  50. package/dist/core/git/index.d.ts +13 -8
  51. package/dist/core/loop/claude.d.ts +11 -5
  52. package/dist/core/loop/hop-record.d.ts +6 -6
  53. package/dist/core/loop/index.d.ts +9 -8
  54. package/dist/core/loop/session-record-parse.d.ts +9 -2
  55. package/dist/core/loop/sessions.d.ts +23 -11
  56. package/dist/core/loop/suite-failure.d.ts +8 -6
  57. package/dist/core/output/active.d.ts +1 -1
  58. package/dist/core/plan/block-reader.d.ts +1 -1
  59. package/dist/core/runtime/identity.d.ts +13 -0
  60. package/dist/core/runtime/index.d.ts +12 -6
  61. package/dist/effort/store/check-rows.d.ts +1 -1
  62. package/dist/effort/store/commit-stats.d.ts +1 -1
  63. package/dist/effort/store/index.js +7 -8
  64. package/dist/effort/store/merge-commit-gaps.d.ts +1 -1
  65. package/dist/effort/store/plan-stubs.d.ts +1 -1
  66. package/dist/effort/store/session-row-types.d.ts +2 -2
  67. package/dist/errors/rafa-codes.d.ts +1 -1
  68. package/dist/index-2xzkzwm6.js +670 -0
  69. package/dist/index-ajv88fkm.js +448 -0
  70. package/dist/{index-ykggr043.js → index-fpgmdmww.js} +13 -5
  71. package/dist/index-g91ys6kw.js +249 -0
  72. package/dist/{index-cy98y87p.js → index-jx3x70xh.js} +1111 -638
  73. package/dist/{index-gvek4r8m.js → index-m672ptpg.js} +84 -26
  74. package/dist/{index-39kbcw68.js → index-w5qbpdtp.js} +415 -842
  75. package/dist/{index-gqz4jn6j.js → index-z4r20zwr.js} +8974 -11438
  76. package/dist/{index-j4k2vdz3.js → index-zsak0jy6.js} +124 -290
  77. package/dist/index.js +24940 -18766
  78. package/dist/learning/index.js +221 -12
  79. package/dist/plan/index.js +10 -9
  80. package/dist/ports/index.d.ts +7 -7
  81. package/dist/ports/learning.d.ts +5 -4
  82. package/dist/ports/spec-review.d.ts +1 -1
  83. package/dist/ready-gax3hhtt.js +241 -0
  84. package/dist/release-templates/release-bot-fragment.yml +6 -6
  85. package/dist/release-templates/release-publish.yml +8 -8
  86. package/dist/release-templates/release-settle.yml +8 -7
  87. package/dist/release-templates/release-tag.yml +8 -7
  88. package/package.json +53 -2
  89. package/dist/index-77ajfffn.js +0 -223
  90. package/dist/index-jh1r4kcn.js +0 -1067
  91. package/dist/index-z1w83f81.js +0 -4
  92. package/dist/pr/checks.d.ts +0 -133
  93. package/dist/pr/types.d.ts +0 -422
  94. package/dist/ready-4f8edezt.js +0 -2016
@@ -0,0 +1,448 @@
1
+ // @bun
2
+ import {
3
+ isStampableStub
4
+ } from "./index-2a7nb3an.js";
5
+ import {
6
+ parseTaskDeclaration
7
+ } from "./index-fpgmdmww.js";
8
+
9
+ // packages/rafa/src/core/plan/blocks.ts
10
+ var RAFA_BLOCK_KINDS = [
11
+ "plan",
12
+ "context",
13
+ "stage-context",
14
+ "report"
15
+ ];
16
+ var RAFA_PREFIX = "rafa:";
17
+ var FENCE_RUN = /^( {0,3})(`{3,}|~{3,})/;
18
+ var CLOSING_FENCE = /^ {0,3}(`{3,}|~{3,})[ \t]*$/;
19
+ function isRafaBlockKind(kind) {
20
+ return RAFA_BLOCK_KINDS.includes(kind);
21
+ }
22
+ function linesOf(markdown) {
23
+ const lines = markdown.split(`
24
+ `);
25
+ if (lines[lines.length - 1] === "")
26
+ lines.pop();
27
+ return lines.map((line) => line.endsWith("\r") ? line.slice(0, -1) : line);
28
+ }
29
+ function kindOf(info) {
30
+ const word = info.trim().split(/\s+/)[0] ?? "";
31
+ return word.startsWith(RAFA_PREFIX) ? word.slice(RAFA_PREFIX.length) : null;
32
+ }
33
+ function openingFence(line) {
34
+ const match = FENCE_RUN.exec(line);
35
+ const opener = match?.[0];
36
+ const indent = match?.[1];
37
+ const run = match?.[2];
38
+ if (opener === undefined || indent === undefined || run === undefined) {
39
+ return null;
40
+ }
41
+ const marker = run.charAt(0);
42
+ const info = line.slice(opener.length);
43
+ if (marker === "`" && info.includes("`"))
44
+ return null;
45
+ return { marker, length: run.length, indent: indent.length, kind: kindOf(info) };
46
+ }
47
+ function closes(line, fence) {
48
+ const run = CLOSING_FENCE.exec(line)?.[1];
49
+ return run !== undefined && run.charAt(0) === fence.marker && run.length >= fence.length;
50
+ }
51
+ function closingIndex(lines, from, fence) {
52
+ for (let index = from;index < lines.length; index += 1) {
53
+ if (closes(lines[index] ?? "", fence))
54
+ return index;
55
+ }
56
+ return lines.length;
57
+ }
58
+ function dedent(line, indent) {
59
+ let cut = 0;
60
+ while (cut < indent && line.charAt(cut) === " ")
61
+ cut += 1;
62
+ return line.slice(cut);
63
+ }
64
+ function readRafaBlocks(markdown) {
65
+ const lines = linesOf(markdown);
66
+ const blocks = [];
67
+ let index = 0;
68
+ while (index < lines.length) {
69
+ const fence = openingFence(lines[index] ?? "");
70
+ if (fence === null) {
71
+ index += 1;
72
+ continue;
73
+ }
74
+ const closing = closingIndex(lines, index + 1, fence);
75
+ const closed = closing < lines.length;
76
+ if (fence.kind !== null) {
77
+ const body = lines.slice(index + 1, closing).map((line) => dedent(line, fence.indent)).join(`
78
+ `);
79
+ const last = closed ? closing + 1 : lines.length;
80
+ blocks.push({ kind: fence.kind, body, span: { first: index + 1, last }, closed });
81
+ }
82
+ index = closing + 1;
83
+ }
84
+ return blocks;
85
+ }
86
+
87
+ // packages/rafa/src/core/plan/blocker-comment.ts
88
+ var BLOCKER_OPEN = "<!-- blocked: ";
89
+ var REPAIRS_OPEN = "<!-- repairs: ";
90
+ var BLOCKER_CLOSE = " -->";
91
+ var BLOCKER_GAP = " ";
92
+ var TRAILING_COMMENT = /\s<!-- (blocked|repairs): ((?:(?!<!--|-->).)*) -->$/;
93
+ var ESCAPE_SEQUENCE = /\\(u[0-9A-Fa-f]{4}|[\s\S])/g;
94
+ var TAB = 9;
95
+ var FIRST_PRINTABLE = 32;
96
+ var ESCAPED_CODE_UNITS = [127, 8232, 8233];
97
+ function isEscapedCodeUnit(code) {
98
+ if (code < FIRST_PRINTABLE)
99
+ return code !== TAB;
100
+ return ESCAPED_CODE_UNITS.includes(code);
101
+ }
102
+ function escapeCharacter(char) {
103
+ if (char === "\\")
104
+ return "\\\\";
105
+ if (char === `
106
+ `)
107
+ return "\\n";
108
+ if (char === "\r")
109
+ return "\\r";
110
+ const code = char.charCodeAt(0);
111
+ return isEscapedCodeUnit(code) ? `\\u${code.toString(16).padStart(4, "0")}` : char;
112
+ }
113
+ function escapeBlockerText(text) {
114
+ return Array.from(text, escapeCharacter).join("").replace(/(?<=--!?)>/g, "\\>").replace(/(?<=<)!(?=--)/g, "\\!");
115
+ }
116
+ function unescapeBlockerText(escaped) {
117
+ return escaped.replace(ESCAPE_SEQUENCE, (_sequence, code) => {
118
+ if (code === "n")
119
+ return `
120
+ `;
121
+ if (code === "r")
122
+ return "\r";
123
+ return code.length === 5 ? String.fromCharCode(Number.parseInt(code.slice(1), 16)) : code;
124
+ });
125
+ }
126
+ function blockerComment(blocker) {
127
+ return `${BLOCKER_OPEN}${escapeBlockerText(blocker)}${BLOCKER_CLOSE}`;
128
+ }
129
+ function repairsComment(repaired) {
130
+ return `${REPAIRS_OPEN}${escapeBlockerText(repaired)}${BLOCKER_CLOSE}`;
131
+ }
132
+ function findTrailingComment(text) {
133
+ const trimmed = text.trimEnd();
134
+ const match = TRAILING_COMMENT.exec(trimmed);
135
+ const kind = match?.[1];
136
+ const escaped = match?.[2];
137
+ if (match === null || escaped === undefined || kind !== "blocked" && kind !== "repairs")
138
+ return null;
139
+ const before = trimmed.slice(0, match.index).trimEnd();
140
+ return before.length === 0 ? null : { kind, before, escaped };
141
+ }
142
+ function splitTrailingComments(taskText) {
143
+ const last = findTrailingComment(taskText);
144
+ if (last === null)
145
+ return { text: taskText, blocked: null, repairs: null };
146
+ const earlier = findTrailingComment(last.before);
147
+ const found = earlier === null || earlier.kind === last.kind ? [last] : [last, earlier];
148
+ return {
149
+ text: found.at(-1)?.before ?? last.before,
150
+ blocked: found.find((comment) => comment.kind === "blocked")?.escaped ?? null,
151
+ repairs: found.find((comment) => comment.kind === "repairs")?.escaped ?? null
152
+ };
153
+ }
154
+ function commentText(escaped) {
155
+ if (escaped === null)
156
+ return null;
157
+ const text = unescapeBlockerText(escaped);
158
+ return text.trim().length === 0 ? null : text;
159
+ }
160
+ function keptRepairs(escaped) {
161
+ return escaped === null ? "" : `${BLOCKER_GAP}${REPAIRS_OPEN}${escaped}${BLOCKER_CLOSE}`;
162
+ }
163
+ function splitBlockerComment(taskText) {
164
+ const { text, blocked } = splitTrailingComments(taskText);
165
+ return { text, blocker: commentText(blocked) };
166
+ }
167
+
168
+ // packages/rafa/src/core/plan/parse.ts
169
+ var PLAN_BLOCK_KINDS = ["plan", "context", "stage-context"];
170
+ var PLAN_HEADER_FIELDS = ["stub", "issue", "spec", "release"];
171
+ var PLAN_RELEASE_LEVELS = ["patch", "minor", "major", "none"];
172
+ var TASK_LINES = [
173
+ ["unchecked", /^- \[ \] (.+)/],
174
+ ["blocked", /^- \[BLOCKED\] (.+)/],
175
+ ["done", /^- \[x\] (.+)/]
176
+ ];
177
+ var STAGE_HEADING = /^# Stage: (.+)/;
178
+ function isPlanBlockKind(kind) {
179
+ return PLAN_BLOCK_KINDS.includes(kind);
180
+ }
181
+ function isHeaderField(key) {
182
+ return PLAN_HEADER_FIELDS.includes(key);
183
+ }
184
+ function isReleaseLevel(value) {
185
+ return PLAN_RELEASE_LEVELS.includes(value);
186
+ }
187
+ function isMapping(value) {
188
+ return typeof value === "object" && value !== null && !Array.isArray(value);
189
+ }
190
+ function describeValue(value) {
191
+ if (typeof value === "string")
192
+ return JSON.stringify(value);
193
+ if (value === null)
194
+ return "null";
195
+ if (Array.isArray(value))
196
+ return "a list";
197
+ if (typeof value === "object")
198
+ return "a mapping";
199
+ return String(value);
200
+ }
201
+ function messageOf(error) {
202
+ return error instanceof Error ? error.message : String(error);
203
+ }
204
+ function planIssue(reason, line, text) {
205
+ return { reason, line, text };
206
+ }
207
+ function emptyHeader() {
208
+ return { stub: null, issue: null, spec: null, release: null, extras: [] };
209
+ }
210
+ function readTaskLine(line) {
211
+ for (const [status, pattern] of TASK_LINES) {
212
+ const capture = pattern.exec(line)?.[1];
213
+ if (capture !== undefined)
214
+ return { status, task: splitBlockerComment(capture.trim()).text };
215
+ }
216
+ return null;
217
+ }
218
+ function readStageHeading(line) {
219
+ const capture = STAGE_HEADING.exec(line)?.[1];
220
+ return capture === undefined ? null : capture.trim();
221
+ }
222
+ function blockAt(blocks, lineNum) {
223
+ const line = lineNum + 1;
224
+ return blocks.find((block) => block.span.first <= line && line <= block.span.last);
225
+ }
226
+ function taskInBlock(lineNum, status, block) {
227
+ const { first, last } = block.span;
228
+ const dispatcher = block.closed ? "findNextTask skips it" : "findNextTask still dispatches it, the block never being closed";
229
+ return planIssue("task-in-block", lineNum + 1, `${status} task line inside the rafa:${block.kind} block at lines ${first}-${last}: ` + `${dispatcher}, and the model reads it as block body`);
230
+ }
231
+ function planTask(line, lineNum, headings) {
232
+ const { text, declaration } = parseTaskDeclaration(line.task);
233
+ const stage = headings.length > 0 ? headings.length - 1 : null;
234
+ return { task: line.task, lineNum, status: line.status, text, declaration, stage };
235
+ }
236
+ function readChecklist(markdown, blocks) {
237
+ const headings = [];
238
+ const tasks = [];
239
+ const hidden = [];
240
+ const issues = [];
241
+ for (const [lineNum, line] of markdown.split(`
242
+ `).entries()) {
243
+ const taskLine = readTaskLine(line);
244
+ const block = blockAt(blocks, lineNum);
245
+ if (block !== undefined) {
246
+ if (taskLine !== null && taskLine.status !== "done") {
247
+ issues.push(taskInBlock(lineNum, taskLine.status, block));
248
+ if (!block.closed)
249
+ hidden.push(planTask(taskLine, lineNum, headings));
250
+ }
251
+ continue;
252
+ }
253
+ const name = readStageHeading(line);
254
+ if (name !== null) {
255
+ headings.push({ name, lineNum });
256
+ continue;
257
+ }
258
+ if (taskLine === null)
259
+ continue;
260
+ tasks.push(planTask(taskLine, lineNum, headings));
261
+ }
262
+ return { headings, tasks, hidden, issues };
263
+ }
264
+ function headingAbove(headings, lineNum) {
265
+ let above = null;
266
+ for (const [index, heading] of headings.entries()) {
267
+ if (heading.lineNum >= lineNum)
268
+ break;
269
+ above = index;
270
+ }
271
+ return above;
272
+ }
273
+ function stageSlot(index) {
274
+ return `stage-context@${index}`;
275
+ }
276
+ function slotOf(block, headings) {
277
+ if (block.kind !== "stage-context")
278
+ return { key: block.kind, scope: "" };
279
+ const index = headingAbove(headings, block.span.first - 1);
280
+ if (index === null)
281
+ return null;
282
+ const name = headings[index]?.name ?? "";
283
+ return { key: stageSlot(index), scope: ` under # Stage: ${name}` };
284
+ }
285
+ function bindBlocks(blocks, headings) {
286
+ const read = new Map;
287
+ const issues = [];
288
+ for (const block of blocks) {
289
+ const line = block.span.first;
290
+ if (!block.closed) {
291
+ issues.push(planIssue("unclosed-block", line, `rafa:${block.kind} block is never closed, so it runs to the end of the document ` + "and nothing after its fence is read"));
292
+ continue;
293
+ }
294
+ if (!isPlanBlockKind(block.kind))
295
+ continue;
296
+ const slot = slotOf(block, headings);
297
+ if (slot === null) {
298
+ issues.push(planIssue("orphan-stage-context", line, "rafa:stage-context block above every # Stage: heading belongs to no stage and is not read"));
299
+ continue;
300
+ }
301
+ const earlier = read.get(slot.key);
302
+ if (earlier === undefined) {
303
+ read.set(slot.key, block);
304
+ continue;
305
+ }
306
+ issues.push(planIssue("duplicate-block", line, `rafa:${block.kind} block${slot.scope} repeats the one at line ${earlier.span.first}, ` + "which is the one read"));
307
+ }
308
+ return {
309
+ header: read.get("plan") ?? null,
310
+ context: read.get("context") ?? null,
311
+ stageContexts: headings.map((_, index) => read.get(stageSlot(index))?.body ?? null),
312
+ issues
313
+ };
314
+ }
315
+ function usableField(field, value) {
316
+ if (field === "issue" && typeof value === "number") {
317
+ return Number.isSafeInteger(value) ? String(value) : null;
318
+ }
319
+ if (typeof value !== "string" || value.trim().length === 0)
320
+ return null;
321
+ if (field === "stub" && !isStampableStub(value))
322
+ return null;
323
+ if (field === "release" && !isReleaseLevel(value))
324
+ return null;
325
+ return value;
326
+ }
327
+ function unusableText(field, value) {
328
+ const subject = `rafa:plan ${field}`;
329
+ if (value === null) {
330
+ return `${subject} is empty; a value opening with # after a space is a YAML comment unless quoted`;
331
+ }
332
+ if (field === "release") {
333
+ return `${subject} is ${describeValue(value)}, not one of ${PLAN_RELEASE_LEVELS.join(", ")}`;
334
+ }
335
+ if (typeof value !== "string") {
336
+ return field === "issue" ? `${subject} is ${describeValue(value)}, not a string or a whole number; quote it` : `${subject} is ${describeValue(value)}, not a string; quote it`;
337
+ }
338
+ if (value.trim().length === 0)
339
+ return `${subject} is blank`;
340
+ return `${subject} ${JSON.stringify(value)} is no stub a plan stamp can carry ` + '(letters, digits, ".", "_" and "-")';
341
+ }
342
+ function releaseOf(values) {
343
+ const value = values.get("release");
344
+ if (value === undefined || !isReleaseLevel(value))
345
+ return null;
346
+ return value;
347
+ }
348
+ function readFields(document, line) {
349
+ const values = new Map;
350
+ const extras = [];
351
+ const issues = [];
352
+ for (const [key, value] of Object.entries(document)) {
353
+ if (!isHeaderField(key)) {
354
+ extras.push({ key, value });
355
+ continue;
356
+ }
357
+ const usable = usableField(key, value);
358
+ if (usable === null)
359
+ issues.push(planIssue("unusable-field", line, unusableText(key, value)));
360
+ else
361
+ values.set(key, usable);
362
+ }
363
+ const header = {
364
+ stub: values.get("stub") ?? null,
365
+ issue: values.get("issue") ?? null,
366
+ spec: values.get("spec") ?? null,
367
+ release: releaseOf(values),
368
+ extras
369
+ };
370
+ return { header, issues };
371
+ }
372
+ function readHeader(block) {
373
+ if (block === null)
374
+ return { header: emptyHeader(), issues: [] };
375
+ const line = block.span.first;
376
+ let document;
377
+ try {
378
+ document = Bun.YAML.parse(block.body);
379
+ } catch (error) {
380
+ const text = `rafa:plan block is not valid YAML (${messageOf(error)})`;
381
+ return { header: emptyHeader(), issues: [planIssue("malformed-header", line, text)] };
382
+ }
383
+ if (document === null)
384
+ return { header: emptyHeader(), issues: [] };
385
+ if (!isMapping(document)) {
386
+ const text = `rafa:plan block holds ${describeValue(document)}, not a mapping of fields`;
387
+ return { header: emptyHeader(), issues: [planIssue("malformed-header", line, text)] };
388
+ }
389
+ return readFields(document, line);
390
+ }
391
+ function parsePlan(markdown) {
392
+ const blocks = readRafaBlocks(markdown);
393
+ const checklist = readChecklist(markdown, blocks);
394
+ const bound = bindBlocks(blocks, checklist.headings);
395
+ const reading = readHeader(bound.header);
396
+ const stages = checklist.headings.map((heading, index) => ({
397
+ name: heading.name,
398
+ lineNum: heading.lineNum,
399
+ context: bound.stageContexts[index] ?? null
400
+ }));
401
+ const issues = [...checklist.issues, ...bound.issues, ...reading.issues].sort((a, b) => a.line - b.line);
402
+ return {
403
+ header: reading.header,
404
+ context: bound.context?.body ?? null,
405
+ stages,
406
+ tasks: checklist.tasks,
407
+ hiddenTasks: checklist.hidden,
408
+ blocks,
409
+ issues
410
+ };
411
+ }
412
+ // packages/rafa/src/core/plan/plan-files.ts
413
+ import { statSync } from "fs";
414
+ import { basename, dirname, join, resolve } from "path";
415
+ function plansDirAt(root, planDir) {
416
+ return { label: planDir, path: resolve(root, planDir) };
417
+ }
418
+ function countTasks(tasks) {
419
+ const done = tasks.filter((task) => task.status === "done").length;
420
+ const blocked = tasks.filter((task) => task.status === "blocked").length;
421
+ return { total: tasks.length, done, blocked, open: tasks.length - done - blocked };
422
+ }
423
+ function planFileName(stub, tracker) {
424
+ return tracker ? `PLAN_TRACKER-${stub}.md` : `PLAN-${stub}.md`;
425
+ }
426
+ function stubOfPlanFile(name) {
427
+ const stub = /^PLAN-(.+)\.md$/.exec(name)?.[1];
428
+ return stub !== undefined && isStampableStub(stub) ? stub : null;
429
+ }
430
+ function isFile(path) {
431
+ return statSync(path, { throwIfNoEntry: false })?.isFile() ?? false;
432
+ }
433
+ var REJECTED_DIR = "rejected";
434
+ function rejectedPath(path) {
435
+ const parent = dirname(path);
436
+ return parent === "." ? join(REJECTED_DIR, basename(path)) : join(parent, REJECTED_DIR, basename(path));
437
+ }
438
+ function issueLine(file, issue) {
439
+ return `${file}:${issue.line}: ${issue.reason}: ${issue.text}`;
440
+ }
441
+ function plural(count, noun) {
442
+ return count === 1 ? `${count} ${noun}` : `${count} ${noun}s`;
443
+ }
444
+ // packages/rafa/src/core/plan/tracker-path.ts
445
+ function trackerPathFor(planPath) {
446
+ return planPath.replace(/PLAN(-[^/]*)?\.md$/, (_m, stub) => `PLAN_TRACKER${stub ?? ""}.md`);
447
+ }
448
+ export { BLOCKER_GAP, escapeBlockerText, unescapeBlockerText, blockerComment, repairsComment, splitTrailingComments, commentText, keptRepairs, splitBlockerComment, RAFA_BLOCK_KINDS, isRafaBlockKind, readRafaBlocks, PLAN_BLOCK_KINDS, PLAN_HEADER_FIELDS, PLAN_RELEASE_LEVELS, parsePlan, plansDirAt, countTasks, planFileName, stubOfPlanFile, isFile, rejectedPath, issueLine, plural, trackerPathFor };
@@ -1,4 +1,6 @@
1
1
  // @bun
2
+ var __require = import.meta.require;
3
+
2
4
  // packages/rafa/src/schema/tiers.ts
3
5
  import { existsSync, realpathSync } from "fs";
4
6
  import { dirname, join } from "path";
@@ -82,7 +84,6 @@ var GRANULAR_KEYS = ["model", "effort", "tools"];
82
84
  var AGENT_OWNED_KEYS = ["model", "tools"];
83
85
  var MODEL_ALIASES = ["opus", "sonnet", "haiku", "fable"];
84
86
  var TEST_SCOPES = ["affected", "module", "full"];
85
- var DEFAULT_TEST_SCOPE = "affected";
86
87
  var DOCS_ROLES = ["repair"];
87
88
  var DECLARATION_BLOCK = /\{([^{}]*)\}$/;
88
89
  var ENTRY_TOKEN = /^([A-Za-z_][A-Za-z0-9_-]*)=(.*)$/;
@@ -107,9 +108,6 @@ function isEffortLevel(value) {
107
108
  function isTestScope(value) {
108
109
  return TEST_SCOPES.includes(value);
109
110
  }
110
- function readTestScope(declaration) {
111
- return declaration?.tests ?? DEFAULT_TEST_SCOPE;
112
- }
113
111
  function isDocsRole(value) {
114
112
  return DOCS_ROLES.includes(value);
115
113
  }
@@ -522,6 +520,7 @@ function branchFromTemplate(template, stub) {
522
520
  }
523
521
 
524
522
  // packages/rafa/src/core/config/branch-template.ts
523
+ var DEFAULT_BASE_BRANCH = "main";
525
524
  var STUB_PREFIX = "rafa-";
526
525
  function branchGlob(template) {
527
526
  return template.replace(BRANCH_STUB, () => `${STUB_PREFIX}*`);
@@ -537,4 +536,13 @@ function stubOfBranch(template, branch) {
537
536
  const stub = branch.slice(prefix.length, branch.length - suffix.length);
538
537
  return stub.startsWith(STUB_PREFIX) ? stub : null;
539
538
  }
540
- export { SKILL_TIERS, RAFA_INSTINCTS_PATH, BUNDLED_SKILLS_DIR, isSkillTier, realEntry, bundledBinDirectory, skillTierDirectory, resolveSkillTiers, resolveInstinctScopes, tierExists, TEST_SCOPES, isAgentName, BUDGET_FLAG, readTestScope, readDocsRole, parseTaskDeclaration, stripTaskDeclaration, resolveDeclarationFlags, isMapping, describeValue, messageOf, CONFIG_VERSIONS, STORE_BACKENDS, SYNC_STRATEGIES, BOARD_RELATIONSHIP_MODES, INJECT_MODES, OUTPUT_MODES, CLAUDE_SETTING_SOURCES, PR_PROVIDERS, RELEASE_AUTO, DUPLICATE_LEVELS, SKILL_RESOLVERS, CLAIMS_STALE_DISABLED, refused, refusedWith, mapReading, below, oneOf, text, flag, usdAmount, issueNumber, dayCount, BUSY_TIMEOUT_MIN_MS, BUSY_TIMEOUT_MAX_MS, isBusyTimeoutMs, busyTimeoutMs, confidence, recurrenceCount, releaseEnabled, duplicatesLevel, tierSwitch, skillResolverName, lessonSwitch, claimDurationHours, claimsStaleAfter, claimsAhead, isGitHubLogin, githubLogin, BOARD_PROJECT_TEMPLATE_DEFAULT, projectUrl, projectNumber, listOf, subsetOf, mapOf, directory, trackerKind, releaseFile, tierPins, routeTable, releaseStrategy, releaseSettleMode, releaseTagMode, releasePublishMode, versionCollisionMode, fragmentsDirectory, BRANCH_STUB, DEFAULT_BRANCH_TEMPLATE, isBranchTemplate, branchTemplate, branchFromTemplate, branchGlob, stubOfBranch };
539
+ // packages/rafa/src/core/config/merge-method.ts
540
+ var MERGE_METHODS = Object.freeze([
541
+ "squash",
542
+ "merge",
543
+ "rebase"
544
+ ]);
545
+ function isMergeMethod(value) {
546
+ return typeof value === "string" && MERGE_METHODS.includes(value);
547
+ }
548
+ export { __require, SKILL_TIERS, RAFA_INSTINCTS_PATH, BUNDLED_SKILLS_DIR, isSkillTier, realEntry, bundledBinDirectory, skillTierDirectory, resolveSkillTiers, resolveInstinctScopes, tierExists, TEST_SCOPES, isAgentName, BUDGET_FLAG, readDocsRole, parseTaskDeclaration, stripTaskDeclaration, resolveDeclarationFlags, isMapping, describeValue, messageOf, CONFIG_VERSIONS, STORE_BACKENDS, SYNC_STRATEGIES, BOARD_RELATIONSHIP_MODES, INJECT_MODES, OUTPUT_MODES, CLAUDE_SETTING_SOURCES, PR_PROVIDERS, RELEASE_AUTO, DUPLICATE_LEVELS, SKILL_RESOLVERS, CLAIMS_STALE_DISABLED, refused, refusedWith, mapReading, below, oneOf, text, flag, usdAmount, issueNumber, dayCount, BUSY_TIMEOUT_MIN_MS, BUSY_TIMEOUT_MAX_MS, isBusyTimeoutMs, busyTimeoutMs, confidence, recurrenceCount, releaseEnabled, duplicatesLevel, tierSwitch, skillResolverName, lessonSwitch, claimDurationHours, claimsStaleAfter, claimsAhead, isGitHubLogin, githubLogin, BOARD_PROJECT_TEMPLATE_DEFAULT, projectUrl, projectNumber, listOf, subsetOf, mapOf, directory, trackerKind, releaseFile, tierPins, routeTable, releaseStrategy, releaseSettleMode, releaseTagMode, releasePublishMode, versionCollisionMode, fragmentsDirectory, BRANCH_STUB, DEFAULT_BRANCH_TEMPLATE, isBranchTemplate, branchTemplate, branchFromTemplate, DEFAULT_BASE_BRANCH, branchGlob, stubOfBranch, MERGE_METHODS, isMergeMethod };