@open-tomato/rafa 0.51.0 → 0.52.1
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 +650 -340
- package/dist/effort/store/index.js +2 -2
- package/dist/{index-j518r1yt.js → index-1tdzcheq.js} +1 -1
- package/dist/{index-h9vwrj54.js → index-4dwaxd5r.js} +1 -1
- package/dist/{index-chm1d3xn.js → index-4wy2nmyt.js} +3 -3
- package/dist/{index-w5qbpdtp.js → index-amevawhe.js} +1 -1
- package/dist/{index-ajv88fkm.js → index-n2r3wf2z.js} +31 -2
- package/dist/index.js +55 -26
- package/dist/plan/index.js +2 -2
- package/dist/plan-prompt.md +1 -0
- package/dist/{ready-dph3z1nz.js → ready-kac4ty0p.js} +3 -3
- package/dist/report/parse.d.ts +3 -1
- package/package.json +9 -17
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.1";
|
|
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))
|
|
@@ -43780,7 +43809,8 @@ function forecastLine(read) {
|
|
|
43780
43809
|
return `Release forecast: none computed, because ${read.problem}`;
|
|
43781
43810
|
const strategy = strategyOf3(read.forecast);
|
|
43782
43811
|
const by = strategy === null ? "" : `${strategy}, `;
|
|
43783
|
-
|
|
43812
|
+
const merged = read.mergedVersion === undefined ? "" : `, ${read.mergedVersion} once this branch's version file merges`;
|
|
43813
|
+
return `Release forecast: this branch ${read.forecast.sentence}` + ` (${by}${read.ref} at ${read.baseVersion}${merged}, ${waitingClause(read.waiting.length)})`;
|
|
43784
43814
|
}
|
|
43785
43815
|
function blockOpen(forecast) {
|
|
43786
43816
|
if (forecast === null || !forecast.ok)
|
|
@@ -44018,6 +44048,12 @@ var init_changes = __esm(() => {
|
|
|
44018
44048
|
`;
|
|
44019
44049
|
});
|
|
44020
44050
|
|
|
44051
|
+
// packages/rafa-release/src/release/guard-merged-version.ts
|
|
44052
|
+
function mergedRootVersion(versions) {
|
|
44053
|
+
const { mergeBase, branch, base: base2 } = versions;
|
|
44054
|
+
return branch !== null && branch !== mergeBase && base2 === mergeBase ? branch : null;
|
|
44055
|
+
}
|
|
44056
|
+
|
|
44021
44057
|
// packages/rafa-release/src/release/guard.ts
|
|
44022
44058
|
function sectionFor(text2, version2) {
|
|
44023
44059
|
if (text2 === null)
|
|
@@ -44178,7 +44214,10 @@ function slotOf2(branch) {
|
|
|
44178
44214
|
function slotBaseVersion2(git, input, base2, pkg) {
|
|
44179
44215
|
const unfolded = "so no forecast was folded";
|
|
44180
44216
|
if (pkg === null) {
|
|
44181
|
-
|
|
44217
|
+
if (base2.rootVersion === null) {
|
|
44218
|
+
return { problem: `${base2.ref} declares no version in ${input.settings.releaseVersionFile}, ${unfolded}` };
|
|
44219
|
+
}
|
|
44220
|
+
return base2.mergedRootVersion === null ? { version: base2.rootVersion } : { version: base2.rootVersion, merged: base2.mergedRootVersion };
|
|
44182
44221
|
}
|
|
44183
44222
|
return packageBaseVersionAt({ git, base: base2, package: pkg });
|
|
44184
44223
|
}
|
|
@@ -44205,9 +44244,16 @@ function dryFold(git, input, base2, branch) {
|
|
|
44205
44244
|
}
|
|
44206
44245
|
}
|
|
44207
44246
|
const strategy = releaseStrategyFor(input.settings.releaseStrategy, { heading: input.settings.releaseHeading });
|
|
44208
|
-
const
|
|
44247
|
+
const merged = "merged" in baseVersion ? baseVersion.merged : undefined;
|
|
44248
|
+
const forecast = forecastRelease({
|
|
44249
|
+
strategy,
|
|
44250
|
+
baseVersion: merged ?? baseVersion.version,
|
|
44251
|
+
waiting: [...waiting, ...before],
|
|
44252
|
+
branch: slot
|
|
44253
|
+
});
|
|
44254
|
+
const read = { ok: true, ref: base2.ref, baseVersion: baseVersion.version, waiting: waiting.map((each) => each.id), forecast, problems };
|
|
44209
44255
|
return {
|
|
44210
|
-
forecast:
|
|
44256
|
+
forecast: merged === undefined ? read : { ...read, mergedVersion: merged },
|
|
44211
44257
|
problems
|
|
44212
44258
|
};
|
|
44213
44259
|
}
|
|
@@ -44267,7 +44313,8 @@ function readGuard(input) {
|
|
|
44267
44313
|
};
|
|
44268
44314
|
const verdict = nameVerdict(git, baseCommit, settings, judgeGuard(facts));
|
|
44269
44315
|
const base2 = { ref: input.base, commit: baseCommit };
|
|
44270
|
-
const
|
|
44316
|
+
const mergedRoot = mergedRootVersion({ mergeBase: facts.mergeBase.version, branch: facts.branch.version, base: baseSide.version });
|
|
44317
|
+
const dry = dryFold(git, input, { ...base2, rootVersion: baseSide.version, mergedRootVersion: mergedRoot }, own.folded);
|
|
44271
44318
|
const level = localLevelReport(own.folded, input.readNotes);
|
|
44272
44319
|
return {
|
|
44273
44320
|
ok: true,
|
|
@@ -45355,6 +45402,11 @@ function formatRows(rows2) {
|
|
|
45355
45402
|
return lines2.join(`
|
|
45356
45403
|
`);
|
|
45357
45404
|
}
|
|
45405
|
+
function headTimeOf(detail) {
|
|
45406
|
+
const committedAt = detail?.headCommittedAt ?? null;
|
|
45407
|
+
const ms = committedAt === null ? Number.NaN : Date.parse(committedAt);
|
|
45408
|
+
return Number.isNaN(ms) ? null : ms;
|
|
45409
|
+
}
|
|
45358
45410
|
function defaultSleep(ms) {
|
|
45359
45411
|
return new Promise((resolve4) => {
|
|
45360
45412
|
setTimeout(resolve4, ms);
|
|
@@ -51013,11 +51065,6 @@ function renderWait(reading2) {
|
|
|
51013
51065
|
].join(`
|
|
51014
51066
|
`);
|
|
51015
51067
|
}
|
|
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
51068
|
async function runWait(context, seams) {
|
|
51022
51069
|
const minutes = readTimeoutMinutes(context.flags, USAGE20);
|
|
51023
51070
|
const asked = readPullArgument(context.args, USAGE20);
|
|
@@ -55603,6 +55650,22 @@ var init_release_commit = __esm(() => {
|
|
|
55603
55650
|
init_version2();
|
|
55604
55651
|
});
|
|
55605
55652
|
|
|
55653
|
+
// packages/rafa-release/src/commands/release/tag-behind.ts
|
|
55654
|
+
function readBehind(git) {
|
|
55655
|
+
const named7 = git(["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"]);
|
|
55656
|
+
const upstream = named7.stdout.trim();
|
|
55657
|
+
if (!named7.ok || upstream === "")
|
|
55658
|
+
return null;
|
|
55659
|
+
const counted8 = git(["rev-list", "--count", "HEAD..@{upstream}"]);
|
|
55660
|
+
if (!counted8.ok)
|
|
55661
|
+
return null;
|
|
55662
|
+
const commits = Number.parseInt(counted8.stdout.trim(), 10);
|
|
55663
|
+
return Number.isNaN(commits) ? null : { upstream, commits };
|
|
55664
|
+
}
|
|
55665
|
+
function commitsOf(count2) {
|
|
55666
|
+
return count2 === 1 ? "1 commit" : `${String(count2)} commits`;
|
|
55667
|
+
}
|
|
55668
|
+
|
|
55606
55669
|
// packages/rafa-release/src/commands/release/tag-follow-ups.ts
|
|
55607
55670
|
function trimmedOrNull4(value) {
|
|
55608
55671
|
if (typeof value !== "string")
|
|
@@ -55769,7 +55832,13 @@ function branchRefusal(inputs) {
|
|
|
55769
55832
|
if (branch === null) {
|
|
55770
55833
|
return refuse14("branch", `${problem ?? "no branch is checked out"}, and a release is tagged` + ` on ${inputs.releaseBranch}`);
|
|
55771
55834
|
}
|
|
55772
|
-
|
|
55835
|
+
if (branch !== inputs.releaseBranch) {
|
|
55836
|
+
return refuse14("branch", `a release is tagged on ${inputs.releaseBranch}, and ${branch} is checked out`);
|
|
55837
|
+
}
|
|
55838
|
+
const behind = inputs.branch.behind ?? null;
|
|
55839
|
+
if (behind === null || behind.commits === 0)
|
|
55840
|
+
return null;
|
|
55841
|
+
return refuse14("behind", `${branch} is ${commitsOf(behind.commits)} behind ${behind.upstream}, which may hold` + ` a release rafa release settle pushed there; run git merge --ff-only ${behind.upstream}, then tag again`);
|
|
55773
55842
|
}
|
|
55774
55843
|
function changelogRefusal(inputs, version2) {
|
|
55775
55844
|
const { path: path3, version: newest, problem } = inputs.changelog;
|
|
@@ -55836,7 +55905,8 @@ async function tagConfig(project, warn4) {
|
|
|
55836
55905
|
}
|
|
55837
55906
|
}
|
|
55838
55907
|
function readTagInputs(root, git, config) {
|
|
55839
|
-
const
|
|
55908
|
+
const read2 = readBranch2(git);
|
|
55909
|
+
const branch = read2.branch === config.releaseBranch ? { ...read2, behind: readBehind(git) } : read2;
|
|
55840
55910
|
const version2 = readVersion(root, config.versionFile);
|
|
55841
55911
|
const walkable = version2.version !== null && branch.branch === config.releaseBranch;
|
|
55842
55912
|
return {
|
|
@@ -57966,7 +58036,7 @@ var init_take = __esm(() => {
|
|
|
57966
58036
|
// src/rafa.ts
|
|
57967
58037
|
init_activate();
|
|
57968
58038
|
init_load2();
|
|
57969
|
-
import { homedir as
|
|
58039
|
+
import { homedir as homedir22 } from "os";
|
|
57970
58040
|
|
|
57971
58041
|
// src/adapter-registry.ts
|
|
57972
58042
|
init_rafa_board();
|
|
@@ -66425,6 +66495,20 @@ function typeCheckLines(recipe) {
|
|
|
66425
66495
|
];
|
|
66426
66496
|
}
|
|
66427
66497
|
|
|
66498
|
+
// packages/rafa-run/src/start/tracker-line.ts
|
|
66499
|
+
import { isAbsolute as isAbsolute24 } from "path";
|
|
66500
|
+
var TRACKER_PROMPT_PREFIX = "The tracker holding this task's line is ";
|
|
66501
|
+
function trackerLines(trackerPath) {
|
|
66502
|
+
if (trackerPath === null)
|
|
66503
|
+
return [];
|
|
66504
|
+
if (!isAbsolute24(trackerPath)) {
|
|
66505
|
+
throw new Error(`The tracker path \`${trackerPath}\` is not absolute; the session may run in a worktree it does not resolve against.`);
|
|
66506
|
+
}
|
|
66507
|
+
return [
|
|
66508
|
+
`${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).`
|
|
66509
|
+
];
|
|
66510
|
+
}
|
|
66511
|
+
|
|
66428
66512
|
// packages/rafa-run/src/start/dispatch.ts
|
|
66429
66513
|
function runTaskSession(prompt, flags, sessionId, settingSources, served2 = [], cwd, spawn) {
|
|
66430
66514
|
const options = cwd === undefined ? {} : { cwd };
|
|
@@ -66439,10 +66523,11 @@ var NO_TASK_SECTIONS = { skills: "", lessons: "" };
|
|
|
66439
66523
|
function sectionLines(sections2) {
|
|
66440
66524
|
return [sections2.skills, sections2.lessons, sections2.inherited].filter((section4) => section4.trim().length > 0).flatMap((section4) => [section4, ""]);
|
|
66441
66525
|
}
|
|
66442
|
-
function buildTaskPrompt(taskText, promptContent, planText, knownMissing = [], blocker = null, sections2 = NO_TASK_SECTIONS, base2 = null, inherited = [], alwaysRun = [], typeCheck = null) {
|
|
66526
|
+
function buildTaskPrompt(taskText, promptContent, planText, knownMissing = [], blocker = null, sections2 = NO_TASK_SECTIONS, base2 = null, inherited = [], alwaysRun = [], typeCheck = null, trackerPath = null) {
|
|
66443
66527
|
return [
|
|
66444
66528
|
`Your scoped task is: ${taskText}`,
|
|
66445
66529
|
"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.",
|
|
66530
|
+
...trackerLines(trackerPath),
|
|
66446
66531
|
...blockerLines(blocker),
|
|
66447
66532
|
...baseLines(base2),
|
|
66448
66533
|
...alwaysRunLines(alwaysRun),
|
|
@@ -66491,7 +66576,7 @@ async function dispatchTask(options) {
|
|
|
66491
66576
|
const resolution = options.serving === null ? EMPTY_RESOLUTION : resolveSessionTiers(options.serving);
|
|
66492
66577
|
const task = taskInputFor(taskInfo, taskText, declaration, options.planContent);
|
|
66493
66578
|
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));
|
|
66579
|
+
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
66580
|
const served2 = serveForSession(options.serving, resolution);
|
|
66496
66581
|
const record2 = {
|
|
66497
66582
|
taskText,
|
|
@@ -66989,16 +67074,18 @@ async function verifyAttempt(io, branch, timeoutMs, isLastAttempt) {
|
|
|
66989
67074
|
const merge3 = await io.pulls.get(prNumber);
|
|
66990
67075
|
return result2.verdict === "none" ? handleNoChecks(io, branch, prNumber, merge3) : handleRedChecks(io, branch, prNumber, result2.rows);
|
|
66991
67076
|
}
|
|
66992
|
-
function pollChecks(io, prNumber, timeoutMs) {
|
|
67077
|
+
async function pollChecks(io, prNumber, timeoutMs) {
|
|
66993
67078
|
io.phases.ciStarted();
|
|
66994
67079
|
activeOutput().info(`
|
|
66995
67080
|
\u23F3 Waiting for CI on PR #${prNumber} (up to ${Math.round(timeoutMs / 60000)} min)...`);
|
|
67081
|
+
const headCommittedAtMs = headTimeOf(await io.pulls.get(prNumber));
|
|
66996
67082
|
return waitForChecks({
|
|
66997
67083
|
probe: async () => (await io.pulls.checks(prNumber)).rows,
|
|
66998
67084
|
timeoutMs,
|
|
66999
67085
|
intervalMs: CI_POLL_INTERVAL_MS,
|
|
67000
67086
|
now: io.now,
|
|
67001
67087
|
sleep: io.sleep,
|
|
67088
|
+
...headCommittedAtMs === null ? {} : { headCommittedAtMs },
|
|
67002
67089
|
onPoll: (rows2, verdict, elapsedMs) => {
|
|
67003
67090
|
const secs = Math.round(elapsedMs / 1000);
|
|
67004
67091
|
activeOutput().info(` [${secs}s] ${verdict} \u2014 ${rows2.length} check(s)`);
|
|
@@ -68358,7 +68445,7 @@ async function readPlanOwns(options) {
|
|
|
68358
68445
|
// packages/rafa-run/src/suite/scope.ts
|
|
68359
68446
|
init_rafa_board();
|
|
68360
68447
|
import { existsSync as existsSync75, readdirSync as readdirSync25, readFileSync as readFileSync83 } from "fs";
|
|
68361
|
-
import { isAbsolute as
|
|
68448
|
+
import { isAbsolute as isAbsolute25, join as join101, relative as relative23, sep as sep9 } from "path";
|
|
68362
68449
|
var BUNFIG_FILE = "bunfig.toml";
|
|
68363
68450
|
var TEST_FILE_NAME = /[._](?:test|spec)\.(?:tsx?|jsx?|[cm][jt]s)$/;
|
|
68364
68451
|
var DEPENDENCY_FOLDER = "node_modules";
|
|
@@ -68366,9 +68453,9 @@ function sortedUnique(paths) {
|
|
|
68366
68453
|
return [...new Set(paths)].sort((a, b) => a.localeCompare(b));
|
|
68367
68454
|
}
|
|
68368
68455
|
function preloadPath(root, entry) {
|
|
68369
|
-
const path4 =
|
|
68456
|
+
const path4 = isAbsolute25(entry) ? relative23(root, entry).split(sep9).join("/") : entry;
|
|
68370
68457
|
const repoRelative2 = normaliseFolder(path4);
|
|
68371
|
-
if (repoRelative2 === "" ||
|
|
68458
|
+
if (repoRelative2 === "" || isAbsolute25(repoRelative2))
|
|
68372
68459
|
return null;
|
|
68373
68460
|
return repoRelative2.split("/").includes("..") ? null : repoRelative2;
|
|
68374
68461
|
}
|
|
@@ -70763,9 +70850,13 @@ function fragmentNotesIn(checkout, fragment) {
|
|
|
70763
70850
|
const reading2 = parseFragment(text2);
|
|
70764
70851
|
return reading2.ok ? reading2.fragment.notes : [];
|
|
70765
70852
|
}
|
|
70766
|
-
function
|
|
70853
|
+
function closedIssues(issue5, closes2) {
|
|
70854
|
+
return [...new Set([issue5, ...closes2])];
|
|
70855
|
+
}
|
|
70856
|
+
function runnerPullRequestBody(issue5, closes2, notes) {
|
|
70767
70857
|
const section4 = notes.length === 0 ? [] : [RELEASE_NOTES_HEADING, "", ...notes, ""];
|
|
70768
|
-
|
|
70858
|
+
const closing = closedIssues(issue5, closes2).map((closed) => `Closes #${String(closed)}`);
|
|
70859
|
+
return [...closing, "", ...section4, UNFINISHED_WRAP_UP_LINE].join(`
|
|
70769
70860
|
`);
|
|
70770
70861
|
}
|
|
70771
70862
|
function blocked3(branch, step2, detail) {
|
|
@@ -70784,11 +70875,11 @@ function dirtyDetail(entries) {
|
|
|
70784
70875
|
].join(`
|
|
70785
70876
|
`);
|
|
70786
70877
|
}
|
|
70787
|
-
async function refreshAfterOpen(seams,
|
|
70878
|
+
async function refreshAfterOpen(seams, issues) {
|
|
70788
70879
|
try {
|
|
70789
|
-
return await seams.refreshProject(
|
|
70880
|
+
return await seams.refreshProject(issues);
|
|
70790
70881
|
} catch (error2) {
|
|
70791
|
-
return [refreshFailedWarning(
|
|
70882
|
+
return [refreshFailedWarning(issues[0] ?? 0, error2)];
|
|
70792
70883
|
}
|
|
70793
70884
|
}
|
|
70794
70885
|
async function openRunnerPullRequest(input, seams) {
|
|
@@ -70809,12 +70900,12 @@ async function openRunnerPullRequest(input, seams) {
|
|
|
70809
70900
|
head: branch,
|
|
70810
70901
|
base: input.base,
|
|
70811
70902
|
title: pullRequestTitle(input.issue, input.planTitle),
|
|
70812
|
-
body: runnerPullRequestBody(input.issue, input.notes)
|
|
70903
|
+
body: runnerPullRequestBody(input.issue, input.closes, input.notes)
|
|
70813
70904
|
});
|
|
70814
70905
|
} catch (error2) {
|
|
70815
70906
|
return blocked3(branch, "create", messageOf(error2));
|
|
70816
70907
|
}
|
|
70817
|
-
return { kind: "opened", pull, warnings: await refreshAfterOpen(seams, input.issue) };
|
|
70908
|
+
return { kind: "opened", pull, warnings: await refreshAfterOpen(seams, closedIssues(input.issue, input.closes)) };
|
|
70818
70909
|
}
|
|
70819
70910
|
|
|
70820
70911
|
// packages/rafa-run/src/start/wrap-up.ts
|
|
@@ -70829,7 +70920,7 @@ init_rafa_pr();
|
|
|
70829
70920
|
init_sections();
|
|
70830
70921
|
init_output();
|
|
70831
70922
|
init_rafa_pr();
|
|
70832
|
-
import { isAbsolute as
|
|
70923
|
+
import { isAbsolute as isAbsolute26, posix as posix10, relative as relative26 } from "path";
|
|
70833
70924
|
|
|
70834
70925
|
// packages/rafa-run/src/start/promoted.ts
|
|
70835
70926
|
init_block_reader();
|
|
@@ -70921,9 +71012,9 @@ function changedSince(git, head) {
|
|
|
70921
71012
|
return { ok: true, head, paths: new Set(paths) };
|
|
70922
71013
|
}
|
|
70923
71014
|
function repoPath3(path5, repoRoot) {
|
|
70924
|
-
const inside =
|
|
71015
|
+
const inside = isAbsolute26(path5) ? relative26(repoRoot, path5) : path5;
|
|
70925
71016
|
const normal = posix10.normalize(inside.replaceAll("\\", "/"));
|
|
70926
|
-
if (normal === "." || normal === ".." || normal.startsWith("../") ||
|
|
71017
|
+
if (normal === "." || normal === ".." || normal.startsWith("../") || isAbsolute26(normal))
|
|
70927
71018
|
return null;
|
|
70928
71019
|
return normal.replace(/^(\.\/)+/, "");
|
|
70929
71020
|
}
|
|
@@ -71082,7 +71173,7 @@ function pullRequestNamingBullets(branch, provider) {
|
|
|
71082
71173
|
return [
|
|
71083
71174
|
"* Find the plan's issue number `<n>`: the plan below carries it in its `rafa:plan` block as `issue: <n>`.",
|
|
71084
71175
|
`* 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
|
-
|
|
71176
|
+
"* 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
71177
|
"* Create a concise yet descriptive PR description that summarizes the overall work done based on the completed plan and progress notes."
|
|
71087
71178
|
];
|
|
71088
71179
|
}
|
|
@@ -71438,6 +71529,7 @@ function runnerPrInputFor(source) {
|
|
|
71438
71529
|
branch: source.branch,
|
|
71439
71530
|
base: source.base,
|
|
71440
71531
|
issue: issue5,
|
|
71532
|
+
closes: parsePlan(source.planContent).header.closes,
|
|
71441
71533
|
planTitle: planTitleIn(source.planContent, source.planStub),
|
|
71442
71534
|
notes: source.notes
|
|
71443
71535
|
};
|
|
@@ -73386,18 +73478,22 @@ var codes_default = command47;
|
|
|
73386
73478
|
// src/commands/bug/recheck.ts
|
|
73387
73479
|
init_rafa_board();
|
|
73388
73480
|
init_fill();
|
|
73389
|
-
init_record3();
|
|
73390
73481
|
init_versions();
|
|
73391
73482
|
init_plan_files2();
|
|
73392
73483
|
init_command2();
|
|
73393
73484
|
init_sections();
|
|
73394
73485
|
init_git2();
|
|
73395
|
-
init_run2();
|
|
73396
73486
|
init_filed_text();
|
|
73397
73487
|
init_local_paths();
|
|
73488
|
+
|
|
73489
|
+
// src/commands/bug/recheck-judge.ts
|
|
73490
|
+
init_rafa_board();
|
|
73491
|
+
init_record3();
|
|
73492
|
+
init_sections();
|
|
73493
|
+
init_run2();
|
|
73398
73494
|
import { mkdtempSync as mkdtempSync7, rmSync as rmSync18 } from "fs";
|
|
73399
73495
|
import { tmpdir as tmpdir9 } from "os";
|
|
73400
|
-
import { join as
|
|
73496
|
+
import { join as join107 } from "path";
|
|
73401
73497
|
|
|
73402
73498
|
// src/bugs/test-reference.ts
|
|
73403
73499
|
init_package_of();
|
|
@@ -73590,8 +73686,115 @@ function recheckComment(row2, report4) {
|
|
|
73590
73686
|
return null;
|
|
73591
73687
|
}
|
|
73592
73688
|
|
|
73689
|
+
// src/commands/bug/recheck-judge.ts
|
|
73690
|
+
var LOCAL_KIND = "local";
|
|
73691
|
+
var MS_PER_SECOND8 = 1000;
|
|
73692
|
+
function rowOf10(bug, fields) {
|
|
73693
|
+
return {
|
|
73694
|
+
issue: bug.issue,
|
|
73695
|
+
title: bug.title,
|
|
73696
|
+
reference: null,
|
|
73697
|
+
runs: 0,
|
|
73698
|
+
failedRuns: null,
|
|
73699
|
+
reason: null,
|
|
73700
|
+
reproduce: null,
|
|
73701
|
+
commented: false,
|
|
73702
|
+
...fields
|
|
73703
|
+
};
|
|
73704
|
+
}
|
|
73705
|
+
async function authorOf(tracker, bug) {
|
|
73706
|
+
if (bug.author !== null)
|
|
73707
|
+
return bug.author;
|
|
73708
|
+
if (tracker.editable === undefined)
|
|
73709
|
+
return "";
|
|
73710
|
+
return (await tracker.editable(bug.ref)).author;
|
|
73711
|
+
}
|
|
73712
|
+
function trustGateOf(tracker, trust) {
|
|
73713
|
+
if (tracker.kind === LOCAL_KIND)
|
|
73714
|
+
return () => Promise.resolve(null);
|
|
73715
|
+
const readings = new Map;
|
|
73716
|
+
return async (bug) => {
|
|
73717
|
+
let author;
|
|
73718
|
+
try {
|
|
73719
|
+
author = await authorOf(tracker, bug);
|
|
73720
|
+
} catch (error2) {
|
|
73721
|
+
return `could not read who opened ${issueName(bug.ref)}: ${messageOf(error2)}`;
|
|
73722
|
+
}
|
|
73723
|
+
if (author === "")
|
|
73724
|
+
return `the ${tracker.kind} tracker names nobody who opened it, so no trust was read`;
|
|
73725
|
+
const board = trust();
|
|
73726
|
+
const key = author.toLowerCase();
|
|
73727
|
+
const reading2 = readings.get(key) ?? readBoardTrust(board, author);
|
|
73728
|
+
readings.set(key, reading2);
|
|
73729
|
+
const answered = await reading2;
|
|
73730
|
+
return answered.trusted ? null : `opened by ${author}, ${trustRefusalClause(board.repo, answered)}`;
|
|
73731
|
+
};
|
|
73732
|
+
}
|
|
73733
|
+
async function checkBug(bug, context) {
|
|
73734
|
+
const record2 = parseBugRecord(bug.body);
|
|
73735
|
+
const read2 = readTestReference(record2.rerun);
|
|
73736
|
+
if (read2.kind === "manual")
|
|
73737
|
+
return rowOf10(bug, { verdict: "manual", reason: read2.reason, reproduce: record2.reproduce });
|
|
73738
|
+
const reference2 = { file: read2.file, pattern: read2.pattern };
|
|
73739
|
+
const resolved = resolveTestReference(read2, context.checkout);
|
|
73740
|
+
if (resolved.kind === "outside") {
|
|
73741
|
+
return rowOf10(bug, { verdict: "manual", reference: reference2, reason: `${read2.file} lies outside the checkout`, reproduce: record2.reproduce });
|
|
73742
|
+
}
|
|
73743
|
+
if (resolved.kind === "missing")
|
|
73744
|
+
return rowOf10(bug, { verdict: "stale", reference: reference2, reason: `no file ${read2.file} in the checkout` });
|
|
73745
|
+
const refused7 = await context.trust(bug);
|
|
73746
|
+
if (refused7 !== null)
|
|
73747
|
+
return rowOf10(bug, { verdict: "skipped", reference: reference2, reason: refused7 });
|
|
73748
|
+
const run = await context.recheck({
|
|
73749
|
+
path: resolved.path,
|
|
73750
|
+
pattern: read2.pattern,
|
|
73751
|
+
checkout: context.checkout,
|
|
73752
|
+
env: context.env,
|
|
73753
|
+
runs: context.runs,
|
|
73754
|
+
timeoutMs: context.timeoutMs,
|
|
73755
|
+
junitDir: join107(context.junitRoot, `issue-${bug.issue}`)
|
|
73756
|
+
});
|
|
73757
|
+
if (run.timedOutRuns > 0) {
|
|
73758
|
+
context.warn(`${issueName(bug.ref)}: ${run.timedOutRuns} of ${run.runs} runs timed out after ${context.timeoutMs / MS_PER_SECOND8}s`);
|
|
73759
|
+
}
|
|
73760
|
+
return rowOf10(bug, {
|
|
73761
|
+
verdict: run.verdict,
|
|
73762
|
+
reference: reference2,
|
|
73763
|
+
runs: run.runs,
|
|
73764
|
+
failedRuns: run.failedRuns,
|
|
73765
|
+
reason: run.verdict === "stale" ? `no case of ${referenceText(reference2)} was judged` : null
|
|
73766
|
+
});
|
|
73767
|
+
}
|
|
73768
|
+
function childEnvOf(base2, secrets) {
|
|
73769
|
+
const leftOut2 = [...new Set(secrets.map((secret) => secret.name))].sort();
|
|
73770
|
+
const env = Object.fromEntries(Object.entries(suiteEnv(base2)).filter(([name2]) => !leftOut2.includes(name2)));
|
|
73771
|
+
return { env, leftOut: leftOut2 };
|
|
73772
|
+
}
|
|
73773
|
+
async function judgeBugs(bugs, options) {
|
|
73774
|
+
const { env, leftOut: leftOut2 } = childEnvOf(options.env, options.secrets);
|
|
73775
|
+
const junitRoot = mkdtempSync7(join107(tmpdir9(), "rafa-bug-recheck-"));
|
|
73776
|
+
try {
|
|
73777
|
+
const context = {
|
|
73778
|
+
checkout: options.checkout,
|
|
73779
|
+
env,
|
|
73780
|
+
runs: options.runs,
|
|
73781
|
+
timeoutMs: options.timeoutMs,
|
|
73782
|
+
junitRoot,
|
|
73783
|
+
trust: trustGateOf(options.tracker, options.trust),
|
|
73784
|
+
recheck: options.recheck,
|
|
73785
|
+
warn: options.warn
|
|
73786
|
+
};
|
|
73787
|
+
const rows2 = [];
|
|
73788
|
+
for (const bug of bugs)
|
|
73789
|
+
rows2.push(await checkBug(bug, context));
|
|
73790
|
+
return { rows: rows2, secretsLeftOut: leftOut2 };
|
|
73791
|
+
} finally {
|
|
73792
|
+
rmSync18(junitRoot, { recursive: true, force: true });
|
|
73793
|
+
}
|
|
73794
|
+
}
|
|
73795
|
+
|
|
73593
73796
|
// src/commands/bug/recheck-run.ts
|
|
73594
|
-
import { join as
|
|
73797
|
+
import { join as join108 } from "path";
|
|
73595
73798
|
init_run2();
|
|
73596
73799
|
|
|
73597
73800
|
// src/bugs/recheck-verdict.ts
|
|
@@ -73629,7 +73832,7 @@ function verdictOf5(outcomes) {
|
|
|
73629
73832
|
|
|
73630
73833
|
// src/commands/bug/recheck-run.ts
|
|
73631
73834
|
function recheckJunitFile(junitDir, index) {
|
|
73632
|
-
return
|
|
73835
|
+
return join108(junitDir, `run-${index}.junit.xml`);
|
|
73633
73836
|
}
|
|
73634
73837
|
async function recheckBug(options) {
|
|
73635
73838
|
if (!Number.isInteger(options.runs) || options.runs < 0) {
|
|
@@ -73674,9 +73877,7 @@ var COMMAND_NAME9 = "rafa bug recheck";
|
|
|
73674
73877
|
var RECHECK_USAGE = "rafa bug recheck [<n>\u2026] [--all] [--comment]";
|
|
73675
73878
|
var ALL_FLAG = "all";
|
|
73676
73879
|
var COMMENT_FLAG = "comment";
|
|
73677
|
-
var LOCAL_KIND = "local";
|
|
73678
73880
|
var ISSUE_NUMBER17 = /^[1-9]\d*$/;
|
|
73679
|
-
var MS_PER_SECOND8 = 1000;
|
|
73680
73881
|
function readRecheckLine(args, flags) {
|
|
73681
73882
|
const hint = `Usage: ${RECHECK_USAGE}`;
|
|
73682
73883
|
const all = readSwitch2(ALL_FLAG, flags[ALL_FLAG], hint);
|
|
@@ -73694,19 +73895,6 @@ function readRecheckLine(args, flags) {
|
|
|
73694
73895
|
}
|
|
73695
73896
|
return { numbers: [...new Set(args.map(Number))], comment };
|
|
73696
73897
|
}
|
|
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
73898
|
async function openBugs(tracker) {
|
|
73711
73899
|
const { openIssues } = tracker;
|
|
73712
73900
|
if (openIssues === undefined) {
|
|
@@ -73734,74 +73922,16 @@ async function numberedBug(tracker, issue5) {
|
|
|
73734
73922
|
return { ref: ref16, row: rowOf10({ issue: issue5, title: "" }, { verdict: "skipped", reason: `could not read ${issueName(ref16)}: ${messageOf(error2)}` }) };
|
|
73735
73923
|
}
|
|
73736
73924
|
}
|
|
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}`)
|
|
73788
|
-
});
|
|
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
|
|
73925
|
+
function rowsAt(read2, bugs, judged2) {
|
|
73926
|
+
return read2.map((bug) => {
|
|
73927
|
+
if ("row" in bug)
|
|
73928
|
+
return bug;
|
|
73929
|
+
const row2 = judged2[bugs.indexOf(bug)];
|
|
73930
|
+
if (row2 === undefined)
|
|
73931
|
+
throw new Error(`${COMMAND_NAME9}: no row was judged for ${issueName(bug.ref)}`);
|
|
73932
|
+
return { ref: bug.ref, row: row2 };
|
|
73798
73933
|
});
|
|
73799
73934
|
}
|
|
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
|
-
}
|
|
73805
73935
|
function codeOf(git) {
|
|
73806
73936
|
const version2 = codeVersionOf(git);
|
|
73807
73937
|
if (version2.commit === null)
|
|
@@ -73846,7 +73976,6 @@ async function runRecheck(context, seams) {
|
|
|
73846
73976
|
const checkout = checkoutOf(git, project.root);
|
|
73847
73977
|
const base2 = (seams.env ?? (() => process.env))();
|
|
73848
73978
|
const secrets = namedSecrets(config, base2);
|
|
73849
|
-
const { env, leftOut: leftOut2 } = childEnvOf(base2, secrets);
|
|
73850
73979
|
const gh = seams.gh ?? createGhRunner({ cwd: project.root });
|
|
73851
73980
|
let board;
|
|
73852
73981
|
const trust = () => {
|
|
@@ -73854,26 +73983,20 @@ async function runRecheck(context, seams) {
|
|
|
73854
73983
|
return board;
|
|
73855
73984
|
};
|
|
73856
73985
|
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 };
|
|
73986
|
+
const bugs = read2.filter((bug) => !("row" in bug));
|
|
73987
|
+
const judged2 = await judgeBugs(bugs, {
|
|
73988
|
+
tracker,
|
|
73989
|
+
trust,
|
|
73990
|
+
checkout,
|
|
73991
|
+
env: base2,
|
|
73992
|
+
secrets,
|
|
73993
|
+
runs: config.bugsRecheckRuns,
|
|
73994
|
+
timeoutMs: config.bugsRecheckTimeoutSeconds * MS_PER_SECOND8,
|
|
73995
|
+
recheck: seams.recheck ?? recheckBug,
|
|
73996
|
+
warn: warn5
|
|
73997
|
+
});
|
|
73998
|
+
const rows2 = rowsAt(read2, bugs, judged2.rows);
|
|
73999
|
+
const head = { rafa: RAFA_VERSION, code: codeOf(git), checkout, secretsLeftOut: judged2.secretsLeftOut, tracker: data };
|
|
73877
74000
|
const local = localPathRedactor([checkout, project.root], project.home);
|
|
73878
74001
|
const redact = (text2) => redactSecrets(local(text2), secrets);
|
|
73879
74002
|
const report4 = {
|
|
@@ -75150,9 +75273,9 @@ init_config_schema_release();
|
|
|
75150
75273
|
|
|
75151
75274
|
// packages/rafa/src/config-schema-tests.ts
|
|
75152
75275
|
init_sections();
|
|
75153
|
-
import { isAbsolute as
|
|
75276
|
+
import { isAbsolute as isAbsolute27 } from "path";
|
|
75154
75277
|
var GLOB_PATTERN = "a glob pattern relative to the repository root";
|
|
75155
|
-
var repoGlob = (raw, at) => typeof raw === "string" &&
|
|
75278
|
+
var repoGlob = (raw, at) => typeof raw === "string" && isAbsolute27(raw) ? refused(at, raw, GLOB_PATTERN) : text(GLOB_PATTERN)(raw, at);
|
|
75156
75279
|
var globList = listOf(repoGlob, "glob patterns");
|
|
75157
75280
|
var TESTS_DEFAULTS = Object.freeze({
|
|
75158
75281
|
testsFullSuiteTriggers: Object.freeze([]),
|
|
@@ -77412,7 +77535,7 @@ function isUnmet(need) {
|
|
|
77412
77535
|
|
|
77413
77536
|
// src/commands/plan/needs.ts
|
|
77414
77537
|
init_rafa_inventory();
|
|
77415
|
-
import { isAbsolute as
|
|
77538
|
+
import { isAbsolute as isAbsolute28, relative as relative29, resolve as resolve42 } from "path";
|
|
77416
77539
|
init_plan_files2();
|
|
77417
77540
|
init_command2();
|
|
77418
77541
|
init_config2();
|
|
@@ -77562,6 +77685,69 @@ async function resolveCreateSpec(options, seams = DEFAULT_ROUTE_SEAMS) {
|
|
|
77562
77685
|
});
|
|
77563
77686
|
}
|
|
77564
77687
|
|
|
77688
|
+
// src/commands/plan/stretch-rules.ts
|
|
77689
|
+
init_command2();
|
|
77690
|
+
init_sections();
|
|
77691
|
+
init_loop();
|
|
77692
|
+
import fs3 from "fs";
|
|
77693
|
+
import path6 from "path";
|
|
77694
|
+
var STRETCH_RULES_ENV = "RAFA_STRETCH_RULES";
|
|
77695
|
+
var STRETCH_RULES_REFUSAL_EXIT = 1;
|
|
77696
|
+
function missingRulesMessage(value) {
|
|
77697
|
+
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}`;
|
|
77698
|
+
}
|
|
77699
|
+
function notRulesFileMessage(value, what) {
|
|
77700
|
+
return `${STRETCH_RULES_ENV}=${value} names ${what}, not a file; point it at the stretch's rules.md`;
|
|
77701
|
+
}
|
|
77702
|
+
function unreadableRulesMessage(value, reason) {
|
|
77703
|
+
return `${STRETCH_RULES_ENV}=${value} could not be read: ${reason}`;
|
|
77704
|
+
}
|
|
77705
|
+
function describeEntry(stat2) {
|
|
77706
|
+
return stat2.isDirectory() ? "a directory" : "something other than a file";
|
|
77707
|
+
}
|
|
77708
|
+
function displayPath2(repoRoot, absolute) {
|
|
77709
|
+
const relative29 = path6.relative(repoRoot, absolute);
|
|
77710
|
+
return relative29 === "" || relative29.startsWith("..") || path6.isAbsolute(relative29) ? absolute : relative29;
|
|
77711
|
+
}
|
|
77712
|
+
function readStretchRules(env, repoRoot) {
|
|
77713
|
+
const value = env[STRETCH_RULES_ENV];
|
|
77714
|
+
if (value === undefined || value.trim() === "")
|
|
77715
|
+
return null;
|
|
77716
|
+
const absolute = path6.resolve(repoRoot, value);
|
|
77717
|
+
let stat2;
|
|
77718
|
+
try {
|
|
77719
|
+
stat2 = fs3.statSync(absolute);
|
|
77720
|
+
} catch (error2) {
|
|
77721
|
+
if (errorCode(error2) === "ENOENT") {
|
|
77722
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, missingRulesMessage(value));
|
|
77723
|
+
}
|
|
77724
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, unreadableRulesMessage(value, messageOf(error2)));
|
|
77725
|
+
}
|
|
77726
|
+
if (!stat2.isFile()) {
|
|
77727
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, notRulesFileMessage(value, describeEntry(stat2)));
|
|
77728
|
+
}
|
|
77729
|
+
try {
|
|
77730
|
+
return Object.freeze({ path: displayPath2(repoRoot, absolute), text: fs3.readFileSync(absolute, "utf8") });
|
|
77731
|
+
} catch (error2) {
|
|
77732
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, unreadableRulesMessage(value, messageOf(error2)));
|
|
77733
|
+
}
|
|
77734
|
+
}
|
|
77735
|
+
function stretchRulesReader(env, repoRoot) {
|
|
77736
|
+
let reading2 = null;
|
|
77737
|
+
return () => {
|
|
77738
|
+
if (reading2 === null) {
|
|
77739
|
+
try {
|
|
77740
|
+
reading2 = { ok: true, rules: readStretchRules(env, repoRoot) };
|
|
77741
|
+
} catch (error2) {
|
|
77742
|
+
reading2 = { ok: false, error: error2 };
|
|
77743
|
+
}
|
|
77744
|
+
}
|
|
77745
|
+
if (reading2.ok)
|
|
77746
|
+
return reading2.rules;
|
|
77747
|
+
throw reading2.error;
|
|
77748
|
+
};
|
|
77749
|
+
}
|
|
77750
|
+
|
|
77565
77751
|
// src/commands/plan/needs.ts
|
|
77566
77752
|
var COMMAND6 = "rafa plan needs";
|
|
77567
77753
|
var USAGE32 = "rafa plan needs [<plan> | --spec=<file> | --issue=<n>] [--missing] [--source=<source>]";
|
|
@@ -77590,16 +77776,16 @@ function specRouteWords(flags) {
|
|
|
77590
77776
|
});
|
|
77591
77777
|
return words.length === 0 ? null : words;
|
|
77592
77778
|
}
|
|
77593
|
-
function labelOf5(root,
|
|
77594
|
-
const under = relative29(root,
|
|
77595
|
-
return under === "" || under.startsWith("..") ||
|
|
77779
|
+
function labelOf5(root, path7) {
|
|
77780
|
+
const under = relative29(root, path7);
|
|
77781
|
+
return under === "" || under.startsWith("..") || isAbsolute28(under) ? path7 : under;
|
|
77596
77782
|
}
|
|
77597
77783
|
function needsPlanPath(root, planDir, typed) {
|
|
77598
|
-
const
|
|
77599
|
-
if (isFile2(
|
|
77600
|
-
return
|
|
77784
|
+
const path7 = resolvePlanPath(root, planDir, typed ?? undefined);
|
|
77785
|
+
if (isFile2(path7))
|
|
77786
|
+
return path7;
|
|
77601
77787
|
if (typed !== null)
|
|
77602
|
-
throw new CommandExit(1, `\u274C Plan file not found: ${
|
|
77788
|
+
throw new CommandExit(1, `\u274C Plan file not found: ${path7}`);
|
|
77603
77789
|
const lookedFor = [...new Set([resolve42(root, planDir, DEFAULT_PLAN_FILE), resolve42(root, DEFAULT_PLAN_FILE)])];
|
|
77604
77790
|
throw new CommandExit(1, `\u274C No plan named, and no default plan at ${lookedFor.join(" or ")}
|
|
77605
77791
|
Usage: ${USAGE32}`);
|
|
@@ -77726,13 +77912,14 @@ async function readMachine(project, context, seams) {
|
|
|
77726
77912
|
`));
|
|
77727
77913
|
}
|
|
77728
77914
|
}
|
|
77729
|
-
async function routedSpec(words, project, config, seams) {
|
|
77915
|
+
async function routedSpec(words, project, context, config, seams) {
|
|
77730
77916
|
const resolution = await resolveCreateSpec({
|
|
77731
77917
|
args: words,
|
|
77732
77918
|
repoRoot: project.root,
|
|
77733
77919
|
specsDir: config.specsDir,
|
|
77734
77920
|
roadmapIssue: config.roadmapIssue,
|
|
77735
|
-
trustedAuthors: config.boardTrustedAuthors
|
|
77921
|
+
trustedAuthors: config.boardTrustedAuthors,
|
|
77922
|
+
readRules: stretchRulesReader(context.env, project.root)
|
|
77736
77923
|
}, {
|
|
77737
77924
|
makeReadyOffer: () => null,
|
|
77738
77925
|
makeAlternativeOffer: () => null,
|
|
@@ -77756,9 +77943,9 @@ Usage: ${USAGE32}`);
|
|
|
77756
77943
|
const project = requireProject(context, COMMAND6);
|
|
77757
77944
|
const { config, needs } = await readMachine(project, context, seams);
|
|
77758
77945
|
const kind = words === null ? "plan" : "spec";
|
|
77759
|
-
const
|
|
77760
|
-
const target = { kind, path:
|
|
77761
|
-
const reading2 = kind === "plan" ? await readPlanNeeds(
|
|
77946
|
+
const path7 = words === null ? needsPlanPath(project.root, config.planDir, typed) : await routedSpec(words, project, context, config, seams);
|
|
77947
|
+
const target = { kind, path: path7, label: labelOf5(project.root, path7) };
|
|
77948
|
+
const reading2 = kind === "plan" ? await readPlanNeeds(path7, needs) : await readSpecNeeds(path7, needs);
|
|
77762
77949
|
const result2 = needsResult(reading2, target, config.settingSources, { missing: missing2, source });
|
|
77763
77950
|
for (const warning of result2.warnings)
|
|
77764
77951
|
context.output.warn(warning);
|
|
@@ -78078,7 +78265,7 @@ function isSessionSource(record2) {
|
|
|
78078
78265
|
return !(record2.source === "rafa" || record2.source.startsWith("addon:"));
|
|
78079
78266
|
}
|
|
78080
78267
|
function recordReason(record2, overrides, settingSources, resolution) {
|
|
78081
|
-
const { state, kind, name: name2, path:
|
|
78268
|
+
const { state, kind, name: name2, path: path7 } = record2;
|
|
78082
78269
|
if (state === "collision") {
|
|
78083
78270
|
const collision = resolution.collisions.find((held2) => held2.kind === kind && held2.name === name2);
|
|
78084
78271
|
return {
|
|
@@ -78108,7 +78295,7 @@ function recordReason(record2, overrides, settingSources, resolution) {
|
|
|
78108
78295
|
}
|
|
78109
78296
|
if (state.startsWith("disabled:")) {
|
|
78110
78297
|
const key = state.slice("disabled:".length);
|
|
78111
|
-
return { why: `its frontmatter sets ${key}`, fix: `remove ${key} from ${
|
|
78298
|
+
return { why: `its frontmatter sets ${key}`, fix: `remove ${key} from ${path7}` };
|
|
78112
78299
|
}
|
|
78113
78300
|
return { why: sourceOffWhy("user", settingSources), fix: addSourceFix("user") };
|
|
78114
78301
|
}
|
|
@@ -78177,7 +78364,7 @@ function readDeepSettings(seams) {
|
|
|
78177
78364
|
...hiddenRecords(inventory, overrides, seams.settingSources),
|
|
78178
78365
|
...hiddenServers(mcp, seams)
|
|
78179
78366
|
]);
|
|
78180
|
-
const warnings = [...inventory.warnings, ...inventory.overrideWarnings, ...mcp.warnings].map(({ path:
|
|
78367
|
+
const warnings = [...inventory.warnings, ...inventory.overrideWarnings, ...mcp.warnings].map(({ path: path7, reason }) => ({ path: path7, reason }));
|
|
78181
78368
|
return Object.freeze({
|
|
78182
78369
|
settingSources: Object.freeze([...seams.settingSources]),
|
|
78183
78370
|
hidden: Object.freeze(hidden),
|
|
@@ -78218,8 +78405,8 @@ function layerPhrase(layer, reading2) {
|
|
|
78218
78405
|
return "no layer";
|
|
78219
78406
|
if (layer === "spawn")
|
|
78220
78407
|
return "rafa's spawn";
|
|
78221
|
-
const
|
|
78222
|
-
return
|
|
78408
|
+
const path7 = reading2.scopes.find((scope) => scope.scope === layer)?.path;
|
|
78409
|
+
return path7 === undefined ? `the ${layer} settings` : `the ${layer} settings file ${path7}`;
|
|
78223
78410
|
}
|
|
78224
78411
|
function cwdRow(reading2) {
|
|
78225
78412
|
const name2 = "working directory";
|
|
@@ -78235,16 +78422,16 @@ function cwdRow(reading2) {
|
|
|
78235
78422
|
function joined2(directories) {
|
|
78236
78423
|
return directories.join(", ");
|
|
78237
78424
|
}
|
|
78238
|
-
function pathRow(
|
|
78239
|
-
const setBy = `set by ${layerPhrase(
|
|
78425
|
+
function pathRow(path7, reading2) {
|
|
78426
|
+
const setBy = `set by ${layerPhrase(path7.layer, reading2)}`;
|
|
78240
78427
|
const parts = [
|
|
78241
|
-
...
|
|
78242
|
-
...
|
|
78428
|
+
...path7.added.length === 0 ? [] : [`gains ${joined2(path7.added)}`],
|
|
78429
|
+
...path7.reordered ? ["searches the directories both hold in another order"] : []
|
|
78243
78430
|
];
|
|
78244
|
-
if (
|
|
78431
|
+
if (path7.removed.length === 0)
|
|
78245
78432
|
return { status: "note", name: PATH_KEY, detail: `${parts.join("; ")}; ${setBy}` };
|
|
78246
|
-
const detail = [`loses ${joined2(
|
|
78247
|
-
const file =
|
|
78433
|
+
const detail = [`loses ${joined2(path7.removed)}, which the shell searches`, ...parts, setBy].join("; ");
|
|
78434
|
+
const file = path7.layer === null || path7.layer === "spawn" ? null : reading2.scopes.find((scope) => scope.scope === path7.layer)?.path ?? null;
|
|
78248
78435
|
return file === null ? { status: "warn", name: PATH_KEY, detail } : {
|
|
78249
78436
|
status: "warn",
|
|
78250
78437
|
name: PATH_KEY,
|
|
@@ -78361,36 +78548,36 @@ import { join as join114 } from "path";
|
|
|
78361
78548
|
init_sqlite();
|
|
78362
78549
|
var EFFORT_SCHEMA_ROW = "effort store schema";
|
|
78363
78550
|
var SCHEMA_COMMAND = "rafa effort schema";
|
|
78364
|
-
function developmentAppliedWarning(
|
|
78365
|
-
return `\u26A0 effort store ${
|
|
78551
|
+
function developmentAppliedWarning(path7, id3, appliedBy) {
|
|
78552
|
+
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
78553
|
}
|
|
78367
|
-
function unreadable4(
|
|
78368
|
-
return { outcome: "fail", path:
|
|
78554
|
+
function unreadable4(path7, live, problem) {
|
|
78555
|
+
return { outcome: "fail", path: path7, live, status: "unreadable", problem, warnings: [], nextStep: NO_NEXT_STEP };
|
|
78369
78556
|
}
|
|
78370
78557
|
function readingOf2(report4, live) {
|
|
78371
|
-
const { path:
|
|
78558
|
+
const { path: path7, status, nextStep: nextStep2 } = report4;
|
|
78372
78559
|
if (report4.refused) {
|
|
78373
|
-
const problem = `this rafa refuses ${
|
|
78374
|
-
return { outcome: "fail", path:
|
|
78560
|
+
const problem = `this rafa refuses ${path7} (${status}): ${String(report4.refusal)}`;
|
|
78561
|
+
return { outcome: "fail", path: path7, live, status, problem, warnings: [], nextStep: nextStep2 };
|
|
78375
78562
|
}
|
|
78376
|
-
const developed = live ? developmentApplied(report4).map(({ id: id3, appliedBy }) => developmentAppliedWarning(
|
|
78563
|
+
const developed = live ? developmentApplied(report4).map(({ id: id3, appliedBy }) => developmentAppliedWarning(path7, id3, appliedBy)) : [];
|
|
78377
78564
|
const warnings = [...unknownAdditive(report4).map(unknownAdditiveWarning), ...developed];
|
|
78378
78565
|
const outcome2 = warnings.length === 0 ? "ok" : "warn";
|
|
78379
|
-
return { outcome: outcome2, path:
|
|
78566
|
+
return { outcome: outcome2, path: path7, live, status, problem: null, warnings, nextStep: nextStep2 };
|
|
78380
78567
|
}
|
|
78381
78568
|
function readDoctorEffortSchema(root, env, options = {}) {
|
|
78382
78569
|
const override = env[EFFORT_DIR_VARIABLE];
|
|
78383
78570
|
const live = override === undefined || override === "";
|
|
78384
|
-
let
|
|
78571
|
+
let path7;
|
|
78385
78572
|
try {
|
|
78386
|
-
|
|
78573
|
+
path7 = join114(effortStoreDir(root, env), SQLITE_STORE_FILE_NAME);
|
|
78387
78574
|
} catch (error2) {
|
|
78388
78575
|
return unreadable4(null, live, messageOf(error2));
|
|
78389
78576
|
}
|
|
78390
78577
|
try {
|
|
78391
|
-
return readingOf2(readSchemaReport(
|
|
78578
|
+
return readingOf2(readSchemaReport(path7, options), live);
|
|
78392
78579
|
} catch (error2) {
|
|
78393
|
-
return unreadable4(
|
|
78580
|
+
return unreadable4(path7, live, `${path7} cannot be read as an effort store: ${messageOf(error2)}`);
|
|
78394
78581
|
}
|
|
78395
78582
|
}
|
|
78396
78583
|
function wayOut(reading2) {
|
|
@@ -78457,20 +78644,20 @@ function isAbsence2(error2) {
|
|
|
78457
78644
|
return false;
|
|
78458
78645
|
return error2.code === "ENOENT" || error2.code === "ENOTDIR";
|
|
78459
78646
|
}
|
|
78460
|
-
function isStoreFile(
|
|
78647
|
+
function isStoreFile(path7) {
|
|
78461
78648
|
try {
|
|
78462
|
-
return statSync32(
|
|
78649
|
+
return statSync32(path7).isFile();
|
|
78463
78650
|
} catch (error2) {
|
|
78464
78651
|
if (isAbsence2(error2))
|
|
78465
78652
|
return false;
|
|
78466
|
-
throw new Error(`${
|
|
78653
|
+
throw new Error(`${path7}: cannot be checked (${messageOf(error2)})`, { cause: error2 });
|
|
78467
78654
|
}
|
|
78468
78655
|
}
|
|
78469
78656
|
function storeFilesIn(dir) {
|
|
78470
78657
|
return Object.freeze(STORE_FILE_NAMES2.filter((name2) => isStoreFile(join115(dir, name2))));
|
|
78471
78658
|
}
|
|
78472
|
-
function shellQuoted(
|
|
78473
|
-
return `'${
|
|
78659
|
+
function shellQuoted(path7) {
|
|
78660
|
+
return `'${path7.replaceAll("'", "'\\''")}'`;
|
|
78474
78661
|
}
|
|
78475
78662
|
function legacyWarning(legacyDir, storeDir, legacyFiles) {
|
|
78476
78663
|
const move3 = `mkdir -p ${shellQuoted(storeDir)} && mv ${shellQuoted(legacyDir)}/* ${shellQuoted(storeDir)}/`;
|
|
@@ -78678,15 +78865,15 @@ function withProjectNumber(text2, number) {
|
|
|
78678
78865
|
return appended6(lines3, ["board:", ...settingLines(number, true)]).join(`
|
|
78679
78866
|
`);
|
|
78680
78867
|
}
|
|
78681
|
-
function projectNumberIn(text2,
|
|
78682
|
-
return parseConfigText(text2,
|
|
78868
|
+
function projectNumberIn(text2, path7) {
|
|
78869
|
+
return parseConfigText(text2, path7).values.boardProjectNumber ?? null;
|
|
78683
78870
|
}
|
|
78684
|
-
function readBackProblem(text2, written5,
|
|
78871
|
+
function readBackProblem(text2, written5, path7, number) {
|
|
78685
78872
|
let before;
|
|
78686
78873
|
let after;
|
|
78687
78874
|
try {
|
|
78688
|
-
before = parseConfigText(text2,
|
|
78689
|
-
after = parseConfigText(written5,
|
|
78875
|
+
before = parseConfigText(text2, path7);
|
|
78876
|
+
after = parseConfigText(written5, path7);
|
|
78690
78877
|
} catch (error2) {
|
|
78691
78878
|
return `does not parse: ${messageOf(error2)}`;
|
|
78692
78879
|
}
|
|
@@ -78700,31 +78887,31 @@ function settingPart(outcome2, detail) {
|
|
|
78700
78887
|
return { kind: "setting", name: PROJECT_NUMBER_SETTING, outcome: outcome2, detail };
|
|
78701
78888
|
}
|
|
78702
78889
|
function writeProjectNumber(root, number) {
|
|
78703
|
-
const
|
|
78890
|
+
const path7 = configFilePath(root);
|
|
78704
78891
|
let text2;
|
|
78705
78892
|
let held2;
|
|
78706
78893
|
try {
|
|
78707
|
-
text2 = readFileSync91(
|
|
78708
|
-
held2 = projectNumberIn(text2,
|
|
78894
|
+
text2 = readFileSync91(path7, "utf8");
|
|
78895
|
+
held2 = projectNumberIn(text2, path7);
|
|
78709
78896
|
} catch (error2) {
|
|
78710
|
-
return settingPart("refused", `${
|
|
78897
|
+
return settingPart("refused", `${path7} could not be read: ${messageOf(error2)}`);
|
|
78711
78898
|
}
|
|
78712
78899
|
if (held2 === number)
|
|
78713
|
-
return settingPart("present", `${
|
|
78900
|
+
return settingPart("present", `${path7} names project ${String(number)}`);
|
|
78714
78901
|
const written5 = withProjectNumber(text2, number);
|
|
78715
78902
|
if (written5 === null) {
|
|
78716
78903
|
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", `${
|
|
78904
|
+
return settingPart("refused", `${path7} was left as it was: ${why}`);
|
|
78718
78905
|
}
|
|
78719
|
-
const problem = readBackProblem(text2, written5,
|
|
78906
|
+
const problem = readBackProblem(text2, written5, path7, number);
|
|
78720
78907
|
if (problem !== null)
|
|
78721
|
-
return settingPart("refused", `${
|
|
78908
|
+
return settingPart("refused", `${path7} was left as it was: the file this run would have written ${problem}`);
|
|
78722
78909
|
try {
|
|
78723
|
-
writeFileSync35(
|
|
78910
|
+
writeFileSync35(path7, written5, "utf8");
|
|
78724
78911
|
} catch (error2) {
|
|
78725
|
-
return settingPart("refused", `${
|
|
78912
|
+
return settingPart("refused", `${path7} could not be written: ${messageOf(error2)}`);
|
|
78726
78913
|
}
|
|
78727
|
-
return settingPart("created", `${
|
|
78914
|
+
return settingPart("created", `${path7} now names project ${String(number)}`);
|
|
78728
78915
|
}
|
|
78729
78916
|
|
|
78730
78917
|
// src/commands/init-board-project.ts
|
|
@@ -79228,31 +79415,31 @@ function stretchFolder(root, n) {
|
|
|
79228
79415
|
function agentFilePath(root, n) {
|
|
79229
79416
|
return join117(stretchFolder(root, n), AGENT_FILE);
|
|
79230
79417
|
}
|
|
79231
|
-
function stretchNumbers(root,
|
|
79232
|
-
return
|
|
79418
|
+
function stretchNumbers(root, fs4 = nodeStretchFs) {
|
|
79419
|
+
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
79420
|
}
|
|
79234
|
-
function highestStretch(root,
|
|
79235
|
-
const numbers = stretchNumbers(root,
|
|
79421
|
+
function highestStretch(root, fs4 = nodeStretchFs) {
|
|
79422
|
+
const numbers = stretchNumbers(root, fs4);
|
|
79236
79423
|
return numbers.length === 0 ? 0 : numbers[numbers.length - 1];
|
|
79237
79424
|
}
|
|
79238
|
-
function nextStretch(root,
|
|
79239
|
-
const highest = highestStretch(root,
|
|
79240
|
-
if (highest > 0 && !hasAgentFile(root, highest,
|
|
79425
|
+
function nextStretch(root, fs4 = nodeStretchFs) {
|
|
79426
|
+
const highest = highestStretch(root, fs4);
|
|
79427
|
+
if (highest > 0 && !hasAgentFile(root, highest, fs4))
|
|
79241
79428
|
return highest;
|
|
79242
79429
|
return highest + 1;
|
|
79243
79430
|
}
|
|
79244
|
-
function newestWatched(root,
|
|
79245
|
-
const numbers = stretchNumbers(root,
|
|
79431
|
+
function newestWatched(root, fs4 = nodeStretchFs) {
|
|
79432
|
+
const numbers = stretchNumbers(root, fs4);
|
|
79246
79433
|
for (let index = numbers.length - 1;index >= 0; index -= 1) {
|
|
79247
79434
|
const n = numbers[index];
|
|
79248
|
-
if (hasAgentFile(root, n,
|
|
79435
|
+
if (hasAgentFile(root, n, fs4))
|
|
79249
79436
|
return n;
|
|
79250
79437
|
}
|
|
79251
79438
|
return 0;
|
|
79252
79439
|
}
|
|
79253
|
-
function readAgentFile(root, n,
|
|
79440
|
+
function readAgentFile(root, n, fs4 = nodeStretchFs) {
|
|
79254
79441
|
const file = agentFilePath(root, n);
|
|
79255
|
-
const text2 =
|
|
79442
|
+
const text2 = fs4.readText(file);
|
|
79256
79443
|
if (text2 === null)
|
|
79257
79444
|
return { kind: "absent", file };
|
|
79258
79445
|
let value;
|
|
@@ -79322,8 +79509,8 @@ var nodeStretchFs = {
|
|
|
79322
79509
|
}
|
|
79323
79510
|
}
|
|
79324
79511
|
};
|
|
79325
|
-
function hasAgentFile(root, n,
|
|
79326
|
-
return
|
|
79512
|
+
function hasAgentFile(root, n, fs4) {
|
|
79513
|
+
return fs4.readText(agentFilePath(root, n)) !== null;
|
|
79327
79514
|
}
|
|
79328
79515
|
function stretchNumber(n) {
|
|
79329
79516
|
if (!isPositiveWhole(n)) {
|
|
@@ -79359,12 +79546,15 @@ function optionalString2(record2, key) {
|
|
|
79359
79546
|
|
|
79360
79547
|
// src/commands/stretch/item.ts
|
|
79361
79548
|
init_rafa_board();
|
|
79549
|
+
init_rafa_effort();
|
|
79362
79550
|
init_naming();
|
|
79363
79551
|
init_plan_files2();
|
|
79364
79552
|
init_command2();
|
|
79365
79553
|
init_sections();
|
|
79554
|
+
init_git2();
|
|
79366
79555
|
init_loop();
|
|
79367
79556
|
init_plan();
|
|
79557
|
+
init_filed_text();
|
|
79368
79558
|
import { closeSync as closeSync4, mkdirSync as mkdirSync34, openSync as openSync4, readdirSync as readdirSync28, readFileSync as readFileSync100, statSync as statSync34 } from "fs";
|
|
79369
79559
|
import { dirname as dirname48, join as join122, posix as posix14 } from "path";
|
|
79370
79560
|
|
|
@@ -79443,7 +79633,7 @@ function defaultOperatorsSeams() {
|
|
|
79443
79633
|
};
|
|
79444
79634
|
}
|
|
79445
79635
|
var nodeOperatorsFs = {
|
|
79446
|
-
exists: (
|
|
79636
|
+
exists: (path7) => existsSync83(path7),
|
|
79447
79637
|
readText(file) {
|
|
79448
79638
|
try {
|
|
79449
79639
|
return readFileSync94(file, "utf8");
|
|
@@ -79475,8 +79665,8 @@ var nodeOperatorsFs = {
|
|
|
79475
79665
|
}
|
|
79476
79666
|
}
|
|
79477
79667
|
};
|
|
79478
|
-
function linksIn(
|
|
79479
|
-
return
|
|
79668
|
+
function linksIn(fs4, dir, keep2) {
|
|
79669
|
+
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
79670
|
}
|
|
79481
79671
|
|
|
79482
79672
|
// src/stretch/launch.ts
|
|
@@ -79544,69 +79734,6 @@ function lineText(argv) {
|
|
|
79544
79734
|
return argv.map((word) => PLAIN_FLAG.test(word) ? word : shellQuote(word)).join(" ");
|
|
79545
79735
|
}
|
|
79546
79736
|
|
|
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
79737
|
// src/commands/stretch/item-merge.ts
|
|
79611
79738
|
init_rafa_board();
|
|
79612
79739
|
import { readFileSync as readFileSync98 } from "fs";
|
|
@@ -79720,8 +79847,119 @@ function itemProblem2(item) {
|
|
|
79720
79847
|
return null;
|
|
79721
79848
|
}
|
|
79722
79849
|
|
|
79850
|
+
// src/stretch/pit-effort.ts
|
|
79851
|
+
init_rafa_effort();
|
|
79852
|
+
init_sections();
|
|
79853
|
+
import { homedir as homedir16 } from "os";
|
|
79854
|
+
var PLAN_ROW_KIND = "plan";
|
|
79855
|
+
var MINUTES_METRIC = "minutes";
|
|
79856
|
+
var MS_PER_SECOND9 = 1000;
|
|
79857
|
+
var DECIMALS = 1;
|
|
79858
|
+
function collectFailure(exitCode) {
|
|
79859
|
+
return exitCode === null ? "rafa effort collect could not start" : `rafa effort collect ended with exit code ${String(exitCode)}`;
|
|
79860
|
+
}
|
|
79861
|
+
function defaultTrendOptions() {
|
|
79862
|
+
const parsed2 = parseReportArgs(["--trend"]);
|
|
79863
|
+
if (parsed2.trend === null)
|
|
79864
|
+
throw new Error(`the trend options did not parse: ${parsed2.errors.join("; ")}`);
|
|
79865
|
+
return parsed2.trend;
|
|
79866
|
+
}
|
|
79867
|
+
function effortOf(dashboard, stub) {
|
|
79868
|
+
const row2 = dashboard.loops.rows.find((entry) => entry.kind === PLAN_ROW_KIND && entry.key === stub);
|
|
79869
|
+
if (row2 === undefined)
|
|
79870
|
+
return { stub, rows: 0 };
|
|
79871
|
+
const minutes2 = dashboard.trend.metrics.find((metric2) => metric2.name === MINUTES_METRIC);
|
|
79872
|
+
return {
|
|
79873
|
+
stub,
|
|
79874
|
+
tasks: row2.tasks,
|
|
79875
|
+
p50: row2.perTask.minutes.p50,
|
|
79876
|
+
max: row2.perTask.minutes.max,
|
|
79877
|
+
baseline: minutes2?.baselineP50 ?? null
|
|
79878
|
+
};
|
|
79879
|
+
}
|
|
79880
|
+
async function readPitEffort(seams, query) {
|
|
79881
|
+
const started = seams.now().getTime();
|
|
79882
|
+
let exitCode;
|
|
79883
|
+
try {
|
|
79884
|
+
exitCode = await seams.runCollect();
|
|
79885
|
+
} catch {
|
|
79886
|
+
exitCode = null;
|
|
79887
|
+
}
|
|
79888
|
+
const collect4 = { exitCode, seconds: (seams.now().getTime() - started) / MS_PER_SECOND9 };
|
|
79889
|
+
if (exitCode !== 0)
|
|
79890
|
+
return { effort: { ok: false, reason: collectFailure(exitCode) }, collect: collect4 };
|
|
79891
|
+
try {
|
|
79892
|
+
const dashboard = await seams.readDashboard({
|
|
79893
|
+
repoRoot: query.root,
|
|
79894
|
+
home: query.home ?? homedir16(),
|
|
79895
|
+
trend: defaultTrendOptions(),
|
|
79896
|
+
now: seams.now()
|
|
79897
|
+
});
|
|
79898
|
+
return { effort: { ok: true, value: effortOf(dashboard, query.stub) }, collect: collect4 };
|
|
79899
|
+
} catch (error2) {
|
|
79900
|
+
return { effort: { ok: false, reason: messageOf(error2) }, collect: collect4 };
|
|
79901
|
+
}
|
|
79902
|
+
}
|
|
79903
|
+
function minutesText(value) {
|
|
79904
|
+
return value === null ? "no figure" : `${value.toFixed(DECIMALS)} min`;
|
|
79905
|
+
}
|
|
79906
|
+
function renderPitEffort(effort) {
|
|
79907
|
+
if (!effort.ok)
|
|
79908
|
+
return `Effort: not read (${effort.reason}).`;
|
|
79909
|
+
const value = effort.value;
|
|
79910
|
+
if ("rows" in value)
|
|
79911
|
+
return `Effort: ${value.stub}: no task sessions stored.`;
|
|
79912
|
+
const against = value.baseline === null ? "no baseline" : minutesText(value.baseline);
|
|
79913
|
+
return `Effort: ${value.stub}: ${String(value.tasks)} tasks, p50 ${minutesText(value.p50)}` + ` against ${against}, max ${minutesText(value.max)}.`;
|
|
79914
|
+
}
|
|
79915
|
+
function collectLine(collect4) {
|
|
79916
|
+
const seconds = collect4.seconds.toFixed(DECIMALS);
|
|
79917
|
+
return collect4.exitCode === null ? `rafa effort collect could not start (${seconds}s)` : `rafa effort collect ended ${String(collect4.exitCode)} in ${seconds}s`;
|
|
79918
|
+
}
|
|
79919
|
+
|
|
79723
79920
|
// src/stretch/pit-readings.ts
|
|
79724
79921
|
init_sections();
|
|
79922
|
+
|
|
79923
|
+
// src/stretch/pit-recheck.ts
|
|
79924
|
+
init_sections();
|
|
79925
|
+
var REPRODUCE_INDENT2 = " ";
|
|
79926
|
+
async function readPitRechecks(judge, filed) {
|
|
79927
|
+
if (!filed.ok)
|
|
79928
|
+
return filed;
|
|
79929
|
+
const bugs = filed.value.bugs.map((bug) => ({ ...bug, author: null }));
|
|
79930
|
+
if (bugs.length === 0)
|
|
79931
|
+
return { ok: true, value: [] };
|
|
79932
|
+
try {
|
|
79933
|
+
const judged2 = await judge(bugs);
|
|
79934
|
+
return { ok: true, value: [...judged2.rows] };
|
|
79935
|
+
} catch (error2) {
|
|
79936
|
+
return { ok: false, reason: messageOf(error2) };
|
|
79937
|
+
}
|
|
79938
|
+
}
|
|
79939
|
+
function detailOf20(row2) {
|
|
79940
|
+
if (row2.verdict === "skipped" || row2.verdict === "stale") {
|
|
79941
|
+
return row2.reason === null ? "" : `: ${row2.reason}`;
|
|
79942
|
+
}
|
|
79943
|
+
if (row2.verdict === "flaky")
|
|
79944
|
+
return `: ${String(row2.failedRuns ?? 0)} of ${String(row2.runs)} runs failed`;
|
|
79945
|
+
return "";
|
|
79946
|
+
}
|
|
79947
|
+
function rowLines2(row2) {
|
|
79948
|
+
const head = `Recheck #${String(row2.issue)}: ${row2.verdict}${detailOf20(row2)}`;
|
|
79949
|
+
if (row2.verdict !== "manual" || row2.reproduce === null)
|
|
79950
|
+
return [head];
|
|
79951
|
+
return [head, ...row2.reproduce.split(`
|
|
79952
|
+
`).map((line) => `${REPRODUCE_INDENT2}${line}`)];
|
|
79953
|
+
}
|
|
79954
|
+
function renderPitRechecks(rechecks) {
|
|
79955
|
+
if (!rechecks.ok)
|
|
79956
|
+
return [`Recheck: not read (${rechecks.reason}).`];
|
|
79957
|
+
if (rechecks.value.length === 0)
|
|
79958
|
+
return ["Recheck: no bug filed since."];
|
|
79959
|
+
return rechecks.value.flatMap(rowLines2);
|
|
79960
|
+
}
|
|
79961
|
+
|
|
79962
|
+
// src/stretch/pit-readings.ts
|
|
79725
79963
|
var NO_OPEN_ISSUES = "the tracker lists no open issues (it has no openIssues)";
|
|
79726
79964
|
var NO_FILED_ISSUES = "the tracker lists no filed issues (it has no filedIssues)";
|
|
79727
79965
|
var INVALID_CUT_OFF = "the cut-off is not a valid time";
|
|
@@ -79730,7 +79968,16 @@ async function readPitReadings(seams, query) {
|
|
|
79730
79968
|
const ci = await attempt4(() => readCi(seams.gh, query));
|
|
79731
79969
|
const bugs = await attempt4(() => readOpenBugs(seams.tracker));
|
|
79732
79970
|
const openBugs2 = bugs.ok ? { ok: true, value: bugs.value.length } : bugs;
|
|
79733
|
-
|
|
79971
|
+
const filedSince = await readFiledSince(seams.tracker, query.since);
|
|
79972
|
+
const effort = await readPitEffort(seams, { root: query.root, stub: query.stub });
|
|
79973
|
+
const rechecks = await readPitRechecks(seams.judge, judgedReading(filedSince));
|
|
79974
|
+
return { ci, openBugs: openBugs2, filedSince, effort, rechecks };
|
|
79975
|
+
}
|
|
79976
|
+
function judgedReading(filed) {
|
|
79977
|
+
if (!filed.ok)
|
|
79978
|
+
return filed;
|
|
79979
|
+
const bugs = filed.value.bugs.map((bug) => ({ ref: bug.ref, issue: Number(bug.id), title: bug.title, body: bug.body }));
|
|
79980
|
+
return { ok: true, value: { bugs } };
|
|
79734
79981
|
}
|
|
79735
79982
|
async function readCiRuns(gh, query) {
|
|
79736
79983
|
if (query.workflow === undefined)
|
|
@@ -79774,7 +80021,9 @@ async function readFiledSince(tracker, since) {
|
|
|
79774
80021
|
title: bug.title,
|
|
79775
80022
|
url: bug.ref.url,
|
|
79776
80023
|
filedAt: new Date(at).toISOString(),
|
|
79777
|
-
firstLine: firstLineOf4(bug.body)
|
|
80024
|
+
firstLine: firstLineOf4(bug.body),
|
|
80025
|
+
ref: bug.ref,
|
|
80026
|
+
body: bug.body
|
|
79778
80027
|
}));
|
|
79779
80028
|
return { ok: true, value: { since: since.toISOString(), bugs: filed } };
|
|
79780
80029
|
}
|
|
@@ -79786,7 +80035,13 @@ async function attempt4(read2) {
|
|
|
79786
80035
|
}
|
|
79787
80036
|
}
|
|
79788
80037
|
function renderPitReadings(readings) {
|
|
79789
|
-
return [
|
|
80038
|
+
return [
|
|
80039
|
+
...ciLines(readings.ci),
|
|
80040
|
+
openBugsLine(readings.openBugs),
|
|
80041
|
+
...filedSinceLines(readings.filedSince),
|
|
80042
|
+
renderPitEffort(readings.effort.effort),
|
|
80043
|
+
...renderPitRechecks(readings.rechecks)
|
|
80044
|
+
];
|
|
79790
80045
|
}
|
|
79791
80046
|
function ciLines(ci) {
|
|
79792
80047
|
if (!ci.ok)
|
|
@@ -80484,6 +80739,9 @@ function refuseUnmergeable2(pull) {
|
|
|
80484
80739
|
function mergeArgv(rafa, number) {
|
|
80485
80740
|
return [...rafa, "pr", "merge", String(number), ...MERGE_FLAGS];
|
|
80486
80741
|
}
|
|
80742
|
+
function collectArgv(rafa) {
|
|
80743
|
+
return [...rafa, "effort", "collect"];
|
|
80744
|
+
}
|
|
80487
80745
|
function mergeDryRunLines(rafa, root, n) {
|
|
80488
80746
|
const base2 = `${STRETCH_BRANCH_PREFIX}${String(n)}`;
|
|
80489
80747
|
const runList5 = lineText(["gh", ...runListArgs({ branch: base2, commit: STAND_IN_SHA })]).replace(STAND_IN_SHA, MERGE_COMMIT_PLACEHOLDER);
|
|
@@ -80493,7 +80751,9 @@ function mergeDryRunLines(rafa, root, n) {
|
|
|
80493
80751
|
`${lineText([...rafa, "pr", "merge"])} <pr> ${lineText(MERGE_FLAGS)}`,
|
|
80494
80752
|
`${runList5} (again every ${String(CI_POLL_MS / 1000)}s until the run on the merge commit ends)`,
|
|
80495
80753
|
`append the item to ${itemsPath(root, n)}`,
|
|
80496
|
-
|
|
80754
|
+
lineText(collectArgv(rafa)),
|
|
80755
|
+
`print the pit-stop readings of ${base2}`,
|
|
80756
|
+
"recheck each bug filed since the last item, as rafa bug recheck judges it, posting no comment"
|
|
80497
80757
|
];
|
|
80498
80758
|
}
|
|
80499
80759
|
function stretchStartedAt(root, n) {
|
|
@@ -80588,6 +80848,25 @@ async function mergePull(context, item, number, seams) {
|
|
|
80588
80848
|
context.output.info(`merged #${String(number)} into ${pull.base} at ${short3(pull.mergeCommit)}`);
|
|
80589
80849
|
return pull;
|
|
80590
80850
|
}
|
|
80851
|
+
function itemJudge(context, item, gh, tracker, seams) {
|
|
80852
|
+
const config = item.recheckConfig;
|
|
80853
|
+
let board;
|
|
80854
|
+
const trust = () => {
|
|
80855
|
+
board ??= ghBoardTrust({ gh, trustedAuthors: config.boardTrustedAuthors, repo: boardRepoLabel(seams.git(item.root)) });
|
|
80856
|
+
return board;
|
|
80857
|
+
};
|
|
80858
|
+
return (bugs) => judgeBugs(bugs, {
|
|
80859
|
+
tracker,
|
|
80860
|
+
trust,
|
|
80861
|
+
checkout: item.root,
|
|
80862
|
+
env: item.env,
|
|
80863
|
+
secrets: config.secrets,
|
|
80864
|
+
runs: config.bugsRecheckRuns,
|
|
80865
|
+
timeoutMs: config.bugsRecheckTimeoutSeconds * MS_PER_SECOND8,
|
|
80866
|
+
recheck: seams.recheck,
|
|
80867
|
+
warn: (text2) => context.output.warn(text2)
|
|
80868
|
+
});
|
|
80869
|
+
}
|
|
80591
80870
|
async function finishItem(context, item, merged2, seams) {
|
|
80592
80871
|
const info2 = (text2) => context.output.info(text2);
|
|
80593
80872
|
const gh = seams.gh(item.root);
|
|
@@ -80602,14 +80881,22 @@ async function finishItem(context, item, merged2, seams) {
|
|
|
80602
80881
|
at: seams.now().toISOString()
|
|
80603
80882
|
});
|
|
80604
80883
|
info2(`ledger: #${String(item.issue)} appended to ${itemsPath(item.root, item.n)}${closes2.length === 0 ? ", closing no issue" : `, ${closes2.join(", ")}`}`);
|
|
80605
|
-
const
|
|
80884
|
+
const tracker = seams.tracker(gh);
|
|
80885
|
+
const collect4 = collectArgv(seams.rafa);
|
|
80886
|
+
const runCollect = () => {
|
|
80887
|
+
info2(lineText(collect4));
|
|
80888
|
+
return seams.runRafa(collect4, item.root, item.env);
|
|
80889
|
+
};
|
|
80890
|
+
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 });
|
|
80891
|
+
info2(collectLine(readings.effort.collect));
|
|
80606
80892
|
for (const line of renderPitReadings(readings))
|
|
80607
80893
|
info2(line);
|
|
80608
80894
|
}
|
|
80609
80895
|
async function mergeItem(context, item, number, seams) {
|
|
80610
80896
|
const since = bugCutOff(item);
|
|
80611
80897
|
const merged2 = await mergePull(context, item, number, seams);
|
|
80612
|
-
|
|
80898
|
+
const finish2 = { root: item.root, n: item.n, issue: item.issue, stub: item.stub, since, env: item.env, recheckConfig: item.recheckConfig };
|
|
80899
|
+
await finishItem(context, finish2, merged2, seams);
|
|
80613
80900
|
}
|
|
80614
80901
|
async function afterLoopWait(context, item, waitExit, seams) {
|
|
80615
80902
|
const ending = readLoopEnding(item.root, item.sessionId);
|
|
@@ -80727,7 +81014,8 @@ async function resumeItem(context, input, seams) {
|
|
|
80727
81014
|
} else {
|
|
80728
81015
|
throw refusal26(`#${String(number)} is ${pull.state}, neither open nor merged. Nothing was run.`);
|
|
80729
81016
|
}
|
|
80730
|
-
|
|
81017
|
+
const finish2 = { root: input.root, n: input.n, issue: input.issue, stub, since, env: input.env, recheckConfig: input.recheckConfig };
|
|
81018
|
+
await finishItem(context, finish2, merged2, seams);
|
|
80731
81019
|
}
|
|
80732
81020
|
|
|
80733
81021
|
// src/commands/stretch/item.ts
|
|
@@ -80936,7 +81224,8 @@ async function waitStep(context, wait, seams) {
|
|
|
80936
81224
|
sessionId: record2.sessionId,
|
|
80937
81225
|
startedAt: record2.startedAt,
|
|
80938
81226
|
log: wait.log,
|
|
80939
|
-
env
|
|
81227
|
+
env,
|
|
81228
|
+
recheckConfig: wait.recheckConfig
|
|
80940
81229
|
}, exitCode, seams);
|
|
80941
81230
|
}
|
|
80942
81231
|
async function resumeStep(context, step2, seams) {
|
|
@@ -80957,7 +81246,8 @@ async function resumeStep(context, step2, seams) {
|
|
|
80957
81246
|
plans: issuePlans(step2.plans, issue5),
|
|
80958
81247
|
plansLabel: step2.plans.label,
|
|
80959
81248
|
log,
|
|
80960
|
-
env: childEnv(context)
|
|
81249
|
+
env: childEnv(context),
|
|
81250
|
+
recheckConfig: step2.recheckConfig
|
|
80961
81251
|
}, seams);
|
|
80962
81252
|
}
|
|
80963
81253
|
async function runStretchItem(context, seams) {
|
|
@@ -80968,8 +81258,14 @@ async function runStretchItem(context, seams) {
|
|
|
80968
81258
|
const config = await resolveProjectConfig(project, COMMAND_NAME19, warn5);
|
|
80969
81259
|
const n = requireStretchBase(config.prBase);
|
|
80970
81260
|
const plans = plansDirAt(root, config.planDir);
|
|
81261
|
+
const recheckConfig = {
|
|
81262
|
+
bugsRecheckRuns: config.bugsRecheckRuns,
|
|
81263
|
+
bugsRecheckTimeoutSeconds: config.bugsRecheckTimeoutSeconds,
|
|
81264
|
+
boardTrustedAuthors: config.boardTrustedAuthors,
|
|
81265
|
+
secrets: namedSecrets(config, context.env)
|
|
81266
|
+
};
|
|
80971
81267
|
if (line.resume) {
|
|
80972
|
-
await resumeStep(context, { root, n, plans, dryRun: line.dryRun, issue: line.issue }, seams);
|
|
81268
|
+
await resumeStep(context, { root, n, plans, dryRun: line.dryRun, issue: line.issue, recheckConfig }, seams);
|
|
80973
81269
|
return;
|
|
80974
81270
|
}
|
|
80975
81271
|
const kept = existingPlan(plans, line.issue);
|
|
@@ -81008,7 +81304,7 @@ async function runStretchItem(context, seams) {
|
|
|
81008
81304
|
info2(`wait on it with: rafa loop wait --session-id=${record2.sessionId}`);
|
|
81009
81305
|
return;
|
|
81010
81306
|
}
|
|
81011
|
-
await waitStep(context, { root, n, issue: line.issue, stub, record: record2, log }, seams);
|
|
81307
|
+
await waitStep(context, { root, n, issue: line.issue, stub, record: record2, log, recheckConfig }, seams);
|
|
81012
81308
|
}
|
|
81013
81309
|
async function spawnOnTerminal(argv, cwd, env) {
|
|
81014
81310
|
try {
|
|
@@ -81042,6 +81338,9 @@ function defaultStretchItemSeams() {
|
|
|
81042
81338
|
isAlive: isPidAlive,
|
|
81043
81339
|
gh: (root) => createGhRunner({ cwd: root }),
|
|
81044
81340
|
tracker: (gh) => createGithubTracker({ gh }),
|
|
81341
|
+
readDashboard,
|
|
81342
|
+
recheck: recheckBug,
|
|
81343
|
+
git: createGitRunner,
|
|
81045
81344
|
sleep: (ms) => Bun.sleep(ms),
|
|
81046
81345
|
now: () => new Date,
|
|
81047
81346
|
rafa: DEFAULT_RAFA_COMMAND
|
|
@@ -81053,7 +81352,7 @@ function createStretchItemCommand(seams) {
|
|
|
81053
81352
|
subject: "stretch",
|
|
81054
81353
|
action: "item",
|
|
81055
81354
|
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.",
|
|
81355
|
+
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
81356
|
args: [
|
|
81058
81357
|
{ name: "issue", description: "The number of the `type:spec` issue to plan and run.", type: "string", required: true }
|
|
81059
81358
|
],
|
|
@@ -81889,7 +82188,7 @@ init_rafa_effort();
|
|
|
81889
82188
|
init_plan_files2();
|
|
81890
82189
|
init_command2();
|
|
81891
82190
|
init_config2();
|
|
81892
|
-
import { homedir as
|
|
82191
|
+
import { homedir as homedir17 } from "os";
|
|
81893
82192
|
var COMMAND_NAME21 = "rafa effort dashboard";
|
|
81894
82193
|
var USAGE33 = "rafa effort dashboard [--days=<n>] [--recent=<n>] [--loops=<n>] [--by=effort|model|agent]";
|
|
81895
82194
|
var TREND_FLAGS = ["days", "recent", "loops", "by"];
|
|
@@ -81917,7 +82216,7 @@ async function runDashboard(context, seams) {
|
|
|
81917
82216
|
try {
|
|
81918
82217
|
dashboard = await readDashboard({
|
|
81919
82218
|
repoRoot: root,
|
|
81920
|
-
home: seams.home ??
|
|
82219
|
+
home: seams.home ?? homedir17(),
|
|
81921
82220
|
trend,
|
|
81922
82221
|
now: (seams.now ?? (() => new Date))()
|
|
81923
82222
|
});
|
|
@@ -82885,7 +83184,7 @@ init_config2();
|
|
|
82885
83184
|
init_load();
|
|
82886
83185
|
init_sections();
|
|
82887
83186
|
import { existsSync as existsSync89, readFileSync as readFileSync104 } from "fs";
|
|
82888
|
-
import { homedir as
|
|
83187
|
+
import { homedir as homedir18 } from "os";
|
|
82889
83188
|
import { join as join130, relative as relative31, sep as sep12 } from "path";
|
|
82890
83189
|
init_roots();
|
|
82891
83190
|
init_project_id();
|
|
@@ -82898,7 +83197,7 @@ init_position();
|
|
|
82898
83197
|
init_scope2();
|
|
82899
83198
|
import { createHash as createHash10 } from "crypto";
|
|
82900
83199
|
import { existsSync as existsSync87, mkdirSync as mkdirSync35, readFileSync as readFileSync103, writeFileSync as writeFileSync38 } from "fs";
|
|
82901
|
-
import { dirname as dirname50, isAbsolute as
|
|
83200
|
+
import { dirname as dirname50, isAbsolute as isAbsolute29, join as join128 } from "path";
|
|
82902
83201
|
var GITIGNORE_FILE = ".gitignore";
|
|
82903
83202
|
var DIGEST_NAME = "tracking.digest";
|
|
82904
83203
|
var PRIVATE_TRIAGE = "triage/private";
|
|
@@ -82980,7 +83279,7 @@ function withTrackingBlock(text2, flags, file = GITIGNORE_FILE) {
|
|
|
82980
83279
|
return `${before}${block2}${after}`;
|
|
82981
83280
|
}
|
|
82982
83281
|
function requireAbsolute3(root) {
|
|
82983
|
-
if (!
|
|
83282
|
+
if (!isAbsolute29(root)) {
|
|
82984
83283
|
throw new GitignoreError(`project root is ${describeValue(root)}, expected an absolute path`);
|
|
82985
83284
|
}
|
|
82986
83285
|
}
|
|
@@ -83502,7 +83801,7 @@ function renderReleaseStep(result2) {
|
|
|
83502
83801
|
// src/commands/init.ts
|
|
83503
83802
|
var DEFAULT_INIT_SEAMS = Object.freeze({
|
|
83504
83803
|
cwd: () => process.cwd(),
|
|
83505
|
-
home: () =>
|
|
83804
|
+
home: () => homedir18(),
|
|
83506
83805
|
entry: () => Bun.main,
|
|
83507
83806
|
isTerminal: () => process.stdin.isTTY === true,
|
|
83508
83807
|
openPrompter: () => createLinePrompter(process.stdin, process.stderr),
|
|
@@ -84592,7 +84891,7 @@ init_plan_files2();
|
|
|
84592
84891
|
init_loop();
|
|
84593
84892
|
init_readings();
|
|
84594
84893
|
init_plan();
|
|
84595
|
-
import { isAbsolute as
|
|
84894
|
+
import { isAbsolute as isAbsolute30, relative as relative32 } from "path";
|
|
84596
84895
|
|
|
84597
84896
|
// src/commands/loop/loop-sessions.ts
|
|
84598
84897
|
init_command2();
|
|
@@ -84710,7 +85009,7 @@ function etaLine(eta) {
|
|
|
84710
85009
|
var USAGE38 = "rafa loop list";
|
|
84711
85010
|
function worktreeLabel2(root, worktree) {
|
|
84712
85011
|
const under = relative32(root, worktree);
|
|
84713
|
-
return under === "" || under.startsWith("..") ||
|
|
85012
|
+
return under === "" || under.startsWith("..") || isAbsolute30(under) ? worktree : under;
|
|
84714
85013
|
}
|
|
84715
85014
|
function checkoutColumn(root, session) {
|
|
84716
85015
|
return session.worktree === undefined ? "in the main checkout" : `in worktree \`${worktreeLabel2(root, session.worktree)}\``;
|
|
@@ -84885,7 +85184,7 @@ init_command2();
|
|
|
84885
85184
|
init_rafa_effort();
|
|
84886
85185
|
init_rafa_pr();
|
|
84887
85186
|
import fs4 from "fs";
|
|
84888
|
-
import { homedir as
|
|
85187
|
+
import { homedir as homedir20 } from "os";
|
|
84889
85188
|
import path7 from "path";
|
|
84890
85189
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
84891
85190
|
init_command2();
|
|
@@ -84899,7 +85198,7 @@ init_tracker();
|
|
|
84899
85198
|
// src/notices/run.ts
|
|
84900
85199
|
init_command2();
|
|
84901
85200
|
init_output();
|
|
84902
|
-
import { homedir as
|
|
85201
|
+
import { homedir as homedir19 } from "os";
|
|
84903
85202
|
|
|
84904
85203
|
// src/notices/notices.ts
|
|
84905
85204
|
init_sections();
|
|
@@ -85015,7 +85314,7 @@ async function offerNotices(request, seams) {
|
|
|
85015
85314
|
// src/notices/run.ts
|
|
85016
85315
|
var NOTICES_CANCELLED = "\uD83D\uDED1 Cancelled at the notice: nothing was started.";
|
|
85017
85316
|
async function requireNoticesAnswered(settingSources) {
|
|
85018
|
-
const outcome2 = await offerNotices({ home:
|
|
85317
|
+
const outcome2 = await offerNotices({ home: homedir19(), version: RAFA_VERSION, settingSources }, {
|
|
85019
85318
|
isTerminal: () => process.stdin.isTTY === true,
|
|
85020
85319
|
openPrompter: () => createLinePrompter(process.stdin, process.stderr),
|
|
85021
85320
|
warn: (line) => {
|
|
@@ -85067,7 +85366,7 @@ async function start(args, repoRoot) {
|
|
|
85067
85366
|
return;
|
|
85068
85367
|
let runConfig;
|
|
85069
85368
|
try {
|
|
85070
|
-
runConfig = await loadRunConfig({ root: repoRoot, home:
|
|
85369
|
+
runConfig = await loadRunConfig({ root: repoRoot, home: homedir20() }, args);
|
|
85071
85370
|
} catch (error2) {
|
|
85072
85371
|
if (!(error2 instanceof ConfigError))
|
|
85073
85372
|
throw error2;
|
|
@@ -85104,7 +85403,7 @@ async function start(args, repoRoot) {
|
|
|
85104
85403
|
let expected2 = openCheckoutExpectation({ projectRoot: repoRoot, checkout, branch });
|
|
85105
85404
|
await announceRiskTotal({
|
|
85106
85405
|
repoRoot,
|
|
85107
|
-
home:
|
|
85406
|
+
home: homedir20(),
|
|
85108
85407
|
planPath,
|
|
85109
85408
|
config: runConfig.config,
|
|
85110
85409
|
environment: process.env
|
|
@@ -85134,16 +85433,16 @@ async function start(args, repoRoot) {
|
|
|
85134
85433
|
tiersRafa: runConfig.config.tiersRafa,
|
|
85135
85434
|
tiersSkills: runConfig.config.tiersSkills,
|
|
85136
85435
|
tiersAgents: runConfig.config.tiersAgents,
|
|
85137
|
-
home:
|
|
85436
|
+
home: homedir20()
|
|
85138
85437
|
},
|
|
85139
|
-
sync: { resolved: runConfig, home:
|
|
85438
|
+
sync: { resolved: runConfig, home: homedir20() },
|
|
85140
85439
|
claim: createStartPreflightClaim(repoRoot, runConfig.config),
|
|
85141
85440
|
drift: createStartPreflightDrift(repoRoot, runConfig.config)
|
|
85142
85441
|
});
|
|
85143
|
-
const serving = { root: repoRoot, run: session.id, home:
|
|
85442
|
+
const serving = { root: repoRoot, run: session.id, home: homedir20(), settings: runConfig.config };
|
|
85144
85443
|
const learning = {
|
|
85145
85444
|
kind: runConfig.config.learningAdapter,
|
|
85146
|
-
home:
|
|
85445
|
+
home: homedir20(),
|
|
85147
85446
|
blessMinConfidence: runConfig.config.learningBlessMinConfidence
|
|
85148
85447
|
};
|
|
85149
85448
|
const handout = {
|
|
@@ -85159,7 +85458,7 @@ async function start(args, repoRoot) {
|
|
|
85159
85458
|
};
|
|
85160
85459
|
const hubContact = createHubContact({
|
|
85161
85460
|
root: repoRoot,
|
|
85162
|
-
home:
|
|
85461
|
+
home: homedir20(),
|
|
85163
85462
|
resolved: runConfig,
|
|
85164
85463
|
warn: (message) => activeOutput().warn(message),
|
|
85165
85464
|
sessionId: session.id
|
|
@@ -85271,7 +85570,7 @@ async function start(args, repoRoot) {
|
|
|
85271
85570
|
inject: injectMode,
|
|
85272
85571
|
repoRoot,
|
|
85273
85572
|
checkout,
|
|
85274
|
-
home:
|
|
85573
|
+
home: homedir20(),
|
|
85275
85574
|
settingSources,
|
|
85276
85575
|
knownMissing,
|
|
85277
85576
|
inherited: runStartFailures(trackerPath),
|
|
@@ -85280,6 +85579,7 @@ async function start(args, repoRoot) {
|
|
|
85280
85579
|
serving,
|
|
85281
85580
|
handout,
|
|
85282
85581
|
base: base2,
|
|
85582
|
+
trackerPath,
|
|
85283
85583
|
guard: { expected: expected2, trackerPath },
|
|
85284
85584
|
docTask: { planStub: planStub2, prBase: runConfig.config.prBase }
|
|
85285
85585
|
});
|
|
@@ -85378,12 +85678,12 @@ async function start(args, repoRoot) {
|
|
|
85378
85678
|
}
|
|
85379
85679
|
|
|
85380
85680
|
// src/commands/loop/start.ts
|
|
85381
|
-
var
|
|
85681
|
+
var DECLARATION = {
|
|
85382
85682
|
name: "loop start",
|
|
85383
85683
|
subject: "loop",
|
|
85384
85684
|
action: "start",
|
|
85385
85685
|
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.",
|
|
85686
|
+
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
85687
|
args: [],
|
|
85388
85688
|
flags: [
|
|
85389
85689
|
{
|
|
@@ -85507,15 +85807,25 @@ var wrapped = wrapPhaseZeroCommand({
|
|
|
85507
85807
|
when: "always",
|
|
85508
85808
|
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
85809
|
}
|
|
85510
|
-
}
|
|
85511
|
-
|
|
85512
|
-
|
|
85513
|
-
|
|
85514
|
-
|
|
85515
|
-
|
|
85516
|
-
|
|
85517
|
-
|
|
85518
|
-
|
|
85810
|
+
};
|
|
85811
|
+
async function refuseTscCannotStart(root, env, seams = {}) {
|
|
85812
|
+
const refusal30 = tscRefusal(await readDoctorTsc(root, env, seams));
|
|
85813
|
+
if (refusal30 !== null)
|
|
85814
|
+
throw new CommandExit(1, refusal30);
|
|
85815
|
+
}
|
|
85816
|
+
function loopStartCommand(run2, seams = {}) {
|
|
85817
|
+
const wrapped = wrapPhaseZeroCommand(DECLARATION, run2);
|
|
85818
|
+
return Object.freeze({
|
|
85819
|
+
...wrapped,
|
|
85820
|
+
run: async (context) => {
|
|
85821
|
+
refuseMisplacedRuntime(context.flags, context.argv);
|
|
85822
|
+
if (context.project !== null)
|
|
85823
|
+
await refuseTscCannotStart(context.project.root, context.env, seams);
|
|
85824
|
+
return wrapped.run(context);
|
|
85825
|
+
}
|
|
85826
|
+
});
|
|
85827
|
+
}
|
|
85828
|
+
var command78 = endingWith(loopStartCommand(start));
|
|
85519
85829
|
var start_default2 = command78;
|
|
85520
85830
|
|
|
85521
85831
|
// src/commands/loop/status.ts
|
|
@@ -86694,7 +87004,7 @@ init_command2();
|
|
|
86694
87004
|
init_rafa_board();
|
|
86695
87005
|
init_rafa_inventory();
|
|
86696
87006
|
import fs6 from "fs";
|
|
86697
|
-
import { homedir as
|
|
87007
|
+
import { homedir as homedir21 } from "os";
|
|
86698
87008
|
import path9 from "path";
|
|
86699
87009
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
86700
87010
|
init_adapters();
|
|
@@ -86712,7 +87022,7 @@ init_sections();
|
|
|
86712
87022
|
init_output();
|
|
86713
87023
|
init_plan();
|
|
86714
87024
|
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
|
|
87025
|
+
import { basename as basename32, isAbsolute as isAbsolute31, join as join132, relative as relative34, resolve as resolve49, sep as sep13 } from "path";
|
|
86716
87026
|
init_tiers();
|
|
86717
87027
|
var SOURCE_DIR2 = "src";
|
|
86718
87028
|
var CODE_SPAN7 = /`([^`]+)`/gu;
|
|
@@ -86749,7 +87059,7 @@ function skillHolding(bundle, realPath2) {
|
|
|
86749
87059
|
if (bundle.skillsRoot === null)
|
|
86750
87060
|
return null;
|
|
86751
87061
|
const inside = relative34(bundle.skillsRoot, realPath2);
|
|
86752
|
-
if (inside === "" || inside.startsWith("..") ||
|
|
87062
|
+
if (inside === "" || inside.startsWith("..") || isAbsolute31(inside))
|
|
86753
87063
|
return null;
|
|
86754
87064
|
const name2 = inside.split(sep13)[0] ?? "";
|
|
86755
87065
|
return bundle.skills.includes(name2) ? name2 : null;
|
|
@@ -87297,7 +87607,7 @@ async function resolvePlanConfig(repoRoot, home) {
|
|
|
87297
87607
|
}
|
|
87298
87608
|
}
|
|
87299
87609
|
async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
87300
|
-
const home =
|
|
87610
|
+
const home = homedir21();
|
|
87301
87611
|
const config = await resolvePlanConfig(repoRoot, home);
|
|
87302
87612
|
const {
|
|
87303
87613
|
settingSources,
|
|
@@ -87496,11 +87806,11 @@ var declaration = {
|
|
|
87496
87806
|
spends: { when: "always", what: "one planning session" },
|
|
87497
87807
|
dangerous: CREATE_DANGEROUS_PHRASES
|
|
87498
87808
|
};
|
|
87499
|
-
var
|
|
87809
|
+
var wrapped = {
|
|
87500
87810
|
...declaration,
|
|
87501
87811
|
run: async (context) => wrapPhaseZeroCommand(declaration, (args, root) => plan(args, root, registryRoster(context.registry))).run(context)
|
|
87502
87812
|
};
|
|
87503
|
-
var command85 = endingWith(Object.freeze(
|
|
87813
|
+
var command85 = endingWith(Object.freeze(wrapped));
|
|
87504
87814
|
var create_default2 = command85;
|
|
87505
87815
|
|
|
87506
87816
|
// src/commands/plan/list.ts
|
|
@@ -90416,7 +90726,7 @@ function createStatusHook(seams = {}) {
|
|
|
90416
90726
|
registerCoreConfigSections();
|
|
90417
90727
|
registerCoreAdapters();
|
|
90418
90728
|
registerCoreServices();
|
|
90419
|
-
var modules = await loadInvocationModules({ cwd: process.cwd(), home:
|
|
90729
|
+
var modules = await loadInvocationModules({ cwd: process.cwd(), home: homedir22() });
|
|
90420
90730
|
activateModuleAdapters(modules);
|
|
90421
90731
|
var registry = createRosterRegistry({ off: modules.disabledFeatures });
|
|
90422
90732
|
var { exitCode } = await dispatch(process.argv.slice(2), {
|