@open-tomato/rafa 0.47.0 → 0.49.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 (73) hide show
  1. package/README.md +5 -2
  2. package/dist/bugs/places.d.ts +1 -1
  3. package/dist/bundled/skills/dev-planner/SKILL.md +1 -1
  4. package/dist/cli.js +58774 -58722
  5. package/dist/config/index.js +4 -5
  6. package/dist/config/shape.d.ts +13 -11
  7. package/dist/config-schema-board-project.d.ts +3 -3
  8. package/dist/config-schema-checks.d.ts +3 -3
  9. package/dist/config-schema-hub.d.ts +3 -3
  10. package/dist/config-schema-issues.d.ts +4 -4
  11. package/dist/config-schema-loop-continue.d.ts +3 -3
  12. package/dist/config-schema-loop-retries.d.ts +4 -4
  13. package/dist/config-schema-release.d.ts +13 -13
  14. package/dist/config-schema-tests.d.ts +3 -3
  15. package/dist/config-schema-triage.d.ts +3 -3
  16. package/dist/config-schema-wrap-up.d.ts +4 -4
  17. package/dist/core/command/global-flags.d.ts +25 -0
  18. package/dist/core/command/index.d.ts +31 -25
  19. package/dist/core/command/registry-types.d.ts +4 -4
  20. package/dist/core/command/shared-flags.d.ts +6 -6
  21. package/dist/core/command/types.d.ts +3 -2
  22. package/dist/core/config/branch-template.d.ts +2 -0
  23. package/dist/core/config/config-items.d.ts +1 -1
  24. package/dist/core/config/config-schema.d.ts +6 -0
  25. package/dist/core/config/config-sections.d.ts +15 -14
  26. package/dist/core/config/config.d.ts +1 -1
  27. package/dist/core/config/core-section.d.ts +1 -1
  28. package/dist/core/config/default-routing.d.ts +1 -1
  29. package/dist/core/config/index.d.ts +4 -4
  30. package/dist/core/config/merge-method.d.ts +4 -4
  31. package/dist/core/config/sections.d.ts +6 -3
  32. package/dist/core/git/gh-runner.d.ts +1 -1
  33. package/dist/core/git/git.d.ts +34 -0
  34. package/dist/core/git/index.d.ts +13 -8
  35. package/dist/core/loop/claude.d.ts +11 -5
  36. package/dist/core/loop/index.d.ts +3 -2
  37. package/dist/core/loop/sessions.d.ts +1 -1
  38. package/dist/core/loop/suite-failure.d.ts +8 -6
  39. package/dist/core/output/active.d.ts +1 -1
  40. package/dist/core/runtime/identity.d.ts +13 -0
  41. package/dist/core/runtime/index.d.ts +12 -6
  42. package/dist/effort/store/check-rows.d.ts +1 -1
  43. package/dist/effort/store/commit-stats.d.ts +1 -1
  44. package/dist/effort/store/index.js +8 -9
  45. package/dist/effort/store/merge-commit-gaps.d.ts +1 -1
  46. package/dist/effort/store/plan-stubs.d.ts +1 -1
  47. package/dist/effort/store/session-row-types.d.ts +2 -2
  48. package/dist/{index-f1y86zbb.js → index-2a7nb3an.js} +31 -31
  49. package/dist/index-ajv88fkm.js +448 -0
  50. package/dist/{index-r5q2pdky.js → index-fpgmdmww.js} +4 -1
  51. package/dist/{index-pzpb1rf7.js → index-g91ys6kw.js} +97 -1
  52. package/dist/{index-7dgc5g1t.js → index-j154qpbj.js} +8696 -11193
  53. package/dist/{index-cbqvgda6.js → index-m672ptpg.js} +3 -1
  54. package/dist/index-thqpre1b.js +670 -0
  55. package/dist/{index-eay1bd2w.js → index-vfny3ryr.js} +1090 -652
  56. package/dist/{index-nwzx41g1.js → index-w5qbpdtp.js} +416 -843
  57. package/dist/{index-n3e31fmw.js → index-zsak0jy6.js} +172 -254
  58. package/dist/index.js +24867 -18958
  59. package/dist/learning/index.js +221 -12
  60. package/dist/plan/index.js +11 -10
  61. package/dist/ports/index.d.ts +6 -6
  62. package/dist/ports/learning.d.ts +5 -4
  63. package/dist/ports/spec-review.d.ts +1 -1
  64. package/dist/ready-mh5wdzq5.js +241 -0
  65. package/dist/release-templates/release-bot-fragment.yml +6 -6
  66. package/dist/release-templates/release-publish.yml +8 -8
  67. package/dist/release-templates/release-settle.yml +8 -7
  68. package/dist/release-templates/release-tag.yml +8 -7
  69. package/package.json +32 -2
  70. package/dist/index-38ktnyvz.js +0 -223
  71. package/dist/index-3mwsr6wg.js +0 -1070
  72. package/dist/index-z1w83f81.js +0 -4
  73. package/dist/ready-6p40c3gw.js +0 -2007
