@open-tomato/rafa 0.34.1 → 0.35.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/README.md +18 -18
- package/dist/bundled/agents/doc-updater.md +1 -1
- package/dist/bundled/operators/.claude-plugin/plugin.json +5 -0
- package/dist/bundled/operators/agents/rafa-stretch-engineer.md +36 -15
- package/dist/bundled/operators/skills/rafa-stretch-pit-stop/SKILL.md +2 -2
- package/dist/cli.js +11408 -10529
- package/dist/describe-59899b0p.js +11 -0
- package/dist/effort/store/index.js +33 -36
- package/dist/index-21jcfatr.js +16 -0
- package/dist/{index-vp0xghk2.js → index-2tjmxwvp.js} +519 -114
- package/dist/{index-v8d7c6sw.js → index-41vzahew.js} +69 -33
- package/dist/{index-bebv92ha.js → index-ckqfhynj.js} +824 -547
- package/dist/{index-s8ff86xt.js → index-dvrq9nfb.js} +4646 -3954
- package/dist/{index-d6d0942q.js → index-hgcvjke7.js} +17 -17
- package/dist/{index-nr4hdb35.js → index-se13pvag.js} +2471 -2303
- package/dist/index.js +147 -154
- package/dist/learning/index.js +20 -20
- package/dist/plan/index.js +42 -45
- package/package.json +1 -1
- package/dist/describe-5hqfwbjc.js +0 -14
- package/dist/index-3mzw3kzh.js +0 -129
- package/dist/index-fzhd3d4y.js +0 -446
- package/dist/index-k6sd4ym5.js +0 -243
- package/dist/index-wp8c28fd.js +0 -18
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
isStampableStub,
|
|
5
|
-
readRafaBlocks
|
|
6
|
-
} from "./index-vp0xghk2.js";
|
|
7
|
-
import {
|
|
3
|
+
parseTaskDeclaration,
|
|
8
4
|
messageOf,
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
isStampableStub,
|
|
6
|
+
activeOutput,
|
|
7
|
+
readRafaBlocks2
|
|
8
|
+
} from "./index-2tjmxwvp.js";
|
|
11
9
|
// src/preflight/prerequisites-md.ts
|
|
12
10
|
import { basename, dirname, join } from "path";
|
|
13
11
|
var SECTION_AUTO_RE = /\[auto\]/i;
|
|
@@ -89,7 +87,7 @@ function readItem(lines, lineIndex, inherited) {
|
|
|
89
87
|
const probe = isProbedTag(tag) ? extractProbe(description) : null;
|
|
90
88
|
return Object.freeze({ raw, description, tag, lineIndex, probe });
|
|
91
89
|
}
|
|
92
|
-
function
|
|
90
|
+
function parsePrerequisites2(content) {
|
|
93
91
|
const lines = content.split(`
|
|
94
92
|
`);
|
|
95
93
|
const items = [];
|
|
@@ -132,8 +130,8 @@ function namedItemOf(item) {
|
|
|
132
130
|
function isMalformed(item) {
|
|
133
131
|
return isProbedTag(item.tag) && item.probe === null;
|
|
134
132
|
}
|
|
135
|
-
function
|
|
136
|
-
const items =
|
|
133
|
+
function planPrerequisites2(content) {
|
|
134
|
+
const items = parsePrerequisites2(content);
|
|
137
135
|
return Object.freeze({
|
|
138
136
|
required: requiredItemsTagged(items, "auto"),
|
|
139
137
|
startRequired: requiredItemsTagged(items, "start"),
|
|
@@ -149,8 +147,8 @@ function malformedPrerequisiteLines(file, malformed) {
|
|
|
149
147
|
`Write each as ${PROBE_ITEM_EXAMPLE}, its one backticked span a complete command run as written;` + " prove a tool is there with `<tool> --version`, `<tool> --help` or `which <tool>`."
|
|
150
148
|
];
|
|
151
149
|
}
|
|
152
|
-
function
|
|
153
|
-
const plan =
|
|
150
|
+
function mergePlanPrerequisites2(settings, content) {
|
|
151
|
+
const plan = planPrerequisites2(content ?? "");
|
|
154
152
|
return Object.freeze({
|
|
155
153
|
required: Object.freeze([...settings.prerequisitesRequired, ...plan.required]),
|
|
156
154
|
startRequired: plan.startRequired,
|
|
@@ -159,7 +157,7 @@ function mergePlanPrerequisites(settings, content) {
|
|
|
159
157
|
malformed: plan.malformed
|
|
160
158
|
});
|
|
161
159
|
}
|
|
162
|
-
function
|
|
160
|
+
function prerequisitesPathForPlan2(planPath) {
|
|
163
161
|
const stub = PLAN_FILE_RE.exec(basename(planPath))?.[1];
|
|
164
162
|
if (stub === undefined)
|
|
165
163
|
return null;
|
|
@@ -175,13 +173,13 @@ async function readIfPresent(path) {
|
|
|
175
173
|
throw new Error(`${path}: cannot be read (${messageOf(error)})`, { cause: error });
|
|
176
174
|
}
|
|
177
175
|
}
|
|
178
|
-
async function
|
|
179
|
-
const path =
|
|
176
|
+
async function loadPlanPrerequisites2(planPath, settings) {
|
|
177
|
+
const path = prerequisitesPathForPlan2(planPath);
|
|
180
178
|
const content = path === null ? null : await readIfPresent(path);
|
|
181
|
-
return
|
|
179
|
+
return mergePlanPrerequisites2(settings, content);
|
|
182
180
|
}
|
|
183
181
|
// src/preflight/run.ts
|
|
184
|
-
var
|
|
182
|
+
var PROBE_TIMEOUT_MS2 = 30000;
|
|
185
183
|
var SHELL = "/bin/sh";
|
|
186
184
|
var PASS = Object.freeze({ outcome: "pass", failure: null });
|
|
187
185
|
function spawnShell(probe, options) {
|
|
@@ -223,13 +221,13 @@ function collect(stream) {
|
|
|
223
221
|
};
|
|
224
222
|
return { text: read(), stop };
|
|
225
223
|
}
|
|
226
|
-
async function
|
|
224
|
+
async function runShellProbe2(probe, options) {
|
|
227
225
|
let proc;
|
|
228
226
|
try {
|
|
229
227
|
proc = spawnShell(probe, options);
|
|
230
228
|
} catch (error) {
|
|
231
|
-
const
|
|
232
|
-
return Object.freeze({ exitCode: null, stderr
|
|
229
|
+
const stderr = `could not run ${SHELL} in ${options.cwd}: ${messageOf(error)}`;
|
|
230
|
+
return Object.freeze({ exitCode: null, stderr, timedOut: false });
|
|
233
231
|
}
|
|
234
232
|
const stderr = collect(proc.stderr);
|
|
235
233
|
let timedOut = false;
|
|
@@ -348,14 +346,14 @@ function contextOf(options) {
|
|
|
348
346
|
return {
|
|
349
347
|
cwd: options.cwd,
|
|
350
348
|
env: options.env ?? process.env,
|
|
351
|
-
timeoutMs: options.timeoutMs ??
|
|
352
|
-
runProbe: options.runProbe ??
|
|
349
|
+
timeoutMs: options.timeoutMs ?? PROBE_TIMEOUT_MS2,
|
|
350
|
+
runProbe: options.runProbe ?? runShellProbe2,
|
|
353
351
|
request: options.request ?? ((url, init) => fetch(url, init)),
|
|
354
352
|
warn: options.warn ?? warnThroughActiveOutput,
|
|
355
353
|
now: options.now ?? (() => performance.now())
|
|
356
354
|
};
|
|
357
355
|
}
|
|
358
|
-
async function
|
|
356
|
+
async function runPreflight2(items, options) {
|
|
359
357
|
const context = contextOf(options);
|
|
360
358
|
const checks = [];
|
|
361
359
|
const knownMissing = [];
|
|
@@ -452,7 +450,7 @@ function withoutBlockerComment(line) {
|
|
|
452
450
|
}
|
|
453
451
|
function closedBlockLines(trackerContent) {
|
|
454
452
|
const inside = new Set;
|
|
455
|
-
for (const block of
|
|
453
|
+
for (const block of readRafaBlocks2(trackerContent)) {
|
|
456
454
|
if (!block.closed)
|
|
457
455
|
continue;
|
|
458
456
|
for (let line = block.span.first;line <= block.span.last; line += 1) {
|
|
@@ -519,13 +517,51 @@ function writeTrackerBlocker(trackerPath, lineNum, blocker) {
|
|
|
519
517
|
`), "utf8");
|
|
520
518
|
return true;
|
|
521
519
|
}
|
|
520
|
+
var ANY_TASK_PREFIX = /^- \[(?: |x|BLOCKED)\] /;
|
|
521
|
+
var LINE_TERMINATOR = /[\n\r\u2028\u2029]/;
|
|
522
|
+
function assertInsertable(entry) {
|
|
523
|
+
if (entry.task.trim().length === 0 || LINE_TERMINATOR.test(entry.task)) {
|
|
524
|
+
throw new Error("insertTrackerTask: the task text must be one line and not blank");
|
|
525
|
+
}
|
|
526
|
+
if (entry.declaration.trim().length === 0 || /[{}]/.test(entry.declaration) || LINE_TERMINATOR.test(entry.declaration)) {
|
|
527
|
+
throw new Error("insertTrackerTask: the declaration must be one line of entries holding no brace");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
function endOfChecklist(lines, inBlock) {
|
|
531
|
+
for (let i = lines.length - 1;i >= 0; i -= 1) {
|
|
532
|
+
if (!inBlock.has(i) && ANY_TASK_PREFIX.test(lines[i]))
|
|
533
|
+
return i + 1;
|
|
534
|
+
}
|
|
535
|
+
const last = lines.length - 1;
|
|
536
|
+
return lines[last] === "" ? last : lines.length;
|
|
537
|
+
}
|
|
538
|
+
function insertTrackerTask(trackerPath, entry, beforeLine) {
|
|
539
|
+
assertInsertable(entry);
|
|
540
|
+
const content = fs.readFileSync(trackerPath, "utf8");
|
|
541
|
+
const lines = content.split(`
|
|
542
|
+
`);
|
|
543
|
+
const inBlock = closedBlockLines(content);
|
|
544
|
+
if (beforeLine !== null) {
|
|
545
|
+
const target = lines[beforeLine];
|
|
546
|
+
if (target === undefined || inBlock.has(beforeLine) || !ANY_TASK_PREFIX.test(target)) {
|
|
547
|
+
throw new Error(`insertTrackerTask: line ${beforeLine} is no task line`);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
const at = beforeLine ?? endOfChecklist(lines, inBlock);
|
|
551
|
+
const { cr } = splitCarriageReturn(lines[0] ?? "");
|
|
552
|
+
const line = `- [BLOCKED] ${entry.task.trim()}${BLOCKER_GAP}{${entry.declaration.trim()}}` + `${BLOCKER_GAP}${blockerComment(entry.blocker)}${cr}`;
|
|
553
|
+
const written = [...lines.slice(0, at), line, ...lines.slice(at)];
|
|
554
|
+
fs.writeFileSync(trackerPath, written.join(`
|
|
555
|
+
`), "utf8");
|
|
556
|
+
return at;
|
|
557
|
+
}
|
|
522
558
|
function trackerPathFor(planPath) {
|
|
523
559
|
return planPath.replace(/PLAN(-[^/]*)?\.md$/, (_m, stub) => `PLAN_TRACKER${stub ?? ""}.md`);
|
|
524
560
|
}
|
|
525
561
|
|
|
526
562
|
// src/plan/parse.ts
|
|
527
|
-
var
|
|
528
|
-
var
|
|
563
|
+
var PLAN_BLOCK_KINDS2 = ["plan", "context", "stage-context"];
|
|
564
|
+
var PLAN_HEADER_FIELDS2 = ["stub", "issue", "spec", "release"];
|
|
529
565
|
var PLAN_RELEASE_LEVELS = ["patch", "minor", "major", "none"];
|
|
530
566
|
var TASK_LINES = [
|
|
531
567
|
["unchecked", /^- \[ \] (.+)/],
|
|
@@ -534,10 +570,10 @@ var TASK_LINES = [
|
|
|
534
570
|
];
|
|
535
571
|
var STAGE_HEADING = /^# Stage: (.+)/;
|
|
536
572
|
function isPlanBlockKind(kind) {
|
|
537
|
-
return
|
|
573
|
+
return PLAN_BLOCK_KINDS2.includes(kind);
|
|
538
574
|
}
|
|
539
575
|
function isHeaderField(key) {
|
|
540
|
-
return
|
|
576
|
+
return PLAN_HEADER_FIELDS2.includes(key);
|
|
541
577
|
}
|
|
542
578
|
function isReleaseLevel(value) {
|
|
543
579
|
return PLAN_RELEASE_LEVELS.includes(value);
|
|
@@ -746,8 +782,8 @@ function readHeader(block) {
|
|
|
746
782
|
}
|
|
747
783
|
return readFields(document, line);
|
|
748
784
|
}
|
|
749
|
-
function
|
|
750
|
-
const blocks =
|
|
785
|
+
function parsePlan2(markdown) {
|
|
786
|
+
const blocks = readRafaBlocks2(markdown);
|
|
751
787
|
const checklist = readChecklist(markdown, blocks);
|
|
752
788
|
const bound = bindBlocks(blocks, checklist.headings);
|
|
753
789
|
const reading = readHeader(bound.header);
|
|
@@ -860,15 +896,15 @@ var RENDERERS = {
|
|
|
860
896
|
stage: renderStage,
|
|
861
897
|
task: renderTask
|
|
862
898
|
};
|
|
863
|
-
function
|
|
899
|
+
function renderInjection2(request) {
|
|
864
900
|
const { mode, plan, task } = request;
|
|
865
901
|
if (mode === "full")
|
|
866
902
|
return { requested: mode, mode, text: plan, fallback: null };
|
|
867
|
-
const model =
|
|
903
|
+
const model = parsePlan2(plan);
|
|
868
904
|
const location = locate(model, task);
|
|
869
905
|
if (!location.found) {
|
|
870
906
|
return { requested: mode, mode: "full", text: plan, fallback: location.fallback };
|
|
871
907
|
}
|
|
872
908
|
return { requested: mode, mode, text: RENDERERS[mode](model, location.task), fallback: null };
|
|
873
909
|
}
|
|
874
|
-
export { escapeBlockerText, splitBlockerComment, findNextTask, updateTrackerLine, writeTrackerBlocker, trackerPathFor,
|
|
910
|
+
export { escapeBlockerText, splitBlockerComment, findNextTask, updateTrackerLine, writeTrackerBlocker, insertTrackerTask, trackerPathFor, PLAN_BLOCK_KINDS2, PLAN_HEADER_FIELDS2, PLAN_RELEASE_LEVELS, parsePlan2, parsePrerequisites2, planPrerequisites2, malformedPrerequisiteLines, mergePlanPrerequisites2, prerequisitesPathForPlan2, loadPlanPrerequisites2, PROBE_TIMEOUT_MS2, runShellProbe2, runPreflight2, renderInjection2 };
|