@open-tomato/rafa 0.51.0 → 0.52.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/bugs/record.d.ts +8 -3
- package/dist/bundled/agents/doc-updater.md +4 -0
- package/dist/bundled/agents/loop-implementer.md +4 -0
- package/dist/bundled/agents/qa-bug-reporter.md +6 -3
- package/dist/bundled/operators/agents/rafa-stretch-engineer.md +10 -2
- package/dist/bundled/operators/skills/rafa-stretch-pit-stop/SKILL.md +37 -11
- package/dist/bundled/operators/skills/rafa-stretch-sweep/SKILL.md +10 -3
- package/dist/bundled/skills/dev-planner/SKILL.md +20 -5
- package/dist/cli.js +602 -333
- package/dist/effort/store/index.js +2 -2
- package/dist/{index-h9vwrj54.js → index-91cag9fr.js} +1 -1
- package/dist/{index-w5qbpdtp.js → index-amevawhe.js} +1 -1
- package/dist/{index-j518r1yt.js → index-hyp1sraj.js} +1 -1
- package/dist/{index-chm1d3xn.js → index-mbxgc1zv.js} +3 -3
- package/dist/{index-ajv88fkm.js → index-n2r3wf2z.js} +31 -2
- package/dist/index.js +53 -25
- package/dist/plan/index.js +2 -2
- package/dist/plan-prompt.md +1 -0
- package/dist/{ready-dph3z1nz.js → ready-3ccr65a2.js} +3 -3
- package/dist/report/parse.d.ts +3 -1
- package/package.json +5 -4
package/dist/cli.js
CHANGED
|
@@ -3964,7 +3964,7 @@ var init_shared_flags = __esm(() => {
|
|
|
3964
3964
|
});
|
|
3965
3965
|
|
|
3966
3966
|
// package.json
|
|
3967
|
-
var name = "@open-tomato/rafa", version = "0.
|
|
3967
|
+
var name = "@open-tomato/rafa", version = "0.52.0";
|
|
3968
3968
|
var init_package = () => {};
|
|
3969
3969
|
|
|
3970
3970
|
// packages/rafa/src/core/command/version.ts
|
|
@@ -5982,7 +5982,7 @@ function planIssue(reason, line, text2) {
|
|
|
5982
5982
|
return { reason, line, text: text2 };
|
|
5983
5983
|
}
|
|
5984
5984
|
function emptyHeader() {
|
|
5985
|
-
return { stub: null, issue: null, spec: null, release: null, extras: [] };
|
|
5985
|
+
return { stub: null, issue: null, spec: null, release: null, closes: [], extras: [] };
|
|
5986
5986
|
}
|
|
5987
5987
|
function readTaskLine(line) {
|
|
5988
5988
|
for (const [status, pattern] of TASK_LINES) {
|
|
@@ -6101,11 +6101,30 @@ function usableField(field2, value) {
|
|
|
6101
6101
|
return null;
|
|
6102
6102
|
return value;
|
|
6103
6103
|
}
|
|
6104
|
+
function isIssueNumber2(entry) {
|
|
6105
|
+
return typeof entry === "number" && Number.isSafeInteger(entry) && entry > 0;
|
|
6106
|
+
}
|
|
6107
|
+
function usableClosesField(value) {
|
|
6108
|
+
if (!Array.isArray(value))
|
|
6109
|
+
return null;
|
|
6110
|
+
const entries = value;
|
|
6111
|
+
return entries.every(isIssueNumber2) ? [...entries] : null;
|
|
6112
|
+
}
|
|
6113
|
+
function closesText(subject, value) {
|
|
6114
|
+
const wanted = "a list of whole positive issue numbers, such as [12, 13]";
|
|
6115
|
+
if (!Array.isArray(value))
|
|
6116
|
+
return `${subject} is ${describeValue2(value)}, not ${wanted}`;
|
|
6117
|
+
const entries = value;
|
|
6118
|
+
const refused2 = entries.find((entry) => !isIssueNumber2(entry));
|
|
6119
|
+
return `${subject} holds ${describeValue2(refused2)}, so the whole list is unread; write ${wanted}`;
|
|
6120
|
+
}
|
|
6104
6121
|
function unusableText(field2, value) {
|
|
6105
6122
|
const subject = `rafa:plan ${field2}`;
|
|
6106
6123
|
if (value === null) {
|
|
6107
6124
|
return `${subject} is empty; a value opening with # after a space is a YAML comment unless quoted`;
|
|
6108
6125
|
}
|
|
6126
|
+
if (field2 === "closes")
|
|
6127
|
+
return closesText(subject, value);
|
|
6109
6128
|
if (field2 === "release") {
|
|
6110
6129
|
return `${subject} is ${describeValue2(value)}, not one of ${PLAN_RELEASE_LEVELS.join(", ")}`;
|
|
6111
6130
|
}
|
|
@@ -6126,11 +6145,20 @@ function readFields2(document, line) {
|
|
|
6126
6145
|
const values = new Map;
|
|
6127
6146
|
const extras = [];
|
|
6128
6147
|
const issues = [];
|
|
6148
|
+
let closes2 = [];
|
|
6129
6149
|
for (const [key, value] of Object.entries(document)) {
|
|
6130
6150
|
if (!isHeaderField(key)) {
|
|
6131
6151
|
extras.push({ key, value });
|
|
6132
6152
|
continue;
|
|
6133
6153
|
}
|
|
6154
|
+
if (key === "closes") {
|
|
6155
|
+
const list = usableClosesField(value);
|
|
6156
|
+
if (list === null)
|
|
6157
|
+
issues.push(planIssue("unusable-field", line, unusableText(key, value)));
|
|
6158
|
+
else
|
|
6159
|
+
closes2 = list;
|
|
6160
|
+
continue;
|
|
6161
|
+
}
|
|
6134
6162
|
const usable = usableField(key, value);
|
|
6135
6163
|
if (usable === null)
|
|
6136
6164
|
issues.push(planIssue("unusable-field", line, unusableText(key, value)));
|
|
@@ -6142,6 +6170,7 @@ function readFields2(document, line) {
|
|
|
6142
6170
|
issue: values.get("issue") ?? null,
|
|
6143
6171
|
spec: values.get("spec") ?? null,
|
|
6144
6172
|
release: releaseOf(values),
|
|
6173
|
+
closes: closes2,
|
|
6145
6174
|
extras
|
|
6146
6175
|
};
|
|
6147
6176
|
return { header, issues };
|
|
@@ -6193,7 +6222,7 @@ var init_parse = __esm(() => {
|
|
|
6193
6222
|
init_declaration();
|
|
6194
6223
|
init_plan_stamp();
|
|
6195
6224
|
PLAN_BLOCK_KINDS = ["plan", "context", "stage-context"];
|
|
6196
|
-
PLAN_HEADER_FIELDS = ["stub", "issue", "spec", "release"];
|
|
6225
|
+
PLAN_HEADER_FIELDS = ["stub", "issue", "spec", "release", "closes"];
|
|
6197
6226
|
PLAN_RELEASE_LEVELS = ["patch", "minor", "major", "none"];
|
|
6198
6227
|
TASK_LINES = [
|
|
6199
6228
|
["unchecked", /^- \[ \] (.+)/],
|
|
@@ -11754,13 +11783,13 @@ function readCache(path2, mode) {
|
|
|
11754
11783
|
return null;
|
|
11755
11784
|
return { version: version2, mode, watermark, rows, stale };
|
|
11756
11785
|
}
|
|
11757
|
-
function
|
|
11786
|
+
function isIssueNumber3(value) {
|
|
11758
11787
|
return typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
11759
11788
|
}
|
|
11760
11789
|
function staleOfFile(value) {
|
|
11761
11790
|
if (value === undefined)
|
|
11762
11791
|
return [];
|
|
11763
|
-
return Array.isArray(value) && value.every(
|
|
11792
|
+
return Array.isArray(value) && value.every(isIssueNumber3) ? value : null;
|
|
11764
11793
|
}
|
|
11765
11794
|
function fileOf(cache) {
|
|
11766
11795
|
const { version: version2, mode, watermark, rows, stale } = cache;
|
|
@@ -11875,7 +11904,7 @@ function createCachedBoardListing(options) {
|
|
|
11875
11904
|
};
|
|
11876
11905
|
}
|
|
11877
11906
|
function invalidateRows(root, numbers) {
|
|
11878
|
-
const bad = numbers.find((number) => !
|
|
11907
|
+
const bad = numbers.find((number) => !isIssueNumber3(number));
|
|
11879
11908
|
if (bad !== undefined)
|
|
11880
11909
|
throw new RangeError(`not an issue number: ${String(bad)}`);
|
|
11881
11910
|
const path2 = join12(root, BOARD_CACHE_FILE);
|
|
@@ -12846,18 +12875,18 @@ var init_owner_resolve = __esm(() => {
|
|
|
12846
12875
|
function isRecord2(value) {
|
|
12847
12876
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12848
12877
|
}
|
|
12849
|
-
function
|
|
12878
|
+
function isIssueNumber4(value) {
|
|
12850
12879
|
return typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
12851
12880
|
}
|
|
12852
12881
|
function asPlace(value) {
|
|
12853
|
-
if (!isRecord2(value) || !
|
|
12882
|
+
if (!isRecord2(value) || !isIssueNumber4(value.board))
|
|
12854
12883
|
return null;
|
|
12855
|
-
if (value.epic !== null && !
|
|
12884
|
+
if (value.epic !== null && !isIssueNumber4(value.epic))
|
|
12856
12885
|
return null;
|
|
12857
12886
|
return { board: value.board, epic: value.epic };
|
|
12858
12887
|
}
|
|
12859
12888
|
function isIssueOrNull(value) {
|
|
12860
|
-
return value === null ||
|
|
12889
|
+
return value === null || isIssueNumber4(value);
|
|
12861
12890
|
}
|
|
12862
12891
|
function isTimestamp(value) {
|
|
12863
12892
|
return typeof value === "string" && !Number.isNaN(Date.parse(value));
|
|
@@ -12879,7 +12908,7 @@ function asHopRecord(value) {
|
|
|
12879
12908
|
return null;
|
|
12880
12909
|
if (!isIssueOrNull(blocked2) || !isIssueOrNull(target) || !isIssueOrNull(pullRequest))
|
|
12881
12910
|
return null;
|
|
12882
|
-
if (!
|
|
12911
|
+
if (!isIssueNumber4(targetEpic2) || !isIssueNumber4(targetBoard) || !isTimestamp(startedAt))
|
|
12883
12912
|
return null;
|
|
12884
12913
|
const hopKind = kind;
|
|
12885
12914
|
if (!issuesMatchKind(hopKind, blocked2, target))
|
|
@@ -18945,7 +18974,7 @@ var init_declarations3 = __esm(() => {
|
|
|
18945
18974
|
},
|
|
18946
18975
|
{
|
|
18947
18976
|
name: "reproduce",
|
|
18948
|
-
description: "A bug: the
|
|
18977
|
+
description: "A bug: one command run from the checkout root whose output or exit code shows it; the condition only when no command can. Never unknown.",
|
|
18949
18978
|
type: "string"
|
|
18950
18979
|
},
|
|
18951
18980
|
{
|
|
@@ -36208,7 +36237,7 @@ function summaryProblems(summary, max) {
|
|
|
36208
36237
|
return length > max ? [`summary is ${length} characters, at most ${max} (issues.titles.summaryMax)`] : [];
|
|
36209
36238
|
}
|
|
36210
36239
|
function reproduceProblems(reproduce) {
|
|
36211
|
-
return hasText2(reproduce) && reproduce.trim().toLowerCase() !== UNKNOWN_VALUE ? [] : ["reproduce is missing: pass --reproduce=<the
|
|
36240
|
+
return hasText2(reproduce) && reproduce.trim().toLowerCase() !== UNKNOWN_VALUE ? [] : ["reproduce is missing: pass --reproduce=<one command run from the checkout root that shows it, or the condition when no command can>; it is never unknown"];
|
|
36212
36241
|
}
|
|
36213
36242
|
function proposedProblems(cause, proposed, codes) {
|
|
36214
36243
|
if (!hasText2(proposed))
|
|
@@ -45355,6 +45384,11 @@ function formatRows(rows2) {
|
|
|
45355
45384
|
return lines2.join(`
|
|
45356
45385
|
`);
|
|
45357
45386
|
}
|
|
45387
|
+
function headTimeOf(detail) {
|
|
45388
|
+
const committedAt = detail?.headCommittedAt ?? null;
|
|
45389
|
+
const ms = committedAt === null ? Number.NaN : Date.parse(committedAt);
|
|
45390
|
+
return Number.isNaN(ms) ? null : ms;
|
|
45391
|
+
}
|
|
45358
45392
|
function defaultSleep(ms) {
|
|
45359
45393
|
return new Promise((resolve4) => {
|
|
45360
45394
|
setTimeout(resolve4, ms);
|
|
@@ -51013,11 +51047,6 @@ function renderWait(reading2) {
|
|
|
51013
51047
|
].join(`
|
|
51014
51048
|
`);
|
|
51015
51049
|
}
|
|
51016
|
-
function headTimeOf(detail) {
|
|
51017
|
-
const committedAt = detail?.headCommittedAt ?? null;
|
|
51018
|
-
const ms = committedAt === null ? Number.NaN : Date.parse(committedAt);
|
|
51019
|
-
return Number.isNaN(ms) ? null : ms;
|
|
51020
|
-
}
|
|
51021
51050
|
async function runWait(context, seams) {
|
|
51022
51051
|
const minutes = readTimeoutMinutes(context.flags, USAGE20);
|
|
51023
51052
|
const asked = readPullArgument(context.args, USAGE20);
|
|
@@ -57966,7 +57995,7 @@ var init_take = __esm(() => {
|
|
|
57966
57995
|
// src/rafa.ts
|
|
57967
57996
|
init_activate();
|
|
57968
57997
|
init_load2();
|
|
57969
|
-
import { homedir as
|
|
57998
|
+
import { homedir as homedir22 } from "os";
|
|
57970
57999
|
|
|
57971
58000
|
// src/adapter-registry.ts
|
|
57972
58001
|
init_rafa_board();
|
|
@@ -66425,6 +66454,20 @@ function typeCheckLines(recipe) {
|
|
|
66425
66454
|
];
|
|
66426
66455
|
}
|
|
66427
66456
|
|
|
66457
|
+
// packages/rafa-run/src/start/tracker-line.ts
|
|
66458
|
+
import { isAbsolute as isAbsolute24 } from "path";
|
|
66459
|
+
var TRACKER_PROMPT_PREFIX = "The tracker holding this task's line is ";
|
|
66460
|
+
function trackerLines(trackerPath) {
|
|
66461
|
+
if (trackerPath === null)
|
|
66462
|
+
return [];
|
|
66463
|
+
if (!isAbsolute24(trackerPath)) {
|
|
66464
|
+
throw new Error(`The tracker path \`${trackerPath}\` is not absolute; the session may run in a worktree it does not resolve against.`);
|
|
66465
|
+
}
|
|
66466
|
+
return [
|
|
66467
|
+
`${TRACKER_PROMPT_PREFIX}\`${trackerPath}\`, by its absolute path, since a worktree checkout holds no copy of it: write any close-out notes there, indented below this task's line, never as a \`- [ ]\` line (the loop dispatches any such line) and never above this task's line (the loop marks it by its line number).`
|
|
66468
|
+
];
|
|
66469
|
+
}
|
|
66470
|
+
|
|
66428
66471
|
// packages/rafa-run/src/start/dispatch.ts
|
|
66429
66472
|
function runTaskSession(prompt, flags, sessionId, settingSources, served2 = [], cwd, spawn) {
|
|
66430
66473
|
const options = cwd === undefined ? {} : { cwd };
|
|
@@ -66439,10 +66482,11 @@ var NO_TASK_SECTIONS = { skills: "", lessons: "" };
|
|
|
66439
66482
|
function sectionLines(sections2) {
|
|
66440
66483
|
return [sections2.skills, sections2.lessons, sections2.inherited].filter((section4) => section4.trim().length > 0).flatMap((section4) => [section4, ""]);
|
|
66441
66484
|
}
|
|
66442
|
-
function buildTaskPrompt(taskText, promptContent, planText, knownMissing = [], blocker = null, sections2 = NO_TASK_SECTIONS, base2 = null, inherited = [], alwaysRun = [], typeCheck = null) {
|
|
66485
|
+
function buildTaskPrompt(taskText, promptContent, planText, knownMissing = [], blocker = null, sections2 = NO_TASK_SECTIONS, base2 = null, inherited = [], alwaysRun = [], typeCheck = null, trackerPath = null) {
|
|
66443
66486
|
return [
|
|
66444
66487
|
`Your scoped task is: ${taskText}`,
|
|
66445
66488
|
"Consider tasks listed above this one in the plan checklist as completed. Do not re-evaluate or re-do them. Focus only on the scoped task.",
|
|
66489
|
+
...trackerLines(trackerPath),
|
|
66446
66490
|
...blockerLines(blocker),
|
|
66447
66491
|
...baseLines(base2),
|
|
66448
66492
|
...alwaysRunLines(alwaysRun),
|
|
@@ -66491,7 +66535,7 @@ async function dispatchTask(options) {
|
|
|
66491
66535
|
const resolution = options.serving === null ? EMPTY_RESOLUTION : resolveSessionTiers(options.serving);
|
|
66492
66536
|
const task = taskInputFor(taskInfo, taskText, declaration, options.planContent);
|
|
66493
66537
|
const handed = await handOut(options.handout, task, resolution, options.repoRoot);
|
|
66494
|
-
const prompt = withStamp(buildTaskPrompt(taskText, docTaskPrompt(options.promptContent, { ...options, declaration, place: options.docTask }), injection.text, options.knownMissing, taskInfo.blocker ?? null, { skills: renderSkillsSection(handed.skills), lessons: renderLessonsSection(handed.lessons) }, options.base, options.inherited, options.alwaysRun, options.typeCheck ?? null));
|
|
66538
|
+
const prompt = withStamp(buildTaskPrompt(taskText, docTaskPrompt(options.promptContent, { ...options, declaration, place: options.docTask }), injection.text, options.knownMissing, taskInfo.blocker ?? null, { skills: renderSkillsSection(handed.skills), lessons: renderLessonsSection(handed.lessons) }, options.base, options.inherited, options.alwaysRun, options.typeCheck ?? null, options.trackerPath ?? null));
|
|
66495
66539
|
const served2 = serveForSession(options.serving, resolution);
|
|
66496
66540
|
const record2 = {
|
|
66497
66541
|
taskText,
|
|
@@ -66989,16 +67033,18 @@ async function verifyAttempt(io, branch, timeoutMs, isLastAttempt) {
|
|
|
66989
67033
|
const merge3 = await io.pulls.get(prNumber);
|
|
66990
67034
|
return result2.verdict === "none" ? handleNoChecks(io, branch, prNumber, merge3) : handleRedChecks(io, branch, prNumber, result2.rows);
|
|
66991
67035
|
}
|
|
66992
|
-
function pollChecks(io, prNumber, timeoutMs) {
|
|
67036
|
+
async function pollChecks(io, prNumber, timeoutMs) {
|
|
66993
67037
|
io.phases.ciStarted();
|
|
66994
67038
|
activeOutput().info(`
|
|
66995
67039
|
\u23F3 Waiting for CI on PR #${prNumber} (up to ${Math.round(timeoutMs / 60000)} min)...`);
|
|
67040
|
+
const headCommittedAtMs = headTimeOf(await io.pulls.get(prNumber));
|
|
66996
67041
|
return waitForChecks({
|
|
66997
67042
|
probe: async () => (await io.pulls.checks(prNumber)).rows,
|
|
66998
67043
|
timeoutMs,
|
|
66999
67044
|
intervalMs: CI_POLL_INTERVAL_MS,
|
|
67000
67045
|
now: io.now,
|
|
67001
67046
|
sleep: io.sleep,
|
|
67047
|
+
...headCommittedAtMs === null ? {} : { headCommittedAtMs },
|
|
67002
67048
|
onPoll: (rows2, verdict, elapsedMs) => {
|
|
67003
67049
|
const secs = Math.round(elapsedMs / 1000);
|
|
67004
67050
|
activeOutput().info(` [${secs}s] ${verdict} \u2014 ${rows2.length} check(s)`);
|
|
@@ -68358,7 +68404,7 @@ async function readPlanOwns(options) {
|
|
|
68358
68404
|
// packages/rafa-run/src/suite/scope.ts
|
|
68359
68405
|
init_rafa_board();
|
|
68360
68406
|
import { existsSync as existsSync75, readdirSync as readdirSync25, readFileSync as readFileSync83 } from "fs";
|
|
68361
|
-
import { isAbsolute as
|
|
68407
|
+
import { isAbsolute as isAbsolute25, join as join101, relative as relative23, sep as sep9 } from "path";
|
|
68362
68408
|
var BUNFIG_FILE = "bunfig.toml";
|
|
68363
68409
|
var TEST_FILE_NAME = /[._](?:test|spec)\.(?:tsx?|jsx?|[cm][jt]s)$/;
|
|
68364
68410
|
var DEPENDENCY_FOLDER = "node_modules";
|
|
@@ -68366,9 +68412,9 @@ function sortedUnique(paths) {
|
|
|
68366
68412
|
return [...new Set(paths)].sort((a, b) => a.localeCompare(b));
|
|
68367
68413
|
}
|
|
68368
68414
|
function preloadPath(root, entry) {
|
|
68369
|
-
const path4 =
|
|
68415
|
+
const path4 = isAbsolute25(entry) ? relative23(root, entry).split(sep9).join("/") : entry;
|
|
68370
68416
|
const repoRelative2 = normaliseFolder(path4);
|
|
68371
|
-
if (repoRelative2 === "" ||
|
|
68417
|
+
if (repoRelative2 === "" || isAbsolute25(repoRelative2))
|
|
68372
68418
|
return null;
|
|
68373
68419
|
return repoRelative2.split("/").includes("..") ? null : repoRelative2;
|
|
68374
68420
|
}
|
|
@@ -70763,9 +70809,13 @@ function fragmentNotesIn(checkout, fragment) {
|
|
|
70763
70809
|
const reading2 = parseFragment(text2);
|
|
70764
70810
|
return reading2.ok ? reading2.fragment.notes : [];
|
|
70765
70811
|
}
|
|
70766
|
-
function
|
|
70812
|
+
function closedIssues(issue5, closes2) {
|
|
70813
|
+
return [...new Set([issue5, ...closes2])];
|
|
70814
|
+
}
|
|
70815
|
+
function runnerPullRequestBody(issue5, closes2, notes) {
|
|
70767
70816
|
const section4 = notes.length === 0 ? [] : [RELEASE_NOTES_HEADING, "", ...notes, ""];
|
|
70768
|
-
|
|
70817
|
+
const closing = closedIssues(issue5, closes2).map((closed) => `Closes #${String(closed)}`);
|
|
70818
|
+
return [...closing, "", ...section4, UNFINISHED_WRAP_UP_LINE].join(`
|
|
70769
70819
|
`);
|
|
70770
70820
|
}
|
|
70771
70821
|
function blocked3(branch, step2, detail) {
|
|
@@ -70784,11 +70834,11 @@ function dirtyDetail(entries) {
|
|
|
70784
70834
|
].join(`
|
|
70785
70835
|
`);
|
|
70786
70836
|
}
|
|
70787
|
-
async function refreshAfterOpen(seams,
|
|
70837
|
+
async function refreshAfterOpen(seams, issues) {
|
|
70788
70838
|
try {
|
|
70789
|
-
return await seams.refreshProject(
|
|
70839
|
+
return await seams.refreshProject(issues);
|
|
70790
70840
|
} catch (error2) {
|
|
70791
|
-
return [refreshFailedWarning(
|
|
70841
|
+
return [refreshFailedWarning(issues[0] ?? 0, error2)];
|
|
70792
70842
|
}
|
|
70793
70843
|
}
|
|
70794
70844
|
async function openRunnerPullRequest(input, seams) {
|
|
@@ -70809,12 +70859,12 @@ async function openRunnerPullRequest(input, seams) {
|
|
|
70809
70859
|
head: branch,
|
|
70810
70860
|
base: input.base,
|
|
70811
70861
|
title: pullRequestTitle(input.issue, input.planTitle),
|
|
70812
|
-
body: runnerPullRequestBody(input.issue, input.notes)
|
|
70862
|
+
body: runnerPullRequestBody(input.issue, input.closes, input.notes)
|
|
70813
70863
|
});
|
|
70814
70864
|
} catch (error2) {
|
|
70815
70865
|
return blocked3(branch, "create", messageOf(error2));
|
|
70816
70866
|
}
|
|
70817
|
-
return { kind: "opened", pull, warnings: await refreshAfterOpen(seams, input.issue) };
|
|
70867
|
+
return { kind: "opened", pull, warnings: await refreshAfterOpen(seams, closedIssues(input.issue, input.closes)) };
|
|
70818
70868
|
}
|
|
70819
70869
|
|
|
70820
70870
|
// packages/rafa-run/src/start/wrap-up.ts
|
|
@@ -70829,7 +70879,7 @@ init_rafa_pr();
|
|
|
70829
70879
|
init_sections();
|
|
70830
70880
|
init_output();
|
|
70831
70881
|
init_rafa_pr();
|
|
70832
|
-
import { isAbsolute as
|
|
70882
|
+
import { isAbsolute as isAbsolute26, posix as posix10, relative as relative26 } from "path";
|
|
70833
70883
|
|
|
70834
70884
|
// packages/rafa-run/src/start/promoted.ts
|
|
70835
70885
|
init_block_reader();
|
|
@@ -70921,9 +70971,9 @@ function changedSince(git, head) {
|
|
|
70921
70971
|
return { ok: true, head, paths: new Set(paths) };
|
|
70922
70972
|
}
|
|
70923
70973
|
function repoPath3(path5, repoRoot) {
|
|
70924
|
-
const inside =
|
|
70974
|
+
const inside = isAbsolute26(path5) ? relative26(repoRoot, path5) : path5;
|
|
70925
70975
|
const normal = posix10.normalize(inside.replaceAll("\\", "/"));
|
|
70926
|
-
if (normal === "." || normal === ".." || normal.startsWith("../") ||
|
|
70976
|
+
if (normal === "." || normal === ".." || normal.startsWith("../") || isAbsolute26(normal))
|
|
70927
70977
|
return null;
|
|
70928
70978
|
return normal.replace(/^(\.\/)+/, "");
|
|
70929
70979
|
}
|
|
@@ -71082,7 +71132,7 @@ function pullRequestNamingBullets(branch, provider) {
|
|
|
71082
71132
|
return [
|
|
71083
71133
|
"* Find the plan's issue number `<n>`: the plan below carries it in its `rafa:plan` block as `issue: <n>`.",
|
|
71084
71134
|
`* If the plan carries no \`issue:\` field, read the number from the branch name (${branch}), which is the \`naming.branch\` template with the plan's stub, \`feat/rafa-<n>-<slug>\` by default.`,
|
|
71085
|
-
|
|
71135
|
+
"* Title the PR `rafa-<n>: <title>`, taking `<title>` from the plan title, e.g. \"rafa-20: Add pull-request commands\". Open the PR body with `Closes #<n>` \u2014 the GitHub issue number on its own, never `#rafa-<n>`, since the `rafa-` prefix is this project's naming convention and not a GitHub alias. Below `Closes #<n>`, write one more `Closes #<m>` line for each number `<m>` of the plan's `closes:` list, in its `rafa:plan` block, never writing a number twice and writing none when the plan has no `closes:` list. If no number was found, title the PR with the plan title alone and write no closing line rather than inventing one.",
|
|
71086
71136
|
"* Create a concise yet descriptive PR description that summarizes the overall work done based on the completed plan and progress notes."
|
|
71087
71137
|
];
|
|
71088
71138
|
}
|
|
@@ -71438,6 +71488,7 @@ function runnerPrInputFor(source) {
|
|
|
71438
71488
|
branch: source.branch,
|
|
71439
71489
|
base: source.base,
|
|
71440
71490
|
issue: issue5,
|
|
71491
|
+
closes: parsePlan(source.planContent).header.closes,
|
|
71441
71492
|
planTitle: planTitleIn(source.planContent, source.planStub),
|
|
71442
71493
|
notes: source.notes
|
|
71443
71494
|
};
|
|
@@ -73386,18 +73437,22 @@ var codes_default = command47;
|
|
|
73386
73437
|
// src/commands/bug/recheck.ts
|
|
73387
73438
|
init_rafa_board();
|
|
73388
73439
|
init_fill();
|
|
73389
|
-
init_record3();
|
|
73390
73440
|
init_versions();
|
|
73391
73441
|
init_plan_files2();
|
|
73392
73442
|
init_command2();
|
|
73393
73443
|
init_sections();
|
|
73394
73444
|
init_git2();
|
|
73395
|
-
init_run2();
|
|
73396
73445
|
init_filed_text();
|
|
73397
73446
|
init_local_paths();
|
|
73447
|
+
|
|
73448
|
+
// src/commands/bug/recheck-judge.ts
|
|
73449
|
+
init_rafa_board();
|
|
73450
|
+
init_record3();
|
|
73451
|
+
init_sections();
|
|
73452
|
+
init_run2();
|
|
73398
73453
|
import { mkdtempSync as mkdtempSync7, rmSync as rmSync18 } from "fs";
|
|
73399
73454
|
import { tmpdir as tmpdir9 } from "os";
|
|
73400
|
-
import { join as
|
|
73455
|
+
import { join as join107 } from "path";
|
|
73401
73456
|
|
|
73402
73457
|
// src/bugs/test-reference.ts
|
|
73403
73458
|
init_package_of();
|
|
@@ -73590,8 +73645,115 @@ function recheckComment(row2, report4) {
|
|
|
73590
73645
|
return null;
|
|
73591
73646
|
}
|
|
73592
73647
|
|
|
73648
|
+
// src/commands/bug/recheck-judge.ts
|
|
73649
|
+
var LOCAL_KIND = "local";
|
|
73650
|
+
var MS_PER_SECOND8 = 1000;
|
|
73651
|
+
function rowOf10(bug, fields) {
|
|
73652
|
+
return {
|
|
73653
|
+
issue: bug.issue,
|
|
73654
|
+
title: bug.title,
|
|
73655
|
+
reference: null,
|
|
73656
|
+
runs: 0,
|
|
73657
|
+
failedRuns: null,
|
|
73658
|
+
reason: null,
|
|
73659
|
+
reproduce: null,
|
|
73660
|
+
commented: false,
|
|
73661
|
+
...fields
|
|
73662
|
+
};
|
|
73663
|
+
}
|
|
73664
|
+
async function authorOf(tracker, bug) {
|
|
73665
|
+
if (bug.author !== null)
|
|
73666
|
+
return bug.author;
|
|
73667
|
+
if (tracker.editable === undefined)
|
|
73668
|
+
return "";
|
|
73669
|
+
return (await tracker.editable(bug.ref)).author;
|
|
73670
|
+
}
|
|
73671
|
+
function trustGateOf(tracker, trust) {
|
|
73672
|
+
if (tracker.kind === LOCAL_KIND)
|
|
73673
|
+
return () => Promise.resolve(null);
|
|
73674
|
+
const readings = new Map;
|
|
73675
|
+
return async (bug) => {
|
|
73676
|
+
let author;
|
|
73677
|
+
try {
|
|
73678
|
+
author = await authorOf(tracker, bug);
|
|
73679
|
+
} catch (error2) {
|
|
73680
|
+
return `could not read who opened ${issueName(bug.ref)}: ${messageOf(error2)}`;
|
|
73681
|
+
}
|
|
73682
|
+
if (author === "")
|
|
73683
|
+
return `the ${tracker.kind} tracker names nobody who opened it, so no trust was read`;
|
|
73684
|
+
const board = trust();
|
|
73685
|
+
const key = author.toLowerCase();
|
|
73686
|
+
const reading2 = readings.get(key) ?? readBoardTrust(board, author);
|
|
73687
|
+
readings.set(key, reading2);
|
|
73688
|
+
const answered = await reading2;
|
|
73689
|
+
return answered.trusted ? null : `opened by ${author}, ${trustRefusalClause(board.repo, answered)}`;
|
|
73690
|
+
};
|
|
73691
|
+
}
|
|
73692
|
+
async function checkBug(bug, context) {
|
|
73693
|
+
const record2 = parseBugRecord(bug.body);
|
|
73694
|
+
const read2 = readTestReference(record2.rerun);
|
|
73695
|
+
if (read2.kind === "manual")
|
|
73696
|
+
return rowOf10(bug, { verdict: "manual", reason: read2.reason, reproduce: record2.reproduce });
|
|
73697
|
+
const reference2 = { file: read2.file, pattern: read2.pattern };
|
|
73698
|
+
const resolved = resolveTestReference(read2, context.checkout);
|
|
73699
|
+
if (resolved.kind === "outside") {
|
|
73700
|
+
return rowOf10(bug, { verdict: "manual", reference: reference2, reason: `${read2.file} lies outside the checkout`, reproduce: record2.reproduce });
|
|
73701
|
+
}
|
|
73702
|
+
if (resolved.kind === "missing")
|
|
73703
|
+
return rowOf10(bug, { verdict: "stale", reference: reference2, reason: `no file ${read2.file} in the checkout` });
|
|
73704
|
+
const refused7 = await context.trust(bug);
|
|
73705
|
+
if (refused7 !== null)
|
|
73706
|
+
return rowOf10(bug, { verdict: "skipped", reference: reference2, reason: refused7 });
|
|
73707
|
+
const run = await context.recheck({
|
|
73708
|
+
path: resolved.path,
|
|
73709
|
+
pattern: read2.pattern,
|
|
73710
|
+
checkout: context.checkout,
|
|
73711
|
+
env: context.env,
|
|
73712
|
+
runs: context.runs,
|
|
73713
|
+
timeoutMs: context.timeoutMs,
|
|
73714
|
+
junitDir: join107(context.junitRoot, `issue-${bug.issue}`)
|
|
73715
|
+
});
|
|
73716
|
+
if (run.timedOutRuns > 0) {
|
|
73717
|
+
context.warn(`${issueName(bug.ref)}: ${run.timedOutRuns} of ${run.runs} runs timed out after ${context.timeoutMs / MS_PER_SECOND8}s`);
|
|
73718
|
+
}
|
|
73719
|
+
return rowOf10(bug, {
|
|
73720
|
+
verdict: run.verdict,
|
|
73721
|
+
reference: reference2,
|
|
73722
|
+
runs: run.runs,
|
|
73723
|
+
failedRuns: run.failedRuns,
|
|
73724
|
+
reason: run.verdict === "stale" ? `no case of ${referenceText(reference2)} was judged` : null
|
|
73725
|
+
});
|
|
73726
|
+
}
|
|
73727
|
+
function childEnvOf(base2, secrets) {
|
|
73728
|
+
const leftOut2 = [...new Set(secrets.map((secret) => secret.name))].sort();
|
|
73729
|
+
const env = Object.fromEntries(Object.entries(suiteEnv(base2)).filter(([name2]) => !leftOut2.includes(name2)));
|
|
73730
|
+
return { env, leftOut: leftOut2 };
|
|
73731
|
+
}
|
|
73732
|
+
async function judgeBugs(bugs, options) {
|
|
73733
|
+
const { env, leftOut: leftOut2 } = childEnvOf(options.env, options.secrets);
|
|
73734
|
+
const junitRoot = mkdtempSync7(join107(tmpdir9(), "rafa-bug-recheck-"));
|
|
73735
|
+
try {
|
|
73736
|
+
const context = {
|
|
73737
|
+
checkout: options.checkout,
|
|
73738
|
+
env,
|
|
73739
|
+
runs: options.runs,
|
|
73740
|
+
timeoutMs: options.timeoutMs,
|
|
73741
|
+
junitRoot,
|
|
73742
|
+
trust: trustGateOf(options.tracker, options.trust),
|
|
73743
|
+
recheck: options.recheck,
|
|
73744
|
+
warn: options.warn
|
|
73745
|
+
};
|
|
73746
|
+
const rows2 = [];
|
|
73747
|
+
for (const bug of bugs)
|
|
73748
|
+
rows2.push(await checkBug(bug, context));
|
|
73749
|
+
return { rows: rows2, secretsLeftOut: leftOut2 };
|
|
73750
|
+
} finally {
|
|
73751
|
+
rmSync18(junitRoot, { recursive: true, force: true });
|
|
73752
|
+
}
|
|
73753
|
+
}
|
|
73754
|
+
|
|
73593
73755
|
// src/commands/bug/recheck-run.ts
|
|
73594
|
-
import { join as
|
|
73756
|
+
import { join as join108 } from "path";
|
|
73595
73757
|
init_run2();
|
|
73596
73758
|
|
|
73597
73759
|
// src/bugs/recheck-verdict.ts
|
|
@@ -73629,7 +73791,7 @@ function verdictOf5(outcomes) {
|
|
|
73629
73791
|
|
|
73630
73792
|
// src/commands/bug/recheck-run.ts
|
|
73631
73793
|
function recheckJunitFile(junitDir, index) {
|
|
73632
|
-
return
|
|
73794
|
+
return join108(junitDir, `run-${index}.junit.xml`);
|
|
73633
73795
|
}
|
|
73634
73796
|
async function recheckBug(options) {
|
|
73635
73797
|
if (!Number.isInteger(options.runs) || options.runs < 0) {
|
|
@@ -73674,9 +73836,7 @@ var COMMAND_NAME9 = "rafa bug recheck";
|
|
|
73674
73836
|
var RECHECK_USAGE = "rafa bug recheck [<n>\u2026] [--all] [--comment]";
|
|
73675
73837
|
var ALL_FLAG = "all";
|
|
73676
73838
|
var COMMENT_FLAG = "comment";
|
|
73677
|
-
var LOCAL_KIND = "local";
|
|
73678
73839
|
var ISSUE_NUMBER17 = /^[1-9]\d*$/;
|
|
73679
|
-
var MS_PER_SECOND8 = 1000;
|
|
73680
73840
|
function readRecheckLine(args, flags) {
|
|
73681
73841
|
const hint = `Usage: ${RECHECK_USAGE}`;
|
|
73682
73842
|
const all = readSwitch2(ALL_FLAG, flags[ALL_FLAG], hint);
|
|
@@ -73694,19 +73854,6 @@ function readRecheckLine(args, flags) {
|
|
|
73694
73854
|
}
|
|
73695
73855
|
return { numbers: [...new Set(args.map(Number))], comment };
|
|
73696
73856
|
}
|
|
73697
|
-
function rowOf10(bug, fields) {
|
|
73698
|
-
return {
|
|
73699
|
-
issue: bug.issue,
|
|
73700
|
-
title: bug.title,
|
|
73701
|
-
reference: null,
|
|
73702
|
-
runs: 0,
|
|
73703
|
-
failedRuns: null,
|
|
73704
|
-
reason: null,
|
|
73705
|
-
reproduce: null,
|
|
73706
|
-
commented: false,
|
|
73707
|
-
...fields
|
|
73708
|
-
};
|
|
73709
|
-
}
|
|
73710
73857
|
async function openBugs(tracker) {
|
|
73711
73858
|
const { openIssues } = tracker;
|
|
73712
73859
|
if (openIssues === undefined) {
|
|
@@ -73734,73 +73881,15 @@ async function numberedBug(tracker, issue5) {
|
|
|
73734
73881
|
return { ref: ref16, row: rowOf10({ issue: issue5, title: "" }, { verdict: "skipped", reason: `could not read ${issueName(ref16)}: ${messageOf(error2)}` }) };
|
|
73735
73882
|
}
|
|
73736
73883
|
}
|
|
73737
|
-
|
|
73738
|
-
|
|
73739
|
-
|
|
73740
|
-
|
|
73741
|
-
|
|
73742
|
-
|
|
73743
|
-
}
|
|
73744
|
-
|
|
73745
|
-
if (tracker.kind === LOCAL_KIND)
|
|
73746
|
-
return () => Promise.resolve(null);
|
|
73747
|
-
const readings = new Map;
|
|
73748
|
-
return async (bug) => {
|
|
73749
|
-
let author;
|
|
73750
|
-
try {
|
|
73751
|
-
author = await authorOf(tracker, bug);
|
|
73752
|
-
} catch (error2) {
|
|
73753
|
-
return `could not read who opened ${issueName(bug.ref)}: ${messageOf(error2)}`;
|
|
73754
|
-
}
|
|
73755
|
-
if (author === "")
|
|
73756
|
-
return `the ${tracker.kind} tracker names nobody who opened it, so no trust was read`;
|
|
73757
|
-
const board = trust();
|
|
73758
|
-
const key = author.toLowerCase();
|
|
73759
|
-
const reading2 = readings.get(key) ?? readBoardTrust(board, author);
|
|
73760
|
-
readings.set(key, reading2);
|
|
73761
|
-
const answered = await reading2;
|
|
73762
|
-
return answered.trusted ? null : `opened by ${author}, ${trustRefusalClause(board.repo, answered)}`;
|
|
73763
|
-
};
|
|
73764
|
-
}
|
|
73765
|
-
async function checkBug(bug, context) {
|
|
73766
|
-
const record2 = parseBugRecord(bug.body);
|
|
73767
|
-
const read2 = readTestReference(record2.rerun);
|
|
73768
|
-
if (read2.kind === "manual")
|
|
73769
|
-
return rowOf10(bug, { verdict: "manual", reason: read2.reason, reproduce: record2.reproduce });
|
|
73770
|
-
const reference2 = { file: read2.file, pattern: read2.pattern };
|
|
73771
|
-
const resolved = resolveTestReference(read2, context.checkout);
|
|
73772
|
-
if (resolved.kind === "outside") {
|
|
73773
|
-
return rowOf10(bug, { verdict: "manual", reference: reference2, reason: `${read2.file} lies outside the checkout`, reproduce: record2.reproduce });
|
|
73774
|
-
}
|
|
73775
|
-
if (resolved.kind === "missing")
|
|
73776
|
-
return rowOf10(bug, { verdict: "stale", reference: reference2, reason: `no file ${read2.file} in the checkout` });
|
|
73777
|
-
const refused7 = await context.trust(bug);
|
|
73778
|
-
if (refused7 !== null)
|
|
73779
|
-
return rowOf10(bug, { verdict: "skipped", reference: reference2, reason: refused7 });
|
|
73780
|
-
const run = await context.recheck({
|
|
73781
|
-
path: resolved.path,
|
|
73782
|
-
pattern: read2.pattern,
|
|
73783
|
-
checkout: context.checkout,
|
|
73784
|
-
env: context.env,
|
|
73785
|
-
runs: context.runs,
|
|
73786
|
-
timeoutMs: context.timeoutMs,
|
|
73787
|
-
junitDir: join108(context.junitRoot, `issue-${bug.issue}`)
|
|
73884
|
+
function rowsAt(read2, bugs, judged2) {
|
|
73885
|
+
return read2.map((bug) => {
|
|
73886
|
+
if ("row" in bug)
|
|
73887
|
+
return bug;
|
|
73888
|
+
const row2 = judged2[bugs.indexOf(bug)];
|
|
73889
|
+
if (row2 === undefined)
|
|
73890
|
+
throw new Error(`${COMMAND_NAME9}: no row was judged for ${issueName(bug.ref)}`);
|
|
73891
|
+
return { ref: bug.ref, row: row2 };
|
|
73788
73892
|
});
|
|
73789
|
-
if (run.timedOutRuns > 0) {
|
|
73790
|
-
context.warn(`${issueName(bug.ref)}: ${run.timedOutRuns} of ${run.runs} runs timed out after ${context.timeoutMs / MS_PER_SECOND8}s`);
|
|
73791
|
-
}
|
|
73792
|
-
return rowOf10(bug, {
|
|
73793
|
-
verdict: run.verdict,
|
|
73794
|
-
reference: reference2,
|
|
73795
|
-
runs: run.runs,
|
|
73796
|
-
failedRuns: run.failedRuns,
|
|
73797
|
-
reason: run.verdict === "stale" ? `no case of ${referenceText(reference2)} was judged` : null
|
|
73798
|
-
});
|
|
73799
|
-
}
|
|
73800
|
-
function childEnvOf(base2, secrets) {
|
|
73801
|
-
const leftOut2 = [...new Set(secrets.map((secret) => secret.name))].sort();
|
|
73802
|
-
const env = Object.fromEntries(Object.entries(suiteEnv(base2)).filter(([name2]) => !leftOut2.includes(name2)));
|
|
73803
|
-
return { env, leftOut: leftOut2 };
|
|
73804
73893
|
}
|
|
73805
73894
|
function codeOf(git) {
|
|
73806
73895
|
const version2 = codeVersionOf(git);
|
|
@@ -73846,7 +73935,6 @@ async function runRecheck(context, seams) {
|
|
|
73846
73935
|
const checkout = checkoutOf(git, project.root);
|
|
73847
73936
|
const base2 = (seams.env ?? (() => process.env))();
|
|
73848
73937
|
const secrets = namedSecrets(config, base2);
|
|
73849
|
-
const { env, leftOut: leftOut2 } = childEnvOf(base2, secrets);
|
|
73850
73938
|
const gh = seams.gh ?? createGhRunner({ cwd: project.root });
|
|
73851
73939
|
let board;
|
|
73852
73940
|
const trust = () => {
|
|
@@ -73854,26 +73942,20 @@ async function runRecheck(context, seams) {
|
|
|
73854
73942
|
return board;
|
|
73855
73943
|
};
|
|
73856
73944
|
const read2 = line.numbers === null ? await openBugs(tracker) : await Promise.all(line.numbers.map((issue5) => numberedBug(tracker, issue5)));
|
|
73857
|
-
const
|
|
73858
|
-
const
|
|
73859
|
-
|
|
73860
|
-
|
|
73861
|
-
|
|
73862
|
-
|
|
73863
|
-
|
|
73864
|
-
|
|
73865
|
-
|
|
73866
|
-
|
|
73867
|
-
|
|
73868
|
-
|
|
73869
|
-
|
|
73870
|
-
|
|
73871
|
-
rows2.push("row" in bug ? bug : { ref: bug.ref, row: await checkBug(bug, bugContext) });
|
|
73872
|
-
}
|
|
73873
|
-
} finally {
|
|
73874
|
-
rmSync18(junitRoot, { recursive: true, force: true });
|
|
73875
|
-
}
|
|
73876
|
-
const head = { rafa: RAFA_VERSION, code: codeOf(git), checkout, secretsLeftOut: leftOut2, tracker: data };
|
|
73945
|
+
const bugs = read2.filter((bug) => !("row" in bug));
|
|
73946
|
+
const judged2 = await judgeBugs(bugs, {
|
|
73947
|
+
tracker,
|
|
73948
|
+
trust,
|
|
73949
|
+
checkout,
|
|
73950
|
+
env: base2,
|
|
73951
|
+
secrets,
|
|
73952
|
+
runs: config.bugsRecheckRuns,
|
|
73953
|
+
timeoutMs: config.bugsRecheckTimeoutSeconds * MS_PER_SECOND8,
|
|
73954
|
+
recheck: seams.recheck ?? recheckBug,
|
|
73955
|
+
warn: warn5
|
|
73956
|
+
});
|
|
73957
|
+
const rows2 = rowsAt(read2, bugs, judged2.rows);
|
|
73958
|
+
const head = { rafa: RAFA_VERSION, code: codeOf(git), checkout, secretsLeftOut: judged2.secretsLeftOut, tracker: data };
|
|
73877
73959
|
const local = localPathRedactor([checkout, project.root], project.home);
|
|
73878
73960
|
const redact = (text2) => redactSecrets(local(text2), secrets);
|
|
73879
73961
|
const report4 = {
|
|
@@ -75150,9 +75232,9 @@ init_config_schema_release();
|
|
|
75150
75232
|
|
|
75151
75233
|
// packages/rafa/src/config-schema-tests.ts
|
|
75152
75234
|
init_sections();
|
|
75153
|
-
import { isAbsolute as
|
|
75235
|
+
import { isAbsolute as isAbsolute27 } from "path";
|
|
75154
75236
|
var GLOB_PATTERN = "a glob pattern relative to the repository root";
|
|
75155
|
-
var repoGlob = (raw, at) => typeof raw === "string" &&
|
|
75237
|
+
var repoGlob = (raw, at) => typeof raw === "string" && isAbsolute27(raw) ? refused(at, raw, GLOB_PATTERN) : text(GLOB_PATTERN)(raw, at);
|
|
75156
75238
|
var globList = listOf(repoGlob, "glob patterns");
|
|
75157
75239
|
var TESTS_DEFAULTS = Object.freeze({
|
|
75158
75240
|
testsFullSuiteTriggers: Object.freeze([]),
|
|
@@ -77412,7 +77494,7 @@ function isUnmet(need) {
|
|
|
77412
77494
|
|
|
77413
77495
|
// src/commands/plan/needs.ts
|
|
77414
77496
|
init_rafa_inventory();
|
|
77415
|
-
import { isAbsolute as
|
|
77497
|
+
import { isAbsolute as isAbsolute28, relative as relative29, resolve as resolve42 } from "path";
|
|
77416
77498
|
init_plan_files2();
|
|
77417
77499
|
init_command2();
|
|
77418
77500
|
init_config2();
|
|
@@ -77562,6 +77644,69 @@ async function resolveCreateSpec(options, seams = DEFAULT_ROUTE_SEAMS) {
|
|
|
77562
77644
|
});
|
|
77563
77645
|
}
|
|
77564
77646
|
|
|
77647
|
+
// src/commands/plan/stretch-rules.ts
|
|
77648
|
+
init_command2();
|
|
77649
|
+
init_sections();
|
|
77650
|
+
init_loop();
|
|
77651
|
+
import fs3 from "fs";
|
|
77652
|
+
import path6 from "path";
|
|
77653
|
+
var STRETCH_RULES_ENV = "RAFA_STRETCH_RULES";
|
|
77654
|
+
var STRETCH_RULES_REFUSAL_EXIT = 1;
|
|
77655
|
+
function missingRulesMessage(value) {
|
|
77656
|
+
return `${STRETCH_RULES_ENV}=${value} names no file; a stretch's rules are read from its rules.md,` + ` so write that file or unset ${STRETCH_RULES_ENV}`;
|
|
77657
|
+
}
|
|
77658
|
+
function notRulesFileMessage(value, what) {
|
|
77659
|
+
return `${STRETCH_RULES_ENV}=${value} names ${what}, not a file; point it at the stretch's rules.md`;
|
|
77660
|
+
}
|
|
77661
|
+
function unreadableRulesMessage(value, reason) {
|
|
77662
|
+
return `${STRETCH_RULES_ENV}=${value} could not be read: ${reason}`;
|
|
77663
|
+
}
|
|
77664
|
+
function describeEntry(stat2) {
|
|
77665
|
+
return stat2.isDirectory() ? "a directory" : "something other than a file";
|
|
77666
|
+
}
|
|
77667
|
+
function displayPath2(repoRoot, absolute) {
|
|
77668
|
+
const relative29 = path6.relative(repoRoot, absolute);
|
|
77669
|
+
return relative29 === "" || relative29.startsWith("..") || path6.isAbsolute(relative29) ? absolute : relative29;
|
|
77670
|
+
}
|
|
77671
|
+
function readStretchRules(env, repoRoot) {
|
|
77672
|
+
const value = env[STRETCH_RULES_ENV];
|
|
77673
|
+
if (value === undefined || value.trim() === "")
|
|
77674
|
+
return null;
|
|
77675
|
+
const absolute = path6.resolve(repoRoot, value);
|
|
77676
|
+
let stat2;
|
|
77677
|
+
try {
|
|
77678
|
+
stat2 = fs3.statSync(absolute);
|
|
77679
|
+
} catch (error2) {
|
|
77680
|
+
if (errorCode(error2) === "ENOENT") {
|
|
77681
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, missingRulesMessage(value));
|
|
77682
|
+
}
|
|
77683
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, unreadableRulesMessage(value, messageOf(error2)));
|
|
77684
|
+
}
|
|
77685
|
+
if (!stat2.isFile()) {
|
|
77686
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, notRulesFileMessage(value, describeEntry(stat2)));
|
|
77687
|
+
}
|
|
77688
|
+
try {
|
|
77689
|
+
return Object.freeze({ path: displayPath2(repoRoot, absolute), text: fs3.readFileSync(absolute, "utf8") });
|
|
77690
|
+
} catch (error2) {
|
|
77691
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, unreadableRulesMessage(value, messageOf(error2)));
|
|
77692
|
+
}
|
|
77693
|
+
}
|
|
77694
|
+
function stretchRulesReader(env, repoRoot) {
|
|
77695
|
+
let reading2 = null;
|
|
77696
|
+
return () => {
|
|
77697
|
+
if (reading2 === null) {
|
|
77698
|
+
try {
|
|
77699
|
+
reading2 = { ok: true, rules: readStretchRules(env, repoRoot) };
|
|
77700
|
+
} catch (error2) {
|
|
77701
|
+
reading2 = { ok: false, error: error2 };
|
|
77702
|
+
}
|
|
77703
|
+
}
|
|
77704
|
+
if (reading2.ok)
|
|
77705
|
+
return reading2.rules;
|
|
77706
|
+
throw reading2.error;
|
|
77707
|
+
};
|
|
77708
|
+
}
|
|
77709
|
+
|
|
77565
77710
|
// src/commands/plan/needs.ts
|
|
77566
77711
|
var COMMAND6 = "rafa plan needs";
|
|
77567
77712
|
var USAGE32 = "rafa plan needs [<plan> | --spec=<file> | --issue=<n>] [--missing] [--source=<source>]";
|
|
@@ -77590,16 +77735,16 @@ function specRouteWords(flags) {
|
|
|
77590
77735
|
});
|
|
77591
77736
|
return words.length === 0 ? null : words;
|
|
77592
77737
|
}
|
|
77593
|
-
function labelOf5(root,
|
|
77594
|
-
const under = relative29(root,
|
|
77595
|
-
return under === "" || under.startsWith("..") ||
|
|
77738
|
+
function labelOf5(root, path7) {
|
|
77739
|
+
const under = relative29(root, path7);
|
|
77740
|
+
return under === "" || under.startsWith("..") || isAbsolute28(under) ? path7 : under;
|
|
77596
77741
|
}
|
|
77597
77742
|
function needsPlanPath(root, planDir, typed) {
|
|
77598
|
-
const
|
|
77599
|
-
if (isFile2(
|
|
77600
|
-
return
|
|
77743
|
+
const path7 = resolvePlanPath(root, planDir, typed ?? undefined);
|
|
77744
|
+
if (isFile2(path7))
|
|
77745
|
+
return path7;
|
|
77601
77746
|
if (typed !== null)
|
|
77602
|
-
throw new CommandExit(1, `\u274C Plan file not found: ${
|
|
77747
|
+
throw new CommandExit(1, `\u274C Plan file not found: ${path7}`);
|
|
77603
77748
|
const lookedFor = [...new Set([resolve42(root, planDir, DEFAULT_PLAN_FILE), resolve42(root, DEFAULT_PLAN_FILE)])];
|
|
77604
77749
|
throw new CommandExit(1, `\u274C No plan named, and no default plan at ${lookedFor.join(" or ")}
|
|
77605
77750
|
Usage: ${USAGE32}`);
|
|
@@ -77726,13 +77871,14 @@ async function readMachine(project, context, seams) {
|
|
|
77726
77871
|
`));
|
|
77727
77872
|
}
|
|
77728
77873
|
}
|
|
77729
|
-
async function routedSpec(words, project, config, seams) {
|
|
77874
|
+
async function routedSpec(words, project, context, config, seams) {
|
|
77730
77875
|
const resolution = await resolveCreateSpec({
|
|
77731
77876
|
args: words,
|
|
77732
77877
|
repoRoot: project.root,
|
|
77733
77878
|
specsDir: config.specsDir,
|
|
77734
77879
|
roadmapIssue: config.roadmapIssue,
|
|
77735
|
-
trustedAuthors: config.boardTrustedAuthors
|
|
77880
|
+
trustedAuthors: config.boardTrustedAuthors,
|
|
77881
|
+
readRules: stretchRulesReader(context.env, project.root)
|
|
77736
77882
|
}, {
|
|
77737
77883
|
makeReadyOffer: () => null,
|
|
77738
77884
|
makeAlternativeOffer: () => null,
|
|
@@ -77756,9 +77902,9 @@ Usage: ${USAGE32}`);
|
|
|
77756
77902
|
const project = requireProject(context, COMMAND6);
|
|
77757
77903
|
const { config, needs } = await readMachine(project, context, seams);
|
|
77758
77904
|
const kind = words === null ? "plan" : "spec";
|
|
77759
|
-
const
|
|
77760
|
-
const target = { kind, path:
|
|
77761
|
-
const reading2 = kind === "plan" ? await readPlanNeeds(
|
|
77905
|
+
const path7 = words === null ? needsPlanPath(project.root, config.planDir, typed) : await routedSpec(words, project, context, config, seams);
|
|
77906
|
+
const target = { kind, path: path7, label: labelOf5(project.root, path7) };
|
|
77907
|
+
const reading2 = kind === "plan" ? await readPlanNeeds(path7, needs) : await readSpecNeeds(path7, needs);
|
|
77762
77908
|
const result2 = needsResult(reading2, target, config.settingSources, { missing: missing2, source });
|
|
77763
77909
|
for (const warning of result2.warnings)
|
|
77764
77910
|
context.output.warn(warning);
|
|
@@ -78078,7 +78224,7 @@ function isSessionSource(record2) {
|
|
|
78078
78224
|
return !(record2.source === "rafa" || record2.source.startsWith("addon:"));
|
|
78079
78225
|
}
|
|
78080
78226
|
function recordReason(record2, overrides, settingSources, resolution) {
|
|
78081
|
-
const { state, kind, name: name2, path:
|
|
78227
|
+
const { state, kind, name: name2, path: path7 } = record2;
|
|
78082
78228
|
if (state === "collision") {
|
|
78083
78229
|
const collision = resolution.collisions.find((held2) => held2.kind === kind && held2.name === name2);
|
|
78084
78230
|
return {
|
|
@@ -78108,7 +78254,7 @@ function recordReason(record2, overrides, settingSources, resolution) {
|
|
|
78108
78254
|
}
|
|
78109
78255
|
if (state.startsWith("disabled:")) {
|
|
78110
78256
|
const key = state.slice("disabled:".length);
|
|
78111
|
-
return { why: `its frontmatter sets ${key}`, fix: `remove ${key} from ${
|
|
78257
|
+
return { why: `its frontmatter sets ${key}`, fix: `remove ${key} from ${path7}` };
|
|
78112
78258
|
}
|
|
78113
78259
|
return { why: sourceOffWhy("user", settingSources), fix: addSourceFix("user") };
|
|
78114
78260
|
}
|
|
@@ -78177,7 +78323,7 @@ function readDeepSettings(seams) {
|
|
|
78177
78323
|
...hiddenRecords(inventory, overrides, seams.settingSources),
|
|
78178
78324
|
...hiddenServers(mcp, seams)
|
|
78179
78325
|
]);
|
|
78180
|
-
const warnings = [...inventory.warnings, ...inventory.overrideWarnings, ...mcp.warnings].map(({ path:
|
|
78326
|
+
const warnings = [...inventory.warnings, ...inventory.overrideWarnings, ...mcp.warnings].map(({ path: path7, reason }) => ({ path: path7, reason }));
|
|
78181
78327
|
return Object.freeze({
|
|
78182
78328
|
settingSources: Object.freeze([...seams.settingSources]),
|
|
78183
78329
|
hidden: Object.freeze(hidden),
|
|
@@ -78218,8 +78364,8 @@ function layerPhrase(layer, reading2) {
|
|
|
78218
78364
|
return "no layer";
|
|
78219
78365
|
if (layer === "spawn")
|
|
78220
78366
|
return "rafa's spawn";
|
|
78221
|
-
const
|
|
78222
|
-
return
|
|
78367
|
+
const path7 = reading2.scopes.find((scope) => scope.scope === layer)?.path;
|
|
78368
|
+
return path7 === undefined ? `the ${layer} settings` : `the ${layer} settings file ${path7}`;
|
|
78223
78369
|
}
|
|
78224
78370
|
function cwdRow(reading2) {
|
|
78225
78371
|
const name2 = "working directory";
|
|
@@ -78235,16 +78381,16 @@ function cwdRow(reading2) {
|
|
|
78235
78381
|
function joined2(directories) {
|
|
78236
78382
|
return directories.join(", ");
|
|
78237
78383
|
}
|
|
78238
|
-
function pathRow(
|
|
78239
|
-
const setBy = `set by ${layerPhrase(
|
|
78384
|
+
function pathRow(path7, reading2) {
|
|
78385
|
+
const setBy = `set by ${layerPhrase(path7.layer, reading2)}`;
|
|
78240
78386
|
const parts = [
|
|
78241
|
-
...
|
|
78242
|
-
...
|
|
78387
|
+
...path7.added.length === 0 ? [] : [`gains ${joined2(path7.added)}`],
|
|
78388
|
+
...path7.reordered ? ["searches the directories both hold in another order"] : []
|
|
78243
78389
|
];
|
|
78244
|
-
if (
|
|
78390
|
+
if (path7.removed.length === 0)
|
|
78245
78391
|
return { status: "note", name: PATH_KEY, detail: `${parts.join("; ")}; ${setBy}` };
|
|
78246
|
-
const detail = [`loses ${joined2(
|
|
78247
|
-
const file =
|
|
78392
|
+
const detail = [`loses ${joined2(path7.removed)}, which the shell searches`, ...parts, setBy].join("; ");
|
|
78393
|
+
const file = path7.layer === null || path7.layer === "spawn" ? null : reading2.scopes.find((scope) => scope.scope === path7.layer)?.path ?? null;
|
|
78248
78394
|
return file === null ? { status: "warn", name: PATH_KEY, detail } : {
|
|
78249
78395
|
status: "warn",
|
|
78250
78396
|
name: PATH_KEY,
|
|
@@ -78361,36 +78507,36 @@ import { join as join114 } from "path";
|
|
|
78361
78507
|
init_sqlite();
|
|
78362
78508
|
var EFFORT_SCHEMA_ROW = "effort store schema";
|
|
78363
78509
|
var SCHEMA_COMMAND = "rafa effort schema";
|
|
78364
|
-
function developmentAppliedWarning(
|
|
78365
|
-
return `\u26A0 effort store ${
|
|
78510
|
+
function developmentAppliedWarning(path7, id3, appliedBy) {
|
|
78511
|
+
return `\u26A0 effort store ${path7} logs migration ${id3} applied by a development build (${appliedBy});` + ` a development build migrates only a copy. Read the log with ${SCHEMA_COMMAND}.`;
|
|
78366
78512
|
}
|
|
78367
|
-
function unreadable4(
|
|
78368
|
-
return { outcome: "fail", path:
|
|
78513
|
+
function unreadable4(path7, live, problem) {
|
|
78514
|
+
return { outcome: "fail", path: path7, live, status: "unreadable", problem, warnings: [], nextStep: NO_NEXT_STEP };
|
|
78369
78515
|
}
|
|
78370
78516
|
function readingOf2(report4, live) {
|
|
78371
|
-
const { path:
|
|
78517
|
+
const { path: path7, status, nextStep: nextStep2 } = report4;
|
|
78372
78518
|
if (report4.refused) {
|
|
78373
|
-
const problem = `this rafa refuses ${
|
|
78374
|
-
return { outcome: "fail", path:
|
|
78519
|
+
const problem = `this rafa refuses ${path7} (${status}): ${String(report4.refusal)}`;
|
|
78520
|
+
return { outcome: "fail", path: path7, live, status, problem, warnings: [], nextStep: nextStep2 };
|
|
78375
78521
|
}
|
|
78376
|
-
const developed = live ? developmentApplied(report4).map(({ id: id3, appliedBy }) => developmentAppliedWarning(
|
|
78522
|
+
const developed = live ? developmentApplied(report4).map(({ id: id3, appliedBy }) => developmentAppliedWarning(path7, id3, appliedBy)) : [];
|
|
78377
78523
|
const warnings = [...unknownAdditive(report4).map(unknownAdditiveWarning), ...developed];
|
|
78378
78524
|
const outcome2 = warnings.length === 0 ? "ok" : "warn";
|
|
78379
|
-
return { outcome: outcome2, path:
|
|
78525
|
+
return { outcome: outcome2, path: path7, live, status, problem: null, warnings, nextStep: nextStep2 };
|
|
78380
78526
|
}
|
|
78381
78527
|
function readDoctorEffortSchema(root, env, options = {}) {
|
|
78382
78528
|
const override = env[EFFORT_DIR_VARIABLE];
|
|
78383
78529
|
const live = override === undefined || override === "";
|
|
78384
|
-
let
|
|
78530
|
+
let path7;
|
|
78385
78531
|
try {
|
|
78386
|
-
|
|
78532
|
+
path7 = join114(effortStoreDir(root, env), SQLITE_STORE_FILE_NAME);
|
|
78387
78533
|
} catch (error2) {
|
|
78388
78534
|
return unreadable4(null, live, messageOf(error2));
|
|
78389
78535
|
}
|
|
78390
78536
|
try {
|
|
78391
|
-
return readingOf2(readSchemaReport(
|
|
78537
|
+
return readingOf2(readSchemaReport(path7, options), live);
|
|
78392
78538
|
} catch (error2) {
|
|
78393
|
-
return unreadable4(
|
|
78539
|
+
return unreadable4(path7, live, `${path7} cannot be read as an effort store: ${messageOf(error2)}`);
|
|
78394
78540
|
}
|
|
78395
78541
|
}
|
|
78396
78542
|
function wayOut(reading2) {
|
|
@@ -78457,20 +78603,20 @@ function isAbsence2(error2) {
|
|
|
78457
78603
|
return false;
|
|
78458
78604
|
return error2.code === "ENOENT" || error2.code === "ENOTDIR";
|
|
78459
78605
|
}
|
|
78460
|
-
function isStoreFile(
|
|
78606
|
+
function isStoreFile(path7) {
|
|
78461
78607
|
try {
|
|
78462
|
-
return statSync32(
|
|
78608
|
+
return statSync32(path7).isFile();
|
|
78463
78609
|
} catch (error2) {
|
|
78464
78610
|
if (isAbsence2(error2))
|
|
78465
78611
|
return false;
|
|
78466
|
-
throw new Error(`${
|
|
78612
|
+
throw new Error(`${path7}: cannot be checked (${messageOf(error2)})`, { cause: error2 });
|
|
78467
78613
|
}
|
|
78468
78614
|
}
|
|
78469
78615
|
function storeFilesIn(dir) {
|
|
78470
78616
|
return Object.freeze(STORE_FILE_NAMES2.filter((name2) => isStoreFile(join115(dir, name2))));
|
|
78471
78617
|
}
|
|
78472
|
-
function shellQuoted(
|
|
78473
|
-
return `'${
|
|
78618
|
+
function shellQuoted(path7) {
|
|
78619
|
+
return `'${path7.replaceAll("'", "'\\''")}'`;
|
|
78474
78620
|
}
|
|
78475
78621
|
function legacyWarning(legacyDir, storeDir, legacyFiles) {
|
|
78476
78622
|
const move3 = `mkdir -p ${shellQuoted(storeDir)} && mv ${shellQuoted(legacyDir)}/* ${shellQuoted(storeDir)}/`;
|
|
@@ -78678,15 +78824,15 @@ function withProjectNumber(text2, number) {
|
|
|
78678
78824
|
return appended6(lines3, ["board:", ...settingLines(number, true)]).join(`
|
|
78679
78825
|
`);
|
|
78680
78826
|
}
|
|
78681
|
-
function projectNumberIn(text2,
|
|
78682
|
-
return parseConfigText(text2,
|
|
78827
|
+
function projectNumberIn(text2, path7) {
|
|
78828
|
+
return parseConfigText(text2, path7).values.boardProjectNumber ?? null;
|
|
78683
78829
|
}
|
|
78684
|
-
function readBackProblem(text2, written5,
|
|
78830
|
+
function readBackProblem(text2, written5, path7, number) {
|
|
78685
78831
|
let before;
|
|
78686
78832
|
let after;
|
|
78687
78833
|
try {
|
|
78688
|
-
before = parseConfigText(text2,
|
|
78689
|
-
after = parseConfigText(written5,
|
|
78834
|
+
before = parseConfigText(text2, path7);
|
|
78835
|
+
after = parseConfigText(written5, path7);
|
|
78690
78836
|
} catch (error2) {
|
|
78691
78837
|
return `does not parse: ${messageOf(error2)}`;
|
|
78692
78838
|
}
|
|
@@ -78700,31 +78846,31 @@ function settingPart(outcome2, detail) {
|
|
|
78700
78846
|
return { kind: "setting", name: PROJECT_NUMBER_SETTING, outcome: outcome2, detail };
|
|
78701
78847
|
}
|
|
78702
78848
|
function writeProjectNumber(root, number) {
|
|
78703
|
-
const
|
|
78849
|
+
const path7 = configFilePath(root);
|
|
78704
78850
|
let text2;
|
|
78705
78851
|
let held2;
|
|
78706
78852
|
try {
|
|
78707
|
-
text2 = readFileSync91(
|
|
78708
|
-
held2 = projectNumberIn(text2,
|
|
78853
|
+
text2 = readFileSync91(path7, "utf8");
|
|
78854
|
+
held2 = projectNumberIn(text2, path7);
|
|
78709
78855
|
} catch (error2) {
|
|
78710
|
-
return settingPart("refused", `${
|
|
78856
|
+
return settingPart("refused", `${path7} could not be read: ${messageOf(error2)}`);
|
|
78711
78857
|
}
|
|
78712
78858
|
if (held2 === number)
|
|
78713
|
-
return settingPart("present", `${
|
|
78859
|
+
return settingPart("present", `${path7} names project ${String(number)}`);
|
|
78714
78860
|
const written5 = withProjectNumber(text2, number);
|
|
78715
78861
|
if (written5 === null) {
|
|
78716
78862
|
const why = `it spells board or board.project in a shape this command does not edit, so set ${PROJECT_NUMBER_SETTING}: ${String(number)} by hand`;
|
|
78717
|
-
return settingPart("refused", `${
|
|
78863
|
+
return settingPart("refused", `${path7} was left as it was: ${why}`);
|
|
78718
78864
|
}
|
|
78719
|
-
const problem = readBackProblem(text2, written5,
|
|
78865
|
+
const problem = readBackProblem(text2, written5, path7, number);
|
|
78720
78866
|
if (problem !== null)
|
|
78721
|
-
return settingPart("refused", `${
|
|
78867
|
+
return settingPart("refused", `${path7} was left as it was: the file this run would have written ${problem}`);
|
|
78722
78868
|
try {
|
|
78723
|
-
writeFileSync35(
|
|
78869
|
+
writeFileSync35(path7, written5, "utf8");
|
|
78724
78870
|
} catch (error2) {
|
|
78725
|
-
return settingPart("refused", `${
|
|
78871
|
+
return settingPart("refused", `${path7} could not be written: ${messageOf(error2)}`);
|
|
78726
78872
|
}
|
|
78727
|
-
return settingPart("created", `${
|
|
78873
|
+
return settingPart("created", `${path7} now names project ${String(number)}`);
|
|
78728
78874
|
}
|
|
78729
78875
|
|
|
78730
78876
|
// src/commands/init-board-project.ts
|
|
@@ -79228,31 +79374,31 @@ function stretchFolder(root, n) {
|
|
|
79228
79374
|
function agentFilePath(root, n) {
|
|
79229
79375
|
return join117(stretchFolder(root, n), AGENT_FILE);
|
|
79230
79376
|
}
|
|
79231
|
-
function stretchNumbers(root,
|
|
79232
|
-
return
|
|
79377
|
+
function stretchNumbers(root, fs4 = nodeStretchFs) {
|
|
79378
|
+
return fs4.list(stretchRoot(root)).filter((entry) => entry.isDirectory && DIGITS.test(entry.name)).map((entry) => Number(entry.name)).filter((n) => n > 0).sort((a, b) => a - b);
|
|
79233
79379
|
}
|
|
79234
|
-
function highestStretch(root,
|
|
79235
|
-
const numbers = stretchNumbers(root,
|
|
79380
|
+
function highestStretch(root, fs4 = nodeStretchFs) {
|
|
79381
|
+
const numbers = stretchNumbers(root, fs4);
|
|
79236
79382
|
return numbers.length === 0 ? 0 : numbers[numbers.length - 1];
|
|
79237
79383
|
}
|
|
79238
|
-
function nextStretch(root,
|
|
79239
|
-
const highest = highestStretch(root,
|
|
79240
|
-
if (highest > 0 && !hasAgentFile(root, highest,
|
|
79384
|
+
function nextStretch(root, fs4 = nodeStretchFs) {
|
|
79385
|
+
const highest = highestStretch(root, fs4);
|
|
79386
|
+
if (highest > 0 && !hasAgentFile(root, highest, fs4))
|
|
79241
79387
|
return highest;
|
|
79242
79388
|
return highest + 1;
|
|
79243
79389
|
}
|
|
79244
|
-
function newestWatched(root,
|
|
79245
|
-
const numbers = stretchNumbers(root,
|
|
79390
|
+
function newestWatched(root, fs4 = nodeStretchFs) {
|
|
79391
|
+
const numbers = stretchNumbers(root, fs4);
|
|
79246
79392
|
for (let index = numbers.length - 1;index >= 0; index -= 1) {
|
|
79247
79393
|
const n = numbers[index];
|
|
79248
|
-
if (hasAgentFile(root, n,
|
|
79394
|
+
if (hasAgentFile(root, n, fs4))
|
|
79249
79395
|
return n;
|
|
79250
79396
|
}
|
|
79251
79397
|
return 0;
|
|
79252
79398
|
}
|
|
79253
|
-
function readAgentFile(root, n,
|
|
79399
|
+
function readAgentFile(root, n, fs4 = nodeStretchFs) {
|
|
79254
79400
|
const file = agentFilePath(root, n);
|
|
79255
|
-
const text2 =
|
|
79401
|
+
const text2 = fs4.readText(file);
|
|
79256
79402
|
if (text2 === null)
|
|
79257
79403
|
return { kind: "absent", file };
|
|
79258
79404
|
let value;
|
|
@@ -79322,8 +79468,8 @@ var nodeStretchFs = {
|
|
|
79322
79468
|
}
|
|
79323
79469
|
}
|
|
79324
79470
|
};
|
|
79325
|
-
function hasAgentFile(root, n,
|
|
79326
|
-
return
|
|
79471
|
+
function hasAgentFile(root, n, fs4) {
|
|
79472
|
+
return fs4.readText(agentFilePath(root, n)) !== null;
|
|
79327
79473
|
}
|
|
79328
79474
|
function stretchNumber(n) {
|
|
79329
79475
|
if (!isPositiveWhole(n)) {
|
|
@@ -79359,12 +79505,15 @@ function optionalString2(record2, key) {
|
|
|
79359
79505
|
|
|
79360
79506
|
// src/commands/stretch/item.ts
|
|
79361
79507
|
init_rafa_board();
|
|
79508
|
+
init_rafa_effort();
|
|
79362
79509
|
init_naming();
|
|
79363
79510
|
init_plan_files2();
|
|
79364
79511
|
init_command2();
|
|
79365
79512
|
init_sections();
|
|
79513
|
+
init_git2();
|
|
79366
79514
|
init_loop();
|
|
79367
79515
|
init_plan();
|
|
79516
|
+
init_filed_text();
|
|
79368
79517
|
import { closeSync as closeSync4, mkdirSync as mkdirSync34, openSync as openSync4, readdirSync as readdirSync28, readFileSync as readFileSync100, statSync as statSync34 } from "fs";
|
|
79369
79518
|
import { dirname as dirname48, join as join122, posix as posix14 } from "path";
|
|
79370
79519
|
|
|
@@ -79443,7 +79592,7 @@ function defaultOperatorsSeams() {
|
|
|
79443
79592
|
};
|
|
79444
79593
|
}
|
|
79445
79594
|
var nodeOperatorsFs = {
|
|
79446
|
-
exists: (
|
|
79595
|
+
exists: (path7) => existsSync83(path7),
|
|
79447
79596
|
readText(file) {
|
|
79448
79597
|
try {
|
|
79449
79598
|
return readFileSync94(file, "utf8");
|
|
@@ -79475,8 +79624,8 @@ var nodeOperatorsFs = {
|
|
|
79475
79624
|
}
|
|
79476
79625
|
}
|
|
79477
79626
|
};
|
|
79478
|
-
function linksIn(
|
|
79479
|
-
return
|
|
79627
|
+
function linksIn(fs4, dir, keep2) {
|
|
79628
|
+
return fs4.list(dir).filter((entry) => entry.isSymbolicLink && entry.name.startsWith(OPERATOR_PREFIX) && keep2(entry.name)).map((entry) => entry.name).sort().map((name2) => join118(dir, name2));
|
|
79480
79629
|
}
|
|
79481
79630
|
|
|
79482
79631
|
// src/stretch/launch.ts
|
|
@@ -79544,69 +79693,6 @@ function lineText(argv) {
|
|
|
79544
79693
|
return argv.map((word) => PLAIN_FLAG.test(word) ? word : shellQuote(word)).join(" ");
|
|
79545
79694
|
}
|
|
79546
79695
|
|
|
79547
|
-
// src/commands/plan/stretch-rules.ts
|
|
79548
|
-
init_command2();
|
|
79549
|
-
init_sections();
|
|
79550
|
-
init_loop();
|
|
79551
|
-
import fs3 from "fs";
|
|
79552
|
-
import path6 from "path";
|
|
79553
|
-
var STRETCH_RULES_ENV = "RAFA_STRETCH_RULES";
|
|
79554
|
-
var STRETCH_RULES_REFUSAL_EXIT = 1;
|
|
79555
|
-
function missingRulesMessage(value) {
|
|
79556
|
-
return `${STRETCH_RULES_ENV}=${value} names no file; a stretch's rules are read from its rules.md,` + ` so write that file or unset ${STRETCH_RULES_ENV}`;
|
|
79557
|
-
}
|
|
79558
|
-
function notRulesFileMessage(value, what) {
|
|
79559
|
-
return `${STRETCH_RULES_ENV}=${value} names ${what}, not a file; point it at the stretch's rules.md`;
|
|
79560
|
-
}
|
|
79561
|
-
function unreadableRulesMessage(value, reason) {
|
|
79562
|
-
return `${STRETCH_RULES_ENV}=${value} could not be read: ${reason}`;
|
|
79563
|
-
}
|
|
79564
|
-
function describeEntry(stat2) {
|
|
79565
|
-
return stat2.isDirectory() ? "a directory" : "something other than a file";
|
|
79566
|
-
}
|
|
79567
|
-
function displayPath2(repoRoot, absolute) {
|
|
79568
|
-
const relative30 = path6.relative(repoRoot, absolute);
|
|
79569
|
-
return relative30 === "" || relative30.startsWith("..") || path6.isAbsolute(relative30) ? absolute : relative30;
|
|
79570
|
-
}
|
|
79571
|
-
function readStretchRules(env, repoRoot) {
|
|
79572
|
-
const value = env[STRETCH_RULES_ENV];
|
|
79573
|
-
if (value === undefined || value.trim() === "")
|
|
79574
|
-
return null;
|
|
79575
|
-
const absolute = path6.resolve(repoRoot, value);
|
|
79576
|
-
let stat2;
|
|
79577
|
-
try {
|
|
79578
|
-
stat2 = fs3.statSync(absolute);
|
|
79579
|
-
} catch (error2) {
|
|
79580
|
-
if (errorCode(error2) === "ENOENT") {
|
|
79581
|
-
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, missingRulesMessage(value));
|
|
79582
|
-
}
|
|
79583
|
-
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, unreadableRulesMessage(value, messageOf(error2)));
|
|
79584
|
-
}
|
|
79585
|
-
if (!stat2.isFile()) {
|
|
79586
|
-
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, notRulesFileMessage(value, describeEntry(stat2)));
|
|
79587
|
-
}
|
|
79588
|
-
try {
|
|
79589
|
-
return Object.freeze({ path: displayPath2(repoRoot, absolute), text: fs3.readFileSync(absolute, "utf8") });
|
|
79590
|
-
} catch (error2) {
|
|
79591
|
-
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, unreadableRulesMessage(value, messageOf(error2)));
|
|
79592
|
-
}
|
|
79593
|
-
}
|
|
79594
|
-
function stretchRulesReader(env, repoRoot) {
|
|
79595
|
-
let reading2 = null;
|
|
79596
|
-
return () => {
|
|
79597
|
-
if (reading2 === null) {
|
|
79598
|
-
try {
|
|
79599
|
-
reading2 = { ok: true, rules: readStretchRules(env, repoRoot) };
|
|
79600
|
-
} catch (error2) {
|
|
79601
|
-
reading2 = { ok: false, error: error2 };
|
|
79602
|
-
}
|
|
79603
|
-
}
|
|
79604
|
-
if (reading2.ok)
|
|
79605
|
-
return reading2.rules;
|
|
79606
|
-
throw reading2.error;
|
|
79607
|
-
};
|
|
79608
|
-
}
|
|
79609
|
-
|
|
79610
79696
|
// src/commands/stretch/item-merge.ts
|
|
79611
79697
|
init_rafa_board();
|
|
79612
79698
|
import { readFileSync as readFileSync98 } from "fs";
|
|
@@ -79720,8 +79806,119 @@ function itemProblem2(item) {
|
|
|
79720
79806
|
return null;
|
|
79721
79807
|
}
|
|
79722
79808
|
|
|
79809
|
+
// src/stretch/pit-effort.ts
|
|
79810
|
+
init_rafa_effort();
|
|
79811
|
+
init_sections();
|
|
79812
|
+
import { homedir as homedir16 } from "os";
|
|
79813
|
+
var PLAN_ROW_KIND = "plan";
|
|
79814
|
+
var MINUTES_METRIC = "minutes";
|
|
79815
|
+
var MS_PER_SECOND9 = 1000;
|
|
79816
|
+
var DECIMALS = 1;
|
|
79817
|
+
function collectFailure(exitCode) {
|
|
79818
|
+
return exitCode === null ? "rafa effort collect could not start" : `rafa effort collect ended with exit code ${String(exitCode)}`;
|
|
79819
|
+
}
|
|
79820
|
+
function defaultTrendOptions() {
|
|
79821
|
+
const parsed2 = parseReportArgs(["--trend"]);
|
|
79822
|
+
if (parsed2.trend === null)
|
|
79823
|
+
throw new Error(`the trend options did not parse: ${parsed2.errors.join("; ")}`);
|
|
79824
|
+
return parsed2.trend;
|
|
79825
|
+
}
|
|
79826
|
+
function effortOf(dashboard, stub) {
|
|
79827
|
+
const row2 = dashboard.loops.rows.find((entry) => entry.kind === PLAN_ROW_KIND && entry.key === stub);
|
|
79828
|
+
if (row2 === undefined)
|
|
79829
|
+
return { stub, rows: 0 };
|
|
79830
|
+
const minutes2 = dashboard.trend.metrics.find((metric2) => metric2.name === MINUTES_METRIC);
|
|
79831
|
+
return {
|
|
79832
|
+
stub,
|
|
79833
|
+
tasks: row2.tasks,
|
|
79834
|
+
p50: row2.perTask.minutes.p50,
|
|
79835
|
+
max: row2.perTask.minutes.max,
|
|
79836
|
+
baseline: minutes2?.baselineP50 ?? null
|
|
79837
|
+
};
|
|
79838
|
+
}
|
|
79839
|
+
async function readPitEffort(seams, query) {
|
|
79840
|
+
const started = seams.now().getTime();
|
|
79841
|
+
let exitCode;
|
|
79842
|
+
try {
|
|
79843
|
+
exitCode = await seams.runCollect();
|
|
79844
|
+
} catch {
|
|
79845
|
+
exitCode = null;
|
|
79846
|
+
}
|
|
79847
|
+
const collect4 = { exitCode, seconds: (seams.now().getTime() - started) / MS_PER_SECOND9 };
|
|
79848
|
+
if (exitCode !== 0)
|
|
79849
|
+
return { effort: { ok: false, reason: collectFailure(exitCode) }, collect: collect4 };
|
|
79850
|
+
try {
|
|
79851
|
+
const dashboard = await seams.readDashboard({
|
|
79852
|
+
repoRoot: query.root,
|
|
79853
|
+
home: query.home ?? homedir16(),
|
|
79854
|
+
trend: defaultTrendOptions(),
|
|
79855
|
+
now: seams.now()
|
|
79856
|
+
});
|
|
79857
|
+
return { effort: { ok: true, value: effortOf(dashboard, query.stub) }, collect: collect4 };
|
|
79858
|
+
} catch (error2) {
|
|
79859
|
+
return { effort: { ok: false, reason: messageOf(error2) }, collect: collect4 };
|
|
79860
|
+
}
|
|
79861
|
+
}
|
|
79862
|
+
function minutesText(value) {
|
|
79863
|
+
return value === null ? "no figure" : `${value.toFixed(DECIMALS)} min`;
|
|
79864
|
+
}
|
|
79865
|
+
function renderPitEffort(effort) {
|
|
79866
|
+
if (!effort.ok)
|
|
79867
|
+
return `Effort: not read (${effort.reason}).`;
|
|
79868
|
+
const value = effort.value;
|
|
79869
|
+
if ("rows" in value)
|
|
79870
|
+
return `Effort: ${value.stub}: no task sessions stored.`;
|
|
79871
|
+
const against = value.baseline === null ? "no baseline" : minutesText(value.baseline);
|
|
79872
|
+
return `Effort: ${value.stub}: ${String(value.tasks)} tasks, p50 ${minutesText(value.p50)}` + ` against ${against}, max ${minutesText(value.max)}.`;
|
|
79873
|
+
}
|
|
79874
|
+
function collectLine(collect4) {
|
|
79875
|
+
const seconds = collect4.seconds.toFixed(DECIMALS);
|
|
79876
|
+
return collect4.exitCode === null ? `rafa effort collect could not start (${seconds}s)` : `rafa effort collect ended ${String(collect4.exitCode)} in ${seconds}s`;
|
|
79877
|
+
}
|
|
79878
|
+
|
|
79723
79879
|
// src/stretch/pit-readings.ts
|
|
79724
79880
|
init_sections();
|
|
79881
|
+
|
|
79882
|
+
// src/stretch/pit-recheck.ts
|
|
79883
|
+
init_sections();
|
|
79884
|
+
var REPRODUCE_INDENT2 = " ";
|
|
79885
|
+
async function readPitRechecks(judge, filed) {
|
|
79886
|
+
if (!filed.ok)
|
|
79887
|
+
return filed;
|
|
79888
|
+
const bugs = filed.value.bugs.map((bug) => ({ ...bug, author: null }));
|
|
79889
|
+
if (bugs.length === 0)
|
|
79890
|
+
return { ok: true, value: [] };
|
|
79891
|
+
try {
|
|
79892
|
+
const judged2 = await judge(bugs);
|
|
79893
|
+
return { ok: true, value: [...judged2.rows] };
|
|
79894
|
+
} catch (error2) {
|
|
79895
|
+
return { ok: false, reason: messageOf(error2) };
|
|
79896
|
+
}
|
|
79897
|
+
}
|
|
79898
|
+
function detailOf20(row2) {
|
|
79899
|
+
if (row2.verdict === "skipped" || row2.verdict === "stale") {
|
|
79900
|
+
return row2.reason === null ? "" : `: ${row2.reason}`;
|
|
79901
|
+
}
|
|
79902
|
+
if (row2.verdict === "flaky")
|
|
79903
|
+
return `: ${String(row2.failedRuns ?? 0)} of ${String(row2.runs)} runs failed`;
|
|
79904
|
+
return "";
|
|
79905
|
+
}
|
|
79906
|
+
function rowLines2(row2) {
|
|
79907
|
+
const head = `Recheck #${String(row2.issue)}: ${row2.verdict}${detailOf20(row2)}`;
|
|
79908
|
+
if (row2.verdict !== "manual" || row2.reproduce === null)
|
|
79909
|
+
return [head];
|
|
79910
|
+
return [head, ...row2.reproduce.split(`
|
|
79911
|
+
`).map((line) => `${REPRODUCE_INDENT2}${line}`)];
|
|
79912
|
+
}
|
|
79913
|
+
function renderPitRechecks(rechecks) {
|
|
79914
|
+
if (!rechecks.ok)
|
|
79915
|
+
return [`Recheck: not read (${rechecks.reason}).`];
|
|
79916
|
+
if (rechecks.value.length === 0)
|
|
79917
|
+
return ["Recheck: no bug filed since."];
|
|
79918
|
+
return rechecks.value.flatMap(rowLines2);
|
|
79919
|
+
}
|
|
79920
|
+
|
|
79921
|
+
// src/stretch/pit-readings.ts
|
|
79725
79922
|
var NO_OPEN_ISSUES = "the tracker lists no open issues (it has no openIssues)";
|
|
79726
79923
|
var NO_FILED_ISSUES = "the tracker lists no filed issues (it has no filedIssues)";
|
|
79727
79924
|
var INVALID_CUT_OFF = "the cut-off is not a valid time";
|
|
@@ -79730,7 +79927,16 @@ async function readPitReadings(seams, query) {
|
|
|
79730
79927
|
const ci = await attempt4(() => readCi(seams.gh, query));
|
|
79731
79928
|
const bugs = await attempt4(() => readOpenBugs(seams.tracker));
|
|
79732
79929
|
const openBugs2 = bugs.ok ? { ok: true, value: bugs.value.length } : bugs;
|
|
79733
|
-
|
|
79930
|
+
const filedSince = await readFiledSince(seams.tracker, query.since);
|
|
79931
|
+
const effort = await readPitEffort(seams, { root: query.root, stub: query.stub });
|
|
79932
|
+
const rechecks = await readPitRechecks(seams.judge, judgedReading(filedSince));
|
|
79933
|
+
return { ci, openBugs: openBugs2, filedSince, effort, rechecks };
|
|
79934
|
+
}
|
|
79935
|
+
function judgedReading(filed) {
|
|
79936
|
+
if (!filed.ok)
|
|
79937
|
+
return filed;
|
|
79938
|
+
const bugs = filed.value.bugs.map((bug) => ({ ref: bug.ref, issue: Number(bug.id), title: bug.title, body: bug.body }));
|
|
79939
|
+
return { ok: true, value: { bugs } };
|
|
79734
79940
|
}
|
|
79735
79941
|
async function readCiRuns(gh, query) {
|
|
79736
79942
|
if (query.workflow === undefined)
|
|
@@ -79774,7 +79980,9 @@ async function readFiledSince(tracker, since) {
|
|
|
79774
79980
|
title: bug.title,
|
|
79775
79981
|
url: bug.ref.url,
|
|
79776
79982
|
filedAt: new Date(at).toISOString(),
|
|
79777
|
-
firstLine: firstLineOf4(bug.body)
|
|
79983
|
+
firstLine: firstLineOf4(bug.body),
|
|
79984
|
+
ref: bug.ref,
|
|
79985
|
+
body: bug.body
|
|
79778
79986
|
}));
|
|
79779
79987
|
return { ok: true, value: { since: since.toISOString(), bugs: filed } };
|
|
79780
79988
|
}
|
|
@@ -79786,7 +79994,13 @@ async function attempt4(read2) {
|
|
|
79786
79994
|
}
|
|
79787
79995
|
}
|
|
79788
79996
|
function renderPitReadings(readings) {
|
|
79789
|
-
return [
|
|
79997
|
+
return [
|
|
79998
|
+
...ciLines(readings.ci),
|
|
79999
|
+
openBugsLine(readings.openBugs),
|
|
80000
|
+
...filedSinceLines(readings.filedSince),
|
|
80001
|
+
renderPitEffort(readings.effort.effort),
|
|
80002
|
+
...renderPitRechecks(readings.rechecks)
|
|
80003
|
+
];
|
|
79790
80004
|
}
|
|
79791
80005
|
function ciLines(ci) {
|
|
79792
80006
|
if (!ci.ok)
|
|
@@ -80484,6 +80698,9 @@ function refuseUnmergeable2(pull) {
|
|
|
80484
80698
|
function mergeArgv(rafa, number) {
|
|
80485
80699
|
return [...rafa, "pr", "merge", String(number), ...MERGE_FLAGS];
|
|
80486
80700
|
}
|
|
80701
|
+
function collectArgv(rafa) {
|
|
80702
|
+
return [...rafa, "effort", "collect"];
|
|
80703
|
+
}
|
|
80487
80704
|
function mergeDryRunLines(rafa, root, n) {
|
|
80488
80705
|
const base2 = `${STRETCH_BRANCH_PREFIX}${String(n)}`;
|
|
80489
80706
|
const runList5 = lineText(["gh", ...runListArgs({ branch: base2, commit: STAND_IN_SHA })]).replace(STAND_IN_SHA, MERGE_COMMIT_PLACEHOLDER);
|
|
@@ -80493,7 +80710,9 @@ function mergeDryRunLines(rafa, root, n) {
|
|
|
80493
80710
|
`${lineText([...rafa, "pr", "merge"])} <pr> ${lineText(MERGE_FLAGS)}`,
|
|
80494
80711
|
`${runList5} (again every ${String(CI_POLL_MS / 1000)}s until the run on the merge commit ends)`,
|
|
80495
80712
|
`append the item to ${itemsPath(root, n)}`,
|
|
80496
|
-
|
|
80713
|
+
lineText(collectArgv(rafa)),
|
|
80714
|
+
`print the pit-stop readings of ${base2}`,
|
|
80715
|
+
"recheck each bug filed since the last item, as rafa bug recheck judges it, posting no comment"
|
|
80497
80716
|
];
|
|
80498
80717
|
}
|
|
80499
80718
|
function stretchStartedAt(root, n) {
|
|
@@ -80588,6 +80807,25 @@ async function mergePull(context, item, number, seams) {
|
|
|
80588
80807
|
context.output.info(`merged #${String(number)} into ${pull.base} at ${short3(pull.mergeCommit)}`);
|
|
80589
80808
|
return pull;
|
|
80590
80809
|
}
|
|
80810
|
+
function itemJudge(context, item, gh, tracker, seams) {
|
|
80811
|
+
const config = item.recheckConfig;
|
|
80812
|
+
let board;
|
|
80813
|
+
const trust = () => {
|
|
80814
|
+
board ??= ghBoardTrust({ gh, trustedAuthors: config.boardTrustedAuthors, repo: boardRepoLabel(seams.git(item.root)) });
|
|
80815
|
+
return board;
|
|
80816
|
+
};
|
|
80817
|
+
return (bugs) => judgeBugs(bugs, {
|
|
80818
|
+
tracker,
|
|
80819
|
+
trust,
|
|
80820
|
+
checkout: item.root,
|
|
80821
|
+
env: item.env,
|
|
80822
|
+
secrets: config.secrets,
|
|
80823
|
+
runs: config.bugsRecheckRuns,
|
|
80824
|
+
timeoutMs: config.bugsRecheckTimeoutSeconds * MS_PER_SECOND8,
|
|
80825
|
+
recheck: seams.recheck,
|
|
80826
|
+
warn: (text2) => context.output.warn(text2)
|
|
80827
|
+
});
|
|
80828
|
+
}
|
|
80591
80829
|
async function finishItem(context, item, merged2, seams) {
|
|
80592
80830
|
const info2 = (text2) => context.output.info(text2);
|
|
80593
80831
|
const gh = seams.gh(item.root);
|
|
@@ -80602,14 +80840,22 @@ async function finishItem(context, item, merged2, seams) {
|
|
|
80602
80840
|
at: seams.now().toISOString()
|
|
80603
80841
|
});
|
|
80604
80842
|
info2(`ledger: #${String(item.issue)} appended to ${itemsPath(item.root, item.n)}${closes2.length === 0 ? ", closing no issue" : `, ${closes2.join(", ")}`}`);
|
|
80605
|
-
const
|
|
80843
|
+
const tracker = seams.tracker(gh);
|
|
80844
|
+
const collect4 = collectArgv(seams.rafa);
|
|
80845
|
+
const runCollect = () => {
|
|
80846
|
+
info2(lineText(collect4));
|
|
80847
|
+
return seams.runRafa(collect4, item.root, item.env);
|
|
80848
|
+
};
|
|
80849
|
+
const readings = await readPitReadings({ gh, tracker, runCollect, readDashboard: seams.readDashboard, now: seams.now, judge: itemJudge(context, item, gh, tracker, seams) }, { branch: merged2.base, since: item.since, root: item.root, stub: item.stub });
|
|
80850
|
+
info2(collectLine(readings.effort.collect));
|
|
80606
80851
|
for (const line of renderPitReadings(readings))
|
|
80607
80852
|
info2(line);
|
|
80608
80853
|
}
|
|
80609
80854
|
async function mergeItem(context, item, number, seams) {
|
|
80610
80855
|
const since = bugCutOff(item);
|
|
80611
80856
|
const merged2 = await mergePull(context, item, number, seams);
|
|
80612
|
-
|
|
80857
|
+
const finish2 = { root: item.root, n: item.n, issue: item.issue, stub: item.stub, since, env: item.env, recheckConfig: item.recheckConfig };
|
|
80858
|
+
await finishItem(context, finish2, merged2, seams);
|
|
80613
80859
|
}
|
|
80614
80860
|
async function afterLoopWait(context, item, waitExit, seams) {
|
|
80615
80861
|
const ending = readLoopEnding(item.root, item.sessionId);
|
|
@@ -80727,7 +80973,8 @@ async function resumeItem(context, input, seams) {
|
|
|
80727
80973
|
} else {
|
|
80728
80974
|
throw refusal26(`#${String(number)} is ${pull.state}, neither open nor merged. Nothing was run.`);
|
|
80729
80975
|
}
|
|
80730
|
-
|
|
80976
|
+
const finish2 = { root: input.root, n: input.n, issue: input.issue, stub, since, env: input.env, recheckConfig: input.recheckConfig };
|
|
80977
|
+
await finishItem(context, finish2, merged2, seams);
|
|
80731
80978
|
}
|
|
80732
80979
|
|
|
80733
80980
|
// src/commands/stretch/item.ts
|
|
@@ -80936,7 +81183,8 @@ async function waitStep(context, wait, seams) {
|
|
|
80936
81183
|
sessionId: record2.sessionId,
|
|
80937
81184
|
startedAt: record2.startedAt,
|
|
80938
81185
|
log: wait.log,
|
|
80939
|
-
env
|
|
81186
|
+
env,
|
|
81187
|
+
recheckConfig: wait.recheckConfig
|
|
80940
81188
|
}, exitCode, seams);
|
|
80941
81189
|
}
|
|
80942
81190
|
async function resumeStep(context, step2, seams) {
|
|
@@ -80957,7 +81205,8 @@ async function resumeStep(context, step2, seams) {
|
|
|
80957
81205
|
plans: issuePlans(step2.plans, issue5),
|
|
80958
81206
|
plansLabel: step2.plans.label,
|
|
80959
81207
|
log,
|
|
80960
|
-
env: childEnv(context)
|
|
81208
|
+
env: childEnv(context),
|
|
81209
|
+
recheckConfig: step2.recheckConfig
|
|
80961
81210
|
}, seams);
|
|
80962
81211
|
}
|
|
80963
81212
|
async function runStretchItem(context, seams) {
|
|
@@ -80968,8 +81217,14 @@ async function runStretchItem(context, seams) {
|
|
|
80968
81217
|
const config = await resolveProjectConfig(project, COMMAND_NAME19, warn5);
|
|
80969
81218
|
const n = requireStretchBase(config.prBase);
|
|
80970
81219
|
const plans = plansDirAt(root, config.planDir);
|
|
81220
|
+
const recheckConfig = {
|
|
81221
|
+
bugsRecheckRuns: config.bugsRecheckRuns,
|
|
81222
|
+
bugsRecheckTimeoutSeconds: config.bugsRecheckTimeoutSeconds,
|
|
81223
|
+
boardTrustedAuthors: config.boardTrustedAuthors,
|
|
81224
|
+
secrets: namedSecrets(config, context.env)
|
|
81225
|
+
};
|
|
80971
81226
|
if (line.resume) {
|
|
80972
|
-
await resumeStep(context, { root, n, plans, dryRun: line.dryRun, issue: line.issue }, seams);
|
|
81227
|
+
await resumeStep(context, { root, n, plans, dryRun: line.dryRun, issue: line.issue, recheckConfig }, seams);
|
|
80973
81228
|
return;
|
|
80974
81229
|
}
|
|
80975
81230
|
const kept = existingPlan(plans, line.issue);
|
|
@@ -81008,7 +81263,7 @@ async function runStretchItem(context, seams) {
|
|
|
81008
81263
|
info2(`wait on it with: rafa loop wait --session-id=${record2.sessionId}`);
|
|
81009
81264
|
return;
|
|
81010
81265
|
}
|
|
81011
|
-
await waitStep(context, { root, n, issue: line.issue, stub, record: record2, log }, seams);
|
|
81266
|
+
await waitStep(context, { root, n, issue: line.issue, stub, record: record2, log, recheckConfig }, seams);
|
|
81012
81267
|
}
|
|
81013
81268
|
async function spawnOnTerminal(argv, cwd, env) {
|
|
81014
81269
|
try {
|
|
@@ -81042,6 +81297,9 @@ function defaultStretchItemSeams() {
|
|
|
81042
81297
|
isAlive: isPidAlive,
|
|
81043
81298
|
gh: (root) => createGhRunner({ cwd: root }),
|
|
81044
81299
|
tracker: (gh) => createGithubTracker({ gh }),
|
|
81300
|
+
readDashboard,
|
|
81301
|
+
recheck: recheckBug,
|
|
81302
|
+
git: createGitRunner,
|
|
81045
81303
|
sleep: (ms) => Bun.sleep(ms),
|
|
81046
81304
|
now: () => new Date,
|
|
81047
81305
|
rafa: DEFAULT_RAFA_COMMAND
|
|
@@ -81053,7 +81311,7 @@ function createStretchItemCommand(seams) {
|
|
|
81053
81311
|
subject: "stretch",
|
|
81054
81312
|
action: "item",
|
|
81055
81313
|
summary: "plan one issue of a stretch and start its loop, logging into the stretch folder",
|
|
81056
|
-
description: "Takes the integration branch from `pr.base`, refusing one that names no `stretch/<n>`" + " branch, then runs `rafa plan create --issue=<issue>` on this terminal, keeping a plan of the issue" + " already in `plan.dir` instead, and starts `rafa loop start --plan=<plan> --as-worktree --no-ci-wait`" + " detached with `RAFA_OUTPUT=events`, its output appended to `.rafa/stretch/<n>/loop-<issue>.log`." + " It waits for the loop's session record and prints its id. With `--wait` it then runs" + " `rafa loop wait --session-id=<id>`; once the loop has opened a pull request it refuses one whose base" + " is not a `stretch/*` branch, waits for GitHub to compute its mergeability and for its checks to pass," + " runs `rafa pr merge <pr> --yes`, waits for the run on the merge commit to end, appends the item to" + " `.rafa/stretch/<n>/items.ndjson` and prints the pit-stop readings. A loop that opened no pull request has its reason printed, merges nothing and exits with" + " `loop wait`'s code. With `--resume` instead of `--wait` it starts no planning session and no loop: it" + " finishes an item whose loop has ended from the last `rafa\xB7 pr #<n> opened` line of its log, skipping" + " the merge of a pull request merged already, and refuses an issue the ledger holds." + " `--dry-run` prints every step in order and runs none. Exit code 1 for a refusal," + " 2 for a step that failed, and the code of `plan create`, `loop wait` or `pr merge` when it fails.",
|
|
81314
|
+
description: "Takes the integration branch from `pr.base`, refusing one that names no `stretch/<n>`" + " branch, then runs `rafa plan create --issue=<issue>` on this terminal, keeping a plan of the issue" + " already in `plan.dir` instead, and starts `rafa loop start --plan=<plan> --as-worktree --no-ci-wait`" + " detached with `RAFA_OUTPUT=events`, its output appended to `.rafa/stretch/<n>/loop-<issue>.log`." + " It waits for the loop's session record and prints its id. With `--wait` it then runs" + " `rafa loop wait --session-id=<id>`; once the loop has opened a pull request it refuses one whose base" + " is not a `stretch/*` branch, waits for GitHub to compute its mergeability and for its checks to pass," + " runs `rafa pr merge <pr> --yes`, waits for the run on the merge commit to end, appends the item to" + " `.rafa/stretch/<n>/items.ndjson`, runs `rafa effort collect` and prints the pit-stop readings: CI on the" + " integration branch, the open bugs, the bugs filed since the last item, the item's effort against the" + " effort store's baseline, and a recheck of each bug filed since, judged as `rafa bug recheck` judges it." + " A loop that opened no pull request has its reason printed, merges nothing and exits with" + " `loop wait`'s code. With `--resume` instead of `--wait` it starts no planning session and no loop: it" + " finishes an item whose loop has ended from the last `rafa\xB7 pr #<n> opened` line of its log, skipping" + " the merge of a pull request merged already, and refuses an issue the ledger holds." + " `--dry-run` prints every step in order and runs none. Exit code 1 for a refusal," + " 2 for a step that failed, and the code of `plan create`, `loop wait` or `pr merge` when it fails.",
|
|
81057
81315
|
args: [
|
|
81058
81316
|
{ name: "issue", description: "The number of the `type:spec` issue to plan and run.", type: "string", required: true }
|
|
81059
81317
|
],
|
|
@@ -81889,7 +82147,7 @@ init_rafa_effort();
|
|
|
81889
82147
|
init_plan_files2();
|
|
81890
82148
|
init_command2();
|
|
81891
82149
|
init_config2();
|
|
81892
|
-
import { homedir as
|
|
82150
|
+
import { homedir as homedir17 } from "os";
|
|
81893
82151
|
var COMMAND_NAME21 = "rafa effort dashboard";
|
|
81894
82152
|
var USAGE33 = "rafa effort dashboard [--days=<n>] [--recent=<n>] [--loops=<n>] [--by=effort|model|agent]";
|
|
81895
82153
|
var TREND_FLAGS = ["days", "recent", "loops", "by"];
|
|
@@ -81917,7 +82175,7 @@ async function runDashboard(context, seams) {
|
|
|
81917
82175
|
try {
|
|
81918
82176
|
dashboard = await readDashboard({
|
|
81919
82177
|
repoRoot: root,
|
|
81920
|
-
home: seams.home ??
|
|
82178
|
+
home: seams.home ?? homedir17(),
|
|
81921
82179
|
trend,
|
|
81922
82180
|
now: (seams.now ?? (() => new Date))()
|
|
81923
82181
|
});
|
|
@@ -82885,7 +83143,7 @@ init_config2();
|
|
|
82885
83143
|
init_load();
|
|
82886
83144
|
init_sections();
|
|
82887
83145
|
import { existsSync as existsSync89, readFileSync as readFileSync104 } from "fs";
|
|
82888
|
-
import { homedir as
|
|
83146
|
+
import { homedir as homedir18 } from "os";
|
|
82889
83147
|
import { join as join130, relative as relative31, sep as sep12 } from "path";
|
|
82890
83148
|
init_roots();
|
|
82891
83149
|
init_project_id();
|
|
@@ -82898,7 +83156,7 @@ init_position();
|
|
|
82898
83156
|
init_scope2();
|
|
82899
83157
|
import { createHash as createHash10 } from "crypto";
|
|
82900
83158
|
import { existsSync as existsSync87, mkdirSync as mkdirSync35, readFileSync as readFileSync103, writeFileSync as writeFileSync38 } from "fs";
|
|
82901
|
-
import { dirname as dirname50, isAbsolute as
|
|
83159
|
+
import { dirname as dirname50, isAbsolute as isAbsolute29, join as join128 } from "path";
|
|
82902
83160
|
var GITIGNORE_FILE = ".gitignore";
|
|
82903
83161
|
var DIGEST_NAME = "tracking.digest";
|
|
82904
83162
|
var PRIVATE_TRIAGE = "triage/private";
|
|
@@ -82980,7 +83238,7 @@ function withTrackingBlock(text2, flags, file = GITIGNORE_FILE) {
|
|
|
82980
83238
|
return `${before}${block2}${after}`;
|
|
82981
83239
|
}
|
|
82982
83240
|
function requireAbsolute3(root) {
|
|
82983
|
-
if (!
|
|
83241
|
+
if (!isAbsolute29(root)) {
|
|
82984
83242
|
throw new GitignoreError(`project root is ${describeValue(root)}, expected an absolute path`);
|
|
82985
83243
|
}
|
|
82986
83244
|
}
|
|
@@ -83502,7 +83760,7 @@ function renderReleaseStep(result2) {
|
|
|
83502
83760
|
// src/commands/init.ts
|
|
83503
83761
|
var DEFAULT_INIT_SEAMS = Object.freeze({
|
|
83504
83762
|
cwd: () => process.cwd(),
|
|
83505
|
-
home: () =>
|
|
83763
|
+
home: () => homedir18(),
|
|
83506
83764
|
entry: () => Bun.main,
|
|
83507
83765
|
isTerminal: () => process.stdin.isTTY === true,
|
|
83508
83766
|
openPrompter: () => createLinePrompter(process.stdin, process.stderr),
|
|
@@ -84592,7 +84850,7 @@ init_plan_files2();
|
|
|
84592
84850
|
init_loop();
|
|
84593
84851
|
init_readings();
|
|
84594
84852
|
init_plan();
|
|
84595
|
-
import { isAbsolute as
|
|
84853
|
+
import { isAbsolute as isAbsolute30, relative as relative32 } from "path";
|
|
84596
84854
|
|
|
84597
84855
|
// src/commands/loop/loop-sessions.ts
|
|
84598
84856
|
init_command2();
|
|
@@ -84710,7 +84968,7 @@ function etaLine(eta) {
|
|
|
84710
84968
|
var USAGE38 = "rafa loop list";
|
|
84711
84969
|
function worktreeLabel2(root, worktree) {
|
|
84712
84970
|
const under = relative32(root, worktree);
|
|
84713
|
-
return under === "" || under.startsWith("..") ||
|
|
84971
|
+
return under === "" || under.startsWith("..") || isAbsolute30(under) ? worktree : under;
|
|
84714
84972
|
}
|
|
84715
84973
|
function checkoutColumn(root, session) {
|
|
84716
84974
|
return session.worktree === undefined ? "in the main checkout" : `in worktree \`${worktreeLabel2(root, session.worktree)}\``;
|
|
@@ -84885,7 +85143,7 @@ init_command2();
|
|
|
84885
85143
|
init_rafa_effort();
|
|
84886
85144
|
init_rafa_pr();
|
|
84887
85145
|
import fs4 from "fs";
|
|
84888
|
-
import { homedir as
|
|
85146
|
+
import { homedir as homedir20 } from "os";
|
|
84889
85147
|
import path7 from "path";
|
|
84890
85148
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
84891
85149
|
init_command2();
|
|
@@ -84899,7 +85157,7 @@ init_tracker();
|
|
|
84899
85157
|
// src/notices/run.ts
|
|
84900
85158
|
init_command2();
|
|
84901
85159
|
init_output();
|
|
84902
|
-
import { homedir as
|
|
85160
|
+
import { homedir as homedir19 } from "os";
|
|
84903
85161
|
|
|
84904
85162
|
// src/notices/notices.ts
|
|
84905
85163
|
init_sections();
|
|
@@ -85015,7 +85273,7 @@ async function offerNotices(request, seams) {
|
|
|
85015
85273
|
// src/notices/run.ts
|
|
85016
85274
|
var NOTICES_CANCELLED = "\uD83D\uDED1 Cancelled at the notice: nothing was started.";
|
|
85017
85275
|
async function requireNoticesAnswered(settingSources) {
|
|
85018
|
-
const outcome2 = await offerNotices({ home:
|
|
85276
|
+
const outcome2 = await offerNotices({ home: homedir19(), version: RAFA_VERSION, settingSources }, {
|
|
85019
85277
|
isTerminal: () => process.stdin.isTTY === true,
|
|
85020
85278
|
openPrompter: () => createLinePrompter(process.stdin, process.stderr),
|
|
85021
85279
|
warn: (line) => {
|
|
@@ -85067,7 +85325,7 @@ async function start(args, repoRoot) {
|
|
|
85067
85325
|
return;
|
|
85068
85326
|
let runConfig;
|
|
85069
85327
|
try {
|
|
85070
|
-
runConfig = await loadRunConfig({ root: repoRoot, home:
|
|
85328
|
+
runConfig = await loadRunConfig({ root: repoRoot, home: homedir20() }, args);
|
|
85071
85329
|
} catch (error2) {
|
|
85072
85330
|
if (!(error2 instanceof ConfigError))
|
|
85073
85331
|
throw error2;
|
|
@@ -85104,7 +85362,7 @@ async function start(args, repoRoot) {
|
|
|
85104
85362
|
let expected2 = openCheckoutExpectation({ projectRoot: repoRoot, checkout, branch });
|
|
85105
85363
|
await announceRiskTotal({
|
|
85106
85364
|
repoRoot,
|
|
85107
|
-
home:
|
|
85365
|
+
home: homedir20(),
|
|
85108
85366
|
planPath,
|
|
85109
85367
|
config: runConfig.config,
|
|
85110
85368
|
environment: process.env
|
|
@@ -85134,16 +85392,16 @@ async function start(args, repoRoot) {
|
|
|
85134
85392
|
tiersRafa: runConfig.config.tiersRafa,
|
|
85135
85393
|
tiersSkills: runConfig.config.tiersSkills,
|
|
85136
85394
|
tiersAgents: runConfig.config.tiersAgents,
|
|
85137
|
-
home:
|
|
85395
|
+
home: homedir20()
|
|
85138
85396
|
},
|
|
85139
|
-
sync: { resolved: runConfig, home:
|
|
85397
|
+
sync: { resolved: runConfig, home: homedir20() },
|
|
85140
85398
|
claim: createStartPreflightClaim(repoRoot, runConfig.config),
|
|
85141
85399
|
drift: createStartPreflightDrift(repoRoot, runConfig.config)
|
|
85142
85400
|
});
|
|
85143
|
-
const serving = { root: repoRoot, run: session.id, home:
|
|
85401
|
+
const serving = { root: repoRoot, run: session.id, home: homedir20(), settings: runConfig.config };
|
|
85144
85402
|
const learning = {
|
|
85145
85403
|
kind: runConfig.config.learningAdapter,
|
|
85146
|
-
home:
|
|
85404
|
+
home: homedir20(),
|
|
85147
85405
|
blessMinConfidence: runConfig.config.learningBlessMinConfidence
|
|
85148
85406
|
};
|
|
85149
85407
|
const handout = {
|
|
@@ -85159,7 +85417,7 @@ async function start(args, repoRoot) {
|
|
|
85159
85417
|
};
|
|
85160
85418
|
const hubContact = createHubContact({
|
|
85161
85419
|
root: repoRoot,
|
|
85162
|
-
home:
|
|
85420
|
+
home: homedir20(),
|
|
85163
85421
|
resolved: runConfig,
|
|
85164
85422
|
warn: (message) => activeOutput().warn(message),
|
|
85165
85423
|
sessionId: session.id
|
|
@@ -85271,7 +85529,7 @@ async function start(args, repoRoot) {
|
|
|
85271
85529
|
inject: injectMode,
|
|
85272
85530
|
repoRoot,
|
|
85273
85531
|
checkout,
|
|
85274
|
-
home:
|
|
85532
|
+
home: homedir20(),
|
|
85275
85533
|
settingSources,
|
|
85276
85534
|
knownMissing,
|
|
85277
85535
|
inherited: runStartFailures(trackerPath),
|
|
@@ -85280,6 +85538,7 @@ async function start(args, repoRoot) {
|
|
|
85280
85538
|
serving,
|
|
85281
85539
|
handout,
|
|
85282
85540
|
base: base2,
|
|
85541
|
+
trackerPath,
|
|
85283
85542
|
guard: { expected: expected2, trackerPath },
|
|
85284
85543
|
docTask: { planStub: planStub2, prBase: runConfig.config.prBase }
|
|
85285
85544
|
});
|
|
@@ -85378,12 +85637,12 @@ async function start(args, repoRoot) {
|
|
|
85378
85637
|
}
|
|
85379
85638
|
|
|
85380
85639
|
// src/commands/loop/start.ts
|
|
85381
|
-
var
|
|
85640
|
+
var DECLARATION = {
|
|
85382
85641
|
name: "loop start",
|
|
85383
85642
|
subject: "loop",
|
|
85384
85643
|
action: "start",
|
|
85385
85644
|
summary: "run a plan task by task, then wrap up, open the PR and wait for CI",
|
|
85386
|
-
description: "Walks the tracker of a plan one task at a time, each in a Claude Code session whose work" + " is committed once it exits, and retries blocked tasks first. After the last task a wrap-up" + " session promotes findings, syncs with main, pushes and opens or updates the PR, and the loop" + " then waits on its checks, spending repair sessions on a red or conflicting PR. With no" + " `--plan` it runs `PLAN.md` in `plan.dir`, `.rafa/plans` unless the config names another, or" + " `PLAN.md` at the project root when that one does not exist. Before any session it checks the" + " prerequisites the config and the plan's `PREREQUISITES-<stub>.md` name, halting when a required" + " one fails and naming each failed optional one known-missing in every task prompt, and warns once" + " for each migration the effort store holds that this rafa does not know and that is additive. It" + " refuses to start while `RAFA_EFFORT_DIR` is set, since a loop records to the project's own" + " store. Started on" + " `main` or `master`, or on a detached `HEAD`, it offers to create the plan's `feat/<stub>` from" + " the latest `origin/<base>` and run there, `--create-branch` answering that without asking, and" + " refuses the run when the offer is not taken. On a detached `HEAD` the base is `pr.base`, else" + " the branch `origin/HEAD` names. `--as-worktree` runs the plan in a worktree of its own on" + " that branch instead, leaving the main checkout as it is, and is refused beside" + " `--create-branch`. Each run writes its session record to `.rafa/runs/<session-id>.json`:" + " the plan, the branch, the pid, the start, the state and the running task, and under `--roadmap`" + " the hop away, when one is. It refuses a plan whose" + " record names another branch, and a plan a session is still running. `rafa loop stop`, `pause`," + " `resume`, `status` and `list` reach the run through that record. With `--retry` or" + " `loop.retries` it goes back into its loop instead of stopping, at most that many times in a row," + " after a red suite step, a task session that exited nonzero, or one that left neither a report nor" + " a commit; a later task done, neither the stopped one nor a repair, starts the count over. With `--continue` a stop that would end the run is handed to a decision instead: retry the" + " task with a new approach, stop with exit code 20, jump over it or defer it until a later task is" + " done; a run left with only passed-over tasks ends with exit code 22 and no wrap-up unless" + " `--force-wrap-up`, and under `--output=json` a decision the line does not name ends the run with" + " exit code 21 and the decision prompt. A run holds its terminal: until" + " phase 6 it refuses `--detached`. With `--runtime` the whole run goes on in that installed rafa," + " never in a `src/` directory.",
|
|
85645
|
+
description: "Walks the tracker of a plan one task at a time, each in a Claude Code session whose work" + " is committed once it exits, and retries blocked tasks first. After the last task a wrap-up" + " session promotes findings, syncs with main, pushes and opens or updates the PR, and the loop" + " then waits on its checks, spending repair sessions on a red or conflicting PR. With no" + " `--plan` it runs `PLAN.md` in `plan.dir`, `.rafa/plans` unless the config names another, or" + " `PLAN.md` at the project root when that one does not exist. Before any session it checks the" + " prerequisites the config and the plan's `PREREQUISITES-<stub>.md` name, halting when a required" + " one fails and naming each failed optional one known-missing in every task prompt, and warns once" + " for each migration the effort store holds that this rafa does not know and that is additive. It" + " refuses to start while `RAFA_EFFORT_DIR` is set, since a loop records to the project's own" + " store. Started on" + " `main` or `master`, or on a detached `HEAD`, it offers to create the plan's `feat/<stub>` from" + " the latest `origin/<base>` and run there, `--create-branch` answering that without asking, and" + " refuses the run when the offer is not taken. On a detached `HEAD` the base is `pr.base`, else" + " the branch `origin/HEAD` names. `--as-worktree` runs the plan in a worktree of its own on" + " that branch instead, leaving the main checkout as it is, and is refused beside" + " `--create-branch`. Each run writes its session record to `.rafa/runs/<session-id>.json`:" + " the plan, the branch, the pid, the start, the state and the running task, and under `--roadmap`" + " the hop away, when one is. It refuses a plan whose" + " record names another branch, and a plan a session is still running. `rafa loop stop`, `pause`," + " `resume`, `status` and `list` reach the run through that record. With `--retry` or" + " `loop.retries` it goes back into its loop instead of stopping, at most that many times in a row," + " after a red suite step, a task session that exited nonzero, or one that left neither a report nor" + " a commit; a later task done, neither the stopped one nor a repair, starts the count over. With `--continue` a stop that would end the run is handed to a decision instead: retry the" + " task with a new approach, stop with exit code 20, jump over it or defer it until a later task is" + " done; a run left with only passed-over tasks ends with exit code 22 and no wrap-up unless" + " `--force-wrap-up`, and under `--output=json` a decision the line does not name ends the run with" + " exit code 21 and the decision prompt. A run holds its terminal: until" + " phase 6 it refuses `--detached`. With `--runtime` the whole run goes on in that installed rafa," + " never in a `src/` directory. It refuses to start, before the run is deferred or recorded, when the" + " project holds a `tsconfig.json` and its `node_modules/.bin/tsc --version` exits 126 or 127," + " as `rafa doctor` would, naming the interpreter to put on the PATH.",
|
|
85387
85646
|
args: [],
|
|
85388
85647
|
flags: [
|
|
85389
85648
|
{
|
|
@@ -85507,15 +85766,25 @@ var wrapped = wrapPhaseZeroCommand({
|
|
|
85507
85766
|
when: "always",
|
|
85508
85767
|
what: "one session per task, one for the wrap-up and up to `loop.wrapUp.retries` more when it opens no pull request," + " repair sessions while CI is red, the sessions of up to `--retry` (`loop.retries`) more passes of the loop" + " in a row after the stops it retries, and under `--continue` one read-only decision session per decision"
|
|
85509
85768
|
}
|
|
85510
|
-
}
|
|
85511
|
-
|
|
85512
|
-
|
|
85513
|
-
|
|
85514
|
-
|
|
85515
|
-
|
|
85516
|
-
|
|
85517
|
-
|
|
85518
|
-
|
|
85769
|
+
};
|
|
85770
|
+
async function refuseTscCannotStart(root, env, seams = {}) {
|
|
85771
|
+
const refusal30 = tscRefusal(await readDoctorTsc(root, env, seams));
|
|
85772
|
+
if (refusal30 !== null)
|
|
85773
|
+
throw new CommandExit(1, refusal30);
|
|
85774
|
+
}
|
|
85775
|
+
function loopStartCommand(run2, seams = {}) {
|
|
85776
|
+
const wrapped = wrapPhaseZeroCommand(DECLARATION, run2);
|
|
85777
|
+
return Object.freeze({
|
|
85778
|
+
...wrapped,
|
|
85779
|
+
run: async (context) => {
|
|
85780
|
+
refuseMisplacedRuntime(context.flags, context.argv);
|
|
85781
|
+
if (context.project !== null)
|
|
85782
|
+
await refuseTscCannotStart(context.project.root, context.env, seams);
|
|
85783
|
+
return wrapped.run(context);
|
|
85784
|
+
}
|
|
85785
|
+
});
|
|
85786
|
+
}
|
|
85787
|
+
var command78 = endingWith(loopStartCommand(start));
|
|
85519
85788
|
var start_default2 = command78;
|
|
85520
85789
|
|
|
85521
85790
|
// src/commands/loop/status.ts
|
|
@@ -86694,7 +86963,7 @@ init_command2();
|
|
|
86694
86963
|
init_rafa_board();
|
|
86695
86964
|
init_rafa_inventory();
|
|
86696
86965
|
import fs6 from "fs";
|
|
86697
|
-
import { homedir as
|
|
86966
|
+
import { homedir as homedir21 } from "os";
|
|
86698
86967
|
import path9 from "path";
|
|
86699
86968
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
86700
86969
|
init_adapters();
|
|
@@ -86712,7 +86981,7 @@ init_sections();
|
|
|
86712
86981
|
init_output();
|
|
86713
86982
|
init_plan();
|
|
86714
86983
|
import { readdirSync as readdirSync29, readFileSync as readFileSync106, realpathSync as realpathSync21, statSync as statSync36, writeFileSync as writeFileSync42 } from "fs";
|
|
86715
|
-
import { basename as basename32, isAbsolute as
|
|
86984
|
+
import { basename as basename32, isAbsolute as isAbsolute31, join as join132, relative as relative34, resolve as resolve49, sep as sep13 } from "path";
|
|
86716
86985
|
init_tiers();
|
|
86717
86986
|
var SOURCE_DIR2 = "src";
|
|
86718
86987
|
var CODE_SPAN7 = /`([^`]+)`/gu;
|
|
@@ -86749,7 +87018,7 @@ function skillHolding(bundle, realPath2) {
|
|
|
86749
87018
|
if (bundle.skillsRoot === null)
|
|
86750
87019
|
return null;
|
|
86751
87020
|
const inside = relative34(bundle.skillsRoot, realPath2);
|
|
86752
|
-
if (inside === "" || inside.startsWith("..") ||
|
|
87021
|
+
if (inside === "" || inside.startsWith("..") || isAbsolute31(inside))
|
|
86753
87022
|
return null;
|
|
86754
87023
|
const name2 = inside.split(sep13)[0] ?? "";
|
|
86755
87024
|
return bundle.skills.includes(name2) ? name2 : null;
|
|
@@ -87297,7 +87566,7 @@ async function resolvePlanConfig(repoRoot, home) {
|
|
|
87297
87566
|
}
|
|
87298
87567
|
}
|
|
87299
87568
|
async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
87300
|
-
const home =
|
|
87569
|
+
const home = homedir21();
|
|
87301
87570
|
const config = await resolvePlanConfig(repoRoot, home);
|
|
87302
87571
|
const {
|
|
87303
87572
|
settingSources,
|
|
@@ -87496,11 +87765,11 @@ var declaration = {
|
|
|
87496
87765
|
spends: { when: "always", what: "one planning session" },
|
|
87497
87766
|
dangerous: CREATE_DANGEROUS_PHRASES
|
|
87498
87767
|
};
|
|
87499
|
-
var
|
|
87768
|
+
var wrapped = {
|
|
87500
87769
|
...declaration,
|
|
87501
87770
|
run: async (context) => wrapPhaseZeroCommand(declaration, (args, root) => plan(args, root, registryRoster(context.registry))).run(context)
|
|
87502
87771
|
};
|
|
87503
|
-
var command85 = endingWith(Object.freeze(
|
|
87772
|
+
var command85 = endingWith(Object.freeze(wrapped));
|
|
87504
87773
|
var create_default2 = command85;
|
|
87505
87774
|
|
|
87506
87775
|
// src/commands/plan/list.ts
|
|
@@ -90416,7 +90685,7 @@ function createStatusHook(seams = {}) {
|
|
|
90416
90685
|
registerCoreConfigSections();
|
|
90417
90686
|
registerCoreAdapters();
|
|
90418
90687
|
registerCoreServices();
|
|
90419
|
-
var modules = await loadInvocationModules({ cwd: process.cwd(), home:
|
|
90688
|
+
var modules = await loadInvocationModules({ cwd: process.cwd(), home: homedir22() });
|
|
90420
90689
|
activateModuleAdapters(modules);
|
|
90421
90690
|
var registry = createRosterRegistry({ off: modules.disabledFeatures });
|
|
90422
90691
|
var { exitCode } = await dispatch(process.argv.slice(2), {
|