@@ -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";
@@ -518,6 +520,7 @@ function branchFromTemplate(template, stub) {
518
520
  }
519
521
 
520
522
  // packages/rafa/src/core/config/branch-template.ts
523
+ var DEFAULT_BASE_BRANCH = "main";
521
524
  var STUB_PREFIX = "rafa-";
522
525
  function branchGlob(template) {
523
526
  return template.replace(BRANCH_STUB, () => `${STUB_PREFIX}*`);
@@ -542,4 +545,4 @@ var MERGE_METHODS = Object.freeze([
542
545
  function isMergeMethod(value) {
543
546
  return typeof value === "string" && MERGE_METHODS.includes(value);
544
547
  }
545
- export { 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, branchGlob, stubOfBranch, MERGE_METHODS, isMergeMethod };
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 };
@@ -1,4 +1,22 @@
1
1
  // @bun
2
+ import {
3
+ MERGE_METHODS,
4
+ PR_PROVIDERS,
5
+ RELEASE_AUTO,
6
+ flag,
7
+ fragmentsDirectory,
8
+ oneOf,
9
+ releaseEnabled,
10
+ releaseFile,
11
+ releasePublishMode,
12
+ releaseSettleMode,
13
+ releaseStrategy,
14
+ releaseTagMode,
15
+ text,
16
+ usdAmount,
17
+ versionCollisionMode
18
+ } from "./index-fpgmdmww.js";
19
+
2
20
  // packages/rafa/src/adapters/logger/settings.ts
3
21
  import { AsyncLocalStorage } from "async_hooks";
4
22
  var LOG_LEVELS = Object.freeze(["error", "warn", "debug"]);
@@ -37,6 +55,84 @@ function levelEnabled(level, module, settings, verbosity) {
37
55
  return LOG_LEVELS.indexOf(level) <= LOG_LEVELS.indexOf(threshold);
38
56
  }
39
57
 
58
+ // packages/rafa/src/config-schema-release.ts
59
+ var PR_DEFAULTS = Object.freeze({
60
+ prProvider: null,
61
+ prMergeMethod: "squash",
62
+ prBase: null,
63
+ prResolveBudget: 2,
64
+ prVersionCollision: "report"
65
+ });
66
+ var RELEASE_DEFAULTS = Object.freeze({
67
+ releaseEnabled: RELEASE_AUTO,
68
+ releaseVersionFile: "package.json",
69
+ releaseChangelog: "CHANGELOG.md",
70
+ releaseHeading: "## {version} \u2014 {date}, {title}",
71
+ releaseFragments: ".changes",
72
+ releaseStrategy: "semver-by-level",
73
+ releaseSettle: "push",
74
+ releaseTag: "manual",
75
+ releasePublishCommand: "npm publish",
76
+ releasePublish: "manual",
77
+ releaseMoveLock: false
78
+ });
79
+ var DANGEROUS_RELEASE_DEFAULTS = Object.freeze({
80
+ dangerousAcceptVersionCollision: false
81
+ });
82
+ var mergeMethod = oneOf(MERGE_METHODS);
83
+ var PR_SETTINGS = {
84
+ prProvider: { key: "pr.provider", read: oneOf(PR_PROVIDERS), cli: false },
85
+ prMergeMethod: { key: "pr.mergeMethod", read: mergeMethod, cli: false },
86
+ prBase: { key: "pr.base", read: text("a branch name"), cli: false },
87
+ prResolveBudget: { key: "pr.resolveBudget", read: usdAmount, cli: false },
88
+ prVersionCollision: {
89
+ key: "pr.versionCollision",
90
+ read: versionCollisionMode,
91
+ cli: false
92
+ }
93
+ };
94
+ var RELEASE_SETTINGS = {
95
+ releaseEnabled: { key: "release.enabled", read: releaseEnabled, cli: false },
96
+ releaseVersionFile: {
97
+ key: "release.versionFile",
98
+ read: releaseFile,
99
+ cli: false
100
+ },
101
+ releaseChangelog: { key: "release.changelog", read: releaseFile, cli: false },
102
+ releaseHeading: {
103
+ key: "release.heading",
104
+ read: text("a changelog heading template"),
105
+ cli: false
106
+ },
107
+ releaseFragments: {
108
+ key: "release.fragments",
109
+ read: fragmentsDirectory,
110
+ cli: false
111
+ },
112
+ releaseStrategy: { key: "release.strategy", read: releaseStrategy, cli: false },
113
+ releaseSettle: { key: "release.settle", read: releaseSettleMode, cli: false },
114
+ releaseTag: { key: "release.tag", read: releaseTagMode, cli: false },
115
+ releasePublishCommand: {
116
+ key: "release.publishCommand",
117
+ read: text("a publish command"),
118
+ cli: false
119
+ },
120
+ releasePublish: { key: "release.publish", read: releasePublishMode, cli: false },
121
+ releaseMoveLock: { key: "release.moveLock", read: flag, cli: false }
122
+ };
123
+ var DANGEROUS_RELEASE_SETTINGS = {
124
+ dangerousAcceptVersionCollision: {
125
+ key: "dangerous.acceptVersionCollision",
126
+ read: flag,
127
+ cli: false
128
+ }
129
+ };
130
+ var RELEASE_SECTION = Object.freeze({
131
+ package: "release",
132
+ settings: Object.freeze({ ...PR_SETTINGS, ...RELEASE_SETTINGS, ...DANGEROUS_RELEASE_SETTINGS }),
133
+ defaults: Object.freeze({ ...PR_DEFAULTS, ...RELEASE_DEFAULTS, ...DANGEROUS_RELEASE_DEFAULTS })
134
+ });
135
+
40
136
  // packages/rafa/src/errors/codes.ts
41
137
  var ERROR_LEVELS = Object.freeze(["error", "warn"]);
42
138
  var CODE_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/;
@@ -150,4 +246,4 @@ function listedCodes(projectCodes) {
150
246
  ]);
151
247
  }
152
248
 
153
- export { ERROR_LEVELS, CODE_PATTERN, NEW_CONTEXT_LEAF, UNKNOWN_FAMILY, familyOf, codeProblem, isKnownCode, RAFA_CODES, listedCodes, LOG_LEVELS, LOGGER_THEMES, DEFAULT_LOGGER_KIND, setActiveLoggerSettings, activeLoggerSettings, levelEnabled };
249
+ export { LOG_LEVELS, LOGGER_THEMES, DEFAULT_LOGGER_KIND, setActiveLoggerSettings, activeLoggerSettings, levelEnabled, ERROR_LEVELS, CODE_PATTERN, NEW_CONTEXT_LEAF, UNKNOWN_FAMILY, familyOf, codeProblem, isKnownCode, RAFA_CODES, listedCodes, PR_DEFAULTS, RELEASE_DEFAULTS, DANGEROUS_RELEASE_DEFAULTS, PR_SETTINGS, RELEASE_SETTINGS, DANGEROUS_RELEASE_SETTINGS, RELEASE_SECTION };