@open-tomato/rafa 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1502 -895
- package/dist/config/index.js +2 -2
- package/dist/effort/store/index.js +2 -2
- package/dist/{index-q1tkqxnh.js → index-chm1d3xn.js} +201 -118
- package/dist/{index-7rg3jbsz.js → index-h9vwrj54.js} +1 -1
- package/dist/{index-kcbs6fp9.js → index-j518r1yt.js} +1 -1
- package/dist/{index-g91ys6kw.js → index-jjxnyqvy.js} +1 -0
- package/dist/{index-zsak0jy6.js → index-nqaqh4zz.js} +1 -1
- package/dist/index.js +301 -79
- package/dist/{ready-stwsr9ws.js → ready-dph3z1nz.js} +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3082,6 +3082,7 @@ var init_rafa_codes = __esm(() => {
|
|
|
3082
3082
|
{ code: "cli:unknown-module", description: "a module command names a module that is not mounted", hint: "run rafa module list for the modules that are mounted", level: "error", since: SEED, legacy: "unknown_module" },
|
|
3083
3083
|
{ code: "cli:unexpected-version", description: "--version is typed beside a command, where it is read alone", hint: "run rafa --version alone, with no command beside it", level: "error", since: SEED, legacy: "unexpected_version" },
|
|
3084
3084
|
{ code: "cli:invalid-spec", description: "a command declares a shape the dispatcher refuses", hint: "fix the command declaration the message names", level: "error", since: SEED, legacy: "invalid_spec" },
|
|
3085
|
+
{ code: "cli:unknown-flag", description: "a command line types a flag the command does not declare", hint: "run rafa <command> --help for its flags", level: "error", since: "#1267", legacy: "unknown_flag" },
|
|
3085
3086
|
{ code: "cli:no-project", description: "a command that needs a project ran outside one", hint: "run it inside a project, or run rafa init", level: "error", since: SEED, legacy: "no_project" },
|
|
3086
3087
|
{ code: "cli:command-exit", description: "a command refused and set its own exit code", hint: "read the message above it", level: "error", since: SEED, legacy: "command_exit" },
|
|
3087
3088
|
{ code: "cli:command-error", description: "a command threw an error it did not handle", hint: "file a bug with the stack", level: "error", since: SEED, legacy: "command_error" },
|
|
@@ -3963,7 +3964,7 @@ var init_shared_flags = __esm(() => {
|
|
|
3963
3964
|
});
|
|
3964
3965
|
|
|
3965
3966
|
// package.json
|
|
3966
|
-
var name = "@open-tomato/rafa", version = "0.
|
|
3967
|
+
var name = "@open-tomato/rafa", version = "0.51.0";
|
|
3967
3968
|
var init_package = () => {};
|
|
3968
3969
|
|
|
3969
3970
|
// packages/rafa/src/core/command/version.ts
|
|
@@ -9885,6 +9886,163 @@ var init_previous_copy = __esm(() => {
|
|
|
9885
9886
|
init_sections();
|
|
9886
9887
|
});
|
|
9887
9888
|
|
|
9889
|
+
// packages/rafa-board/src/board/snapshot-change.ts
|
|
9890
|
+
function normalise2(text2) {
|
|
9891
|
+
return text2.replace(/\r\n?/gu, `
|
|
9892
|
+
`).replace(/\n+$/u, "");
|
|
9893
|
+
}
|
|
9894
|
+
function localText(text2) {
|
|
9895
|
+
return text2 === null ? "" : normalise2(text2).trim();
|
|
9896
|
+
}
|
|
9897
|
+
function section(heading, text2) {
|
|
9898
|
+
return text2 === "" ? "" : `${heading}
|
|
9899
|
+
|
|
9900
|
+
${text2}`;
|
|
9901
|
+
}
|
|
9902
|
+
function snapshotText(body, notes, rules = null) {
|
|
9903
|
+
const sections2 = [
|
|
9904
|
+
normalise2(body),
|
|
9905
|
+
section(LOCAL_NOTES_HEADING, localText(notes)),
|
|
9906
|
+
section(STRETCH_RULES_HEADING, localText(rules))
|
|
9907
|
+
].filter((part) => part !== "");
|
|
9908
|
+
return `${sections2.join(`
|
|
9909
|
+
|
|
9910
|
+
`)}
|
|
9911
|
+
`;
|
|
9912
|
+
}
|
|
9913
|
+
function commonLines(before, after) {
|
|
9914
|
+
let previous = new Uint32Array(after.length + 1);
|
|
9915
|
+
for (const line of before) {
|
|
9916
|
+
const row = new Uint32Array(after.length + 1);
|
|
9917
|
+
after.forEach((other, index) => {
|
|
9918
|
+
row[index + 1] = line === other ? (previous[index] ?? 0) + 1 : Math.max(previous[index + 1] ?? 0, row[index] ?? 0);
|
|
9919
|
+
});
|
|
9920
|
+
previous = row;
|
|
9921
|
+
}
|
|
9922
|
+
return previous[after.length] ?? 0;
|
|
9923
|
+
}
|
|
9924
|
+
function headingName(line) {
|
|
9925
|
+
const text2 = line.replace(/^#+/u, "").replace(/[ \t]+#+[ \t]*$/u, "").trim();
|
|
9926
|
+
return text2 === "" ? line.trim() : text2;
|
|
9927
|
+
}
|
|
9928
|
+
function headingSections(lines) {
|
|
9929
|
+
const sections2 = new Map;
|
|
9930
|
+
let fenced = false;
|
|
9931
|
+
let current = null;
|
|
9932
|
+
const close = () => {
|
|
9933
|
+
if (current === null)
|
|
9934
|
+
return;
|
|
9935
|
+
sections2.set(current.key, [...sections2.get(current.key) ?? [], current.lines.join(`
|
|
9936
|
+
`)]);
|
|
9937
|
+
};
|
|
9938
|
+
for (const line of lines) {
|
|
9939
|
+
if (FENCE3.test(line))
|
|
9940
|
+
fenced = !fenced;
|
|
9941
|
+
if (fenced || !HEADING2.test(line)) {
|
|
9942
|
+
current?.lines.push(line);
|
|
9943
|
+
continue;
|
|
9944
|
+
}
|
|
9945
|
+
close();
|
|
9946
|
+
current = { key: line.trim(), lines: [] };
|
|
9947
|
+
}
|
|
9948
|
+
close();
|
|
9949
|
+
return sections2;
|
|
9950
|
+
}
|
|
9951
|
+
function changedHeadings(before, after) {
|
|
9952
|
+
const old = headingSections(before);
|
|
9953
|
+
const now = headingSections(after);
|
|
9954
|
+
const keys = [...now.keys(), ...[...old.keys()].filter((key) => !now.has(key))];
|
|
9955
|
+
const changed = keys.filter((key) => JSON.stringify(old.get(key) ?? []) !== JSON.stringify(now.get(key) ?? []));
|
|
9956
|
+
return [...new Set(changed.map(headingName))];
|
|
9957
|
+
}
|
|
9958
|
+
function bodyChangeLine(before, after) {
|
|
9959
|
+
const old = before.split(`
|
|
9960
|
+
`);
|
|
9961
|
+
const now = after.split(`
|
|
9962
|
+
`);
|
|
9963
|
+
const common = commonLines(old, now);
|
|
9964
|
+
const headings = changedHeadings(old, now);
|
|
9965
|
+
const clause = headings.length === 0 ? "no heading changed" : `headings changed: ${headings.join(", ")}`;
|
|
9966
|
+
return `issue body: +${String(now.length - common)} -${String(old.length - common)} lines; ${clause}`;
|
|
9967
|
+
}
|
|
9968
|
+
function notesChangeLine(path2) {
|
|
9969
|
+
return `local notes: ${path2} changed since the saved copy`;
|
|
9970
|
+
}
|
|
9971
|
+
function rulesChangeLine(rules) {
|
|
9972
|
+
return rules === null ? RULES_REMOVED_LINE : `stretch rules: ${rules.path} changed since the saved copy`;
|
|
9973
|
+
}
|
|
9974
|
+
function savedParts(saved) {
|
|
9975
|
+
const rulesAt = saved.lastIndexOf(RULES_SEPARATOR);
|
|
9976
|
+
const head = rulesAt === -1 ? saved : saved.slice(0, rulesAt);
|
|
9977
|
+
const rules = rulesAt === -1 ? "" : localText(saved.slice(rulesAt + RULES_SEPARATOR.length));
|
|
9978
|
+
const notesAt = head.lastIndexOf(NOTES_SEPARATOR);
|
|
9979
|
+
return {
|
|
9980
|
+
body: notesAt === -1 ? head : head.slice(0, notesAt),
|
|
9981
|
+
notes: notesAt === -1 ? "" : localText(head.slice(notesAt + NOTES_SEPARATOR.length)),
|
|
9982
|
+
rules
|
|
9983
|
+
};
|
|
9984
|
+
}
|
|
9985
|
+
function tailParts(saved, now) {
|
|
9986
|
+
if (saved === `${now}
|
|
9987
|
+
`)
|
|
9988
|
+
return { notes: "", rules: "" };
|
|
9989
|
+
if (!saved.startsWith(now))
|
|
9990
|
+
return null;
|
|
9991
|
+
const tail = saved.slice(now.length);
|
|
9992
|
+
if (tail.startsWith(RULES_SEPARATOR))
|
|
9993
|
+
return { notes: "", rules: localText(tail.slice(RULES_SEPARATOR.length)) };
|
|
9994
|
+
if (!tail.startsWith(NOTES_SEPARATOR))
|
|
9995
|
+
return null;
|
|
9996
|
+
const rest = tail.slice(NOTES_SEPARATOR.length);
|
|
9997
|
+
const rulesAt = rest.lastIndexOf(RULES_SEPARATOR);
|
|
9998
|
+
return rulesAt === -1 ? { notes: localText(rest), rules: "" } : {
|
|
9999
|
+
notes: localText(rest.slice(0, rulesAt)),
|
|
10000
|
+
rules: localText(rest.slice(rulesAt + RULES_SEPARATOR.length))
|
|
10001
|
+
};
|
|
10002
|
+
}
|
|
10003
|
+
function localChangeLine(old, now, options) {
|
|
10004
|
+
const clauses = [
|
|
10005
|
+
old.notes === now.notes ? null : notesChangeLine(options.notesPath),
|
|
10006
|
+
old.rules === now.rules ? null : rulesChangeLine(options.rules ?? null)
|
|
10007
|
+
].filter((clause) => clause !== null);
|
|
10008
|
+
return clauses.length === 0 ? null : clauses.join("; ");
|
|
10009
|
+
}
|
|
10010
|
+
function readSnapshotChange(options) {
|
|
10011
|
+
const { body, notes } = options;
|
|
10012
|
+
const rules = options.rules ?? null;
|
|
10013
|
+
const saved = readRefsBlock(options.saved).body;
|
|
10014
|
+
if (saved === snapshotText(body, notes, rules?.text ?? null)) {
|
|
10015
|
+
return { kind: "unchanged", bodyLine: null, notesLine: null };
|
|
10016
|
+
}
|
|
10017
|
+
const now = normalise2(body);
|
|
10018
|
+
const local = { notes: localText(notes), rules: localText(rules?.text ?? null) };
|
|
10019
|
+
const tail = tailParts(saved, now);
|
|
10020
|
+
if (tail !== null) {
|
|
10021
|
+
const notesLine2 = localChangeLine(tail, local, options) ?? notesChangeLine(options.notesPath);
|
|
10022
|
+
return { kind: "notes", bodyLine: null, notesLine: notesLine2 };
|
|
10023
|
+
}
|
|
10024
|
+
const old = savedParts(saved);
|
|
10025
|
+
const bodyLine = bodyChangeLine(normalise2(old.body), now);
|
|
10026
|
+
const notesLine = localChangeLine(old, local, options);
|
|
10027
|
+
return notesLine === null ? { kind: "body", bodyLine, notesLine: null } : { kind: "both", bodyLine, notesLine };
|
|
10028
|
+
}
|
|
10029
|
+
var LOCAL_NOTES_HEADING = "## Local notes", STRETCH_RULES_HEADING = "## Stretch rules", RULES_REMOVED_LINE = "stretch rules: the saved copy holds rules, and this run was handed no rules file", NOTES_SEPARATOR, RULES_SEPARATOR, HEADING2, FENCE3;
|
|
10030
|
+
var init_snapshot_change = __esm(() => {
|
|
10031
|
+
init_stamp();
|
|
10032
|
+
NOTES_SEPARATOR = `
|
|
10033
|
+
|
|
10034
|
+
${LOCAL_NOTES_HEADING}
|
|
10035
|
+
|
|
10036
|
+
`;
|
|
10037
|
+
RULES_SEPARATOR = `
|
|
10038
|
+
|
|
10039
|
+
${STRETCH_RULES_HEADING}
|
|
10040
|
+
|
|
10041
|
+
`;
|
|
10042
|
+
HEADING2 = /^#{1,6}(?:[ \t]|$)/u;
|
|
10043
|
+
FENCE3 = /^ {0,3}(?:`{3,}|~{3,})/u;
|
|
10044
|
+
});
|
|
10045
|
+
|
|
9888
10046
|
// packages/rafa-board/src/board/issue.ts
|
|
9889
10047
|
import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync5, statSync as statSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
9890
10048
|
import { dirname as dirname7, resolve as resolve8 } from "path";
|
|
@@ -9972,98 +10130,6 @@ function requireSpecIssue(issue) {
|
|
|
9972
10130
|
throw new CommandExit(ISSUE_REFUSAL_EXIT, missingSpecLabelMessage(issue.number));
|
|
9973
10131
|
}
|
|
9974
10132
|
}
|
|
9975
|
-
function normalise2(text2) {
|
|
9976
|
-
return text2.replace(/\r\n?/gu, `
|
|
9977
|
-
`).replace(/\n+$/u, "");
|
|
9978
|
-
}
|
|
9979
|
-
function snapshotText(body, notes) {
|
|
9980
|
-
const local = notes === null ? "" : normalise2(notes).trim();
|
|
9981
|
-
const sections2 = [
|
|
9982
|
-
normalise2(body),
|
|
9983
|
-
local === "" ? "" : `${LOCAL_NOTES_HEADING}
|
|
9984
|
-
|
|
9985
|
-
${local}`
|
|
9986
|
-
].filter((section) => section !== "");
|
|
9987
|
-
return `${sections2.join(`
|
|
9988
|
-
|
|
9989
|
-
`)}
|
|
9990
|
-
`;
|
|
9991
|
-
}
|
|
9992
|
-
function commonLines(before, after) {
|
|
9993
|
-
let previous = new Uint32Array(after.length + 1);
|
|
9994
|
-
for (const line of before) {
|
|
9995
|
-
const row = new Uint32Array(after.length + 1);
|
|
9996
|
-
after.forEach((other, index) => {
|
|
9997
|
-
row[index + 1] = line === other ? (previous[index] ?? 0) + 1 : Math.max(previous[index + 1] ?? 0, row[index] ?? 0);
|
|
9998
|
-
});
|
|
9999
|
-
previous = row;
|
|
10000
|
-
}
|
|
10001
|
-
return previous[after.length] ?? 0;
|
|
10002
|
-
}
|
|
10003
|
-
function headingName(line) {
|
|
10004
|
-
const text2 = line.replace(/^#+/u, "").replace(/[ \t]+#+[ \t]*$/u, "").trim();
|
|
10005
|
-
return text2 === "" ? line.trim() : text2;
|
|
10006
|
-
}
|
|
10007
|
-
function headingSections(lines) {
|
|
10008
|
-
const sections2 = new Map;
|
|
10009
|
-
let fenced = false;
|
|
10010
|
-
let current = null;
|
|
10011
|
-
const close = () => {
|
|
10012
|
-
if (current === null)
|
|
10013
|
-
return;
|
|
10014
|
-
sections2.set(current.key, [...sections2.get(current.key) ?? [], current.lines.join(`
|
|
10015
|
-
`)]);
|
|
10016
|
-
};
|
|
10017
|
-
for (const line of lines) {
|
|
10018
|
-
if (FENCE3.test(line))
|
|
10019
|
-
fenced = !fenced;
|
|
10020
|
-
if (fenced || !HEADING2.test(line)) {
|
|
10021
|
-
current?.lines.push(line);
|
|
10022
|
-
continue;
|
|
10023
|
-
}
|
|
10024
|
-
close();
|
|
10025
|
-
current = { key: line.trim(), lines: [] };
|
|
10026
|
-
}
|
|
10027
|
-
close();
|
|
10028
|
-
return sections2;
|
|
10029
|
-
}
|
|
10030
|
-
function changedHeadings(before, after) {
|
|
10031
|
-
const old = headingSections(before);
|
|
10032
|
-
const now = headingSections(after);
|
|
10033
|
-
const keys = [...now.keys(), ...[...old.keys()].filter((key) => !now.has(key))];
|
|
10034
|
-
const changed = keys.filter((key) => JSON.stringify(old.get(key) ?? []) !== JSON.stringify(now.get(key) ?? []));
|
|
10035
|
-
return [...new Set(changed.map(headingName))];
|
|
10036
|
-
}
|
|
10037
|
-
function bodyChangeLine(before, after) {
|
|
10038
|
-
const old = before.split(`
|
|
10039
|
-
`);
|
|
10040
|
-
const now = after.split(`
|
|
10041
|
-
`);
|
|
10042
|
-
const common = commonLines(old, now);
|
|
10043
|
-
const headings = changedHeadings(old, now);
|
|
10044
|
-
const clause = headings.length === 0 ? "no heading changed" : `headings changed: ${headings.join(", ")}`;
|
|
10045
|
-
return `issue body: +${String(now.length - common)} -${String(old.length - common)} lines; ${clause}`;
|
|
10046
|
-
}
|
|
10047
|
-
function notesChangeLine(path2) {
|
|
10048
|
-
return `local notes: ${path2} changed since the saved copy`;
|
|
10049
|
-
}
|
|
10050
|
-
function readSnapshotChange(options) {
|
|
10051
|
-
const { body, notes, notesPath: path2 } = options;
|
|
10052
|
-
const saved = readRefsBlock(options.saved).body;
|
|
10053
|
-
if (saved === snapshotText(body, notes))
|
|
10054
|
-
return { kind: "unchanged", bodyLine: null, notesLine: null };
|
|
10055
|
-
const now = normalise2(body);
|
|
10056
|
-
if (saved === `${now}
|
|
10057
|
-
` || saved.startsWith(`${now}${NOTES_SEPARATOR}`)) {
|
|
10058
|
-
return { kind: "notes", bodyLine: null, notesLine: notesChangeLine(path2) };
|
|
10059
|
-
}
|
|
10060
|
-
const split = saved.lastIndexOf(NOTES_SEPARATOR);
|
|
10061
|
-
const oldBody = split === -1 ? saved : saved.slice(0, split);
|
|
10062
|
-
const oldNotes = split === -1 ? "" : normalise2(saved.slice(split + NOTES_SEPARATOR.length)).trim();
|
|
10063
|
-
const newNotes = notes === null ? "" : normalise2(notes).trim();
|
|
10064
|
-
const bodyLine = bodyChangeLine(normalise2(oldBody), now);
|
|
10065
|
-
return oldNotes === newNotes ? { kind: "body", bodyLine, notesLine: null } : { kind: "both", bodyLine, notesLine: notesChangeLine(path2) };
|
|
10066
|
-
}
|
|
10067
10133
|
function readIfFile(file, what) {
|
|
10068
10134
|
if (!existsSync5(file))
|
|
10069
10135
|
return null;
|
|
@@ -10087,6 +10153,7 @@ function notesCollisionMessage(path2, issue) {
|
|
|
10087
10153
|
}
|
|
10088
10154
|
function writeSpecSnapshot(options) {
|
|
10089
10155
|
const { repoRoot, specsDir, issue, refresh } = options;
|
|
10156
|
+
const rules = options.rules ?? null;
|
|
10090
10157
|
const path2 = specPath(specsDir, issue.number, issue.title);
|
|
10091
10158
|
const notes = notesPath(specsDir, issue.number);
|
|
10092
10159
|
if (path2 === notes) {
|
|
@@ -10095,16 +10162,17 @@ function writeSpecSnapshot(options) {
|
|
|
10095
10162
|
const local = readLocalNotes(repoRoot, specsDir, issue.number);
|
|
10096
10163
|
const absolute = resolve8(repoRoot, path2);
|
|
10097
10164
|
const existing = readIfFile(absolute, "the spec snapshot");
|
|
10098
|
-
const text2 = carryRefsBlock(existing, snapshotText(issue.body, local));
|
|
10165
|
+
const text2 = carryRefsBlock(existing, snapshotText(issue.body, local, rules?.text ?? null));
|
|
10099
10166
|
const written2 = {
|
|
10100
10167
|
path: path2,
|
|
10101
10168
|
absolute,
|
|
10102
10169
|
action: "created",
|
|
10103
10170
|
notes: local === null ? null : notes,
|
|
10171
|
+
rules: rules?.path ?? null,
|
|
10104
10172
|
previous: null,
|
|
10105
10173
|
text: text2
|
|
10106
10174
|
};
|
|
10107
|
-
const action = rewriteAction(existing, issue.body, local, notes, refresh);
|
|
10175
|
+
const action = rewriteAction(existing, { body: issue.body, notes: local, notesPath: notes, rules }, refresh);
|
|
10108
10176
|
if (action === "unchanged")
|
|
10109
10177
|
return { ...written2, action, text: existing ?? text2 };
|
|
10110
10178
|
if (action === null) {
|
|
@@ -10119,30 +10187,24 @@ function writeSpecSnapshot(options) {
|
|
|
10119
10187
|
}
|
|
10120
10188
|
return { ...written2, action, previous };
|
|
10121
10189
|
}
|
|
10122
|
-
function rewriteAction(existing,
|
|
10190
|
+
function rewriteAction(existing, now, refresh) {
|
|
10123
10191
|
if (existing === null)
|
|
10124
10192
|
return "created";
|
|
10125
|
-
const { kind } = readSnapshotChange({ saved: existing
|
|
10193
|
+
const { kind } = readSnapshotChange({ ...now, saved: existing });
|
|
10126
10194
|
if (kind === "unchanged")
|
|
10127
10195
|
return "unchanged";
|
|
10128
10196
|
if (kind === "notes")
|
|
10129
10197
|
return "notes-rebuilt";
|
|
10130
10198
|
return refresh ? "refreshed" : null;
|
|
10131
10199
|
}
|
|
10132
|
-
var PREFIX17 = "board issue", ISSUE_VIEW_FIELDS = "number,title,body,state,labels,author", SPEC_LABEL = "type:spec", ISSUE_REFUSAL_EXIT = 2
|
|
10200
|
+
var PREFIX17 = "board issue", ISSUE_VIEW_FIELDS = "number,title,body,state,labels,author", SPEC_LABEL = "type:spec", ISSUE_REFUSAL_EXIT = 2;
|
|
10133
10201
|
var init_issue = __esm(() => {
|
|
10134
10202
|
init_naming();
|
|
10135
10203
|
init_command2();
|
|
10136
10204
|
init_sections();
|
|
10137
10205
|
init_stamp();
|
|
10138
10206
|
init_previous_copy();
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
${LOCAL_NOTES_HEADING}
|
|
10142
|
-
|
|
10143
|
-
`;
|
|
10144
|
-
HEADING2 = /^#{1,6}(?:[ \t]|$)/u;
|
|
10145
|
-
FENCE3 = /^ {0,3}(?:`{3,}|~{3,})/u;
|
|
10207
|
+
init_snapshot_change();
|
|
10146
10208
|
});
|
|
10147
10209
|
|
|
10148
10210
|
// packages/rafa-board/src/board/setup-parts.ts
|
|
@@ -15599,6 +15661,9 @@ function refreshQuestion(issue, savedAt) {
|
|
|
15599
15661
|
function notesRebuiltLine(path2, issue, previous) {
|
|
15600
15662
|
return `local notes changed; rebuilt ${path2} from issue #${String(issue)} and the notes,` + ` the old copy is at ${previous}`;
|
|
15601
15663
|
}
|
|
15664
|
+
function stretchRulesLine(rules, path2) {
|
|
15665
|
+
return `stretch rules: appended ${rules} to ${path2}`;
|
|
15666
|
+
}
|
|
15602
15667
|
function readSavedCopy(absolute, path2) {
|
|
15603
15668
|
if (!existsSync9(absolute))
|
|
15604
15669
|
return null;
|
|
@@ -15618,8 +15683,22 @@ function printChange(change, output) {
|
|
|
15618
15683
|
}
|
|
15619
15684
|
}
|
|
15620
15685
|
async function settleSpecSnapshot(options) {
|
|
15686
|
+
const { output } = options;
|
|
15687
|
+
const rules = options.rules ?? null;
|
|
15688
|
+
const written5 = await settle2(options, rules);
|
|
15689
|
+
if (rules !== null && rules.text.trim() !== "")
|
|
15690
|
+
output.info(stretchRulesLine(rules.path, written5.path));
|
|
15691
|
+
return written5;
|
|
15692
|
+
}
|
|
15693
|
+
async function settle2(options, rules) {
|
|
15621
15694
|
const { repoRoot, specsDir, issue, refresh, output } = options;
|
|
15622
|
-
const write2 = (rewrite) => writeSpecSnapshot({
|
|
15695
|
+
const write2 = (rewrite) => writeSpecSnapshot({
|
|
15696
|
+
repoRoot,
|
|
15697
|
+
specsDir,
|
|
15698
|
+
issue,
|
|
15699
|
+
refresh: rewrite,
|
|
15700
|
+
...rules === null ? {} : { rules }
|
|
15701
|
+
});
|
|
15623
15702
|
const path2 = specPath(specsDir, issue.number, issue.title);
|
|
15624
15703
|
const notes = notesPath(specsDir, issue.number);
|
|
15625
15704
|
if (path2 === notes)
|
|
@@ -15631,7 +15710,8 @@ async function settleSpecSnapshot(options) {
|
|
|
15631
15710
|
saved: saved.text,
|
|
15632
15711
|
body: issue.body,
|
|
15633
15712
|
notes: readLocalNotes(repoRoot, specsDir, issue.number),
|
|
15634
|
-
notesPath: notes
|
|
15713
|
+
notesPath: notes,
|
|
15714
|
+
rules
|
|
15635
15715
|
});
|
|
15636
15716
|
if (change.kind === "unchanged")
|
|
15637
15717
|
return write2(refresh);
|
|
@@ -16042,8 +16122,9 @@ function readSpecSourceFlags(args) {
|
|
|
16042
16122
|
function describeIssue(issue) {
|
|
16043
16123
|
return `issue #${String(issue.number)} "${issue.title}"`;
|
|
16044
16124
|
}
|
|
16045
|
-
function dryRunLine(what) {
|
|
16046
|
-
|
|
16125
|
+
function dryRunLine(what, rules = null) {
|
|
16126
|
+
const appended2 = rules === null ? "" : `, appending the stretch rules of ${rules}`;
|
|
16127
|
+
return `\uD83D\uDD0E ${DRY_RUN_FLAG}: would plan from ${what}${appended2}. Nothing was written.`;
|
|
16047
16128
|
}
|
|
16048
16129
|
function requireRoadmapSeams(seams) {
|
|
16049
16130
|
if (seams === undefined) {
|
|
@@ -16051,6 +16132,9 @@ function requireRoadmapSeams(seams) {
|
|
|
16051
16132
|
}
|
|
16052
16133
|
return seams;
|
|
16053
16134
|
}
|
|
16135
|
+
function appendedRules(rules) {
|
|
16136
|
+
return rules === null || rules.text.trim() === "" ? null : rules;
|
|
16137
|
+
}
|
|
16054
16138
|
function stopped(reason) {
|
|
16055
16139
|
return Object.freeze({ outcome: "stopped", reason });
|
|
16056
16140
|
}
|
|
@@ -16113,8 +16197,9 @@ async function resolveSpecSource(options) {
|
|
|
16113
16197
|
const read = await issues(number);
|
|
16114
16198
|
requireSpecIssue(read);
|
|
16115
16199
|
await options.inspect?.(read);
|
|
16200
|
+
const rules = options.rules ?? null;
|
|
16116
16201
|
if (dryRun) {
|
|
16117
|
-
output.info(dryRunLine(describeIssue(read)));
|
|
16202
|
+
output.info(dryRunLine(describeIssue(read), appendedRules(rules)?.path ?? null));
|
|
16118
16203
|
return stopped("dry-run");
|
|
16119
16204
|
}
|
|
16120
16205
|
const snapshot = await settleSpecSnapshot({
|
|
@@ -16123,7 +16208,8 @@ async function resolveSpecSource(options) {
|
|
|
16123
16208
|
issue: read,
|
|
16124
16209
|
refresh,
|
|
16125
16210
|
offerRefresh: options.offerRefresh ?? null,
|
|
16126
|
-
output
|
|
16211
|
+
output,
|
|
16212
|
+
...rules === null ? {} : { rules }
|
|
16127
16213
|
});
|
|
16128
16214
|
return Object.freeze({
|
|
16129
16215
|
outcome: "spec",
|
|
@@ -16235,7 +16321,8 @@ async function resolvePlanSpec(options) {
|
|
|
16235
16321
|
...options.passOver === undefined ? {} : { passOver: options.passOver },
|
|
16236
16322
|
...options.branchTemplate === undefined ? {} : { branchTemplate: options.branchTemplate }
|
|
16237
16323
|
},
|
|
16238
|
-
output
|
|
16324
|
+
output,
|
|
16325
|
+
...options.rules === undefined || options.rules === null ? {} : { rules: options.rules }
|
|
16239
16326
|
});
|
|
16240
16327
|
if (resolution.outcome === "stopped") {
|
|
16241
16328
|
return Object.freeze({ outcome: "stopped", reason: resolution.reason });
|
|
@@ -27954,8 +28041,8 @@ function classifySkill(source) {
|
|
|
27954
28041
|
return decide("learned-without-origin", `a ${LEARNED_DIRECTORY}/ file whose frontmatter carries no ${ORIGIN_FIELD}`);
|
|
27955
28042
|
}
|
|
27956
28043
|
const sections2 = bodySections(document.body);
|
|
27957
|
-
const problems = sections2.filter((
|
|
27958
|
-
const solutions = sections2.filter((
|
|
28044
|
+
const problems = sections2.filter((section2) => PROBLEM_HEADING.test(section2.title));
|
|
28045
|
+
const solutions = sections2.filter((section2) => SOLUTION_HEADING.test(section2.title));
|
|
27959
28046
|
if (problems.length === 0 || solutions.length === 0) {
|
|
27960
28047
|
return decide("no-section-pair", pairReason(problems.length, solutions.length));
|
|
27961
28048
|
}
|
|
@@ -27973,7 +28060,7 @@ function classifySkill(source) {
|
|
|
27973
28060
|
return decide("observation-shape", "one Problem section and one Solution section, no numbered procedure of " + `${PROCEDURE_STEP_MINIMUM} or more consecutive steps, and no referenced script`);
|
|
27974
28061
|
}
|
|
27975
28062
|
function firstSection(sections2, heading) {
|
|
27976
|
-
return sections2.find((
|
|
28063
|
+
return sections2.find((section2) => heading.test(section2.title));
|
|
27977
28064
|
}
|
|
27978
28065
|
function withoutFences(text2) {
|
|
27979
28066
|
const kept = [];
|
|
@@ -28195,8 +28282,8 @@ function eccStack(directory2) {
|
|
|
28195
28282
|
return stacks.length > 0 ? stacks : null;
|
|
28196
28283
|
}
|
|
28197
28284
|
function triggerSentence(body) {
|
|
28198
|
-
const
|
|
28199
|
-
return
|
|
28285
|
+
const section2 = bodySections(body).find((entry) => WHEN_TO_USE_HEADING.test(entry.title));
|
|
28286
|
+
return section2 === undefined ? "" : firstSentence(section2.text);
|
|
28200
28287
|
}
|
|
28201
28288
|
function trimWhenToUse(description, whenToUse) {
|
|
28202
28289
|
const budget = LISTING_LIMIT - 1 - countCharacters(description);
|
|
@@ -30511,7 +30598,7 @@ function renderShowView(view) {
|
|
|
30511
30598
|
othersLines(view),
|
|
30512
30599
|
...view.text === null ? [frontmatterLines(view), headingLines(view)] : [fileLines(view, view.text)]
|
|
30513
30600
|
];
|
|
30514
|
-
return sections2.flatMap((
|
|
30601
|
+
return sections2.flatMap((section2, index) => index === 0 ? section2 : ["", ...section2]);
|
|
30515
30602
|
}
|
|
30516
30603
|
var FENCE5, ATX_HEADING;
|
|
30517
30604
|
var init_show = __esm(() => {
|
|
@@ -36046,19 +36133,19 @@ function sortedBody(body) {
|
|
|
36046
36133
|
const { lead, sections: sections2 } = sectionsOf(body);
|
|
36047
36134
|
const fields = new Map;
|
|
36048
36135
|
const others = [];
|
|
36049
|
-
for (const
|
|
36050
|
-
const field5 = fieldOf3(
|
|
36136
|
+
for (const section2 of sections2) {
|
|
36137
|
+
const field5 = fieldOf3(section2.heading);
|
|
36051
36138
|
if (field5 === undefined || fields.has(field5.key))
|
|
36052
|
-
others.push(
|
|
36139
|
+
others.push(section2);
|
|
36053
36140
|
else
|
|
36054
|
-
fields.set(field5.key,
|
|
36141
|
+
fields.set(field5.key, section2);
|
|
36055
36142
|
}
|
|
36056
36143
|
return { lead: trimmedLines(lead).join(`
|
|
36057
36144
|
`), fields, others };
|
|
36058
36145
|
}
|
|
36059
36146
|
function fieldValue(sorted, key) {
|
|
36060
|
-
const
|
|
36061
|
-
return
|
|
36147
|
+
const section2 = sorted.fields.get(key);
|
|
36148
|
+
return section2 === undefined ? null : valueOf3(section2.lines);
|
|
36062
36149
|
}
|
|
36063
36150
|
function hasBugSections(body) {
|
|
36064
36151
|
return sortedBody(body).fields.size > 0;
|
|
@@ -36068,9 +36155,9 @@ function parseBugRecord(body) {
|
|
|
36068
36155
|
const read = Object.fromEntries(BUG_FIELDS.map(({ key }) => [key, fieldValue(sorted, key)]));
|
|
36069
36156
|
return read.what === null && sorted.lead !== "" ? { ...read, what: sorted.lead } : read;
|
|
36070
36157
|
}
|
|
36071
|
-
function writtenSection(
|
|
36072
|
-
const kept = trimmedLines(
|
|
36073
|
-
return kept.length === 0 ?
|
|
36158
|
+
function writtenSection(section2) {
|
|
36159
|
+
const kept = trimmedLines(section2.lines);
|
|
36160
|
+
return kept.length === 0 ? section2.written : [section2.written, "", ...kept].join(`
|
|
36074
36161
|
`);
|
|
36075
36162
|
}
|
|
36076
36163
|
function otherSections(body) {
|
|
@@ -36170,8 +36257,8 @@ function boundaryProblems(field5, value, vocabulary) {
|
|
|
36170
36257
|
function environmentProblems(environment, environments) {
|
|
36171
36258
|
if (!hasText2(environment))
|
|
36172
36259
|
return ["environment is missing: pass --env=<place>"];
|
|
36173
|
-
const
|
|
36174
|
-
return
|
|
36260
|
+
const accepted3 = [...environments, UNKNOWN_VALUE];
|
|
36261
|
+
return accepted3.includes(environment) ? [] : [`environment is ${JSON.stringify(environment)}, expected one of: ${accepted3.join(", ")}`];
|
|
36175
36262
|
}
|
|
36176
36263
|
function bugProblems(record2, rules) {
|
|
36177
36264
|
const summary = summaryProblems(record2.summary, rules.summaryMax);
|
|
@@ -36474,11 +36561,11 @@ var init_stack_path = __esm(() => {
|
|
|
36474
36561
|
});
|
|
36475
36562
|
|
|
36476
36563
|
// packages/rafa/src/config-schema-issues.ts
|
|
36477
|
-
function
|
|
36564
|
+
function accepted3(value) {
|
|
36478
36565
|
return { value, problems: [], extras: [] };
|
|
36479
36566
|
}
|
|
36480
36567
|
function nameOf2(shape, reserved, expected2) {
|
|
36481
|
-
return (raw, at) => typeof raw === "string" && shape.test(raw) && !reserved.includes(raw) ?
|
|
36568
|
+
return (raw, at) => typeof raw === "string" && shape.test(raw) && !reserved.includes(raw) ? accepted3(raw) : refused(at, raw, expected2);
|
|
36482
36569
|
}
|
|
36483
36570
|
function bugRulesOf(config) {
|
|
36484
36571
|
return {
|
|
@@ -36494,8 +36581,8 @@ var SUMMARY_MAX_DEFAULT = 80, SUMMARY_MAX_FLOOR = 20, SUMMARY_MAX_CEILING = 120,
|
|
|
36494
36581
|
if (typeof raw !== "string" || raw.trim() === "")
|
|
36495
36582
|
return refused(at, raw, TEMPLATE_EXPECTED);
|
|
36496
36583
|
const problem = templateProblem(raw);
|
|
36497
|
-
return problem === null ?
|
|
36498
|
-
}, summaryMax = (raw, at) => typeof raw === "number" && Number.isSafeInteger(raw) && raw >= SUMMARY_MAX_FLOOR && raw <= SUMMARY_MAX_CEILING ?
|
|
36584
|
+
return problem === null ? accepted3(raw) : refused(at, raw, `${TEMPLATE_EXPECTED}: ${problem}`);
|
|
36585
|
+
}, summaryMax = (raw, at) => typeof raw === "number" && Number.isSafeInteger(raw) && raw >= SUMMARY_MAX_FLOOR && raw <= SUMMARY_MAX_CEILING ? accepted3(raw) : refused(at, raw, `a whole number from ${SUMMARY_MAX_FLOOR} to ${SUMMARY_MAX_CEILING}`), place, moduleName, actionName, ISSUES_DEFAULTS, ISSUES_SETTINGS, ISSUES_SECTION;
|
|
36499
36586
|
var init_config_schema_issues = __esm(() => {
|
|
36500
36587
|
init_places();
|
|
36501
36588
|
init_title();
|
|
@@ -36992,9 +37079,9 @@ function accept2(services) {
|
|
|
36992
37079
|
});
|
|
36993
37080
|
}
|
|
36994
37081
|
function registerServices(services) {
|
|
36995
|
-
const
|
|
37082
|
+
const accepted4 = accept2(services);
|
|
36996
37083
|
const previous = active5;
|
|
36997
|
-
active5 =
|
|
37084
|
+
active5 = accepted4;
|
|
36998
37085
|
return previous;
|
|
36999
37086
|
}
|
|
37000
37087
|
function restoreServices(previous) {
|
|
@@ -40642,8 +40729,8 @@ async function weighResults(run, epic, ran) {
|
|
|
40642
40729
|
throw new CommandExit(EPIC_CLOSE_REFUSAL_EXIT, `\u274C Epic ${ref11(epic)} was not closed: against ${ran.commit}, ${parts.join(", and ")}.`);
|
|
40643
40730
|
}
|
|
40644
40731
|
async function closeWithComment(run, epic, passed2, unchecked) {
|
|
40645
|
-
const
|
|
40646
|
-
const comment = renderCloseComment({ passed: passed2.map((result2) => result2.check.criterion.text), unchecked:
|
|
40732
|
+
const accepted4 = unchecked.map((verdict) => Object.freeze({ criterion: verdict.criterion.text, reason: verdict.reason }));
|
|
40733
|
+
const comment = renderCloseComment({ passed: passed2.map((result2) => result2.check.criterion.text), unchecked: accepted4 });
|
|
40647
40734
|
const gh = run.seams.gh ?? createGhRunner({ cwd: run.root });
|
|
40648
40735
|
try {
|
|
40649
40736
|
await createGhIssueBoard({ gh }).closeIssue(epic, "completed", comment);
|
|
@@ -40651,7 +40738,7 @@ async function closeWithComment(run, epic, passed2, unchecked) {
|
|
|
40651
40738
|
throw new CommandExit(1, `\u274C Every check passed, but epic ${ref11(epic)} could not be closed: ${messageOf(error2)}
|
|
40652
40739
|
` + "Close it as completed by hand, or run the close again.");
|
|
40653
40740
|
}
|
|
40654
|
-
return Object.freeze(
|
|
40741
|
+
return Object.freeze(accepted4);
|
|
40655
40742
|
}
|
|
40656
40743
|
function printCost(run, target) {
|
|
40657
40744
|
try {
|
|
@@ -40706,16 +40793,16 @@ async function closeEpic(context, seams) {
|
|
|
40706
40793
|
throw new CommandExit(1, `\u274C The checks for epic ${ref11(epic)} could not run: ${outcome2.step.command} failed: ${outcome2.step.said}; the epic stays open`);
|
|
40707
40794
|
}
|
|
40708
40795
|
const passed2 = outcome2.status === "ran" ? await weighResults(run, epic, outcome2) : [];
|
|
40709
|
-
const
|
|
40796
|
+
const accepted4 = await closeWithComment(run, epic, passed2, unchecked);
|
|
40710
40797
|
const commit = outcome2.status === "ran" ? outcome2.commit : null;
|
|
40711
|
-
say(run, `Closed epic ${ref11(epic)} as completed: ${criteria(passed2.length)} passed${commit === null ? "" : ` against ${commit}`}${
|
|
40798
|
+
say(run, `Closed epic ${ref11(epic)} as completed: ${criteria(passed2.length)} passed${commit === null ? "" : ` against ${commit}`}${accepted4.length === 0 ? "" : `, ${criteria(accepted4.length)} closed over with --${ACCEPT_UNCHECKED_FLAG}`}.`);
|
|
40712
40799
|
const cost = printCost(run, target);
|
|
40713
40800
|
return Object.freeze({
|
|
40714
40801
|
status: "closed",
|
|
40715
40802
|
epic,
|
|
40716
40803
|
commit,
|
|
40717
40804
|
passed: passed2.map((result2) => result2.check.criterion.number),
|
|
40718
|
-
unchecked:
|
|
40805
|
+
unchecked: accepted4,
|
|
40719
40806
|
cost,
|
|
40720
40807
|
estimate: target.body.estimate
|
|
40721
40808
|
});
|
|
@@ -41548,6 +41635,12 @@ function readTags(git) {
|
|
|
41548
41635
|
const tags = releaseTagsOf(result2.stdout);
|
|
41549
41636
|
return { tags, latest: tags.find((tag) => tag.package === null) ?? null, problem: null };
|
|
41550
41637
|
}
|
|
41638
|
+
function newestRootRelease(git) {
|
|
41639
|
+
const reading2 = readTags(git);
|
|
41640
|
+
if (reading2.problem !== null)
|
|
41641
|
+
return;
|
|
41642
|
+
return reading2.latest?.version ?? null;
|
|
41643
|
+
}
|
|
41551
41644
|
function readUntagged(root, configured, tags) {
|
|
41552
41645
|
const resolved = join59(root, configured);
|
|
41553
41646
|
const text2 = textOf(resolved);
|
|
@@ -41619,7 +41712,7 @@ function changelogSections(text2) {
|
|
|
41619
41712
|
return sections2;
|
|
41620
41713
|
}
|
|
41621
41714
|
function adoptionBoundary(sections2) {
|
|
41622
|
-
const receipted = sections2.map((
|
|
41715
|
+
const receipted = sections2.map((section2) => section2.receipt !== null);
|
|
41623
41716
|
const oldest = receipted.lastIndexOf(true);
|
|
41624
41717
|
if (oldest === -1)
|
|
41625
41718
|
return { adopted: false, version: null };
|
|
@@ -41636,11 +41729,11 @@ function atOrBelow(version2, boundary) {
|
|
|
41636
41729
|
}
|
|
41637
41730
|
function checkReceipt(text2, version2) {
|
|
41638
41731
|
const sections2 = changelogSections(text2);
|
|
41639
|
-
const
|
|
41640
|
-
if (
|
|
41732
|
+
const section2 = sections2.find((each) => each.version === version2);
|
|
41733
|
+
if (section2 === undefined)
|
|
41641
41734
|
return { kind: "absent" };
|
|
41642
|
-
if (
|
|
41643
|
-
return { kind: "receipted", ids:
|
|
41735
|
+
if (section2.receipt !== null)
|
|
41736
|
+
return { kind: "receipted", ids: section2.receipt };
|
|
41644
41737
|
const boundary = adoptionBoundary(sections2);
|
|
41645
41738
|
if (!boundary.adopted || atOrBelow(version2, boundary.version))
|
|
41646
41739
|
return { kind: "legacy", boundary };
|
|
@@ -41706,7 +41799,7 @@ function receiptIds(git, baseRef, changelog) {
|
|
|
41706
41799
|
if (!shown3.ok) {
|
|
41707
41800
|
return unread2("cat-file", shown3);
|
|
41708
41801
|
}
|
|
41709
|
-
return new Set(changelogSections(shown3.stdout).flatMap((
|
|
41802
|
+
return new Set(changelogSections(shown3.stdout).flatMap((section2) => section2.receipt ?? []));
|
|
41710
41803
|
}
|
|
41711
41804
|
function readBaseHolding(git, baseRef, settings) {
|
|
41712
41805
|
const prefix = directoryPrefix(settings.fragments);
|
|
@@ -42443,11 +42536,11 @@ function foldBy(heading) {
|
|
|
42443
42536
|
const top = `${headingLine}
|
|
42444
42537
|
${fragmentsReceipt(orderedFragments.map((each) => each.id))}`;
|
|
42445
42538
|
const lines = noteLines(orderedFragments);
|
|
42446
|
-
const
|
|
42539
|
+
const section2 = lines.length === 0 ? top : `${top}
|
|
42447
42540
|
|
|
42448
42541
|
${lines.join(`
|
|
42449
42542
|
`)}`;
|
|
42450
|
-
return { version: version2, section };
|
|
42543
|
+
return { version: version2, section: section2 };
|
|
42451
42544
|
};
|
|
42452
42545
|
}
|
|
42453
42546
|
function createSemverByLevel(options) {
|
|
@@ -42517,7 +42610,7 @@ function forecastRelease(input) {
|
|
|
42517
42610
|
if (outcome2.result === null) {
|
|
42518
42611
|
return { kind: "none", strategy: outcome2.strategy, sentence: FORECAST_NONE_SENTENCE };
|
|
42519
42612
|
}
|
|
42520
|
-
const { version: version2, section } = outcome2.result;
|
|
42613
|
+
const { version: version2, section: section2 } = outcome2.result;
|
|
42521
42614
|
const bump2 = versionBump(baseVersion, version2);
|
|
42522
42615
|
return {
|
|
42523
42616
|
kind: "ships",
|
|
@@ -42526,7 +42619,7 @@ function forecastRelease(input) {
|
|
|
42526
42619
|
waiting: waiting.map((each) => each.id),
|
|
42527
42620
|
version: version2,
|
|
42528
42621
|
bump: bump2,
|
|
42529
|
-
section,
|
|
42622
|
+
section: section2,
|
|
42530
42623
|
sentence: shipsSentence(version2, bump2)
|
|
42531
42624
|
};
|
|
42532
42625
|
}
|
|
@@ -42542,7 +42635,7 @@ function forecastSettle(input) {
|
|
|
42542
42635
|
return { kind: "failed", strategy: outcome2.strategy, sentence: outcome2.line };
|
|
42543
42636
|
if (outcome2.result === null)
|
|
42544
42637
|
return { kind: "none", strategy: outcome2.strategy, sentence: SETTLE_NONE_SENTENCE };
|
|
42545
|
-
const { version: version2, section } = outcome2.result;
|
|
42638
|
+
const { version: version2, section: section2 } = outcome2.result;
|
|
42546
42639
|
const bump2 = versionBump(baseVersion, version2);
|
|
42547
42640
|
return {
|
|
42548
42641
|
kind: "settles",
|
|
@@ -42551,7 +42644,7 @@ function forecastSettle(input) {
|
|
|
42551
42644
|
waiting: waiting.map((each) => each.id),
|
|
42552
42645
|
version: version2,
|
|
42553
42646
|
bump: bump2,
|
|
42554
|
-
section,
|
|
42647
|
+
section: section2,
|
|
42555
42648
|
sentence: settlesSentence(version2, bump2)
|
|
42556
42649
|
};
|
|
42557
42650
|
}
|
|
@@ -43315,6 +43408,20 @@ var init_status_fragments = __esm(() => {
|
|
|
43315
43408
|
function staleDocsTitle(version2) {
|
|
43316
43409
|
return `Release ${version2}: update stale docs`;
|
|
43317
43410
|
}
|
|
43411
|
+
function staleDocsTitleVersion(title2) {
|
|
43412
|
+
return STALE_DOCS_TITLE.exec(title2)?.[1] ?? null;
|
|
43413
|
+
}
|
|
43414
|
+
function isUnreleasedVersion(version2, newestRelease) {
|
|
43415
|
+
if (version2 === NEXT_VERSION)
|
|
43416
|
+
return true;
|
|
43417
|
+
const parsed2 = parseSemanticVersion(version2);
|
|
43418
|
+
if (parsed2 === null)
|
|
43419
|
+
return false;
|
|
43420
|
+
if (newestRelease === null)
|
|
43421
|
+
return true;
|
|
43422
|
+
const newest = parseSemanticVersion(newestRelease);
|
|
43423
|
+
return newest !== null && compareVersions(parsed2, newest) > 0;
|
|
43424
|
+
}
|
|
43318
43425
|
function staleDocsVersion(input) {
|
|
43319
43426
|
if (!input.releaseEnabled)
|
|
43320
43427
|
return NEXT_VERSION;
|
|
@@ -43369,8 +43476,81 @@ async function call(step, action) {
|
|
|
43369
43476
|
return { ok: false, problem: oneLine7(`${step} failed: ${messageOf(error2)}`) };
|
|
43370
43477
|
}
|
|
43371
43478
|
}
|
|
43372
|
-
function
|
|
43373
|
-
|
|
43479
|
+
function createdMs(issue5) {
|
|
43480
|
+
if (issue5.createdAt === null)
|
|
43481
|
+
return null;
|
|
43482
|
+
const ms = Date.parse(issue5.createdAt);
|
|
43483
|
+
return Number.isNaN(ms) ? null : ms;
|
|
43484
|
+
}
|
|
43485
|
+
function idOrder(left, right) {
|
|
43486
|
+
const [a, b] = [Number(left), Number(right)];
|
|
43487
|
+
if (Number.isSafeInteger(a) && Number.isSafeInteger(b))
|
|
43488
|
+
return a - b;
|
|
43489
|
+
return left.localeCompare(right);
|
|
43490
|
+
}
|
|
43491
|
+
function olderFirst(left, right) {
|
|
43492
|
+
const [a, b] = [createdMs(left), createdMs(right)];
|
|
43493
|
+
if (a !== null && b !== null && a !== b)
|
|
43494
|
+
return a - b;
|
|
43495
|
+
return idOrder(left.ref.externalId, right.ref.externalId);
|
|
43496
|
+
}
|
|
43497
|
+
function releaseReading(newestRelease) {
|
|
43498
|
+
return typeof newestRelease === "string" && parseSemanticVersion(newestRelease) === null ? undefined : newestRelease;
|
|
43499
|
+
}
|
|
43500
|
+
function mayTake(issue5, choice) {
|
|
43501
|
+
if (!issue5.body.includes(STALE_DOCS_MARKER))
|
|
43502
|
+
return false;
|
|
43503
|
+
if (choice.newestRelease === undefined)
|
|
43504
|
+
return issue5.title === choice.title;
|
|
43505
|
+
const version2 = staleDocsTitleVersion(issue5.title);
|
|
43506
|
+
return version2 !== null && isUnreleasedVersion(version2, choice.newestRelease);
|
|
43507
|
+
}
|
|
43508
|
+
function chooseIssue(open, choice) {
|
|
43509
|
+
const candidates = open.filter((issue5) => mayTake(issue5, choice)).sort(olderFirst);
|
|
43510
|
+
return candidates.find((issue5) => issue5.title === choice.title) ?? candidates[0];
|
|
43511
|
+
}
|
|
43512
|
+
function issueChange(found, title2, line, held2) {
|
|
43513
|
+
if (held2)
|
|
43514
|
+
return { title: title2 };
|
|
43515
|
+
const body = appendItem(found.body, line.item);
|
|
43516
|
+
return found.title === title2 ? { body } : { title: title2, body };
|
|
43517
|
+
}
|
|
43518
|
+
async function addToIssue(tracker, found, title2, line) {
|
|
43519
|
+
const held2 = bodyHoldsLine(found.body, line.text);
|
|
43520
|
+
const action = held2 ? "held" : "appended";
|
|
43521
|
+
if (held2 && found.title === title2)
|
|
43522
|
+
return { action, title: title2, ref: found.ref };
|
|
43523
|
+
const change = issueChange(found, title2, line, held2);
|
|
43524
|
+
const edited = await call("editing the stale-docs issue", () => tracker.edit(found.ref, change));
|
|
43525
|
+
if (!edited.ok)
|
|
43526
|
+
return { action: "failed", title: title2, problem: edited.problem };
|
|
43527
|
+
return found.title === title2 ? { action, title: title2, ref: found.ref } : { action, title: title2, ref: found.ref, retitledFrom: found.title };
|
|
43528
|
+
}
|
|
43529
|
+
async function closeDuplicate(tracker, duplicate, older) {
|
|
43530
|
+
const id2 = duplicate.externalId;
|
|
43531
|
+
const commented = await call(`commenting on the duplicate issue ${id2}`, () => tracker.comment(duplicate, `Duplicate of #${older.externalId}`));
|
|
43532
|
+
if (!commented.ok)
|
|
43533
|
+
return commented;
|
|
43534
|
+
return call(`closing the duplicate issue ${id2}`, () => tracker.transition(duplicate, "cancelled"));
|
|
43535
|
+
}
|
|
43536
|
+
async function createAndConverge(tracker, choice, line) {
|
|
43537
|
+
const { title: title2 } = choice;
|
|
43538
|
+
const created = await call("creating the stale-docs issue", () => tracker.create(issueDraft(title2, line.item)));
|
|
43539
|
+
if (!created.ok)
|
|
43540
|
+
return { action: "failed", title: title2, problem: created.problem };
|
|
43541
|
+
const ref14 = created.value;
|
|
43542
|
+
const relisted = await call(`listing the open chore issues after creating issue ${ref14.externalId}`, () => tracker.openIssues("chore"));
|
|
43543
|
+
if (!relisted.ok)
|
|
43544
|
+
return { action: "failed", title: title2, problem: relisted.problem };
|
|
43545
|
+
const own = relisted.value.find((issue5) => issue5.ref.externalId === ref14.externalId) ?? { ref: ref14, title: title2, body: "", createdAt: null };
|
|
43546
|
+
const older = chooseIssue(relisted.value.filter((issue5) => issue5.ref.externalId !== ref14.externalId && olderFirst(issue5, own) < 0), choice);
|
|
43547
|
+
if (older === undefined)
|
|
43548
|
+
return { action: "created", title: title2, ref: ref14 };
|
|
43549
|
+
const added = await addToIssue(tracker, older, title2, line);
|
|
43550
|
+
if (added.action !== "appended" && added.action !== "held")
|
|
43551
|
+
return added;
|
|
43552
|
+
const closed = await closeDuplicate(tracker, ref14, older.ref);
|
|
43553
|
+
return closed.ok ? { ...added, duplicate: ref14 } : { action: "failed", title: title2, problem: closed.problem };
|
|
43374
43554
|
}
|
|
43375
43555
|
async function addStaleDocLine(options) {
|
|
43376
43556
|
const { tracker, version: version2, entry } = options;
|
|
@@ -43378,20 +43558,13 @@ async function addStaleDocLine(options) {
|
|
|
43378
43558
|
if (!canHoldIssue(tracker))
|
|
43379
43559
|
return { action: "kept", title: title2, reason: NO_EDITABLE_TRACKER };
|
|
43380
43560
|
const text2 = staleDocLineText(entry);
|
|
43381
|
-
const
|
|
43561
|
+
const line = { text: text2, item: `${UNTICKED2}${text2}` };
|
|
43562
|
+
const choice = { title: title2, newestRelease: releaseReading(options.newestRelease) };
|
|
43382
43563
|
const listed3 = await call("listing the open chore issues", () => tracker.openIssues("chore"));
|
|
43383
43564
|
if (!listed3.ok)
|
|
43384
43565
|
return { action: "failed", title: title2, problem: listed3.problem };
|
|
43385
|
-
const found =
|
|
43386
|
-
|
|
43387
|
-
const created = await call("creating the stale-docs issue", () => tracker.create(issueDraft(title2, item)));
|
|
43388
|
-
return created.ok ? { action: "created", title: title2, ref: created.value } : { action: "failed", title: title2, problem: created.problem };
|
|
43389
|
-
}
|
|
43390
|
-
if (bodyHoldsLine(found.body, text2))
|
|
43391
|
-
return { action: "held", title: title2, ref: found.ref };
|
|
43392
|
-
const body = appendItem(found.body, item);
|
|
43393
|
-
const edited = await call("editing the stale-docs issue", () => tracker.edit(found.ref, { body }));
|
|
43394
|
-
return edited.ok ? { action: "appended", title: title2, ref: found.ref } : { action: "failed", title: title2, problem: edited.problem };
|
|
43566
|
+
const found = chooseIssue(listed3.value, choice);
|
|
43567
|
+
return found === undefined ? createAndConverge(tracker, choice, line) : addToIssue(tracker, found, title2, line);
|
|
43395
43568
|
}
|
|
43396
43569
|
function docUpdateLineText(taskText) {
|
|
43397
43570
|
if (!taskText.startsWith(DOC_UPDATE_TASK_PREFIX))
|
|
@@ -43424,16 +43597,18 @@ async function tickStaleDocLine(options) {
|
|
|
43424
43597
|
const edited = await call("editing the stale-docs issue", () => tracker.edit(found.ref, { body }));
|
|
43425
43598
|
return edited.ok ? { action: "ticked", ref: found.ref } : { action: "failed", problem: edited.problem };
|
|
43426
43599
|
}
|
|
43427
|
-
var STALE_DOCS_MARKER = "<!-- rafa:stale-docs -->", NEXT_VERSION = "next", STALE_DOCS_OPENING, NO_EDITABLE_TRACKER = "no tracker resolved that can list and edit issues", UNTICKED2 = "- [ ] ", CHECKLIST_ITEM, UNTICKED_ITEM, DOC_UPDATE_TITLE = "chore(doc-update)", DOC_UPDATE_TASK_PREFIX = "Repair the stale doc line at ";
|
|
43600
|
+
var STALE_DOCS_MARKER = "<!-- rafa:stale-docs -->", NEXT_VERSION = "next", STALE_DOCS_OPENING, NO_EDITABLE_TRACKER = "no tracker resolved that can list and edit issues", UNTICKED2 = "- [ ] ", CHECKLIST_ITEM, UNTICKED_ITEM, DOC_UPDATE_TITLE = "chore(doc-update)", DOC_UPDATE_TASK_PREFIX = "Repair the stale doc line at ", STALE_DOCS_TITLE;
|
|
43428
43601
|
var init_release_issue = __esm(() => {
|
|
43429
43602
|
init_sections();
|
|
43430
43603
|
init_plan();
|
|
43431
43604
|
init_filed_text();
|
|
43432
43605
|
init_stale_doc_line();
|
|
43606
|
+
init_status_readings();
|
|
43433
43607
|
init_version2();
|
|
43434
43608
|
STALE_DOCS_OPENING = "Documentation lines the loop could not settle before this release. " + "Each item names the file, with the line when known, and what no longer matches.";
|
|
43435
43609
|
CHECKLIST_ITEM = /^\s*- \[[ xX]\] (.*)$/;
|
|
43436
43610
|
UNTICKED_ITEM = /^(\s*)- \[ \] (.*)$/;
|
|
43611
|
+
STALE_DOCS_TITLE = /^Release (\S+): update stale docs$/;
|
|
43437
43612
|
});
|
|
43438
43613
|
|
|
43439
43614
|
// packages/rafa-release/src/docs/open-lines.ts
|
|
@@ -43899,9 +44074,9 @@ function judgeStamp(facts, version2) {
|
|
|
43899
44074
|
}
|
|
43900
44075
|
const current = facts.base.version === null ? null : sectionFor(facts.base.changelog, facts.base.version);
|
|
43901
44076
|
const top = versionsOf(facts.base.changelog)[0];
|
|
43902
|
-
const
|
|
44077
|
+
const section2 = current ?? (top === undefined ? null : sectionFor(facts.base.changelog, top));
|
|
43903
44078
|
const relation = isAbove(facts.base.version, version2) ? "passed" : "not-on-base";
|
|
43904
|
-
return { answer: "stale", stamp: stamp2, base: { version: facts.base.version, section }, relation };
|
|
44079
|
+
return { answer: "stale", stamp: stamp2, base: { version: facts.base.version, section: section2 }, relation };
|
|
43905
44080
|
}
|
|
43906
44081
|
function judgeGuard(facts) {
|
|
43907
44082
|
const stamped = stampedVersion(facts);
|
|
@@ -43991,8 +44166,8 @@ function versionCommit(git, base2, versionFile, version2) {
|
|
|
43991
44166
|
function nameVerdict(git, base2, settings, judgement) {
|
|
43992
44167
|
if (judgement.answer === "clean" || judgement.answer === "missing")
|
|
43993
44168
|
return judgement;
|
|
43994
|
-
const { section, version: version2 } = judgement.base;
|
|
43995
|
-
const commit =
|
|
44169
|
+
const { section: section2, version: version2 } = judgement.base;
|
|
44170
|
+
const commit = section2 !== null ? sectionCommit(git, base2, settings.releaseChangelog, section2.heading) : versionCommit(git, base2, settings.releaseVersionFile, version2 ?? judgement.stamp.version);
|
|
43996
44171
|
return { ...judgement, base: { ...judgement.base, commit } };
|
|
43997
44172
|
}
|
|
43998
44173
|
function slotOf2(branch) {
|
|
@@ -44110,9 +44285,9 @@ function short(hash) {
|
|
|
44110
44285
|
function branchPhrase(branch) {
|
|
44111
44286
|
return branch.pullRequest === null ? `${branch.name} (no pull request)` : `${branch.name} (pull request #${branch.pullRequest})`;
|
|
44112
44287
|
}
|
|
44113
|
-
function entryPhrase(path3, version2,
|
|
44288
|
+
function entryPhrase(path3, version2, section2) {
|
|
44114
44289
|
const declares = `${path3} ${version2 ?? "declares no version"}`;
|
|
44115
|
-
return
|
|
44290
|
+
return section2 === null ? `${declares}, no changelog section` : `${declares}, "${section2.heading}"`;
|
|
44116
44291
|
}
|
|
44117
44292
|
function stampHead(reading2, verdict) {
|
|
44118
44293
|
const { version: version2 } = verdict.stamp;
|
|
@@ -47663,8 +47838,8 @@ function cappedSections(stderr) {
|
|
|
47663
47838
|
return { blocks: blocksText(rawBlocks(lines2)), summary: summaryLines(lines2) };
|
|
47664
47839
|
}
|
|
47665
47840
|
function joinSections(sections2) {
|
|
47666
|
-
const held2 = sections2.filter((
|
|
47667
|
-
return held2.length === 0 ? "" : `${held2.map((
|
|
47841
|
+
const held2 = sections2.filter((section2) => section2.length > 0);
|
|
47842
|
+
return held2.length === 0 ? "" : `${held2.map((section2) => section2.join(`
|
|
47668
47843
|
`)).join(`
|
|
47669
47844
|
|
|
47670
47845
|
`)}
|
|
@@ -48164,7 +48339,7 @@ function supersedesSection(closed, redact) {
|
|
|
48164
48339
|
|
|
48165
48340
|
${redact(sentence)}`;
|
|
48166
48341
|
}
|
|
48167
|
-
function
|
|
48342
|
+
function section2(heading, value, absent6, redact) {
|
|
48168
48343
|
const shown3 = value === null ? absent6 : fenced(redact(value));
|
|
48169
48344
|
return `## ${heading}
|
|
48170
48345
|
|
|
@@ -48174,13 +48349,13 @@ function issueText(opening, values, redact) {
|
|
|
48174
48349
|
return [
|
|
48175
48350
|
opening,
|
|
48176
48351
|
...values.supersedes === undefined ? [] : [supersedesSection(values.supersedes, redact)],
|
|
48177
|
-
|
|
48178
|
-
|
|
48352
|
+
section2("What", values.what, "", redact),
|
|
48353
|
+
section2("Artifact", values.artifact, "The report gave no artifact, so a recurrence files again.", redact),
|
|
48179
48354
|
...values.refs === null ? [] : [values.refs],
|
|
48180
|
-
|
|
48181
|
-
|
|
48182
|
-
|
|
48183
|
-
|
|
48355
|
+
section2("Recurrence key", values.key, "The report gave no artifact, so this bug has no key.", redact),
|
|
48356
|
+
section2("Plan", values.planStub, "The dispatch resolved no plan stub.", redact),
|
|
48357
|
+
section2("Task", values.taskText, "", redact),
|
|
48358
|
+
section2("Feedback", values.feedback, "The report gave no feedback.", redact),
|
|
48184
48359
|
...afterFeedback(values, redact),
|
|
48185
48360
|
...values.duplicates === undefined ? [] : [possibleDuplicatesSection(values.duplicates, redact)]
|
|
48186
48361
|
].join(`
|
|
@@ -49395,7 +49570,7 @@ function resultOf4(run, action, fields = {}) {
|
|
|
49395
49570
|
...fields
|
|
49396
49571
|
};
|
|
49397
49572
|
}
|
|
49398
|
-
async function
|
|
49573
|
+
async function settle4(run, action, ref15, foundBy, supersedes) {
|
|
49399
49574
|
const { store } = run.route;
|
|
49400
49575
|
const { key } = run.filing;
|
|
49401
49576
|
if (store === null || key === null)
|
|
@@ -49407,13 +49582,13 @@ async function fileNew(run, extras = {}) {
|
|
|
49407
49582
|
const { filing } = run;
|
|
49408
49583
|
const draft = extras.supersedes === undefined && extras.duplicates === undefined ? filing.draft : { ...filing.draft, body: issueText(ISSUE_OPENING, { ...filing.values, ...extras }, run.redact) };
|
|
49409
49584
|
const created = await step(run, `the ${run.route.channel} tracker create`, () => run.route.tracker.create(draft));
|
|
49410
|
-
return created.ok ?
|
|
49585
|
+
return created.ok ? settle4(run, "filed", created.value, null, extras.supersedes) : resultOf4(run, "failed", { problem: created.problem });
|
|
49411
49586
|
}
|
|
49412
49587
|
async function commentOn2(run, ref15, foundBy, action = "commented", comment = run.filing.comment) {
|
|
49413
49588
|
const commented = await step(run, `the ${run.route.channel} tracker comment`, () => run.route.tracker.comment(ref15, comment));
|
|
49414
49589
|
if (!commented.ok)
|
|
49415
49590
|
return resultOf4(run, "failed", { ref: ref15, foundBy, problem: commented.problem });
|
|
49416
|
-
return foundBy === "store" ? resultOf4(run, action, { ref: ref15, foundBy }) :
|
|
49591
|
+
return foundBy === "store" ? resultOf4(run, action, { ref: ref15, foundBy }) : settle4(run, action, ref15, foundBy);
|
|
49417
49592
|
}
|
|
49418
49593
|
async function lookUp2(run, key, searchText) {
|
|
49419
49594
|
const { route, filing } = run;
|
|
@@ -49979,17 +50154,17 @@ function readTriageBlock(body) {
|
|
|
49979
50154
|
}
|
|
49980
50155
|
return readFields3(document);
|
|
49981
50156
|
}
|
|
49982
|
-
function
|
|
50157
|
+
function quoted5(value) {
|
|
49983
50158
|
return JSON.stringify(value);
|
|
49984
50159
|
}
|
|
49985
50160
|
function writeTriageBlock(fields) {
|
|
49986
50161
|
return [
|
|
49987
|
-
`head: ${
|
|
49988
|
-
`at: ${
|
|
49989
|
-
`class: ${
|
|
50162
|
+
`head: ${quoted5(fields.head)}`,
|
|
50163
|
+
`at: ${quoted5(fields.at)}`,
|
|
50164
|
+
`class: ${quoted5(fields.triageClass)}`,
|
|
49990
50165
|
`simple: ${String(fields.simple)}`,
|
|
49991
50166
|
`attempts: ${String(fields.attempts)}`,
|
|
49992
|
-
`files: [${fields.files.map((file) =>
|
|
50167
|
+
`files: [${fields.files.map((file) => quoted5(file)).join(", ")}]`
|
|
49993
50168
|
].join(`
|
|
49994
50169
|
`);
|
|
49995
50170
|
}
|
|
@@ -50963,7 +51138,7 @@ function settleWhy(waiting) {
|
|
|
50963
51138
|
return `${count2} ${wait} on ${waiting.base} and ${fold} into ${waiting.version}`;
|
|
50964
51139
|
}
|
|
50965
51140
|
function readFollowUps(reading2) {
|
|
50966
|
-
const { liveLoopBranches, rafaCheckout, runtimeInstalled, settle:
|
|
51141
|
+
const { liveLoopBranches, rafaCheckout, runtimeInstalled, settle: settle5, version: version2 } = reading2;
|
|
50967
51142
|
const followUps = [];
|
|
50968
51143
|
if (version2 !== null && rafaCheckout && !runtimeInstalled) {
|
|
50969
51144
|
followUps.push({
|
|
@@ -50972,8 +51147,8 @@ function readFollowUps(reading2) {
|
|
|
50972
51147
|
why: selfUpdateWhy(version2, liveLoopBranches)
|
|
50973
51148
|
});
|
|
50974
51149
|
}
|
|
50975
|
-
if (
|
|
50976
|
-
followUps.push({ id: "release-settle", command: RELEASE_SETTLE_COMMAND, why: settleWhy(
|
|
51150
|
+
if (settle5 !== null) {
|
|
51151
|
+
followUps.push({ id: "release-settle", command: RELEASE_SETTLE_COMMAND, why: settleWhy(settle5) });
|
|
50977
51152
|
}
|
|
50978
51153
|
return Object.freeze(followUps.map((followUp2) => Object.freeze(followUp2)));
|
|
50979
51154
|
}
|
|
@@ -51847,11 +52022,11 @@ async function confirmUncheckedMerge(unchecked, options) {
|
|
|
51847
52022
|
}
|
|
51848
52023
|
}
|
|
51849
52024
|
function commentProblemLine(number, problem, body) {
|
|
51850
|
-
const
|
|
52025
|
+
const quoted6 = body.split(`
|
|
51851
52026
|
`).map((line) => `${INDENT9}${line}`).join(`
|
|
51852
52027
|
`);
|
|
51853
52028
|
return `the unchecked-merge comment was not posted on #${number}: ${problem}. Post it yourself:
|
|
51854
|
-
${
|
|
52029
|
+
${quoted6}`;
|
|
51855
52030
|
}
|
|
51856
52031
|
async function postUncheckedComment(pulls, number, unchecked, warn4) {
|
|
51857
52032
|
const body = unchecked.reading.comment;
|
|
@@ -56267,6 +56442,178 @@ var init_workflows = __esm(() => {
|
|
|
56267
56442
|
workflows_default = command33;
|
|
56268
56443
|
});
|
|
56269
56444
|
|
|
56445
|
+
// packages/rafa/src/project/roots.ts
|
|
56446
|
+
import { spawnSync as spawnSync7 } from "child_process";
|
|
56447
|
+
import { accessSync, constants as constants2, readFileSync as readFileSync70, statSync as statSync27 } from "fs";
|
|
56448
|
+
import { isAbsolute as isAbsolute21, join as join85, resolve as resolve33 } from "path";
|
|
56449
|
+
function gitToplevel(dir) {
|
|
56450
|
+
const result2 = spawnSync7("git", ["rev-parse", "--show-toplevel"], {
|
|
56451
|
+
cwd: dir,
|
|
56452
|
+
encoding: "utf8",
|
|
56453
|
+
env: { ...process.env, LC_ALL: "C" }
|
|
56454
|
+
});
|
|
56455
|
+
if (result2.error !== undefined) {
|
|
56456
|
+
throw new RootsError(`git could not run in ${dir} (${result2.error.message})`, { cause: result2.error });
|
|
56457
|
+
}
|
|
56458
|
+
if (result2.status === 0)
|
|
56459
|
+
return result2.stdout.replace(/\n$/, "");
|
|
56460
|
+
if (result2.stderr.startsWith(NOT_A_REPOSITORY))
|
|
56461
|
+
return null;
|
|
56462
|
+
const status = String(result2.status);
|
|
56463
|
+
throw new RootsError(`git rev-parse --show-toplevel failed in ${dir}, exit ${status}: ${result2.stderr.trim()}`);
|
|
56464
|
+
}
|
|
56465
|
+
function requireAbsolute2(label, path3) {
|
|
56466
|
+
if (!isAbsolute21(path3)) {
|
|
56467
|
+
throw new RootsError(`${label} is ${describeValue(path3)}, expected an absolute path`);
|
|
56468
|
+
}
|
|
56469
|
+
}
|
|
56470
|
+
function realOf(label, path3, fs2) {
|
|
56471
|
+
try {
|
|
56472
|
+
return fs2.realpath(path3);
|
|
56473
|
+
} catch (error2) {
|
|
56474
|
+
throw new RootsError(`${label} ${path3} does not resolve (${messageOf(error2)})`, { cause: error2 });
|
|
56475
|
+
}
|
|
56476
|
+
}
|
|
56477
|
+
function realOrSpelled(path3, fs2) {
|
|
56478
|
+
try {
|
|
56479
|
+
return fs2.realpath(path3);
|
|
56480
|
+
} catch {
|
|
56481
|
+
return resolve33(path3);
|
|
56482
|
+
}
|
|
56483
|
+
}
|
|
56484
|
+
function namedRoots(home, fs2) {
|
|
56485
|
+
const system = REFUSED_ROOTS.map(({ path: path3, why }) => ({
|
|
56486
|
+
kind: "system",
|
|
56487
|
+
path: path3,
|
|
56488
|
+
why,
|
|
56489
|
+
real: realOrSpelled(path3, fs2)
|
|
56490
|
+
}));
|
|
56491
|
+
return [...system, { kind: "home", path: home, why: HOME_WHY, real: realOrSpelled(home, fs2) }];
|
|
56492
|
+
}
|
|
56493
|
+
function namedRefusal(given, real, named8) {
|
|
56494
|
+
const match = named8.find((root) => root.real === real);
|
|
56495
|
+
if (match === undefined)
|
|
56496
|
+
return null;
|
|
56497
|
+
const reason = given === match.path ? `${given} ${match.why}` : `${given} is the same directory as ${match.path}, which ${match.why}`;
|
|
56498
|
+
return { kind: match.kind, path: given, reason };
|
|
56499
|
+
}
|
|
56500
|
+
function unwritable(given, why) {
|
|
56501
|
+
return { kind: "unwritable", path: given, reason: `${given} ${why}` };
|
|
56502
|
+
}
|
|
56503
|
+
function resolveReal(path3, fs2) {
|
|
56504
|
+
try {
|
|
56505
|
+
return { real: fs2.realpath(path3), error: null };
|
|
56506
|
+
} catch (error2) {
|
|
56507
|
+
return { real: null, error: error2 };
|
|
56508
|
+
}
|
|
56509
|
+
}
|
|
56510
|
+
function writeRefusal(given, real, fs2) {
|
|
56511
|
+
if (!fs2.isDirectory(real)) {
|
|
56512
|
+
return unwritable(given, "is not a directory, so no project tree can be written under it");
|
|
56513
|
+
}
|
|
56514
|
+
try {
|
|
56515
|
+
fs2.assertWritable(real);
|
|
56516
|
+
return null;
|
|
56517
|
+
} catch (error2) {
|
|
56518
|
+
return unwritable(given, `is not writable by this user (${messageOf(error2)})`);
|
|
56519
|
+
}
|
|
56520
|
+
}
|
|
56521
|
+
function refusalOf2(given, named8, fs2) {
|
|
56522
|
+
const resolved = resolveReal(given, fs2);
|
|
56523
|
+
const byName2 = namedRefusal(given, resolved.real ?? resolve33(given), named8);
|
|
56524
|
+
if (byName2 !== null)
|
|
56525
|
+
return byName2;
|
|
56526
|
+
if (resolved.real === null) {
|
|
56527
|
+
const detail = messageOf(resolved.error);
|
|
56528
|
+
return unwritable(given, `does not resolve, so no project tree can be written under it (${detail})`);
|
|
56529
|
+
}
|
|
56530
|
+
return writeRefusal(given, resolved.real, fs2);
|
|
56531
|
+
}
|
|
56532
|
+
function rootRefusal(path3, seams) {
|
|
56533
|
+
const { home, fs: fs2 = DISK_ROOTS_FILE_SYSTEM } = seams;
|
|
56534
|
+
requireAbsolute2("root", path3);
|
|
56535
|
+
requireAbsolute2("home directory", home);
|
|
56536
|
+
return refusalOf2(path3, namedRoots(home, fs2), fs2);
|
|
56537
|
+
}
|
|
56538
|
+
function hasWorkspaces(manifest) {
|
|
56539
|
+
return typeof manifest === "object" && manifest !== null && Object.hasOwn(manifest, "workspaces");
|
|
56540
|
+
}
|
|
56541
|
+
function readManifest2(file, fs2) {
|
|
56542
|
+
if (!fs2.exists(file))
|
|
56543
|
+
return { marks: false, warnings: [] };
|
|
56544
|
+
try {
|
|
56545
|
+
return { marks: hasWorkspaces(JSON.parse(fs2.readFile(file))), warnings: [] };
|
|
56546
|
+
} catch (error2) {
|
|
56547
|
+
return { marks: false, warnings: [`${file} was not read as a monorepo marker (${messageOf(error2)})`] };
|
|
56548
|
+
}
|
|
56549
|
+
}
|
|
56550
|
+
function readDir(dir, fs2) {
|
|
56551
|
+
const manifest = readManifest2(join85(dir, PACKAGE_JSON), fs2);
|
|
56552
|
+
const files = MONOREPO_MARKER_FILES.filter((name2) => fs2.exists(join85(dir, name2)));
|
|
56553
|
+
const markers = manifest.marks ? [PACKAGE_JSON, ...files] : files;
|
|
56554
|
+
return { ...manifest, dir, markers };
|
|
56555
|
+
}
|
|
56556
|
+
function walkMarkers(base2, named8, fs2) {
|
|
56557
|
+
return selfAndAncestors(base2).filter((dir) => !named8.some((root) => root.real === dir)).map((dir) => readDir(dir, fs2));
|
|
56558
|
+
}
|
|
56559
|
+
function candidateAt(path3, source, walk2, named8, fs2) {
|
|
56560
|
+
const markers = walk2.find((read2) => read2.dir === path3)?.markers ?? [];
|
|
56561
|
+
return { path: path3, source, markers, refusal: refusalOf2(path3, named8, fs2) };
|
|
56562
|
+
}
|
|
56563
|
+
function rootCandidates(start, seams) {
|
|
56564
|
+
const { home, fs: fs2 = DISK_ROOTS_FILE_SYSTEM, gitToplevel: probe3 = gitToplevel } = seams;
|
|
56565
|
+
requireAbsolute2("start directory", start);
|
|
56566
|
+
requireAbsolute2("home directory", home);
|
|
56567
|
+
const realStart = realOf("start directory", start, fs2);
|
|
56568
|
+
const toplevel = probe3(realStart);
|
|
56569
|
+
if (toplevel !== null)
|
|
56570
|
+
requireAbsolute2("git toplevel", toplevel);
|
|
56571
|
+
const base2 = toplevel === null ? realStart : realOf("git toplevel", toplevel, fs2);
|
|
56572
|
+
const source = toplevel === null ? "directory" : "git-toplevel";
|
|
56573
|
+
const named8 = namedRoots(home, fs2);
|
|
56574
|
+
const walk2 = walkMarkers(base2, named8, fs2);
|
|
56575
|
+
const outermost = walk2.filter((read2) => read2.markers.length > 0).at(-1);
|
|
56576
|
+
const monorepo = outermost === undefined || outermost.dir === base2 ? [] : [candidateAt(outermost.dir, "monorepo", walk2, named8, fs2)];
|
|
56577
|
+
return {
|
|
56578
|
+
start,
|
|
56579
|
+
candidates: [candidateAt(base2, source, walk2, named8, fs2), ...monorepo],
|
|
56580
|
+
warnings: walk2.flatMap((read2) => read2.warnings)
|
|
56581
|
+
};
|
|
56582
|
+
}
|
|
56583
|
+
var REFUSED_ROOTS, HOME_WHY, MONOREPO_MARKER_FILES, PACKAGE_JSON = "package.json", DISK_ROOTS_FILE_SYSTEM, RootsError;
|
|
56584
|
+
var init_roots = __esm(() => {
|
|
56585
|
+
init_sections();
|
|
56586
|
+
init_scope2();
|
|
56587
|
+
init_worktree_root();
|
|
56588
|
+
REFUSED_ROOTS = Object.freeze([
|
|
56589
|
+
{ path: "/", why: "is the filesystem root" },
|
|
56590
|
+
{ path: "/var", why: "holds system state" },
|
|
56591
|
+
{ path: "/etc", why: "holds system configuration" },
|
|
56592
|
+
{ path: "/usr", why: "holds system programs" },
|
|
56593
|
+
{ path: "/home", why: "holds the home directories of every user" },
|
|
56594
|
+
{ path: "/Users", why: "holds the home directories of every user" }
|
|
56595
|
+
]);
|
|
56596
|
+
HOME_WHY = `is the home directory, whose ${SCOPE_DIR}/ is the user scope`;
|
|
56597
|
+
MONOREPO_MARKER_FILES = Object.freeze([
|
|
56598
|
+
"turbo.json",
|
|
56599
|
+
"pnpm-workspace.yaml",
|
|
56600
|
+
"nx.json",
|
|
56601
|
+
"lerna.json"
|
|
56602
|
+
]);
|
|
56603
|
+
DISK_ROOTS_FILE_SYSTEM = Object.freeze({
|
|
56604
|
+
...DISK_FILE_SYSTEM,
|
|
56605
|
+
readFile: (path3) => readFileSync70(path3, "utf8"),
|
|
56606
|
+
isDirectory: (path3) => statSync27(path3).isDirectory(),
|
|
56607
|
+
assertWritable: (path3) => accessSync(path3, constants2.W_OK)
|
|
56608
|
+
});
|
|
56609
|
+
RootsError = class RootsError extends Error {
|
|
56610
|
+
constructor(message, options) {
|
|
56611
|
+
super(`rafa roots: ${message}`, options);
|
|
56612
|
+
this.name = "RootsError";
|
|
56613
|
+
}
|
|
56614
|
+
};
|
|
56615
|
+
});
|
|
56616
|
+
|
|
56270
56617
|
// packages/rafa-release/src/commands/release/fragment.ts
|
|
56271
56618
|
var exports_fragment = {};
|
|
56272
56619
|
__export(exports_fragment, {
|
|
@@ -56284,7 +56631,7 @@ __export(exports_fragment, {
|
|
|
56284
56631
|
LEVEL_FLAG: () => LEVEL_FLAG
|
|
56285
56632
|
});
|
|
56286
56633
|
import { existsSync as existsSync58, mkdirSync as mkdirSync24, writeFileSync as writeFileSync26 } from "fs";
|
|
56287
|
-
import { dirname as dirname37, join as
|
|
56634
|
+
import { dirname as dirname37, join as join86, posix as posix9 } from "path";
|
|
56288
56635
|
function refusal15(message) {
|
|
56289
56636
|
return new CommandExit(1, `\u274C ${message}
|
|
56290
56637
|
Usage: ${RELEASE_FRAGMENT_USAGE}`);
|
|
@@ -56376,6 +56723,14 @@ function checkPackage(root, name2) {
|
|
|
56376
56723
|
if (member.isPrivate)
|
|
56377
56724
|
throw refusal15(`${name2} (${member.dir}) is private, so it never releases and settle would refuse its fragment`);
|
|
56378
56725
|
}
|
|
56726
|
+
function fragmentRoot(projectRoot2, seams) {
|
|
56727
|
+
const cwd = (seams.cwd ?? (() => process.cwd()))();
|
|
56728
|
+
try {
|
|
56729
|
+
return (seams.toplevel ?? gitToplevel)(cwd) ?? projectRoot2;
|
|
56730
|
+
} catch (error2) {
|
|
56731
|
+
throw new CommandExit(1, `\u274C the git worktree of ${cwd} could not be read, so no fragment was written: ${messageOf(error2)}`);
|
|
56732
|
+
}
|
|
56733
|
+
}
|
|
56379
56734
|
function waitingNames(git, branch, fragments) {
|
|
56380
56735
|
const ref15 = `${RELEASE_REMOTE}/${branch}`;
|
|
56381
56736
|
const fetched = git(["fetch", RELEASE_REMOTE, branch]);
|
|
@@ -56411,14 +56766,16 @@ async function runFragment(context, seams = {}) {
|
|
|
56411
56766
|
const config = await resolveProjectConfig(project, COMMAND_NAME3, (message) => {
|
|
56412
56767
|
context.output.warn(message);
|
|
56413
56768
|
});
|
|
56414
|
-
|
|
56415
|
-
|
|
56769
|
+
const root = fragmentRoot(project.root, seams);
|
|
56770
|
+
checkPackage(root, request.package);
|
|
56771
|
+
const git = (seams.git ?? createGitRunner)(root);
|
|
56416
56772
|
const base2 = waitingNames(git, config.prBase ?? RELEASE_BASE_BRANCH, config.releaseFragments);
|
|
56417
56773
|
const name2 = allocateFragmentName(request.plan, base2.names);
|
|
56418
56774
|
const path3 = posix9.join(config.releaseFragments.replace(/\\/g, "/"), name2);
|
|
56419
|
-
const resolved =
|
|
56775
|
+
const resolved = join86(root, path3);
|
|
56776
|
+
const shown3 = root === project.root ? path3 : resolved;
|
|
56420
56777
|
if (existsSync58(resolved) || inHead(git, path3)) {
|
|
56421
|
-
throw refusal15(`${
|
|
56778
|
+
throw refusal15(`${shown3} is already on this branch, so the fragment is not written twice`);
|
|
56422
56779
|
}
|
|
56423
56780
|
const lines2 = fragmentNotes2(request);
|
|
56424
56781
|
const fragment = {
|
|
@@ -56428,9 +56785,9 @@ async function runFragment(context, seams = {}) {
|
|
|
56428
56785
|
package: request.package,
|
|
56429
56786
|
notes: lines2.notes
|
|
56430
56787
|
};
|
|
56431
|
-
writeNew(
|
|
56788
|
+
writeNew(shown3, resolved, serializeFragment(fragment));
|
|
56432
56789
|
const problems = lines2.problem === null ? base2.problems : [...base2.problems, lines2.problem];
|
|
56433
|
-
return { path:
|
|
56790
|
+
return { path: shown3, fragment, problems };
|
|
56434
56791
|
}
|
|
56435
56792
|
function createReleaseFragmentCommand(seams = {}) {
|
|
56436
56793
|
const command34 = {
|
|
@@ -56455,6 +56812,7 @@ var init_fragment2 = __esm(() => {
|
|
|
56455
56812
|
init_sections();
|
|
56456
56813
|
init_git2();
|
|
56457
56814
|
init_plan();
|
|
56815
|
+
init_roots();
|
|
56458
56816
|
init_fragment();
|
|
56459
56817
|
init_fragment_tree();
|
|
56460
56818
|
init_version2();
|
|
@@ -56482,11 +56840,11 @@ __export(exports_list4, {
|
|
|
56482
56840
|
createReleaseListCommand: () => createReleaseListCommand,
|
|
56483
56841
|
RELEASE_LIST_USAGE: () => RELEASE_LIST_USAGE
|
|
56484
56842
|
});
|
|
56485
|
-
import { readFileSync as
|
|
56486
|
-
import { join as
|
|
56843
|
+
import { readFileSync as readFileSync71 } from "fs";
|
|
56844
|
+
import { join as join87 } from "path";
|
|
56487
56845
|
function rootNameOf(root, versionFile) {
|
|
56488
56846
|
try {
|
|
56489
|
-
return readManifestName(
|
|
56847
|
+
return readManifestName(readFileSync71(join87(root, versionFile), "utf8")) ?? versionFile;
|
|
56490
56848
|
} catch {
|
|
56491
56849
|
return versionFile;
|
|
56492
56850
|
}
|
|
@@ -58169,6 +58527,68 @@ function finish(ending, base2, settings) {
|
|
|
58169
58527
|
}
|
|
58170
58528
|
}
|
|
58171
58529
|
|
|
58530
|
+
// src/cli/flag-refusal.ts
|
|
58531
|
+
init_command2();
|
|
58532
|
+
var NEGATION = "no-";
|
|
58533
|
+
var FLAGS_END = "--";
|
|
58534
|
+
function globalName(spelling) {
|
|
58535
|
+
return spelling.replace(/^-+/u, "").split("=")[0] ?? "";
|
|
58536
|
+
}
|
|
58537
|
+
var GLOBAL_FLAG_NAMES = Object.freeze([
|
|
58538
|
+
...new Set(GLOBAL_FLAGS.flatMap((flag2) => flag2.spelling.split(", ").map(globalName)))
|
|
58539
|
+
]);
|
|
58540
|
+
function isFlagWord(word) {
|
|
58541
|
+
return word.startsWith("--") || word.startsWith("-") && word.length > 1;
|
|
58542
|
+
}
|
|
58543
|
+
function flagName(word) {
|
|
58544
|
+
const isLong = word.startsWith("--");
|
|
58545
|
+
const body = word.slice(isLong ? 2 : 1);
|
|
58546
|
+
const eqIndex = body.indexOf("=");
|
|
58547
|
+
if (eqIndex !== -1)
|
|
58548
|
+
return { name: body.slice(0, eqIndex), negated: false };
|
|
58549
|
+
if (isLong && body.startsWith(NEGATION) && body.length > NEGATION.length) {
|
|
58550
|
+
return { name: body.slice(NEGATION.length), negated: true };
|
|
58551
|
+
}
|
|
58552
|
+
return { name: body, negated: false };
|
|
58553
|
+
}
|
|
58554
|
+
function declaredSpellings(flags) {
|
|
58555
|
+
const spellings = new Map;
|
|
58556
|
+
for (const flag2 of flags) {
|
|
58557
|
+
for (const spelling of [flag2.name, ...flag2.aliases ?? []])
|
|
58558
|
+
spellings.set(spelling, flag2);
|
|
58559
|
+
}
|
|
58560
|
+
return spellings;
|
|
58561
|
+
}
|
|
58562
|
+
function accepted2(read, spellings) {
|
|
58563
|
+
const flag2 = spellings.get(read.name);
|
|
58564
|
+
if (read.negated)
|
|
58565
|
+
return flag2?.type === "boolean";
|
|
58566
|
+
return flag2 !== undefined || GLOBAL_FLAG_NAMES.includes(read.name);
|
|
58567
|
+
}
|
|
58568
|
+
function undeclaredFlags(line, command) {
|
|
58569
|
+
const spellings = declaredSpellings(command.flags);
|
|
58570
|
+
const undeclared2 = new Set;
|
|
58571
|
+
for (const word of line) {
|
|
58572
|
+
if (word === FLAGS_END)
|
|
58573
|
+
break;
|
|
58574
|
+
if (!isFlagWord(word) || accepted2(flagName(word), spellings))
|
|
58575
|
+
continue;
|
|
58576
|
+
undeclared2.add(word);
|
|
58577
|
+
}
|
|
58578
|
+
return [...undeclared2];
|
|
58579
|
+
}
|
|
58580
|
+
function quoted4(words) {
|
|
58581
|
+
return words.map((word) => `"${word}"`).join(", ");
|
|
58582
|
+
}
|
|
58583
|
+
function unknownFlagMessage(command, undeclared2, spelling = commandSpelling(command)) {
|
|
58584
|
+
const noun = undeclared2.length === 1 ? "flag" : "flags";
|
|
58585
|
+
const declared = command.flags.length === 0 ? "it declares no flags" : `its flags are ${command.flags.map((flag2) => `--${flag2.name}`).join(", ")}`;
|
|
58586
|
+
return `unknown ${noun} ${quoted4(undeclared2)} for "rafa ${spelling}"; ${declared}`;
|
|
58587
|
+
}
|
|
58588
|
+
function unknownFlagHint(command, spelling = commandSpelling(command)) {
|
|
58589
|
+
return `run rafa ${spelling} --help for its flags`;
|
|
58590
|
+
}
|
|
58591
|
+
|
|
58172
58592
|
// src/cli/modules.ts
|
|
58173
58593
|
init_sections();
|
|
58174
58594
|
init_load2();
|
|
@@ -58382,9 +58802,11 @@ function routeLine(registry, argv) {
|
|
|
58382
58802
|
|
|
58383
58803
|
// src/cli/dispatch.ts
|
|
58384
58804
|
var REFUSAL7 = "dispatcher";
|
|
58805
|
+
var UNKNOWN_FLAG_EXIT = 2;
|
|
58385
58806
|
var DISPATCH_ERROR_CODES = [
|
|
58386
58807
|
...ROUTE_REFUSALS,
|
|
58387
58808
|
"invalid_spec",
|
|
58809
|
+
"unknown_flag",
|
|
58388
58810
|
"no_project",
|
|
58389
58811
|
"command_exit",
|
|
58390
58812
|
"command_error",
|
|
@@ -58517,6 +58939,18 @@ function assemble(route, settings) {
|
|
|
58517
58939
|
function boundaryOf(command) {
|
|
58518
58940
|
return { module: command.subject, action: command.action };
|
|
58519
58941
|
}
|
|
58942
|
+
function refusedFlags(route) {
|
|
58943
|
+
const undeclared2 = undeclaredFlags(readDeprecatedFlags(route).line, route.command);
|
|
58944
|
+
if (undeclared2.length === 0)
|
|
58945
|
+
return null;
|
|
58946
|
+
const found = {
|
|
58947
|
+
cause: causeOfDispatchCode("unknown_flag"),
|
|
58948
|
+
hint: unknownFlagHint(route.command, route.label),
|
|
58949
|
+
...boundaryOf(route.command),
|
|
58950
|
+
coded: true
|
|
58951
|
+
};
|
|
58952
|
+
return { ...failure2("unknown_flag", unknownFlagMessage(route.command, undeclared2, route.label), found), exitCode: UNKNOWN_FLAG_EXIT };
|
|
58953
|
+
}
|
|
58520
58954
|
async function runCommand(route, base2, registry, project, settings) {
|
|
58521
58955
|
const deprecation = deprecationLine(route);
|
|
58522
58956
|
if (deprecation !== null)
|
|
@@ -58601,7 +59035,7 @@ async function settleCommand(route, base2, registry, settings) {
|
|
|
58601
59035
|
await callHook("after", async () => hook.after(route, project), base2);
|
|
58602
59036
|
}
|
|
58603
59037
|
}
|
|
58604
|
-
async function
|
|
59038
|
+
async function settle3(route, base2, problem, registry, settings) {
|
|
58605
59039
|
switch (route.kind) {
|
|
58606
59040
|
case "help":
|
|
58607
59041
|
if (base2.outputMode === "text")
|
|
@@ -58615,7 +59049,9 @@ async function settle2(route, base2, problem, registry, settings) {
|
|
|
58615
59049
|
case "refusal":
|
|
58616
59050
|
return failure2(route.code, route.message);
|
|
58617
59051
|
case "command":
|
|
58618
|
-
|
|
59052
|
+
if (problem !== null)
|
|
59053
|
+
return failure2("invalid_spec", problem);
|
|
59054
|
+
return refusedFlags(route) ?? settleCommand(route, base2, registry, settings);
|
|
58619
59055
|
}
|
|
58620
59056
|
}
|
|
58621
59057
|
async function dispatch(argv, options) {
|
|
@@ -58640,7 +59076,7 @@ async function dispatch(argv, options) {
|
|
|
58640
59076
|
base2.output.warn(warning);
|
|
58641
59077
|
let ending;
|
|
58642
59078
|
try {
|
|
58643
|
-
ending = await
|
|
59079
|
+
ending = await settle3(route, base2, problem, loaded.registry, settings);
|
|
58644
59080
|
} catch (error2) {
|
|
58645
59081
|
ending = failure2("command_error", messageOf12(error2), failureOf(error2, null));
|
|
58646
59082
|
}
|
|
@@ -59485,12 +59921,12 @@ function firstLine7(text2) {
|
|
|
59485
59921
|
// packages/rafa-run/src/cleanup/runs.ts
|
|
59486
59922
|
init_sections();
|
|
59487
59923
|
init_loop();
|
|
59488
|
-
import { existsSync as existsSync60, readdirSync as readdirSync20, readFileSync as
|
|
59489
|
-
import { join as
|
|
59924
|
+
import { existsSync as existsSync60, readdirSync as readdirSync20, readFileSync as readFileSync73 } from "fs";
|
|
59925
|
+
import { join as join89 } from "path";
|
|
59490
59926
|
|
|
59491
59927
|
// packages/rafa-run/src/start/loop-events.ts
|
|
59492
59928
|
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync25 } from "fs";
|
|
59493
|
-
import { join as
|
|
59929
|
+
import { join as join88 } from "path";
|
|
59494
59930
|
init_sections();
|
|
59495
59931
|
init_loop();
|
|
59496
59932
|
init_output();
|
|
@@ -59503,13 +59939,13 @@ init_tracker();
|
|
|
59503
59939
|
init_plan();
|
|
59504
59940
|
init_tracker();
|
|
59505
59941
|
init_rafa_pr();
|
|
59506
|
-
import { readFileSync as
|
|
59942
|
+
import { readFileSync as readFileSync72, writeFileSync as writeFileSync27 } from "fs";
|
|
59507
59943
|
|
|
59508
59944
|
// packages/rafa-run/src/start/suite-outside-case.ts
|
|
59509
|
-
import { constants as
|
|
59945
|
+
import { constants as constants3 } from "os";
|
|
59510
59946
|
var OUTSIDE_CASE_REASON = "the run failed outside any test case";
|
|
59511
59947
|
var OUTSIDE_CASE_LIKELY_CAUSE = "a test file that did not load";
|
|
59512
|
-
var SIGINT_STOP_CODE = 128 +
|
|
59948
|
+
var SIGINT_STOP_CODE = 128 + constants3.signals.SIGINT;
|
|
59513
59949
|
var TAIL_QUOTED_LENGTH = 300;
|
|
59514
59950
|
var TAIL_LINE_QUOTED_LENGTH = 100;
|
|
59515
59951
|
var QUOTE_CUT_MARK = "...";
|
|
@@ -59530,11 +59966,11 @@ function quotedTail(tail) {
|
|
|
59530
59966
|
}
|
|
59531
59967
|
function outsideCaseText(result2) {
|
|
59532
59968
|
const said = `bun test exited ${result2.exitCode} and listed no failing test: ${OUTSIDE_CASE_REASON}.`;
|
|
59533
|
-
const
|
|
59534
|
-
if (
|
|
59969
|
+
const quoted6 = quotedTail(result2.outputTail);
|
|
59970
|
+
if (quoted6.length === 0)
|
|
59535
59971
|
return `${said} It printed nothing on stderr.`;
|
|
59536
|
-
const lines3 =
|
|
59537
|
-
const count2 =
|
|
59972
|
+
const lines3 = quoted6.map((line) => `"${line}"`).join(", ");
|
|
59973
|
+
const count2 = quoted6.length < result2.outputTail.length ? ` (${quoted6.length} of the ${result2.outputTail.length} lines on the step's record)` : "";
|
|
59538
59974
|
return `${said} The last lines it printed: ${lines3}${count2}.`;
|
|
59539
59975
|
}
|
|
59540
59976
|
function outsideCaseRecord(verdict, result2) {
|
|
@@ -59591,15 +60027,15 @@ function quotedFile(file, failures) {
|
|
|
59591
60027
|
const lines3 = firstErrorLines(failures.filter((failure8) => failure8.file === file));
|
|
59592
60028
|
if (lines3.length === 0)
|
|
59593
60029
|
return null;
|
|
59594
|
-
const
|
|
59595
|
-
const left = lines3.length -
|
|
60030
|
+
const quoted6 = lines3.slice(0, ERROR_LINES_QUOTED).map(([line, count2]) => `"${quotedLine2(line)}" (${testCount(count2)})`);
|
|
60031
|
+
const left = lines3.length - quoted6.length;
|
|
59596
60032
|
const more = left > 0 ? [leftOut(left, "line")] : [];
|
|
59597
|
-
return `${file} ${[...
|
|
60033
|
+
return `${file} ${[...quoted6, ...more].join(", ")}`;
|
|
59598
60034
|
}
|
|
59599
60035
|
function quotedErrors(failures) {
|
|
59600
60036
|
const files = failingFiles(failures).flatMap(([file]) => {
|
|
59601
|
-
const
|
|
59602
|
-
return
|
|
60037
|
+
const quoted6 = quotedFile(file, failures);
|
|
60038
|
+
return quoted6 === null ? [] : [quoted6];
|
|
59603
60039
|
});
|
|
59604
60040
|
if (files.length === 0)
|
|
59605
60041
|
return null;
|
|
@@ -59681,9 +60117,9 @@ function blockerText(label, result2, verdict, alone) {
|
|
|
59681
60117
|
const run = files.filter(([file]) => notes.get(file) !== GREEN_ALONE_NOTE).map(([file]) => runnablePath(file));
|
|
59682
60118
|
if (run.length > 0)
|
|
59683
60119
|
parts.push(`Run bun test ${run.join(" ")} and make them pass.`);
|
|
59684
|
-
const
|
|
59685
|
-
if (
|
|
59686
|
-
parts.push(`What Bun printed for them: ${
|
|
60120
|
+
const quoted6 = quotedErrors(verdict.fresh);
|
|
60121
|
+
if (quoted6 !== null)
|
|
60122
|
+
parts.push(`What Bun printed for them: ${quoted6}.`);
|
|
59687
60123
|
if (alone !== undefined && notRun2.length > 0)
|
|
59688
60124
|
parts.push(notRunText(notRun2.length, alone));
|
|
59689
60125
|
}
|
|
@@ -59749,7 +60185,7 @@ function blockRepairAgain(trackerPath, content, line, blocker) {
|
|
|
59749
60185
|
return writeTrackerBlocker(trackerPath, line, blocker) ? { line, inserted: false } : null;
|
|
59750
60186
|
}
|
|
59751
60187
|
function writeRepairTask(trackerPath, blocker, site) {
|
|
59752
|
-
const content =
|
|
60188
|
+
const content = readFileSync72(trackerPath, "utf8");
|
|
59753
60189
|
const { tasks } = parsePlan(content);
|
|
59754
60190
|
const existing = existingRepairOf(tasks, site);
|
|
59755
60191
|
if (existing !== null)
|
|
@@ -59768,7 +60204,7 @@ function writeRepairTask(trackerPath, blocker, site) {
|
|
|
59768
60204
|
// packages/rafa-run/src/start/loop-events.ts
|
|
59769
60205
|
var MINUTE_MS2 = 60000;
|
|
59770
60206
|
var TOKENS_PER_K = 1000;
|
|
59771
|
-
function
|
|
60207
|
+
function quoted6(text2) {
|
|
59772
60208
|
return `"${oneLine4(text2).replaceAll('"', "\\\"")}"`;
|
|
59773
60209
|
}
|
|
59774
60210
|
function taskKind(position, verb) {
|
|
@@ -59780,7 +60216,7 @@ function minutes(durationMs) {
|
|
|
59780
60216
|
function summaryOf4(event) {
|
|
59781
60217
|
switch (event.kind) {
|
|
59782
60218
|
case "task-start":
|
|
59783
|
-
return `${taskKind(event.position, "start")}${
|
|
60219
|
+
return `${taskKind(event.position, "start")}${quoted6(event.text)}`;
|
|
59784
60220
|
case "task-done":
|
|
59785
60221
|
return event.tokens === null ? `${taskKind(event.position, "done")}${minutes(event.durationMs)}` : `${taskKind(event.position, "done")}${minutes(event.durationMs)} ${Math.round(event.tokens / TOKENS_PER_K)}k tokens`;
|
|
59786
60222
|
case "task-blocked":
|
|
@@ -59798,7 +60234,7 @@ function summaryOf4(event) {
|
|
|
59798
60234
|
case "decision":
|
|
59799
60235
|
return `${padKind(`decision ${event.strategy}`)}line ${event.line}: ${oneLine4(event.reason)}`;
|
|
59800
60236
|
case "decision-needed":
|
|
59801
|
-
return `${padKind("decision needed")}line ${event.line} ${
|
|
60237
|
+
return `${padKind("decision needed")}line ${event.line} ${quoted6(event.task)}`;
|
|
59802
60238
|
case "passed-over":
|
|
59803
60239
|
return `${padKind("passed over")}${passedOverList(event.tasks)}`;
|
|
59804
60240
|
case "inherited":
|
|
@@ -59821,7 +60257,7 @@ function eventsFilePath(root, sessionId) {
|
|
|
59821
60257
|
if (!isSessionId(sessionId)) {
|
|
59822
60258
|
throw new Error(`events file: unusable session id ${JSON.stringify(sessionId)}`);
|
|
59823
60259
|
}
|
|
59824
|
-
return
|
|
60260
|
+
return join88(runsDir(root), `${sessionId}${EVENTS_EXTENSION}`);
|
|
59825
60261
|
}
|
|
59826
60262
|
function bindEventsFile(root, sessionId, warn5 = (line) => {
|
|
59827
60263
|
process.stderr.write(line);
|
|
@@ -59872,7 +60308,7 @@ function injectionPlace(trackerContent, taskInfo) {
|
|
|
59872
60308
|
}
|
|
59873
60309
|
async function taskTokens(checkout, sessionId, home) {
|
|
59874
60310
|
try {
|
|
59875
|
-
const { usage } = await readSessionLog(
|
|
60311
|
+
const { usage } = await readSessionLog(join88(sessionLogDir(checkout, home), `${sessionId}.jsonl`));
|
|
59876
60312
|
return usage.inputTokens + usage.cacheCreationInputTokens + usage.outputTokens;
|
|
59877
60313
|
} catch {
|
|
59878
60314
|
return null;
|
|
@@ -59895,7 +60331,7 @@ function readRunRecords(root, seams = {}) {
|
|
|
59895
60331
|
const notes = [];
|
|
59896
60332
|
const finished = [];
|
|
59897
60333
|
for (const name2 of names2.filter((entry) => entry.endsWith(RECORD_EXTENSION)).sort()) {
|
|
59898
|
-
const file =
|
|
60334
|
+
const file = join89(dir, name2);
|
|
59899
60335
|
const read2 = readRecord2(file);
|
|
59900
60336
|
if (typeof read2 === "string") {
|
|
59901
60337
|
notes.push(read2);
|
|
@@ -59914,7 +60350,7 @@ function readRunRecords(root, seams = {}) {
|
|
|
59914
60350
|
}
|
|
59915
60351
|
function readRecord2(file) {
|
|
59916
60352
|
try {
|
|
59917
|
-
return parseSessionRecord(
|
|
60353
|
+
return parseSessionRecord(readFileSync73(file, "utf8"), file);
|
|
59918
60354
|
} catch (error2) {
|
|
59919
60355
|
return `run records: skipped ${file}: ${messageOf(error2)}`;
|
|
59920
60356
|
}
|
|
@@ -59927,7 +60363,7 @@ function byStart2(a, b) {
|
|
|
59927
60363
|
}
|
|
59928
60364
|
function runRow(dir, entry) {
|
|
59929
60365
|
const { record: record2 } = entry;
|
|
59930
|
-
const events =
|
|
60366
|
+
const events = join89(dir, `${record2.sessionId}${EVENTS_EXTENSION}`);
|
|
59931
60367
|
return {
|
|
59932
60368
|
sessionId: record2.sessionId,
|
|
59933
60369
|
path: entry.file,
|
|
@@ -60660,21 +61096,21 @@ init_rafa_pr();
|
|
|
60660
61096
|
|
|
60661
61097
|
// packages/rafa-run/src/plan/list.ts
|
|
60662
61098
|
init_plan();
|
|
60663
|
-
import { existsSync as existsSync61, readdirSync as readdirSync21, readFileSync as
|
|
60664
|
-
import { join as
|
|
61099
|
+
import { existsSync as existsSync61, readdirSync as readdirSync21, readFileSync as readFileSync74 } from "fs";
|
|
61100
|
+
import { join as join90 } from "path";
|
|
60665
61101
|
function listing2(dir, stub) {
|
|
60666
|
-
const plan =
|
|
60667
|
-
const trackerPath =
|
|
61102
|
+
const plan = join90(dir, planFileName(stub, false));
|
|
61103
|
+
const trackerPath = join90(dir, planFileName(stub, true));
|
|
60668
61104
|
const tracker = isFile2(trackerPath) ? trackerPath : null;
|
|
60669
|
-
const planModel = parsePlan(
|
|
60670
|
-
const counted8 = tracker === null ? planModel : parsePlan(
|
|
61105
|
+
const planModel = parsePlan(readFileSync74(plan, "utf8"));
|
|
61106
|
+
const counted8 = tracker === null ? planModel : parsePlan(readFileSync74(tracker, "utf8"));
|
|
60671
61107
|
return { stub, plan, tracker, tasks: countTasks(counted8.tasks), issues: planModel.issues.length };
|
|
60672
61108
|
}
|
|
60673
61109
|
function listPlans(plans) {
|
|
60674
61110
|
const dir = plans.path;
|
|
60675
61111
|
if (!existsSync61(dir))
|
|
60676
61112
|
return { dir, plans: [] };
|
|
60677
|
-
const stubs = readdirSync21(dir).filter((name2) => isFile2(
|
|
61113
|
+
const stubs = readdirSync21(dir).filter((name2) => isFile2(join90(dir, name2))).map((name2) => stubOfPlanFile(name2)).filter((stub) => stub !== null).sort((a, b) => a.localeCompare(b));
|
|
60678
61114
|
return { dir, plans: stubs.map((stub) => listing2(dir, stub)) };
|
|
60679
61115
|
}
|
|
60680
61116
|
|
|
@@ -62022,7 +62458,7 @@ init_plan();
|
|
|
62022
62458
|
|
|
62023
62459
|
// packages/rafa/src/preflight/prerequisites-md.ts
|
|
62024
62460
|
init_sections();
|
|
62025
|
-
import { basename as basename20, dirname as dirname38, join as
|
|
62461
|
+
import { basename as basename20, dirname as dirname38, join as join91 } from "path";
|
|
62026
62462
|
var SECTION_AUTO_RE = /\[auto\]/i;
|
|
62027
62463
|
var SECTION_START_RE = /\[start\]/i;
|
|
62028
62464
|
var SECTION_HUMAN_RE = /\[human\]|manual|human|sign.?off|team/i;
|
|
@@ -62191,7 +62627,7 @@ function prerequisitesPathForPlan(planPath) {
|
|
|
62191
62627
|
const stub = PLAN_FILE_RE.exec(basename20(planPath))?.[1];
|
|
62192
62628
|
if (stub === undefined)
|
|
62193
62629
|
return null;
|
|
62194
|
-
return
|
|
62630
|
+
return join91(dirname38(planPath), `PREREQUISITES-${stub}.md`);
|
|
62195
62631
|
}
|
|
62196
62632
|
async function readIfPresent2(path4) {
|
|
62197
62633
|
try {
|
|
@@ -62297,11 +62733,11 @@ function storeRuleLine(file, problem) {
|
|
|
62297
62733
|
// packages/rafa-run/src/preflight/first-dispatch.ts
|
|
62298
62734
|
init_plan();
|
|
62299
62735
|
init_block_reader();
|
|
62300
|
-
import { readFileSync as
|
|
62736
|
+
import { readFileSync as readFileSync75 } from "fs";
|
|
62301
62737
|
var TICKED_TASK = /^- \[[xX]\] (.+)/;
|
|
62302
62738
|
function readIfReadable(path4) {
|
|
62303
62739
|
try {
|
|
62304
|
-
return
|
|
62740
|
+
return readFileSync75(path4, "utf8");
|
|
62305
62741
|
} catch {
|
|
62306
62742
|
return null;
|
|
62307
62743
|
}
|
|
@@ -62336,20 +62772,20 @@ import {
|
|
|
62336
62772
|
existsSync as existsSync63,
|
|
62337
62773
|
mkdirSync as mkdirSync26,
|
|
62338
62774
|
readdirSync as readdirSync23,
|
|
62339
|
-
readFileSync as
|
|
62775
|
+
readFileSync as readFileSync76,
|
|
62340
62776
|
realpathSync as realpathSync15,
|
|
62341
62777
|
renameSync as renameSync10,
|
|
62342
62778
|
rmSync as rmSync16,
|
|
62343
|
-
statSync as
|
|
62779
|
+
statSync as statSync29,
|
|
62344
62780
|
symlinkSync as symlinkSync2
|
|
62345
62781
|
} from "fs";
|
|
62346
|
-
import { basename as basename21, delimiter as delimiter4, dirname as dirname39, join as
|
|
62782
|
+
import { basename as basename21, delimiter as delimiter4, dirname as dirname39, join as join94, relative as relative21, resolve as resolve36 } from "path";
|
|
62347
62783
|
|
|
62348
62784
|
// packages/rafa/src/project/bin-path.ts
|
|
62349
62785
|
init_scope2();
|
|
62350
|
-
import { delimiter as delimiter3, isAbsolute as
|
|
62351
|
-
var RAFA_BIN_DIR =
|
|
62352
|
-
var BUN_BIN_DIR =
|
|
62786
|
+
import { delimiter as delimiter3, isAbsolute as isAbsolute22, join as join92, resolve as resolve34 } from "path";
|
|
62787
|
+
var RAFA_BIN_DIR = join92(SCOPE_DIR, "bin");
|
|
62788
|
+
var BUN_BIN_DIR = join92(".bun", "bin");
|
|
62353
62789
|
function exportLine(rafaBin) {
|
|
62354
62790
|
return `export PATH="${rafaBin}:$PATH"`;
|
|
62355
62791
|
}
|
|
@@ -62366,12 +62802,12 @@ function canonical2(path4, fs2) {
|
|
|
62366
62802
|
try {
|
|
62367
62803
|
return fs2.realpath(path4);
|
|
62368
62804
|
} catch {
|
|
62369
|
-
return
|
|
62805
|
+
return resolve34(path4);
|
|
62370
62806
|
}
|
|
62371
62807
|
}
|
|
62372
62808
|
function indexOf(entries, dir, fs2) {
|
|
62373
62809
|
const target = canonical2(dir, fs2);
|
|
62374
|
-
const index = entries.findIndex((entry) =>
|
|
62810
|
+
const index = entries.findIndex((entry) => isAbsolute22(entry) && canonical2(entry, fs2) === target);
|
|
62375
62811
|
return index === -1 ? null : index;
|
|
62376
62812
|
}
|
|
62377
62813
|
function stateOf2(rafaIndex, bunIndex) {
|
|
@@ -62382,8 +62818,8 @@ function stateOf2(rafaIndex, bunIndex) {
|
|
|
62382
62818
|
return "ahead";
|
|
62383
62819
|
}
|
|
62384
62820
|
function readBinPath(pathValue, home, fs2 = DISK_FILE_SYSTEM) {
|
|
62385
|
-
const rafaBin =
|
|
62386
|
-
const bunBin =
|
|
62821
|
+
const rafaBin = join92(home, RAFA_BIN_DIR);
|
|
62822
|
+
const bunBin = join92(home, BUN_BIN_DIR);
|
|
62387
62823
|
const entries = (pathValue ?? "").split(delimiter3);
|
|
62388
62824
|
const rafaIndex = indexOf(entries, rafaBin, fs2);
|
|
62389
62825
|
const bunIndex = indexOf(entries, bunBin, fs2);
|
|
@@ -62400,9 +62836,9 @@ init_command2();
|
|
|
62400
62836
|
init_sections();
|
|
62401
62837
|
init_output();
|
|
62402
62838
|
init_runtime();
|
|
62403
|
-
import { existsSync as existsSync62, readdirSync as readdirSync22, realpathSync as realpathSync14, statSync as
|
|
62839
|
+
import { existsSync as existsSync62, readdirSync as readdirSync22, realpathSync as realpathSync14, statSync as statSync28 } from "fs";
|
|
62404
62840
|
import { homedir as homedir9 } from "os";
|
|
62405
|
-
import { isAbsolute as
|
|
62841
|
+
import { isAbsolute as isAbsolute23, join as join93, relative as relative20, resolve as resolve35, sep as sep7 } from "path";
|
|
62406
62842
|
|
|
62407
62843
|
// packages/rafa-run/src/start/run-config.ts
|
|
62408
62844
|
init_command2();
|
|
@@ -62672,7 +63108,7 @@ function resolveRuntime(value, places) {
|
|
|
62672
63108
|
throw refusal17([`\u274C Refusing to start: \`--runtime\` names no runtime. Spell it ${SPELLING}.`]);
|
|
62673
63109
|
}
|
|
62674
63110
|
const isVersion = VERSION_SHAPE2.test(value);
|
|
62675
|
-
const named8 = isVersion ?
|
|
63111
|
+
const named8 = isVersion ? join93(places.home, RUNTIME_SUBDIR, value, RUNTIME_ENTRY) : resolve35(places.cwd, value);
|
|
62676
63112
|
refuseInsideSource(value, named8, places);
|
|
62677
63113
|
const entry = entryOf3(value, named8, isVersion, places.home);
|
|
62678
63114
|
const real = realpathSync14(entry);
|
|
@@ -62683,7 +63119,7 @@ function entryOf3(value, named8, isVersion, home) {
|
|
|
62683
63119
|
if (isVersion) {
|
|
62684
63120
|
if (isFile5(named8))
|
|
62685
63121
|
return named8;
|
|
62686
|
-
const root =
|
|
63122
|
+
const root = join93(home, RUNTIME_SUBDIR);
|
|
62687
63123
|
const installed = installedVersions(root);
|
|
62688
63124
|
throw refusal17([
|
|
62689
63125
|
`\u274C Refusing to start: \`--runtime=${value}\` names no installed runtime: ${named8} is no file.`,
|
|
@@ -62692,7 +63128,7 @@ function entryOf3(value, named8, isVersion, home) {
|
|
|
62692
63128
|
}
|
|
62693
63129
|
if (isFile5(named8))
|
|
62694
63130
|
return named8;
|
|
62695
|
-
const inside =
|
|
63131
|
+
const inside = join93(named8, RUNTIME_ENTRY);
|
|
62696
63132
|
if (isDirectory2(named8) && isFile5(inside))
|
|
62697
63133
|
return inside;
|
|
62698
63134
|
throw refusal17([
|
|
@@ -62710,31 +63146,31 @@ function refuseInsideSource(value, path4, places) {
|
|
|
62710
63146
|
]);
|
|
62711
63147
|
}
|
|
62712
63148
|
function sourceDirs({ cwd, root }) {
|
|
62713
|
-
const dirs = [
|
|
63149
|
+
const dirs = [join93(cwd, SOURCE_DIR), join93(root, SOURCE_DIR)];
|
|
62714
63150
|
const real = dirs.filter((dir) => existsSync62(dir)).map((dir) => realpathSync14(dir));
|
|
62715
63151
|
return [...new Set([...dirs, ...real])];
|
|
62716
63152
|
}
|
|
62717
63153
|
function isInside4(path4, dir) {
|
|
62718
63154
|
const rel = relative20(dir, path4);
|
|
62719
|
-
return rel === "" || !
|
|
63155
|
+
return rel === "" || !isAbsolute23(rel) && rel !== ".." && !rel.startsWith(`..${sep7}`);
|
|
62720
63156
|
}
|
|
62721
63157
|
function installedVersions(root) {
|
|
62722
63158
|
try {
|
|
62723
|
-
return readdirSync22(root).filter((name2) => isFile5(
|
|
63159
|
+
return readdirSync22(root).filter((name2) => isFile5(join93(root, name2, RUNTIME_ENTRY))).sort((a, b) => a.localeCompare(b));
|
|
62724
63160
|
} catch {
|
|
62725
63161
|
return [];
|
|
62726
63162
|
}
|
|
62727
63163
|
}
|
|
62728
63164
|
function isFile5(path4) {
|
|
62729
63165
|
try {
|
|
62730
|
-
return
|
|
63166
|
+
return statSync28(path4).isFile();
|
|
62731
63167
|
} catch {
|
|
62732
63168
|
return false;
|
|
62733
63169
|
}
|
|
62734
63170
|
}
|
|
62735
63171
|
function isDirectory2(path4) {
|
|
62736
63172
|
try {
|
|
62737
|
-
return
|
|
63173
|
+
return statSync28(path4).isDirectory();
|
|
62738
63174
|
} catch {
|
|
62739
63175
|
return false;
|
|
62740
63176
|
}
|
|
@@ -62765,7 +63201,7 @@ function realOrResolved2(path4) {
|
|
|
62765
63201
|
try {
|
|
62766
63202
|
return realpathSync14(path4);
|
|
62767
63203
|
} catch {
|
|
62768
|
-
return
|
|
63204
|
+
return resolve35(path4);
|
|
62769
63205
|
}
|
|
62770
63206
|
}
|
|
62771
63207
|
async function runRuntime(entry, words, run) {
|
|
@@ -62918,20 +63354,20 @@ function runtimeRefusalLines(runtimeDir, version2) {
|
|
|
62918
63354
|
];
|
|
62919
63355
|
}
|
|
62920
63356
|
function listTrackers(repoRoot, planDir) {
|
|
62921
|
-
const dir =
|
|
62922
|
-
return entryNames(dir).filter((entry) => TRACKER_NAME.test(entry)).sort((a, b) => a.localeCompare(b)).map((entry) =>
|
|
63357
|
+
const dir = resolve36(repoRoot, planDir);
|
|
63358
|
+
return entryNames(dir).filter((entry) => TRACKER_NAME.test(entry)).sort((a, b) => a.localeCompare(b)).map((entry) => join94(dir, entry)).filter((path4) => statSync29(path4).isFile()).map((path4) => relative21(repoRoot, path4));
|
|
62923
63359
|
}
|
|
62924
63360
|
function openTrackers(repoRoot, planDir) {
|
|
62925
63361
|
return listTrackers(repoRoot, planDir).flatMap((path4) => {
|
|
62926
|
-
const task = findNextTask(
|
|
63362
|
+
const task = findNextTask(readFileSync76(join94(repoRoot, path4), "utf8"));
|
|
62927
63363
|
return task ? [{ path: path4, task }] : [];
|
|
62928
63364
|
});
|
|
62929
63365
|
}
|
|
62930
63366
|
function readManifestVersion2(repoRoot) {
|
|
62931
|
-
const manifest = JSON.parse(
|
|
63367
|
+
const manifest = JSON.parse(readFileSync76(join94(repoRoot, "package.json"), "utf8"));
|
|
62932
63368
|
const record2 = typeof manifest === "object" && manifest !== null ? manifest : {};
|
|
62933
63369
|
if (record2["name"] !== RAFA_PACKAGE_NAME2) {
|
|
62934
|
-
throw new Error(`${
|
|
63370
|
+
throw new Error(`${join94(repoRoot, "package.json")} names ${JSON.stringify(record2["name"])}, not ${RAFA_PACKAGE_NAME2}: this is no rafa checkout`);
|
|
62935
63371
|
}
|
|
62936
63372
|
const version2 = record2["version"];
|
|
62937
63373
|
if (typeof version2 !== "string" || !VERSION_SHAPE2.test(version2)) {
|
|
@@ -62944,8 +63380,8 @@ function copyTree(from, to) {
|
|
|
62944
63380
|
let copied = 0;
|
|
62945
63381
|
const entries = readdirSync23(from, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
62946
63382
|
for (const entry of entries) {
|
|
62947
|
-
const source =
|
|
62948
|
-
const target =
|
|
63383
|
+
const source = join94(from, entry.name);
|
|
63384
|
+
const target = join94(to, entry.name);
|
|
62949
63385
|
if (entry.isDirectory()) {
|
|
62950
63386
|
copied += copyTree(source, target);
|
|
62951
63387
|
} else if (entry.isFile()) {
|
|
@@ -63040,20 +63476,20 @@ async function installRuntime(seams, options = {}) {
|
|
|
63040
63476
|
}
|
|
63041
63477
|
async function runInstall(seams, options) {
|
|
63042
63478
|
const { repoRoot, home, log } = seams;
|
|
63043
|
-
const runtimeRoot =
|
|
63044
|
-
const linkPath =
|
|
63479
|
+
const runtimeRoot = join94(home, RUNTIME_SUBDIR);
|
|
63480
|
+
const linkPath = join94(home, RAFA_BIN_DIR, LINK_NAME);
|
|
63045
63481
|
log(`repo root: ${repoRoot}`);
|
|
63046
63482
|
log(`runtime root: ${runtimeRoot}`);
|
|
63047
63483
|
log(`link: ${linkPath}`);
|
|
63048
63484
|
const version2 = inStage("manifest", () => readManifestVersion2(repoRoot));
|
|
63049
|
-
const planDir = await inStageAsync("config", async () =>
|
|
63485
|
+
const planDir = await inStageAsync("config", async () => resolve36(repoRoot, (await loadConfig({ root: repoRoot, home }, {}, seams.warn)).config.planDir));
|
|
63050
63486
|
log(`plan dir: ${planDir}`);
|
|
63051
63487
|
const open = inStage("trackers", () => openTrackers(repoRoot, planDir));
|
|
63052
63488
|
if (open.length > 0 && options.force !== true && loopIsLive(seams)) {
|
|
63053
63489
|
return { kind: "refused", reason: "trackers", planDir, trackers: open };
|
|
63054
63490
|
}
|
|
63055
|
-
const distDir =
|
|
63056
|
-
const runtimeDir =
|
|
63491
|
+
const distDir = join94(repoRoot, "dist");
|
|
63492
|
+
const runtimeDir = join94(runtimeRoot, version2);
|
|
63057
63493
|
const installed = existsSync63(runtimeDir);
|
|
63058
63494
|
if (installed && options.force !== true) {
|
|
63059
63495
|
return { kind: "refused", reason: "runtime-exists", version: version2, runtimeDir };
|
|
@@ -63064,13 +63500,13 @@ async function runInstall(seams, options) {
|
|
|
63064
63500
|
const code = inStage("build", () => seams.build(repoRoot));
|
|
63065
63501
|
if (code !== 0)
|
|
63066
63502
|
throw new StageFailure("build", `the build exited ${code}`);
|
|
63067
|
-
if (!existsSync63(
|
|
63068
|
-
throw new StageFailure("build", `the build exited 0 and left no ${
|
|
63503
|
+
if (!existsSync63(join94(distDir, RUNTIME_ENTRY))) {
|
|
63504
|
+
throw new StageFailure("build", `the build exited 0 and left no ${join94(distDir, RUNTIME_ENTRY)}`);
|
|
63069
63505
|
}
|
|
63070
63506
|
log(installed ? `copying ${distDir} over ${runtimeDir}, replacing it whole` : `copying ${distDir} into ${runtimeDir}`);
|
|
63071
63507
|
const copied = inStage("copy", () => replaceTree(distDir, runtimeDir));
|
|
63072
63508
|
log(`copied ${copied} file(s)`);
|
|
63073
|
-
const resolved = inStage("link", () => relink(linkPath,
|
|
63509
|
+
const resolved = inStage("link", () => relink(linkPath, join94(runtimeDir, RUNTIME_ENTRY)));
|
|
63074
63510
|
log(`${linkPath} resolves to ${resolved}`);
|
|
63075
63511
|
return { kind: "done", version: version2, runtimeDir, linkPath, resolved, copied };
|
|
63076
63512
|
}
|
|
@@ -63109,7 +63545,7 @@ function replaceFile(source, target) {
|
|
|
63109
63545
|
const temporary = temporaryName(target);
|
|
63110
63546
|
try {
|
|
63111
63547
|
copyFileSync6(source, temporary);
|
|
63112
|
-
chmodSync(temporary,
|
|
63548
|
+
chmodSync(temporary, statSync29(source).mode & 4095);
|
|
63113
63549
|
renameSync10(temporary, target);
|
|
63114
63550
|
} catch (err) {
|
|
63115
63551
|
rmSync16(temporary, { force: true });
|
|
@@ -63117,7 +63553,7 @@ function replaceFile(source, target) {
|
|
|
63117
63553
|
}
|
|
63118
63554
|
}
|
|
63119
63555
|
function temporaryName(path4) {
|
|
63120
|
-
return
|
|
63556
|
+
return join94(dirname39(path4), `.${basename21(path4)}.snapshot-${process.pid}`);
|
|
63121
63557
|
}
|
|
63122
63558
|
// packages/rafa-run/src/start/budget.ts
|
|
63123
63559
|
init_output();
|
|
@@ -63337,179 +63773,7 @@ function haltIfWrapUpMoved(options, seams = {}) {
|
|
|
63337
63773
|
init_command2();
|
|
63338
63774
|
init_sections();
|
|
63339
63775
|
init_output();
|
|
63340
|
-
|
|
63341
|
-
// packages/rafa/src/project/roots.ts
|
|
63342
|
-
init_sections();
|
|
63343
|
-
init_scope2();
|
|
63344
|
-
init_worktree_root();
|
|
63345
|
-
import { spawnSync as spawnSync7 } from "child_process";
|
|
63346
|
-
import { accessSync, constants as constants3, readFileSync as readFileSync76, statSync as statSync29 } from "fs";
|
|
63347
|
-
import { isAbsolute as isAbsolute23, join as join94, resolve as resolve36 } from "path";
|
|
63348
|
-
var REFUSED_ROOTS = Object.freeze([
|
|
63349
|
-
{ path: "/", why: "is the filesystem root" },
|
|
63350
|
-
{ path: "/var", why: "holds system state" },
|
|
63351
|
-
{ path: "/etc", why: "holds system configuration" },
|
|
63352
|
-
{ path: "/usr", why: "holds system programs" },
|
|
63353
|
-
{ path: "/home", why: "holds the home directories of every user" },
|
|
63354
|
-
{ path: "/Users", why: "holds the home directories of every user" }
|
|
63355
|
-
]);
|
|
63356
|
-
var HOME_WHY = `is the home directory, whose ${SCOPE_DIR}/ is the user scope`;
|
|
63357
|
-
var MONOREPO_MARKER_FILES = Object.freeze([
|
|
63358
|
-
"turbo.json",
|
|
63359
|
-
"pnpm-workspace.yaml",
|
|
63360
|
-
"nx.json",
|
|
63361
|
-
"lerna.json"
|
|
63362
|
-
]);
|
|
63363
|
-
var PACKAGE_JSON = "package.json";
|
|
63364
|
-
var DISK_ROOTS_FILE_SYSTEM = Object.freeze({
|
|
63365
|
-
...DISK_FILE_SYSTEM,
|
|
63366
|
-
readFile: (path4) => readFileSync76(path4, "utf8"),
|
|
63367
|
-
isDirectory: (path4) => statSync29(path4).isDirectory(),
|
|
63368
|
-
assertWritable: (path4) => accessSync(path4, constants3.W_OK)
|
|
63369
|
-
});
|
|
63370
|
-
|
|
63371
|
-
class RootsError extends Error {
|
|
63372
|
-
constructor(message, options) {
|
|
63373
|
-
super(`rafa roots: ${message}`, options);
|
|
63374
|
-
this.name = "RootsError";
|
|
63375
|
-
}
|
|
63376
|
-
}
|
|
63377
|
-
function gitToplevel(dir) {
|
|
63378
|
-
const result2 = spawnSync7("git", ["rev-parse", "--show-toplevel"], {
|
|
63379
|
-
cwd: dir,
|
|
63380
|
-
encoding: "utf8",
|
|
63381
|
-
env: { ...process.env, LC_ALL: "C" }
|
|
63382
|
-
});
|
|
63383
|
-
if (result2.error !== undefined) {
|
|
63384
|
-
throw new RootsError(`git could not run in ${dir} (${result2.error.message})`, { cause: result2.error });
|
|
63385
|
-
}
|
|
63386
|
-
if (result2.status === 0)
|
|
63387
|
-
return result2.stdout.replace(/\n$/, "");
|
|
63388
|
-
if (result2.stderr.startsWith(NOT_A_REPOSITORY))
|
|
63389
|
-
return null;
|
|
63390
|
-
const status = String(result2.status);
|
|
63391
|
-
throw new RootsError(`git rev-parse --show-toplevel failed in ${dir}, exit ${status}: ${result2.stderr.trim()}`);
|
|
63392
|
-
}
|
|
63393
|
-
function requireAbsolute2(label, path4) {
|
|
63394
|
-
if (!isAbsolute23(path4)) {
|
|
63395
|
-
throw new RootsError(`${label} is ${describeValue(path4)}, expected an absolute path`);
|
|
63396
|
-
}
|
|
63397
|
-
}
|
|
63398
|
-
function realOf(label, path4, fs2) {
|
|
63399
|
-
try {
|
|
63400
|
-
return fs2.realpath(path4);
|
|
63401
|
-
} catch (error2) {
|
|
63402
|
-
throw new RootsError(`${label} ${path4} does not resolve (${messageOf(error2)})`, { cause: error2 });
|
|
63403
|
-
}
|
|
63404
|
-
}
|
|
63405
|
-
function realOrSpelled(path4, fs2) {
|
|
63406
|
-
try {
|
|
63407
|
-
return fs2.realpath(path4);
|
|
63408
|
-
} catch {
|
|
63409
|
-
return resolve36(path4);
|
|
63410
|
-
}
|
|
63411
|
-
}
|
|
63412
|
-
function namedRoots(home, fs2) {
|
|
63413
|
-
const system = REFUSED_ROOTS.map(({ path: path4, why }) => ({
|
|
63414
|
-
kind: "system",
|
|
63415
|
-
path: path4,
|
|
63416
|
-
why,
|
|
63417
|
-
real: realOrSpelled(path4, fs2)
|
|
63418
|
-
}));
|
|
63419
|
-
return [...system, { kind: "home", path: home, why: HOME_WHY, real: realOrSpelled(home, fs2) }];
|
|
63420
|
-
}
|
|
63421
|
-
function namedRefusal(given, real, named8) {
|
|
63422
|
-
const match = named8.find((root) => root.real === real);
|
|
63423
|
-
if (match === undefined)
|
|
63424
|
-
return null;
|
|
63425
|
-
const reason = given === match.path ? `${given} ${match.why}` : `${given} is the same directory as ${match.path}, which ${match.why}`;
|
|
63426
|
-
return { kind: match.kind, path: given, reason };
|
|
63427
|
-
}
|
|
63428
|
-
function unwritable(given, why) {
|
|
63429
|
-
return { kind: "unwritable", path: given, reason: `${given} ${why}` };
|
|
63430
|
-
}
|
|
63431
|
-
function resolveReal(path4, fs2) {
|
|
63432
|
-
try {
|
|
63433
|
-
return { real: fs2.realpath(path4), error: null };
|
|
63434
|
-
} catch (error2) {
|
|
63435
|
-
return { real: null, error: error2 };
|
|
63436
|
-
}
|
|
63437
|
-
}
|
|
63438
|
-
function writeRefusal(given, real, fs2) {
|
|
63439
|
-
if (!fs2.isDirectory(real)) {
|
|
63440
|
-
return unwritable(given, "is not a directory, so no project tree can be written under it");
|
|
63441
|
-
}
|
|
63442
|
-
try {
|
|
63443
|
-
fs2.assertWritable(real);
|
|
63444
|
-
return null;
|
|
63445
|
-
} catch (error2) {
|
|
63446
|
-
return unwritable(given, `is not writable by this user (${messageOf(error2)})`);
|
|
63447
|
-
}
|
|
63448
|
-
}
|
|
63449
|
-
function refusalOf2(given, named8, fs2) {
|
|
63450
|
-
const resolved = resolveReal(given, fs2);
|
|
63451
|
-
const byName2 = namedRefusal(given, resolved.real ?? resolve36(given), named8);
|
|
63452
|
-
if (byName2 !== null)
|
|
63453
|
-
return byName2;
|
|
63454
|
-
if (resolved.real === null) {
|
|
63455
|
-
const detail = messageOf(resolved.error);
|
|
63456
|
-
return unwritable(given, `does not resolve, so no project tree can be written under it (${detail})`);
|
|
63457
|
-
}
|
|
63458
|
-
return writeRefusal(given, resolved.real, fs2);
|
|
63459
|
-
}
|
|
63460
|
-
function rootRefusal(path4, seams) {
|
|
63461
|
-
const { home, fs: fs2 = DISK_ROOTS_FILE_SYSTEM } = seams;
|
|
63462
|
-
requireAbsolute2("root", path4);
|
|
63463
|
-
requireAbsolute2("home directory", home);
|
|
63464
|
-
return refusalOf2(path4, namedRoots(home, fs2), fs2);
|
|
63465
|
-
}
|
|
63466
|
-
function hasWorkspaces(manifest) {
|
|
63467
|
-
return typeof manifest === "object" && manifest !== null && Object.hasOwn(manifest, "workspaces");
|
|
63468
|
-
}
|
|
63469
|
-
function readManifest2(file, fs2) {
|
|
63470
|
-
if (!fs2.exists(file))
|
|
63471
|
-
return { marks: false, warnings: [] };
|
|
63472
|
-
try {
|
|
63473
|
-
return { marks: hasWorkspaces(JSON.parse(fs2.readFile(file))), warnings: [] };
|
|
63474
|
-
} catch (error2) {
|
|
63475
|
-
return { marks: false, warnings: [`${file} was not read as a monorepo marker (${messageOf(error2)})`] };
|
|
63476
|
-
}
|
|
63477
|
-
}
|
|
63478
|
-
function readDir(dir, fs2) {
|
|
63479
|
-
const manifest = readManifest2(join94(dir, PACKAGE_JSON), fs2);
|
|
63480
|
-
const files = MONOREPO_MARKER_FILES.filter((name2) => fs2.exists(join94(dir, name2)));
|
|
63481
|
-
const markers = manifest.marks ? [PACKAGE_JSON, ...files] : files;
|
|
63482
|
-
return { ...manifest, dir, markers };
|
|
63483
|
-
}
|
|
63484
|
-
function walkMarkers(base2, named8, fs2) {
|
|
63485
|
-
return selfAndAncestors(base2).filter((dir) => !named8.some((root) => root.real === dir)).map((dir) => readDir(dir, fs2));
|
|
63486
|
-
}
|
|
63487
|
-
function candidateAt(path4, source, walk2, named8, fs2) {
|
|
63488
|
-
const markers = walk2.find((read2) => read2.dir === path4)?.markers ?? [];
|
|
63489
|
-
return { path: path4, source, markers, refusal: refusalOf2(path4, named8, fs2) };
|
|
63490
|
-
}
|
|
63491
|
-
function rootCandidates(start, seams) {
|
|
63492
|
-
const { home, fs: fs2 = DISK_ROOTS_FILE_SYSTEM, gitToplevel: probe3 = gitToplevel } = seams;
|
|
63493
|
-
requireAbsolute2("start directory", start);
|
|
63494
|
-
requireAbsolute2("home directory", home);
|
|
63495
|
-
const realStart = realOf("start directory", start, fs2);
|
|
63496
|
-
const toplevel = probe3(realStart);
|
|
63497
|
-
if (toplevel !== null)
|
|
63498
|
-
requireAbsolute2("git toplevel", toplevel);
|
|
63499
|
-
const base2 = toplevel === null ? realStart : realOf("git toplevel", toplevel, fs2);
|
|
63500
|
-
const source = toplevel === null ? "directory" : "git-toplevel";
|
|
63501
|
-
const named8 = namedRoots(home, fs2);
|
|
63502
|
-
const walk2 = walkMarkers(base2, named8, fs2);
|
|
63503
|
-
const outermost = walk2.filter((read2) => read2.markers.length > 0).at(-1);
|
|
63504
|
-
const monorepo = outermost === undefined || outermost.dir === base2 ? [] : [candidateAt(outermost.dir, "monorepo", walk2, named8, fs2)];
|
|
63505
|
-
return {
|
|
63506
|
-
start,
|
|
63507
|
-
candidates: [candidateAt(base2, source, walk2, named8, fs2), ...monorepo],
|
|
63508
|
-
warnings: walk2.flatMap((read2) => read2.warnings)
|
|
63509
|
-
};
|
|
63510
|
-
}
|
|
63511
|
-
|
|
63512
|
-
// packages/rafa-run/src/start/checkout.ts
|
|
63776
|
+
init_roots();
|
|
63513
63777
|
init_worktree_root();
|
|
63514
63778
|
function sameRepository(toplevel, projectRoot2, mainCheckout) {
|
|
63515
63779
|
if (toplevel === projectRoot2)
|
|
@@ -63788,7 +64052,7 @@ var SLOT_PATTERN3 = new RegExp(`\\{\\{(${DECISION_PROMPT_SLOTS.join("|")})\\}\\}
|
|
|
63788
64052
|
var RETRY_SECTION = /^<!-- (retry|no-retry) -->\n([\s\S]*?)^<!-- \/\1 -->\n/gmu;
|
|
63789
64053
|
function chooseRetrySections(template, retriesLeft) {
|
|
63790
64054
|
const kept = retriesLeft > 0 ? "retry" : "no-retry";
|
|
63791
|
-
return template.replace(RETRY_SECTION, (_whole,
|
|
64055
|
+
return template.replace(RETRY_SECTION, (_whole, section3, body) => section3 === kept ? body : "");
|
|
63792
64056
|
}
|
|
63793
64057
|
var NO_HOLDS = "(no reason was recorded)";
|
|
63794
64058
|
var NO_OPEN_TASKS = "(no open task is left)";
|
|
@@ -64556,7 +64820,7 @@ function contextBody(body) {
|
|
|
64556
64820
|
return null;
|
|
64557
64821
|
return body.replace(/^(?:[ \t]*\n)+/, "").replace(/(?:\n[ \t]*)+$/, "");
|
|
64558
64822
|
}
|
|
64559
|
-
function
|
|
64823
|
+
function section3(heading, ...parts) {
|
|
64560
64824
|
return [heading, ...parts].filter((part) => part !== null).join(`
|
|
64561
64825
|
|
|
64562
64826
|
`);
|
|
@@ -64587,14 +64851,14 @@ function checklistLines(task, dispatched) {
|
|
|
64587
64851
|
}
|
|
64588
64852
|
function planContextSection(model) {
|
|
64589
64853
|
const body = contextBody(model.context);
|
|
64590
|
-
return body === null ? null :
|
|
64854
|
+
return body === null ? null : section3(PLAN_CONTEXT_HEADING, body);
|
|
64591
64855
|
}
|
|
64592
64856
|
function stageSection(model, dispatched, lines3) {
|
|
64593
64857
|
const owner = dispatched.stage === null ? undefined : model.stages[dispatched.stage];
|
|
64594
64858
|
if (owner === undefined)
|
|
64595
|
-
return
|
|
64859
|
+
return section3(CHECKLIST_HEADING, lines3.join(`
|
|
64596
64860
|
`));
|
|
64597
|
-
return
|
|
64861
|
+
return section3(`${STAGE_HEADING_PREFIX}${owner.name}`, contextBody(owner.context), lines3.join(`
|
|
64598
64862
|
`));
|
|
64599
64863
|
}
|
|
64600
64864
|
function stageListSection(model, dispatched) {
|
|
@@ -64604,7 +64868,7 @@ function stageListSection(model, dispatched) {
|
|
|
64604
64868
|
const mark = index === dispatched.stage ? CURRENT_STAGE_MARK : "";
|
|
64605
64869
|
return `${index + 1}. ${stage2.name}${mark}`;
|
|
64606
64870
|
});
|
|
64607
|
-
return
|
|
64871
|
+
return section3(STAGE_LIST_HEADING, items2.join(`
|
|
64608
64872
|
`));
|
|
64609
64873
|
}
|
|
64610
64874
|
function renderStage(model, dispatched) {
|
|
@@ -65783,20 +66047,22 @@ init_rafa_pr();
|
|
|
65783
66047
|
init_sections();
|
|
65784
66048
|
init_output();
|
|
65785
66049
|
init_rafa_pr();
|
|
65786
|
-
import { existsSync as existsSync71, mkdtempSync as mkdtempSync6, realpathSync as realpathSync17, rmSync as rmSync17, symlinkSync as symlinkSync3, writeFileSync as writeFileSync29 } from "fs";
|
|
66050
|
+
import { closeSync as closeSync3, existsSync as existsSync71, mkdtempSync as mkdtempSync6, openSync as openSync3, readSync as readSync2, realpathSync as realpathSync17, rmSync as rmSync17, symlinkSync as symlinkSync3, writeFileSync as writeFileSync29 } from "fs";
|
|
65787
66051
|
import { tmpdir as tmpdir8 } from "os";
|
|
65788
|
-
import { dirname as dirname41, join as join98, relative as relative22, resolve as resolve38, sep as sep8 } from "path";
|
|
66052
|
+
import { basename as basename23, dirname as dirname41, join as join98, relative as relative22, resolve as resolve38, sep as sep8 } from "path";
|
|
65789
66053
|
var TEST_FILE_SUFFIX = ".test.ts";
|
|
65790
66054
|
var TSC_FLAGS = ["--noEmit", "--pretty", "false"];
|
|
66055
|
+
var CANNOT_START_CODES = [126, 127];
|
|
66056
|
+
var SHEBANG_BYTES = 256;
|
|
65791
66057
|
var ERRORS_LISTED = 10;
|
|
65792
66058
|
var NODE_MODULES2 = "node_modules";
|
|
65793
66059
|
var TSC_BIN = [".bin", "tsc"];
|
|
65794
66060
|
var SCRATCH_NAME = "tsconfig.json";
|
|
65795
66061
|
var FILE_ERROR = /^(.+)\((\d+),(\d+)\): error (TS\d+): (.*)$/;
|
|
65796
66062
|
var GLOBAL_ERROR = /^error (TS\d+): (.*)$/;
|
|
65797
|
-
var NOTHING_RAN = { ran: false, red: false, interrupted: false, blocker: null };
|
|
65798
|
-
var GREEN = { ran: true, red: false, interrupted: false, blocker: null };
|
|
65799
|
-
var INTERRUPTED2 = { ran: true, red: false, interrupted: true, blocker: null };
|
|
66063
|
+
var NOTHING_RAN = { ran: false, red: false, interrupted: false, cannotStart: false, blocker: null };
|
|
66064
|
+
var GREEN = { ran: true, red: false, interrupted: false, cannotStart: false, blocker: null };
|
|
66065
|
+
var INTERRUPTED2 = { ran: true, red: false, interrupted: true, cannotStart: false, blocker: null };
|
|
65800
66066
|
async function runTsc(options) {
|
|
65801
66067
|
const proc = Bun.spawn([...options.argv], {
|
|
65802
66068
|
cwd: options.cwd,
|
|
@@ -65943,6 +66209,32 @@ function typeBlockerText(label, base2, errors) {
|
|
|
65943
66209
|
function brokenBlockerText(label, run, said) {
|
|
65944
66210
|
return `The runner's ${label} could not type-check the task's test files: tsc exited ${run.exitCode}${said === undefined ? " and printed no error." : `: ${said}`}`;
|
|
65945
66211
|
}
|
|
66212
|
+
function scriptInterpreter(path4) {
|
|
66213
|
+
let head;
|
|
66214
|
+
try {
|
|
66215
|
+
const fd = openSync3(path4, "r");
|
|
66216
|
+
try {
|
|
66217
|
+
const buffer = Buffer.alloc(SHEBANG_BYTES);
|
|
66218
|
+
head = buffer.toString("utf8", 0, readSync2(fd, buffer, 0, SHEBANG_BYTES, 0));
|
|
66219
|
+
} finally {
|
|
66220
|
+
closeSync3(fd);
|
|
66221
|
+
}
|
|
66222
|
+
} catch {
|
|
66223
|
+
return null;
|
|
66224
|
+
}
|
|
66225
|
+
const first = head.split(`
|
|
66226
|
+
`)[0] ?? "";
|
|
66227
|
+
if (!first.startsWith("#!"))
|
|
66228
|
+
return null;
|
|
66229
|
+
const [program = "", ...rest] = first.slice(2).trim().split(/\s+/u);
|
|
66230
|
+
const named8 = basename23(program) === "env" ? rest.find((word) => !word.startsWith("-") && !word.includes("=")) : program;
|
|
66231
|
+
return named8 === undefined || named8 === "" ? null : basename23(named8);
|
|
66232
|
+
}
|
|
66233
|
+
function cannotStartBlockerText(label, tsc, run, said, interpreter) {
|
|
66234
|
+
const heard = said === undefined ? "" : ` (${said})`;
|
|
66235
|
+
const fix = interpreter === null ? `Its first line names no interpreter, so make ${tsc} runnable from the PATH the loop runs under` : `tsc runs under ${interpreter}, which its first line names: put ${interpreter} on the PATH the loop runs under`;
|
|
66236
|
+
return `The runner's ${label} could not start tsc: ${tsc} exited ${run.exitCode}${heard}. ` + `${fix}, then run the task again. This is no type error of the task's, and no change to its files fixes it.`;
|
|
66237
|
+
}
|
|
65946
66238
|
function configError(errors, scratch, cwd) {
|
|
65947
66239
|
const config = relative22(cwd, scratch);
|
|
65948
66240
|
return errors.find((error2) => error2.file === null || error2.file === config);
|
|
@@ -65965,6 +66257,8 @@ async function checkTree(input, modules, tree, files) {
|
|
|
65965
66257
|
}
|
|
65966
66258
|
if (run.exitCode === input.stopCode || input.isInterrupted?.() === true)
|
|
65967
66259
|
return { kind: "interrupted" };
|
|
66260
|
+
if (CANNOT_START_CODES.includes(run.exitCode))
|
|
66261
|
+
return { kind: "cannot-start", run, said: firstLine11(run) };
|
|
65968
66262
|
const errors = parseTscOutput(run.stdout, tree);
|
|
65969
66263
|
const config = configError(errors, scratch, tree);
|
|
65970
66264
|
if (config !== undefined)
|
|
@@ -66010,6 +66304,8 @@ async function baseErrors(input, label, modules, files) {
|
|
|
66010
66304
|
return { outcome: GREEN };
|
|
66011
66305
|
if (run.kind === "interrupted")
|
|
66012
66306
|
return { outcome: interrupted(label) };
|
|
66307
|
+
if (run.kind === "cannot-start")
|
|
66308
|
+
return { outcome: cannotStart(label, modules, run) };
|
|
66013
66309
|
if (run.kind !== "read") {
|
|
66014
66310
|
const why = run.kind === "threw" ? run.why : brokenBlockerText(label, run.run, run.said);
|
|
66015
66311
|
activeOutput().warn(`\u26A0\uFE0F The ${label} could not check the files at ${input.base} (${why}); it reads no error as new.`);
|
|
@@ -66022,6 +66318,12 @@ function interrupted(label) {
|
|
|
66022
66318
|
activeOutput().info(`\u23F9 The ${label} was interrupted by SIGINT: read as a stop, not as errors.`);
|
|
66023
66319
|
return INTERRUPTED2;
|
|
66024
66320
|
}
|
|
66321
|
+
function cannotStart(label, modules, run) {
|
|
66322
|
+
const tsc = join98(modules, ...TSC_BIN);
|
|
66323
|
+
const blocker = cannotStartBlockerText(label, tsc, run.run, run.said, scriptInterpreter(tsc));
|
|
66324
|
+
activeOutput().warn(`\u26A0\uFE0F ${blocker}`);
|
|
66325
|
+
return { ran: false, red: false, interrupted: false, cannotStart: true, blocker };
|
|
66326
|
+
}
|
|
66025
66327
|
function filesToCheck(input, label) {
|
|
66026
66328
|
if (!existsSync71(join98(input.checkout, "tsconfig.json"))) {
|
|
66027
66329
|
activeOutput().info(`\uD83D\uDD0E ${label}: no tsconfig.json at the checkout root; nothing to type-check.`);
|
|
@@ -66048,10 +66350,12 @@ async function runTypeStep(input) {
|
|
|
66048
66350
|
}
|
|
66049
66351
|
if (head.kind === "interrupted")
|
|
66050
66352
|
return interrupted(label);
|
|
66353
|
+
if (head.kind === "cannot-start")
|
|
66354
|
+
return cannotStart(label, modules, head);
|
|
66051
66355
|
if (head.kind === "broken") {
|
|
66052
66356
|
const blocker = brokenBlockerText(label, head.run, head.said);
|
|
66053
66357
|
activeOutput().info(`\uD83D\uDD0E ${label}: ${blocker}`);
|
|
66054
|
-
return { ran: true, red: true, interrupted: false, blocker };
|
|
66358
|
+
return { ran: true, red: true, interrupted: false, cannotStart: false, blocker };
|
|
66055
66359
|
}
|
|
66056
66360
|
const ran = `\uD83D\uDD0E ${label}: tsc over ${files.length} test file(s)`;
|
|
66057
66361
|
if (head.errors.length === 0) {
|
|
@@ -66067,7 +66371,7 @@ async function runTypeStep(input) {
|
|
|
66067
66371
|
activeOutput().info(` ${line}`);
|
|
66068
66372
|
if (added.length === 0)
|
|
66069
66373
|
return GREEN;
|
|
66070
|
-
return { ran: true, red: true, interrupted: false, blocker: typeBlockerText(label, input.base, added) };
|
|
66374
|
+
return { ran: true, red: true, interrupted: false, cannotStart: false, blocker: typeBlockerText(label, input.base, added) };
|
|
66071
66375
|
}
|
|
66072
66376
|
|
|
66073
66377
|
// packages/rafa-run/src/start/task-gate-lines.ts
|
|
@@ -66133,7 +66437,7 @@ function blockerLines(blocker) {
|
|
|
66133
66437
|
}
|
|
66134
66438
|
var NO_TASK_SECTIONS = { skills: "", lessons: "" };
|
|
66135
66439
|
function sectionLines(sections2) {
|
|
66136
|
-
return [sections2.skills, sections2.lessons, sections2.inherited].filter((
|
|
66440
|
+
return [sections2.skills, sections2.lessons, sections2.inherited].filter((section4) => section4.trim().length > 0).flatMap((section4) => [section4, ""]);
|
|
66137
66441
|
}
|
|
66138
66442
|
function buildTaskPrompt(taskText, promptContent, planText, knownMissing = [], blocker = null, sections2 = NO_TASK_SECTIONS, base2 = null, inherited = [], alwaysRun = [], typeCheck = null) {
|
|
66139
66443
|
return [
|
|
@@ -67656,12 +67960,19 @@ function createStartStaleDocs(options) {
|
|
|
67656
67960
|
const redact = (text2) => local(redactSecrets(text2, secrets));
|
|
67657
67961
|
const kept = new Map;
|
|
67658
67962
|
let version2 = null;
|
|
67963
|
+
let newestRelease = null;
|
|
67659
67964
|
let tracker = null;
|
|
67660
67965
|
let docUpdatePlan;
|
|
67661
67966
|
const versionOnce = () => {
|
|
67662
67967
|
version2 ??= (options.readVersion ?? (() => readStaleDocsVersion(options)))();
|
|
67663
67968
|
return version2;
|
|
67664
67969
|
};
|
|
67970
|
+
const newestReleaseOnce = () => {
|
|
67971
|
+
newestRelease ??= {
|
|
67972
|
+
value: (options.readNewestRelease ?? (() => newestRootRelease(createGitRunner(options.checkout))))()
|
|
67973
|
+
};
|
|
67974
|
+
return newestRelease.value;
|
|
67975
|
+
};
|
|
67665
67976
|
const resolveOnce = () => {
|
|
67666
67977
|
tracker ??= (options.resolve ?? resolveTracker)({
|
|
67667
67978
|
config: options.config,
|
|
@@ -67689,7 +68000,12 @@ function createStartStaleDocs(options) {
|
|
|
67689
68000
|
}
|
|
67690
68001
|
};
|
|
67691
68002
|
const addLine = async (entry) => {
|
|
67692
|
-
const result2 = await addStaleDocLine({
|
|
68003
|
+
const result2 = await addStaleDocLine({
|
|
68004
|
+
tracker: await resolveOnce(),
|
|
68005
|
+
version: versionOnce(),
|
|
68006
|
+
entry,
|
|
68007
|
+
newestRelease: newestReleaseOnce()
|
|
68008
|
+
});
|
|
67693
68009
|
const text2 = staleDocLineText(entry);
|
|
67694
68010
|
if (result2.action === "kept")
|
|
67695
68011
|
kept.set(text2, result2.title);
|
|
@@ -67860,17 +68176,17 @@ init_run2();
|
|
|
67860
68176
|
init_rafa_pr();
|
|
67861
68177
|
import { readFileSync as readFileSync87 } from "fs";
|
|
67862
68178
|
import { constants as constants4 } from "os";
|
|
67863
|
-
import { basename as
|
|
68179
|
+
import { basename as basename26, join as join105 } from "path";
|
|
67864
68180
|
|
|
67865
68181
|
// packages/rafa-run/src/suite/baseline.ts
|
|
67866
68182
|
import { existsSync as existsSync74, mkdirSync as mkdirSync27, readFileSync as readFileSync82, renameSync as renameSync11, writeFileSync as writeFileSync30 } from "fs";
|
|
67867
|
-
import { basename as
|
|
68183
|
+
import { basename as basename24, dirname as dirname42, join as join100 } from "path";
|
|
67868
68184
|
var BASELINE_VERSION = 1;
|
|
67869
68185
|
var BASELINE_FILE_PREFIX = "SUITE_BASELINE";
|
|
67870
68186
|
var PLAN_FILE_NAME2 = /^PLAN(?:_TRACKER)?(-.+)?\.md$/;
|
|
67871
68187
|
var JUNIT_READINGS = ["read", "missing", "unreadable"];
|
|
67872
68188
|
function baselinePathFor(trackerPath) {
|
|
67873
|
-
const match = PLAN_FILE_NAME2.exec(
|
|
68189
|
+
const match = PLAN_FILE_NAME2.exec(basename24(trackerPath));
|
|
67874
68190
|
if (match === null) {
|
|
67875
68191
|
throw new RangeError(`baselinePathFor: ${trackerPath} is not a PLAN or PLAN_TRACKER file`);
|
|
67876
68192
|
}
|
|
@@ -68374,12 +68690,12 @@ init_output();
|
|
|
68374
68690
|
init_plan();
|
|
68375
68691
|
init_tracker();
|
|
68376
68692
|
import { existsSync as existsSync77, mkdirSync as mkdirSync28, readFileSync as readFileSync84, renameSync as renameSync12, writeFileSync as writeFileSync31 } from "fs";
|
|
68377
|
-
import { basename as
|
|
68693
|
+
import { basename as basename25, dirname as dirname43, join as join104 } from "path";
|
|
68378
68694
|
var STAGE_LEDGER_PREFIX = "SUITE_STAGES";
|
|
68379
68695
|
var STAGE_LEDGER_VERSION = 1;
|
|
68380
68696
|
function stageLedgerPathFor(trackerPath) {
|
|
68381
68697
|
const baselinePath = baselinePathFor(trackerPath);
|
|
68382
|
-
const name2 =
|
|
68698
|
+
const name2 = basename25(baselinePath).replace(BASELINE_FILE_PREFIX, STAGE_LEDGER_PREFIX);
|
|
68383
68699
|
return join104(dirname43(baselinePath), name2);
|
|
68384
68700
|
}
|
|
68385
68701
|
function isLedgerEntry(value) {
|
|
@@ -68414,7 +68730,7 @@ function readStageLedger(path4) {
|
|
|
68414
68730
|
}
|
|
68415
68731
|
if (typeof parsed2 !== "string")
|
|
68416
68732
|
return parsed2;
|
|
68417
|
-
activeOutput().warn(`\u26A0\uFE0F ${
|
|
68733
|
+
activeOutput().warn(`\u26A0\uFE0F ${basename25(path4)} does not read (${parsed2}); every finished stage's step is taken again.`);
|
|
68418
68734
|
return [];
|
|
68419
68735
|
}
|
|
68420
68736
|
function writeStageLedger(path4, entries) {
|
|
@@ -68433,7 +68749,7 @@ function addToLedger(trackerPath, added) {
|
|
|
68433
68749
|
try {
|
|
68434
68750
|
writeStageLedger(path4, [...entries, ...fresh]);
|
|
68435
68751
|
} catch (error2) {
|
|
68436
|
-
activeOutput().warn(`\u26A0\uFE0F Could not write ${
|
|
68752
|
+
activeOutput().warn(`\u26A0\uFE0F Could not write ${basename25(path4)} (${messageOf(error2)}); the next run takes these stage steps again.`);
|
|
68437
68753
|
}
|
|
68438
68754
|
}
|
|
68439
68755
|
function sameStage(a, b) {
|
|
@@ -68790,6 +69106,9 @@ function typeCheckTask(context, seams, input) {
|
|
|
68790
69106
|
const isInterrupted = context.isInterrupted ?? (() => false);
|
|
68791
69107
|
return runTypeStep({ checkout: context.checkout, base: input.base, task: input.task, git: seams.git, runTypes: seams.runTypes, stopCode: SIGINT_EXIT_CODE, isInterrupted });
|
|
68792
69108
|
}
|
|
69109
|
+
function isCheckUnstartable(settling) {
|
|
69110
|
+
return settling.types?.cannotStart === true;
|
|
69111
|
+
}
|
|
68793
69112
|
async function taskDiffChecks(context, seams, input, result2) {
|
|
68794
69113
|
if (isStepInterrupted(context, result2))
|
|
68795
69114
|
return {};
|
|
@@ -69035,7 +69354,7 @@ function settleStep(context, seams, settling) {
|
|
|
69035
69354
|
const tested = isRed(verdict) ? [blockerText(label, result2, verdict, alone)] : [];
|
|
69036
69355
|
const blocker = [...tested, ...checked].join(" ");
|
|
69037
69356
|
activeOutput().error(`\u274C ${blocker}`);
|
|
69038
|
-
const written5 = settling.repair === null ? null : writeRepairTask(context.trackerPath, blocker, { ...settling.repair, commit: readHead(seams.git) });
|
|
69357
|
+
const written5 = settling.repair === null || isCheckUnstartable(settling) ? null : writeRepairTask(context.trackerPath, blocker, { ...settling.repair, commit: readHead(seams.git) });
|
|
69039
69358
|
if (written5 !== null)
|
|
69040
69359
|
activeOutput().error(written5.inserted ? ` A repair task (line ${written5.line + 1}) is inserted, blocked on it.` : ` The repair task (line ${written5.line + 1}) is marked blocked on it again.`);
|
|
69041
69360
|
return { kind, step: step2, red: true, interrupted: false, blocker, blockedLine: written5?.line ?? null, repairInserted: written5?.inserted ?? false };
|
|
@@ -69079,13 +69398,13 @@ async function ensureBaseline(context) {
|
|
|
69079
69398
|
const reading2 = readBaseline(path4);
|
|
69080
69399
|
if (reading2.state === "read" && !failedOutsideAnyCase(reading2.baseline)) {
|
|
69081
69400
|
const known = reading2.baseline.failures.length;
|
|
69082
|
-
activeOutput().info(`\uD83D\uDCCF Suite baseline reused from ${
|
|
69401
|
+
activeOutput().info(`\uD83D\uDCCF Suite baseline reused from ${basename26(path4)} (${reading2.baseline.recordedAt}): ${known} known failure(s).`);
|
|
69083
69402
|
return { baseline: reading2.baseline, step: null, interrupted: false, halted: false };
|
|
69084
69403
|
}
|
|
69085
69404
|
if (reading2.state === "unreadable")
|
|
69086
|
-
activeOutput().warn(`\u26A0\uFE0F ${
|
|
69405
|
+
activeOutput().warn(`\u26A0\uFE0F ${basename26(path4)} does not read (${reading2.reason}); recording the baseline again.`);
|
|
69087
69406
|
if (reading2.state === "read")
|
|
69088
|
-
activeOutput().warn(storedOutsideCaseLine(
|
|
69407
|
+
activeOutput().warn(storedOutsideCaseLine(basename26(path4), reading2.baseline));
|
|
69089
69408
|
const commit = readHead(seams.git);
|
|
69090
69409
|
const result2 = await runOne(context, seams, "baseline", {});
|
|
69091
69410
|
const baseline = baselineOf(result2, seams.now(), commit);
|
|
@@ -69101,7 +69420,7 @@ async function ensureBaseline(context) {
|
|
|
69101
69420
|
try {
|
|
69102
69421
|
writeBaseline(path4, baseline);
|
|
69103
69422
|
} catch (error2) {
|
|
69104
|
-
activeOutput().warn(`\u26A0\uFE0F Could not write ${
|
|
69423
|
+
activeOutput().warn(`\u26A0\uFE0F Could not write ${basename26(path4)} (${messageOf(error2)}); the next run records the baseline again.`);
|
|
69105
69424
|
}
|
|
69106
69425
|
const outcome2 = settleStep(context, seams, settling);
|
|
69107
69426
|
const covered = completeStages(readFileSync87(context.trackerPath, "utf8"));
|
|
@@ -69928,8 +70247,8 @@ function bodyWithConventions(body, lines3) {
|
|
|
69928
70247
|
${lines3.join(`
|
|
69929
70248
|
`)}`);
|
|
69930
70249
|
const end = sectionEnd(held2, heading);
|
|
69931
|
-
const
|
|
69932
|
-
const missing2 = lines3.filter((line) => !
|
|
70250
|
+
const section4 = held2.slice(heading + 1, end).map((line) => line.trim());
|
|
70251
|
+
const missing2 = lines3.filter((line) => !section4.includes(line));
|
|
69933
70252
|
if (missing2.length === 0)
|
|
69934
70253
|
return body;
|
|
69935
70254
|
const last = lastFilled(held2, heading, end);
|
|
@@ -70050,7 +70369,7 @@ function issueDraft2(stub, lines3) {
|
|
|
70050
70369
|
function canHoldIssue2(tracker) {
|
|
70051
70370
|
return tracker !== null && tracker.openIssues !== undefined && tracker.edit !== undefined;
|
|
70052
70371
|
}
|
|
70053
|
-
function
|
|
70372
|
+
function findIssue(open, stub) {
|
|
70054
70373
|
const marker = followUpsMarker(stub);
|
|
70055
70374
|
const title2 = followUpsTitle(stub);
|
|
70056
70375
|
return open.find((issue5) => issue5.body.includes(marker) && issue5.title === title2);
|
|
@@ -70067,7 +70386,7 @@ async function fileOn(tracker, stub, lines3) {
|
|
|
70067
70386
|
const listed4 = await call2("listing the open bug issues", () => tracker.openIssues("bug"));
|
|
70068
70387
|
if ("problem" in listed4)
|
|
70069
70388
|
return { action: "failed", problem: listed4.problem };
|
|
70070
|
-
const found =
|
|
70389
|
+
const found = findIssue(listed4.value, stub);
|
|
70071
70390
|
if (found === undefined) {
|
|
70072
70391
|
const created = await call2("creating the follow-up issue", () => tracker.create(issueDraft2(stub, lines3)));
|
|
70073
70392
|
return "problem" in created ? { action: "failed", problem: created.problem } : { action: "created", title: title2, ref: created.value, lines: lines3 };
|
|
@@ -70445,8 +70764,8 @@ function fragmentNotesIn(checkout, fragment) {
|
|
|
70445
70764
|
return reading2.ok ? reading2.fragment.notes : [];
|
|
70446
70765
|
}
|
|
70447
70766
|
function runnerPullRequestBody(issue5, notes) {
|
|
70448
|
-
const
|
|
70449
|
-
return [`Closes #${String(issue5)}`, "", ...
|
|
70767
|
+
const section4 = notes.length === 0 ? [] : [RELEASE_NOTES_HEADING, "", ...notes, ""];
|
|
70768
|
+
return [`Closes #${String(issue5)}`, "", ...section4, UNFINISHED_WRAP_UP_LINE].join(`
|
|
70450
70769
|
`);
|
|
70451
70770
|
}
|
|
70452
70771
|
function blocked3(branch, step2, detail) {
|
|
@@ -70922,7 +71241,7 @@ async function runWrapUpSession(run) {
|
|
|
70922
71241
|
}
|
|
70923
71242
|
|
|
70924
71243
|
// packages/rafa-run/src/start/wrap-up-retry.ts
|
|
70925
|
-
function
|
|
71244
|
+
function quoted7(message) {
|
|
70926
71245
|
return message.trimEnd().split(`
|
|
70927
71246
|
`).map((line) => line.trimEnd() === "" ? " >" : ` > ${line.trimEnd()}`);
|
|
70928
71247
|
}
|
|
@@ -70931,7 +71250,7 @@ function missingPullRequestBullet(branch, previousMessage) {
|
|
|
70931
71250
|
if (previousMessage.trim() === "") {
|
|
70932
71251
|
return [opening, " The earlier session left no final message."];
|
|
70933
71252
|
}
|
|
70934
|
-
return [opening, " Its final message follows, quoted:", "", ...
|
|
71253
|
+
return [opening, " Its final message follows, quoted:", "", ...quoted7(previousMessage), ""];
|
|
70935
71254
|
}
|
|
70936
71255
|
function buildWrapUpRetryPrompt(retry) {
|
|
70937
71256
|
const first = buildWrapUpPrompt(retry.branch, retry.base, retry.planContent, retry.provider, null, retry.release, retry.lessons, retry.stepOnly);
|
|
@@ -71357,8 +71676,8 @@ async function* readKeys(input) {
|
|
|
71357
71676
|
throw queue.failure.error;
|
|
71358
71677
|
if (queue.ended)
|
|
71359
71678
|
return;
|
|
71360
|
-
await new Promise((
|
|
71361
|
-
queue.wake =
|
|
71679
|
+
await new Promise((settle5) => {
|
|
71680
|
+
queue.wake = settle5;
|
|
71362
71681
|
});
|
|
71363
71682
|
queue.wake = null;
|
|
71364
71683
|
}
|
|
@@ -72602,7 +72921,7 @@ init_rafa_inventory();
|
|
|
72602
72921
|
init_command2();
|
|
72603
72922
|
init_agent_definition();
|
|
72604
72923
|
import { copyFileSync as copyFileSync7, existsSync as existsSync80, mkdirSync as mkdirSync29, readFileSync as readFileSync89, writeFileSync as writeFileSync32 } from "fs";
|
|
72605
|
-
import { basename as
|
|
72924
|
+
import { basename as basename27, join as join106 } from "path";
|
|
72606
72925
|
var USAGE31 = "rafa agent vendor <name>... [--force]";
|
|
72607
72926
|
var NOTHING_WRITTEN2 = "Nothing was written.";
|
|
72608
72927
|
var VENDOR_TIERS = Object.freeze(["rafa", "user"]);
|
|
@@ -72671,7 +72990,7 @@ function planCopies(names2, project, force, entry) {
|
|
|
72671
72990
|
problems.push(` agent "${name2}": no definition under ${searched} carries that name`);
|
|
72672
72991
|
continue;
|
|
72673
72992
|
}
|
|
72674
|
-
const to = join106(dir,
|
|
72993
|
+
const to = join106(dir, basename27(holder.definition.path));
|
|
72675
72994
|
const replaced = existsSync80(to);
|
|
72676
72995
|
if (replaced && !force) {
|
|
72677
72996
|
problems.push(` agent "${name2}": ${to} is already there; pass --force to replace it`);
|
|
@@ -73128,14 +73447,14 @@ function wordsOf5(line) {
|
|
|
73128
73447
|
continue;
|
|
73129
73448
|
}
|
|
73130
73449
|
if (line[at] === '"') {
|
|
73131
|
-
const
|
|
73132
|
-
if ("kind" in
|
|
73133
|
-
return
|
|
73134
|
-
const after = line[
|
|
73450
|
+
const quoted8 = quotedWordAt(line, at);
|
|
73451
|
+
if ("kind" in quoted8)
|
|
73452
|
+
return quoted8;
|
|
73453
|
+
const after = line[quoted8.next];
|
|
73135
73454
|
if (after !== undefined && !/\s/.test(after))
|
|
73136
73455
|
return manual("a double quote inside the -t value");
|
|
73137
|
-
words.push(
|
|
73138
|
-
at =
|
|
73456
|
+
words.push(quoted8.word);
|
|
73457
|
+
at = quoted8.next;
|
|
73139
73458
|
continue;
|
|
73140
73459
|
}
|
|
73141
73460
|
const end = line.slice(at).search(/\s/);
|
|
@@ -73612,53 +73931,12 @@ init_plan_files2();
|
|
|
73612
73931
|
init_command2();
|
|
73613
73932
|
init_sections();
|
|
73614
73933
|
|
|
73615
|
-
// src/ci/failed-cases.ts
|
|
73616
|
-
init_rafa_pr();
|
|
73617
|
-
var TEST_FILE_HEADER = /^##\[group\](\S+\.(?:test|spec)\.[cm]?[jt]sx?):$/;
|
|
73618
|
-
var GROUP_END = "##[endgroup]";
|
|
73619
|
-
var GROUP_START = "##[group]";
|
|
73620
|
-
var FAIL_LINE2 = /^\(fail\) (.+?)(?: \[\d+(?:\.\d+)?m?s\])?$/;
|
|
73621
|
-
var SUMMARY_HEAD = /^\d+ tests? failed:$/;
|
|
73622
|
-
function failLines(log) {
|
|
73623
|
-
const reads = [];
|
|
73624
|
-
let file = null;
|
|
73625
|
-
let summary = false;
|
|
73626
|
-
for (const raw of log.split(`
|
|
73627
|
-
`)) {
|
|
73628
|
-
const text2 = parseFailedLogLine(raw).text.trimEnd();
|
|
73629
|
-
if (text2.startsWith(GROUP_START)) {
|
|
73630
|
-
file = TEST_FILE_HEADER.exec(text2)?.[1] ?? null;
|
|
73631
|
-
} else if (text2 === GROUP_END) {
|
|
73632
|
-
file = null;
|
|
73633
|
-
} else if (SUMMARY_HEAD.test(text2)) {
|
|
73634
|
-
file = null;
|
|
73635
|
-
summary = true;
|
|
73636
|
-
} else {
|
|
73637
|
-
const name2 = FAIL_LINE2.exec(text2)?.[1];
|
|
73638
|
-
if (name2 !== undefined)
|
|
73639
|
-
reads.push({ file, name: name2, summary });
|
|
73640
|
-
}
|
|
73641
|
-
}
|
|
73642
|
-
return reads;
|
|
73643
|
-
}
|
|
73644
|
-
function readFailedCases(log) {
|
|
73645
|
-
const reads = failLines(log);
|
|
73646
|
-
const named8 = new Set(reads.filter((read2) => read2.file !== null).map((read2) => read2.name));
|
|
73647
|
-
const kept = reads.filter((read2) => !(read2.summary && read2.file === null && named8.has(read2.name)));
|
|
73648
|
-
const byFile = new Map;
|
|
73649
|
-
for (const read2 of kept) {
|
|
73650
|
-
const cases = byFile.get(read2.file) ?? [];
|
|
73651
|
-
if (!cases.includes(read2.name))
|
|
73652
|
-
byFile.set(read2.file, [...cases, read2.name]);
|
|
73653
|
-
}
|
|
73654
|
-
return [...byFile].map(([file, cases]) => ({ file, cases }));
|
|
73655
|
-
}
|
|
73656
|
-
|
|
73657
73934
|
// src/ci/runs.ts
|
|
73658
73935
|
init_sections();
|
|
73659
73936
|
var PREFIX47 = "ci runs";
|
|
73660
73937
|
var FULL_SHA3 = /^[0-9a-f]{40}$/;
|
|
73661
73938
|
var RUN_LIST_FIELDS = ["databaseId", "workflowName", "status", "conclusion", "headSha"];
|
|
73939
|
+
var HEAD_RUN_LIMIT = 100;
|
|
73662
73940
|
var RUN_STATES = ["queued", "in_progress", "completed", "requested", "waiting", "pending"];
|
|
73663
73941
|
function runListArgs(query) {
|
|
73664
73942
|
const branch = textArgument2(query.branch, "branch");
|
|
@@ -73667,7 +73945,31 @@ function runListArgs(query) {
|
|
|
73667
73945
|
return ["run", "list", "--branch", branch, ...commit, ...workflow2, "--limit", "1", "--json", RUN_LIST_FIELDS.join(",")];
|
|
73668
73946
|
}
|
|
73669
73947
|
async function readNewestRun(gh, query) {
|
|
73670
|
-
const
|
|
73948
|
+
const [first] = await listRuns(gh, runListArgs(query));
|
|
73949
|
+
return first ?? null;
|
|
73950
|
+
}
|
|
73951
|
+
function headRunsArgs(branch, commit) {
|
|
73952
|
+
const name2 = textArgument2(branch, "branch");
|
|
73953
|
+
const sha = shaArgument(commit);
|
|
73954
|
+
return ["run", "list", "--branch", name2, "--commit", sha, "--limit", String(HEAD_RUN_LIMIT), "--json", RUN_LIST_FIELDS.join(",")];
|
|
73955
|
+
}
|
|
73956
|
+
async function readHeadRuns(gh, branch) {
|
|
73957
|
+
const newest = await readNewestRun(gh, { branch });
|
|
73958
|
+
if (newest === null)
|
|
73959
|
+
return null;
|
|
73960
|
+
const args = headRunsArgs(branch, newest.commit);
|
|
73961
|
+
const command49 = `gh ${args.join(" ")}`;
|
|
73962
|
+
const runs = await listRuns(gh, args);
|
|
73963
|
+
if (runs.length === 0)
|
|
73964
|
+
refuse20(command49, `no run, although the newest run on the branch, ${newest.id}, is of that commit`);
|
|
73965
|
+
const stray = runs.find((run) => run.commit !== newest.commit);
|
|
73966
|
+
if (stray !== undefined)
|
|
73967
|
+
refuse20(command49, `run ${stray.id} of commit ${stray.commit}, expected only runs of ${newest.commit}`);
|
|
73968
|
+
if (runs.length >= HEAD_RUN_LIMIT)
|
|
73969
|
+
refuse20(command49, `${runs.length} runs, as many as the limit, so the list may be cut`);
|
|
73970
|
+
return { commit: newest.commit, runs };
|
|
73971
|
+
}
|
|
73972
|
+
async function listRuns(gh, args) {
|
|
73671
73973
|
const command49 = `gh ${args.join(" ")}`;
|
|
73672
73974
|
const result2 = await gh(args);
|
|
73673
73975
|
if (!result2.ok)
|
|
@@ -73675,8 +73977,7 @@ async function readNewestRun(gh, query) {
|
|
|
73675
73977
|
const rows2 = parseJson4(result2.stdout, command49);
|
|
73676
73978
|
if (!Array.isArray(rows2))
|
|
73677
73979
|
refuse20(command49, `${describeValue(rows2)}, expected a list`);
|
|
73678
|
-
|
|
73679
|
-
return first === undefined ? null : readRun(first, command49);
|
|
73980
|
+
return rows2.map((row2) => readRun(row2, command49));
|
|
73680
73981
|
}
|
|
73681
73982
|
function readRun(row2, command49) {
|
|
73682
73983
|
if (!isMapping(row2))
|
|
@@ -73735,6 +74036,48 @@ function detailOf19(result2) {
|
|
|
73735
74036
|
return result2.stderr.trim() || result2.stdout.trim() || "it exited non-zero and wrote nothing";
|
|
73736
74037
|
}
|
|
73737
74038
|
|
|
74039
|
+
// src/ci/failed-cases.ts
|
|
74040
|
+
init_rafa_pr();
|
|
74041
|
+
var TEST_FILE_HEADER = /^##\[group\](\S+\.(?:test|spec)\.[cm]?[jt]sx?):$/;
|
|
74042
|
+
var GROUP_END = "##[endgroup]";
|
|
74043
|
+
var GROUP_START = "##[group]";
|
|
74044
|
+
var FAIL_LINE2 = /^\(fail\) (.+?)(?: \[\d+(?:\.\d+)?m?s\])?$/;
|
|
74045
|
+
var SUMMARY_HEAD = /^\d+ tests? failed:$/;
|
|
74046
|
+
function failLines(log) {
|
|
74047
|
+
const reads = [];
|
|
74048
|
+
let file = null;
|
|
74049
|
+
let summary = false;
|
|
74050
|
+
for (const raw of log.split(`
|
|
74051
|
+
`)) {
|
|
74052
|
+
const text2 = parseFailedLogLine(raw).text.trimEnd();
|
|
74053
|
+
if (text2.startsWith(GROUP_START)) {
|
|
74054
|
+
file = TEST_FILE_HEADER.exec(text2)?.[1] ?? null;
|
|
74055
|
+
} else if (text2 === GROUP_END) {
|
|
74056
|
+
file = null;
|
|
74057
|
+
} else if (SUMMARY_HEAD.test(text2)) {
|
|
74058
|
+
file = null;
|
|
74059
|
+
summary = true;
|
|
74060
|
+
} else {
|
|
74061
|
+
const name2 = FAIL_LINE2.exec(text2)?.[1];
|
|
74062
|
+
if (name2 !== undefined)
|
|
74063
|
+
reads.push({ file, name: name2, summary });
|
|
74064
|
+
}
|
|
74065
|
+
}
|
|
74066
|
+
return reads;
|
|
74067
|
+
}
|
|
74068
|
+
function readFailedCases(log) {
|
|
74069
|
+
const reads = failLines(log);
|
|
74070
|
+
const named8 = new Set(reads.filter((read2) => read2.file !== null).map((read2) => read2.name));
|
|
74071
|
+
const kept = reads.filter((read2) => !(read2.summary && read2.file === null && named8.has(read2.name)));
|
|
74072
|
+
const byFile = new Map;
|
|
74073
|
+
for (const read2 of kept) {
|
|
74074
|
+
const cases = byFile.get(read2.file) ?? [];
|
|
74075
|
+
if (!cases.includes(read2.name))
|
|
74076
|
+
byFile.set(read2.file, [...cases, read2.name]);
|
|
74077
|
+
}
|
|
74078
|
+
return [...byFile].map(([file, cases]) => ({ file, cases }));
|
|
74079
|
+
}
|
|
74080
|
+
|
|
73738
74081
|
// src/ci/status-reading.ts
|
|
73739
74082
|
var CI_STATUS_EXIT = Object.freeze({
|
|
73740
74083
|
green: 0,
|
|
@@ -73742,15 +74085,25 @@ var CI_STATUS_EXIT = Object.freeze({
|
|
|
73742
74085
|
none: 2,
|
|
73743
74086
|
running: 3
|
|
73744
74087
|
});
|
|
74088
|
+
var VERDICTS_WORST_FIRST = Object.freeze(["red", "running", "green", "none"]);
|
|
74089
|
+
var PASSING_CONCLUSIONS = Object.freeze(["success", "skipped", "neutral"]);
|
|
73745
74090
|
var SHORT_COMMIT_LENGTH = 7;
|
|
73746
|
-
var GREEN_CONCLUSION = "success";
|
|
73747
74091
|
var LOG_DROPPED2 = "log not found";
|
|
74092
|
+
var MARK = Object.freeze({ green: "\u2705", red: "\u274C", running: "\u23F3", none: "\u26AA" });
|
|
74093
|
+
var WORKFLOW_INDENT = " ";
|
|
74094
|
+
var CASE_INDENT = " ";
|
|
73748
74095
|
function verdictOf6(run) {
|
|
73749
74096
|
if (run === null)
|
|
73750
74097
|
return "none";
|
|
73751
74098
|
if (run.state !== "completed")
|
|
73752
74099
|
return "running";
|
|
73753
|
-
return run.conclusion
|
|
74100
|
+
return run.conclusion !== null && PASSING_CONCLUSIONS.includes(run.conclusion) ? "green" : "red";
|
|
74101
|
+
}
|
|
74102
|
+
function worstVerdict(verdicts) {
|
|
74103
|
+
return VERDICTS_WORST_FIRST.find((verdict) => verdicts.includes(verdict)) ?? "none";
|
|
74104
|
+
}
|
|
74105
|
+
function newestPerWorkflow(runs) {
|
|
74106
|
+
return runs.filter((run, index) => runs.findIndex((other) => other.workflow === run.workflow) === index);
|
|
73754
74107
|
}
|
|
73755
74108
|
async function readFailedLog2(gh, id3) {
|
|
73756
74109
|
const args = ["run", "view", String(id3), "--log-failed"];
|
|
@@ -73762,31 +74115,57 @@ async function readFailedLog2(gh, id3) {
|
|
|
73762
74115
|
const detail = result2.stderr.trim() || result2.stdout.trim() || "it exited non-zero and wrote nothing";
|
|
73763
74116
|
throw new Error(`gh ${args.join(" ")} failed: ${detail}`);
|
|
73764
74117
|
}
|
|
74118
|
+
async function readWorkflowReadings(gh, runs) {
|
|
74119
|
+
const readings = [];
|
|
74120
|
+
for (const run of newestPerWorkflow(runs)) {
|
|
74121
|
+
const verdict = verdictOf6(run);
|
|
74122
|
+
const log = verdict === "red" ? await readFailedLog2(gh, run.id) : null;
|
|
74123
|
+
const failed6 = log === null ? null : readFailedCases(log);
|
|
74124
|
+
readings.push({ workflow: run.workflow, verdict, run, failed: failed6 });
|
|
74125
|
+
}
|
|
74126
|
+
return readings;
|
|
74127
|
+
}
|
|
74128
|
+
function branchReading(branch, workflow2, workflows) {
|
|
74129
|
+
const names2 = workflows.map((line) => line.workflow);
|
|
74130
|
+
const twice = names2.find((name2, index) => names2.indexOf(name2) !== index);
|
|
74131
|
+
if (twice !== undefined)
|
|
74132
|
+
throw new TypeError(`ci status: two lines of the workflow ${twice}, expected one per workflow`);
|
|
74133
|
+
const commits = [...new Set(workflows.map((line) => line.run.commit))];
|
|
74134
|
+
if (commits.length > 1)
|
|
74135
|
+
throw new TypeError(`ci status: lines of the commits ${commits.join(", ")}, expected one commit`);
|
|
74136
|
+
const verdict = worstVerdict(workflows.map((line) => line.verdict));
|
|
74137
|
+
return { branch, workflow: workflow2, commit: commits[0] ?? null, verdict, workflows, exitCode: CI_STATUS_EXIT[verdict] };
|
|
74138
|
+
}
|
|
73765
74139
|
function stateWord2(run) {
|
|
73766
74140
|
return run.state === "completed" ? run.conclusion ?? "completed" : run.state;
|
|
73767
74141
|
}
|
|
73768
|
-
function
|
|
73769
|
-
|
|
73770
|
-
const where = reading2.workflow === null ? reading2.branch : `${reading2.branch} (${reading2.workflow})`;
|
|
73771
|
-
if (run === null)
|
|
73772
|
-
return `\u26AA No run on ${where}.`;
|
|
73773
|
-
const mark = { green: "\u2705", red: "\u274C", running: "\u23F3", none: "\u26AA" }[reading2.verdict];
|
|
73774
|
-
const commit = run.commit.slice(0, SHORT_COMMIT_LENGTH);
|
|
73775
|
-
return `${mark} ${where}: ${run.workflow} run ${String(run.id)} is ${stateWord2(run)} on ${commit}.`;
|
|
74142
|
+
function whereOf(branch, workflow2) {
|
|
74143
|
+
return workflow2 === null ? branch : `${branch} (${workflow2})`;
|
|
73776
74144
|
}
|
|
73777
|
-
function failedLines(failed6) {
|
|
74145
|
+
function failedLines(failed6, indent) {
|
|
73778
74146
|
if (failed6 === null)
|
|
73779
|
-
return [
|
|
74147
|
+
return [`${indent}The run's log is no longer on GitHub, so its failed cases cannot be read.`];
|
|
73780
74148
|
if (failed6.length === 0)
|
|
73781
|
-
return [
|
|
74149
|
+
return [`${indent}No bun test case failed: the run went red outside the tests.`];
|
|
73782
74150
|
return failed6.flatMap((file) => [
|
|
73783
|
-
|
|
73784
|
-
...file.cases.map((name2) =>
|
|
74151
|
+
`${indent}${file.file ?? "(no file named)"}`,
|
|
74152
|
+
...file.cases.map((name2) => `${indent} - ${name2}`)
|
|
73785
74153
|
]);
|
|
73786
74154
|
}
|
|
73787
|
-
function
|
|
73788
|
-
const
|
|
73789
|
-
|
|
74155
|
+
function workflowLines(line) {
|
|
74156
|
+
const { run } = line;
|
|
74157
|
+
const head = `${WORKFLOW_INDENT}${MARK[line.verdict]} ${line.workflow} run ${String(run.id)} is ${stateWord2(run)}.`;
|
|
74158
|
+
return line.verdict === "red" ? [head, ...failedLines(line.failed, CASE_INDENT)] : [head];
|
|
74159
|
+
}
|
|
74160
|
+
function renderCiBranch(reading2) {
|
|
74161
|
+
const where = whereOf(reading2.branch, reading2.workflow);
|
|
74162
|
+
if (reading2.commit === null)
|
|
74163
|
+
return [`${MARK.none} No run on ${where}.`];
|
|
74164
|
+
const count2 = reading2.workflows.length;
|
|
74165
|
+
const commit = reading2.commit.slice(0, SHORT_COMMIT_LENGTH);
|
|
74166
|
+
const noun = count2 === 1 ? "workflow" : "workflows";
|
|
74167
|
+
const headline = `${MARK[reading2.verdict]} ${where}: ${reading2.verdict} on ${commit}, ${String(count2)} ${noun}.`;
|
|
74168
|
+
return [headline, ...reading2.workflows.flatMap(workflowLines)];
|
|
73790
74169
|
}
|
|
73791
74170
|
|
|
73792
74171
|
// src/commands/ci/status.ts
|
|
@@ -73816,22 +74195,20 @@ function readLine4(context) {
|
|
|
73816
74195
|
function refuseWords(args) {
|
|
73817
74196
|
throw refusal19(`expected no argument, got ${String(args.length)}: ${args.join(" ")}`);
|
|
73818
74197
|
}
|
|
74198
|
+
async function readLineRuns(gh, branch, workflow2) {
|
|
74199
|
+
if (workflow2 === undefined)
|
|
74200
|
+
return (await readHeadRuns(gh, branch))?.runs ?? [];
|
|
74201
|
+
const run = await readNewestRun(gh, { branch, workflow: workflow2 });
|
|
74202
|
+
return run === null ? [] : [run];
|
|
74203
|
+
}
|
|
73819
74204
|
async function readCiStatus(context, seams) {
|
|
73820
74205
|
const { branch, workflow: workflow2 } = readLine4(context);
|
|
73821
74206
|
const project = requireProject(context, "rafa ci status");
|
|
73822
74207
|
const gh = seams.gh(project.root);
|
|
73823
74208
|
try {
|
|
73824
|
-
const
|
|
73825
|
-
const
|
|
73826
|
-
|
|
73827
|
-
return {
|
|
73828
|
-
branch,
|
|
73829
|
-
workflow: workflow2 ?? null,
|
|
73830
|
-
verdict,
|
|
73831
|
-
run,
|
|
73832
|
-
failed: log === null ? null : readFailedCases(log),
|
|
73833
|
-
exitCode: CI_STATUS_EXIT[verdict]
|
|
73834
|
-
};
|
|
74209
|
+
const runs = await readLineRuns(gh, branch, workflow2);
|
|
74210
|
+
const lines3 = await readWorkflowReadings(gh, runs);
|
|
74211
|
+
return branchReading(branch, workflow2 ?? null, lines3);
|
|
73835
74212
|
} catch (error2) {
|
|
73836
74213
|
throw new CommandExit(CI_STATUS_FAILED_EXIT, `\u274C rafa ci status: ${messageOf(error2)}`);
|
|
73837
74214
|
}
|
|
@@ -73841,17 +74218,17 @@ function createCiStatusCommand(seams = DEFAULT_CI_STATUS_SEAMS) {
|
|
|
73841
74218
|
name: "ci status",
|
|
73842
74219
|
subject: "ci",
|
|
73843
74220
|
action: "status",
|
|
73844
|
-
summary: "
|
|
73845
|
-
description: "Reads
|
|
74221
|
+
summary: "every CI workflow on a branch's head commit: its state, the commit and the cases it failed",
|
|
74222
|
+
description: "Reads every GitHub Actions run of the head commit of `--branch` (the commit of its newest" + " run) and prints one line per workflow, its newest run on that commit and its state, under a headline" + " with the verdict and the short commit; with `--workflow` it reads only that workflow's newest run on" + " the branch. For each red line it also reads the run's failed log and prints the bun cases that failed," + " by file and case, each once. Success, skipped and neutral are green, and the verdict is the worst of" + " the lines: one red workflow makes the branch red. Exit code 0 when it is green, 1 when it is red, 2" + " when there is no run and 3 while a run is not finished; 4 for a line it refuses and for any `gh`" + " failure, a workflow `gh` does not know included. With `--output=json` the branch, the workflow, the" + " commit, the verdict, the lines with their runs and failed cases, and the exit code are written as a" + " `ci-status` event on every verdict, and are the data of the terminal result when it is green." + " Starts no session.",
|
|
73846
74223
|
args: [],
|
|
73847
74224
|
flags: [
|
|
73848
|
-
{ name: "branch", description: "The branch whose
|
|
73849
|
-
{ name: "workflow", description: "Read only
|
|
74225
|
+
{ name: "branch", description: "The branch whose head commit's runs are read.", type: "string" },
|
|
74226
|
+
{ name: "workflow", description: "Read only this workflow's newest run, named as `gh run list --workflow` takes it.", type: "string" }
|
|
73850
74227
|
],
|
|
73851
74228
|
examples: [
|
|
73852
74229
|
{
|
|
73853
74230
|
cmd: "rafa ci status --branch=stretch/9",
|
|
73854
|
-
note: "Prints the
|
|
74231
|
+
note: "Prints every workflow on the head commit of stretch/9 and the cases each red one failed."
|
|
73855
74232
|
},
|
|
73856
74233
|
{
|
|
73857
74234
|
cmd: "rafa ci status --branch=main --workflow=verify.yml --output=json",
|
|
@@ -73861,7 +74238,7 @@ function createCiStatusCommand(seams = DEFAULT_CI_STATUS_SEAMS) {
|
|
|
73861
74238
|
outputs: ["text", "json"],
|
|
73862
74239
|
run: async (context) => {
|
|
73863
74240
|
const reading2 = await readCiStatus(context, seams);
|
|
73864
|
-
const lines3 =
|
|
74241
|
+
const lines3 = renderCiBranch(reading2);
|
|
73865
74242
|
if (context.outputMode === "json") {
|
|
73866
74243
|
context.output.emit({
|
|
73867
74244
|
type: "event",
|
|
@@ -75039,17 +75416,17 @@ var SETTINGS = Object.freeze({
|
|
|
75039
75416
|
var SETTING_NAMES = Object.freeze(Object.keys(SETTINGS));
|
|
75040
75417
|
function inSettingOrder(sections2, names2) {
|
|
75041
75418
|
const cuts = names2.reduce((runs, name2) => {
|
|
75042
|
-
const
|
|
75043
|
-
if (
|
|
75419
|
+
const section4 = sections2.find((candidate) => Object.hasOwn(candidate.settings, name2));
|
|
75420
|
+
if (section4 === undefined)
|
|
75044
75421
|
throw new Error(`rafa config registry: no section defines setting ${name2}`);
|
|
75045
75422
|
const last = runs.at(-1);
|
|
75046
|
-
return last?.section ===
|
|
75423
|
+
return last?.section === section4 ? [...runs.slice(0, -1), { section: section4, names: [...last.names, name2] }] : [...runs, { section: section4, names: [name2] }];
|
|
75047
75424
|
}, []);
|
|
75048
|
-
return cuts.map(({ section:
|
|
75049
|
-
package:
|
|
75050
|
-
settings: Object.fromEntries(run2.map((name2) => [name2,
|
|
75051
|
-
defaults: Object.fromEntries(run2.map((name2) => [name2,
|
|
75052
|
-
checks: cuts.findIndex((cut2) => cut2.section ===
|
|
75425
|
+
return cuts.map(({ section: section4, names: run2 }, index) => ({
|
|
75426
|
+
package: section4.package,
|
|
75427
|
+
settings: Object.fromEntries(run2.map((name2) => [name2, section4.settings[name2]])),
|
|
75428
|
+
defaults: Object.fromEntries(run2.map((name2) => [name2, section4.defaults[name2]])),
|
|
75429
|
+
checks: cuts.findIndex((cut2) => cut2.section === section4) === index ? section4.checks ?? [] : []
|
|
75053
75430
|
}));
|
|
75054
75431
|
}
|
|
75055
75432
|
function holdsCoreSections() {
|
|
@@ -75197,16 +75574,16 @@ function withTopLevel(lines3, text2, target) {
|
|
|
75197
75574
|
}
|
|
75198
75575
|
function withSectionKey(lines3, text2, target) {
|
|
75199
75576
|
const { key, value, path: path5 } = target;
|
|
75200
|
-
const [
|
|
75577
|
+
const [section4 = "", name2 = ""] = key.split(".");
|
|
75201
75578
|
const dotted = linesMatching(lines3, keyLine(key, ""));
|
|
75202
|
-
const opens = linesMatching(lines3, keyLine(
|
|
75579
|
+
const opens = linesMatching(lines3, keyLine(section4, ""));
|
|
75203
75580
|
if (opens.length > 1) {
|
|
75204
|
-
throw new ConfigSetRefusal("duplicate", `${path5} opens ${
|
|
75581
|
+
throw new ConfigSetRefusal("duplicate", `${path5} opens ${section4} on ${String(opens.length)} lines; keep one, then set ${key} again`);
|
|
75205
75582
|
}
|
|
75206
75583
|
const [open] = opens;
|
|
75207
75584
|
const block2 = open === undefined ? null : blockAfter(lines3, open);
|
|
75208
|
-
if (open !== undefined && holdsValue(keyLine(
|
|
75209
|
-
throw new ConfigSetRefusal("shape", `${path5} writes ${
|
|
75585
|
+
if (open !== undefined && holdsValue(keyLine(section4, "").exec(lines3[open] ?? "")?.[1] ?? "")) {
|
|
75586
|
+
throw new ConfigSetRefusal("shape", `${path5} writes ${section4} in flow style, which this edit does not cover`);
|
|
75210
75587
|
}
|
|
75211
75588
|
const children = open === undefined || block2 === null || block2.indent === null ? [] : linesMatching(lines3.slice(open + 1, block2.end), keyLine(name2, block2.indent)).map((index) => index + open + 1);
|
|
75212
75589
|
const found = [...dotted, ...children];
|
|
@@ -75222,10 +75599,10 @@ function withSectionKey(lines3, text2, target) {
|
|
|
75222
75599
|
const line = `${block2?.indent ?? " "}${name2}: ${value}`;
|
|
75223
75600
|
return [...lines3.slice(0, open + 1), line, ...lines3.slice(open + 1)];
|
|
75224
75601
|
}
|
|
75225
|
-
if (namesTopLevel(text2,
|
|
75226
|
-
throw new ConfigSetRefusal("shape", `${path5} names ${
|
|
75602
|
+
if (namesTopLevel(text2, section4)) {
|
|
75603
|
+
throw new ConfigSetRefusal("shape", `${path5} names ${section4} in a shape this edit does not cover, such as flow style`);
|
|
75227
75604
|
}
|
|
75228
|
-
return appended5(lines3, [`${
|
|
75605
|
+
return appended5(lines3, [`${section4}:`, ` ${name2}: ${value}`]);
|
|
75229
75606
|
}
|
|
75230
75607
|
function settingOf(key) {
|
|
75231
75608
|
const setting = SETTING_BY_KEY.get(key);
|
|
@@ -75247,9 +75624,9 @@ function valueReading(key, setting, value, path5) {
|
|
|
75247
75624
|
throw new ConfigSetRefusal("value", `${key} needs a value`);
|
|
75248
75625
|
if (/[\r\n]/u.test(value))
|
|
75249
75626
|
throw new ConfigSetRefusal("value", `${key} takes a value on one line`);
|
|
75250
|
-
const [
|
|
75627
|
+
const [section4, name2] = key.split(".");
|
|
75251
75628
|
const minimal = name2 === undefined ? `${key}: ${value}
|
|
75252
|
-
` : `${
|
|
75629
|
+
` : `${section4 ?? ""}:
|
|
75253
75630
|
${name2}: ${value}
|
|
75254
75631
|
`;
|
|
75255
75632
|
let read2;
|
|
@@ -75767,7 +76144,7 @@ var plan_default = command54;
|
|
|
75767
76144
|
init_rafa_board();
|
|
75768
76145
|
init_rafa_effort();
|
|
75769
76146
|
init_rafa_pr();
|
|
75770
|
-
import { basename as
|
|
76147
|
+
import { basename as basename31, resolve as resolve43 } from "path";
|
|
75771
76148
|
init_command2();
|
|
75772
76149
|
init_config2();
|
|
75773
76150
|
init_load();
|
|
@@ -76353,7 +76730,7 @@ function renderDoctorRelations(report4) {
|
|
|
76353
76730
|
// src/commands/doctor-render.ts
|
|
76354
76731
|
init_rafa_board();
|
|
76355
76732
|
init_plan();
|
|
76356
|
-
import { basename as
|
|
76733
|
+
import { basename as basename28, relative as relative28, sep as sep10 } from "path";
|
|
76357
76734
|
function shownPath(path5, root) {
|
|
76358
76735
|
return path5.startsWith(`${root}${sep10}`) ? relative28(root, path5) : path5;
|
|
76359
76736
|
}
|
|
@@ -76372,7 +76749,7 @@ function headLine5(preflight) {
|
|
|
76372
76749
|
const checked2 = checkedPhrase(count2, automatic, "from the config ");
|
|
76373
76750
|
return `Preflight with no plan, none being at ${where}: ${checked2}, no run started.`;
|
|
76374
76751
|
}
|
|
76375
|
-
const merged = prerequisitesFile === null ? "" : `, with ${
|
|
76752
|
+
const merged = prerequisitesFile === null ? "" : `, with ${basename28(prerequisitesFile)} merged in`;
|
|
76376
76753
|
const checked = checkedPhrase(count2, automatic, "");
|
|
76377
76754
|
return `Preflight for ${shownPath(plan, root)}${merged}: ${checked}, no run started.`;
|
|
76378
76755
|
}
|
|
@@ -76394,7 +76771,7 @@ function reminderLines(preflight) {
|
|
|
76394
76771
|
if (reminders.length === 0 || prerequisitesFile === null)
|
|
76395
76772
|
return [];
|
|
76396
76773
|
return [
|
|
76397
|
-
`${
|
|
76774
|
+
`${basename28(prerequisitesFile)} names ${plural(reminders.length, "step")} the preflight does not check:`,
|
|
76398
76775
|
...reminders.map((reminder) => ` line ${String(reminder.line)}: ${reminder.description}`)
|
|
76399
76776
|
];
|
|
76400
76777
|
}
|
|
@@ -76544,9 +76921,9 @@ function renderDeepRow(row2) {
|
|
|
76544
76921
|
const fixIndent = " ".repeat(ROW_INDENT2.length + STATUS_WIDTH + 1);
|
|
76545
76922
|
return [line, `${fixIndent}fix: ${row2.fix}`];
|
|
76546
76923
|
}
|
|
76547
|
-
function renderDeepSection(
|
|
76548
|
-
const rows2 =
|
|
76549
|
-
return [`${
|
|
76924
|
+
function renderDeepSection(section4) {
|
|
76925
|
+
const rows2 = section4.rows.length === 0 ? [EMPTY_SECTION_LINE] : section4.rows.flatMap(renderDeepRow);
|
|
76926
|
+
return [`${section4.title}:`, ...rows2];
|
|
76550
76927
|
}
|
|
76551
76928
|
|
|
76552
76929
|
// src/commands/doctor-config.ts
|
|
@@ -77164,6 +77541,7 @@ async function resolveCreateSpec(options, seams = DEFAULT_ROUTE_SEAMS) {
|
|
|
77164
77541
|
const makeReadyOffer = seams.makeReadyOffer ?? createPlanReadyOffer;
|
|
77165
77542
|
const makeAlternativeOffer = seams.makeAlternativeOffer ?? createPlanBlockedOffer;
|
|
77166
77543
|
const makeRefreshOffer = seams.makeRefreshOffer ?? createPlanRefreshOffer;
|
|
77544
|
+
const rules = source.request.kind === "spec" ? null : options.readRules?.() ?? null;
|
|
77167
77545
|
return await resolve4({
|
|
77168
77546
|
request: source.request,
|
|
77169
77547
|
refresh: source.refresh,
|
|
@@ -77179,7 +77557,8 @@ async function resolveCreateSpec(options, seams = DEFAULT_ROUTE_SEAMS) {
|
|
|
77179
77557
|
offerRefresh: makeRefreshOffer(),
|
|
77180
77558
|
...options.passOver === undefined ? {} : { passOver: options.passOver },
|
|
77181
77559
|
...options.branchTemplate === undefined ? {} : { branchTemplate: options.branchTemplate },
|
|
77182
|
-
...options.projectConfig === undefined ? {} : { projectConfig: options.projectConfig }
|
|
77560
|
+
...options.projectConfig === undefined ? {} : { projectConfig: options.projectConfig },
|
|
77561
|
+
...rules === null ? {} : { rules }
|
|
77183
77562
|
});
|
|
77184
77563
|
}
|
|
77185
77564
|
|
|
@@ -77973,7 +78352,7 @@ function renderDeep(reading2) {
|
|
|
77973
78352
|
}
|
|
77974
78353
|
|
|
77975
78354
|
// src/commands/doctor-description.ts
|
|
77976
|
-
var DOCTOR_DESCRIPTION = "Checks the prerequisites `rafa loop start` checks before its first session and prints each" + " check, starting no run and storing nothing: the required and optional items of" + " `.rafa/config.yaml`, with the `PREREQUISITES-<stub>.md` beside the plan merged in, and, when the" + " repository resolves to `pr.provider: gh`, the two required items that provider adds ahead of them:" + " `gh` on PATH and `gh auth status` for the remote's host. A plan's `[start]` items are checked" + " after those and ahead of the configured tiers, on a first dispatch alone: a" + " `PLAN_TRACKER-<stub>.md` beside the plan already holding a ticked task makes the next run a" + " resume, which checks none of them and says in one line how many it passed over." + " The plan is the" + " one `--plan=<file>` names, relative to the project root, or the default plan `rafa loop start`" + ` runs. Each probe runs in the project root with stdin closed and a ${String(PROBE_TIMEOUT_MS / 1000)}-second` + " timeout. It exits 1 when a required item fails, naming the item, its probe and its exit code or" + " first line of stderr, where `rafa loop start` would halt. It reads the effort store as" + " `rafa effort schema --check` does, changing nothing, and prints its `effort store schema` row:" + " it exits 1 where that check fails, naming the next safe step, and warns on a migration this rafa" + " does not know that is additive and on one the project's own store logs as applied by a development" + " build. It prints its `effort sync` row, the strategy `effort.sync` names (`local` when unset) and" + " whether core or a loaded module serves it, and exits 1 when no adapter serves it, naming for" + " `git`, `service` and `p2p` the `modules:` and `allowList:` lines that load a module providing it." + " It exits 0 otherwise. It warns when" + " `.ralph/effort/` holds an effort store and `.rafa/effort/` holds none, and when `~/.rafa/bin` is" + " not on PATH ahead of `~/.bun/bin`, and when `previous/` under `specs.dir` holds more than fifty" + " previous copies of issue specs, which are safe to delete; a warning never changes the exit code. On a repository whose" + " provider is `gh` it also reads the GitHub board `rafa init --board` sets up and prints one row per" + " part \u2014 the seven labels, the spec issue template, the Roadmap issue and `roadmap.issue` \u2014 as present," + " missing, or unknown for a reading that failed, naming `rafa init --board` as the fix; it writes" + " nothing to the board and a row never changes the exit code. It then names, under `Blocked" + " issues:`, every open issue labelled `spec:blocked` whose `Blocked by:` line is missing, names no" + " issue, names itself, or names an id the board has no issue for, with what an author does about" + " it; that reading writes nothing and never changes the exit code either. It then names, under" + " `Epic labels:`, every issue carrying two `epic:` labels and every `epic:` label no `type:epic` issue" + " carries, read off one board listing, writing nothing and never changing the exit code. It then names, under" + " `Boards:`, every type:roadmap board whose Owner: handle resolves to nobody GitHub shows, every open issue titled" + ` "Roadmap" without type:roadmap while labelled boards exist, and every slot of this checkout's position on a` + " board or epic that is closed, unlabelled or gone, read off that same listing and printing nothing when there is" + " none; it writes nothing and never changes the exit code. Where `board.project.number` is set, it then" + " prints, under `GitHub project:`, the `project` scope, the project at that number and its five fields as" + " present, missing or unknown, each one not present naming its fix and a project in place naming" + " `rafa board sync --dry-run`; it reads no item and never changes the exit code. It then counts, without" + " fetching, the branches and worktrees `rafa cleanup` would list, and prints them in one row naming" + " `rafa cleanup` when any group holds one. It then counts the suspect, dangling and unknown references" + " of every saved copy under `specs.dir`, writing nothing, and names `rafa issue check <n>` for each" + " copy holding a suspect or dangling one. Where the release is on, it then prints one `Release:` row naming" + " the version `origin/<pr.base>` declares as last fetched, the latest release tag, the version the changelog's" + " top heading names and the change fragments waiting on the base, as a warning naming `rafa release settle`" + " while any wait; it fetches nothing and never changes the exit code." + " It then prints, under `Skill tiers`, a warning per" + " skill or agent name two tiers hold with different contents, per unreviewed third-party rafa or" + " add-on item, and for an installed Claude Code other than the version skill serving was probed" + " against, and a note per byte-identical copy that can be deleted and per user-tier item with no" + " `provenance`; none changes the exit code. With `--output=json` the" + " checks, both readings, those rows, those issues, those labels and those boards are the data of the terminal result event," + " unless a required item failed. A plan `--plan` names also gets the one-line risk total" + " `rafa loop start` prints before its notices, which never changes the exit code. With `--deep` it" + " also prints the machine as a loop session sees it, starting no session: the session's" + " Environment and working directory against the shell's, the Settings each agent, skill and MCP" + " server is read from and whether a session sees it, the Providers `gh` answers under the session's" + " environment, and the Stack tools the project's stack needs, with Plan needs for a plan `--plan`" + " names; each row is ok, warn or note with its fix, printed after the blocked issues and before a" + " refusal, and none changes the exit code. With `--output=json` they are the `deep` of the data.";
|
|
78355
|
+
var DOCTOR_DESCRIPTION = "Checks the prerequisites `rafa loop start` checks before its first session and prints each" + " check, starting no run and storing nothing: the required and optional items of" + " `.rafa/config.yaml`, with the `PREREQUISITES-<stub>.md` beside the plan merged in, and, when the" + " repository resolves to `pr.provider: gh`, the two required items that provider adds ahead of them:" + " `gh` on PATH and `gh auth status` for the remote's host. A plan's `[start]` items are checked" + " after those and ahead of the configured tiers, on a first dispatch alone: a" + " `PLAN_TRACKER-<stub>.md` beside the plan already holding a ticked task makes the next run a" + " resume, which checks none of them and says in one line how many it passed over." + " The plan is the" + " one `--plan=<file>` names, relative to the project root, or the default plan `rafa loop start`" + ` runs. Each probe runs in the project root with stdin closed and a ${String(PROBE_TIMEOUT_MS / 1000)}-second` + " timeout. It exits 1 when a required item fails, naming the item, its probe and its exit code or" + " first line of stderr, where `rafa loop start` would halt. It reads the effort store as" + " `rafa effort schema --check` does, changing nothing, and prints its `effort store schema` row:" + " it exits 1 where that check fails, naming the next safe step, and warns on a migration this rafa" + " does not know that is additive and on one the project's own store logs as applied by a development" + " build. It prints its `effort sync` row, the strategy `effort.sync` names (`local` when unset) and" + " whether core or a loaded module serves it, and exits 1 when no adapter serves it, naming for" + " `git`, `service` and `p2p` the `modules:` and `allowList:` lines that load a module providing it." + " In a project holding a `tsconfig.json` it runs `node_modules/.bin/tsc --version` under its own environment" + " and prints the `tsc` row, exiting 1 when tsc exits 126 or 127, which is a tsc that cannot start, and" + " naming the interpreter its first line names to put on the PATH the loop runs under." + " It exits 0 otherwise. It warns when" + " `.ralph/effort/` holds an effort store and `.rafa/effort/` holds none, and when `~/.rafa/bin` is" + " not on PATH ahead of `~/.bun/bin`, and when `previous/` under `specs.dir` holds more than fifty" + " previous copies of issue specs, which are safe to delete; a warning never changes the exit code. On a repository whose" + " provider is `gh` it also reads the GitHub board `rafa init --board` sets up and prints one row per" + " part \u2014 the seven labels, the spec issue template, the Roadmap issue and `roadmap.issue` \u2014 as present," + " missing, or unknown for a reading that failed, naming `rafa init --board` as the fix; it writes" + " nothing to the board and a row never changes the exit code. It then names, under `Blocked" + " issues:`, every open issue labelled `spec:blocked` whose `Blocked by:` line is missing, names no" + " issue, names itself, or names an id the board has no issue for, with what an author does about" + " it; that reading writes nothing and never changes the exit code either. It then names, under" + " `Epic labels:`, every issue carrying two `epic:` labels and every `epic:` label no `type:epic` issue" + " carries, read off one board listing, writing nothing and never changing the exit code. It then names, under" + " `Boards:`, every type:roadmap board whose Owner: handle resolves to nobody GitHub shows, every open issue titled" + ` "Roadmap" without type:roadmap while labelled boards exist, and every slot of this checkout's position on a` + " board or epic that is closed, unlabelled or gone, read off that same listing and printing nothing when there is" + " none; it writes nothing and never changes the exit code. Where `board.project.number` is set, it then" + " prints, under `GitHub project:`, the `project` scope, the project at that number and its five fields as" + " present, missing or unknown, each one not present naming its fix and a project in place naming" + " `rafa board sync --dry-run`; it reads no item and never changes the exit code. It then counts, without" + " fetching, the branches and worktrees `rafa cleanup` would list, and prints them in one row naming" + " `rafa cleanup` when any group holds one. It then counts the suspect, dangling and unknown references" + " of every saved copy under `specs.dir`, writing nothing, and names `rafa issue check <n>` for each" + " copy holding a suspect or dangling one. Where the release is on, it then prints one `Release:` row naming" + " the version `origin/<pr.base>` declares as last fetched, the latest release tag, the version the changelog's" + " top heading names and the change fragments waiting on the base, as a warning naming `rafa release settle`" + " while any wait; it fetches nothing and never changes the exit code." + " It then prints, under `Skill tiers`, a warning per" + " skill or agent name two tiers hold with different contents, per unreviewed third-party rafa or" + " add-on item, and for an installed Claude Code other than the version skill serving was probed" + " against, and a note per byte-identical copy that can be deleted and per user-tier item with no" + " `provenance`; none changes the exit code. With `--output=json` the" + " checks, both readings, those rows, those issues, those labels and those boards are the data of the terminal result event," + " unless a required item failed. A plan `--plan` names also gets the one-line risk total" + " `rafa loop start` prints before its notices, which never changes the exit code. With `--deep` it" + " also prints the machine as a loop session sees it, starting no session: the session's" + " Environment and working directory against the shell's, the Settings each agent, skill and MCP" + " server is read from and whether a session sees it, the Providers `gh` answers under the session's" + " environment, and the Stack tools the project's stack needs, with Plan needs for a plan `--plan`" + " names; each row is ok, warn or note with its fix, printed after the blocked issues and before a" + " refusal, and none changes the exit code. With `--output=json` they are the `deep` of the data.";
|
|
77977
78356
|
|
|
77978
78357
|
// src/commands/doctor-effort-schema.ts
|
|
77979
78358
|
init_sections();
|
|
@@ -78835,7 +79214,7 @@ import { relative as relative30 } from "path";
|
|
|
78835
79214
|
init_sections();
|
|
78836
79215
|
init_loop();
|
|
78837
79216
|
import { readdirSync as readdirSync26, readFileSync as readFileSync93 } from "fs";
|
|
78838
|
-
import { basename as
|
|
79217
|
+
import { basename as basename29, join as join117 } from "path";
|
|
78839
79218
|
var STRETCH_DIR = join117(".rafa", "stretch");
|
|
78840
79219
|
var AGENT_FILE = "agent.json";
|
|
78841
79220
|
var RUNNING_STATE = "running";
|
|
@@ -78888,7 +79267,7 @@ function readAgentFile(root, n, fs3 = nodeStretchFs) {
|
|
|
78888
79267
|
return agentFields(file, value);
|
|
78889
79268
|
}
|
|
78890
79269
|
function projectName(root) {
|
|
78891
|
-
const name2 =
|
|
79270
|
+
const name2 = basename29(root).replace(/[^\w-]/g, "-").replace(/-+$/, "");
|
|
78892
79271
|
if (name2 === "") {
|
|
78893
79272
|
throw new Error(`stretch: ${JSON.stringify(root)} leaves no project name for a tmux session`);
|
|
78894
79273
|
}
|
|
@@ -78986,7 +79365,7 @@ init_command2();
|
|
|
78986
79365
|
init_sections();
|
|
78987
79366
|
init_loop();
|
|
78988
79367
|
init_plan();
|
|
78989
|
-
import { closeSync as
|
|
79368
|
+
import { closeSync as closeSync4, mkdirSync as mkdirSync34, openSync as openSync4, readdirSync as readdirSync28, readFileSync as readFileSync100, statSync as statSync34 } from "fs";
|
|
78990
79369
|
import { dirname as dirname48, join as join122, posix as posix14 } from "path";
|
|
78991
79370
|
|
|
78992
79371
|
// src/stretch/launch.ts
|
|
@@ -79165,6 +79544,69 @@ function lineText(argv) {
|
|
|
79165
79544
|
return argv.map((word) => PLAIN_FLAG.test(word) ? word : shellQuote(word)).join(" ");
|
|
79166
79545
|
}
|
|
79167
79546
|
|
|
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
|
+
|
|
79168
79610
|
// src/commands/stretch/item-merge.ts
|
|
79169
79611
|
init_rafa_board();
|
|
79170
79612
|
import { readFileSync as readFileSync98 } from "fs";
|
|
@@ -79290,18 +79732,15 @@ async function readPitReadings(seams, query) {
|
|
|
79290
79732
|
const openBugs2 = bugs.ok ? { ok: true, value: bugs.value.length } : bugs;
|
|
79291
79733
|
return { ci, openBugs: openBugs2, filedSince: await readFiledSince(seams.tracker, query.since) };
|
|
79292
79734
|
}
|
|
79735
|
+
async function readCiRuns(gh, query) {
|
|
79736
|
+
if (query.workflow === undefined)
|
|
79737
|
+
return (await readHeadRuns(gh, query.branch))?.runs ?? [];
|
|
79738
|
+
const run2 = await readNewestRun(gh, { branch: query.branch, workflow: query.workflow });
|
|
79739
|
+
return run2 === null ? [] : [run2];
|
|
79740
|
+
}
|
|
79293
79741
|
async function readCi(gh, query) {
|
|
79294
|
-
const
|
|
79295
|
-
|
|
79296
|
-
const log = run2 !== null && verdict === "red" ? await readFailedLog2(gh, run2.id) : null;
|
|
79297
|
-
return {
|
|
79298
|
-
branch: query.branch,
|
|
79299
|
-
workflow: query.workflow ?? null,
|
|
79300
|
-
verdict,
|
|
79301
|
-
run: run2,
|
|
79302
|
-
failed: log === null ? null : readFailedCases(log),
|
|
79303
|
-
exitCode: CI_STATUS_EXIT[verdict]
|
|
79304
|
-
};
|
|
79742
|
+
const lines3 = await readWorkflowReadings(gh, await readCiRuns(gh, query));
|
|
79743
|
+
return branchReading(query.branch, query.workflow ?? null, lines3);
|
|
79305
79744
|
}
|
|
79306
79745
|
async function readOpenBugs(tracker) {
|
|
79307
79746
|
if (tracker.openIssues === undefined)
|
|
@@ -79352,7 +79791,7 @@ function renderPitReadings(readings) {
|
|
|
79352
79791
|
function ciLines(ci) {
|
|
79353
79792
|
if (!ci.ok)
|
|
79354
79793
|
return [`CI: not read: ${ci.reason}`];
|
|
79355
|
-
const [head = "", ...rest] =
|
|
79794
|
+
const [head = "", ...rest] = renderCiBranch(ci.value);
|
|
79356
79795
|
return [`CI: ${head}`, ...rest];
|
|
79357
79796
|
}
|
|
79358
79797
|
function openBugsLine(open) {
|
|
@@ -79531,10 +79970,10 @@ var CHECKOUT_ENTRY2 = join120("src", "rafa.ts");
|
|
|
79531
79970
|
function bundledPromptPath(entry) {
|
|
79532
79971
|
return join120(dirname46(realEntry(entry ?? Bun.main)), BUNDLED_PROMPT);
|
|
79533
79972
|
}
|
|
79534
|
-
function isRafaCheckout(root,
|
|
79535
|
-
if (!
|
|
79973
|
+
function isRafaCheckout(root, fs4 = nodePromptFs) {
|
|
79974
|
+
if (!fs4.exists(join120(root, CHECKOUT_ENTRY2)))
|
|
79536
79975
|
return false;
|
|
79537
|
-
const text2 =
|
|
79976
|
+
const text2 = fs4.readText(join120(root, "package.json"));
|
|
79538
79977
|
if (text2 === null)
|
|
79539
79978
|
return false;
|
|
79540
79979
|
try {
|
|
@@ -79575,7 +80014,7 @@ function defaultPromptSeams() {
|
|
|
79575
80014
|
return { fs: nodePromptFs, entry: Bun.main };
|
|
79576
80015
|
}
|
|
79577
80016
|
var nodePromptFs = {
|
|
79578
|
-
exists: (
|
|
80017
|
+
exists: (path7) => existsSync84(path7),
|
|
79579
80018
|
readText(file) {
|
|
79580
80019
|
try {
|
|
79581
80020
|
return readFileSync96(file, "utf8");
|
|
@@ -79694,15 +80133,15 @@ function requireProgram(context, seams, program) {
|
|
|
79694
80133
|
throw refusal24(`${program} is not on PATH. Nothing was pushed, set or copied.`);
|
|
79695
80134
|
}
|
|
79696
80135
|
function prBaseEdit(root, n) {
|
|
79697
|
-
const
|
|
80136
|
+
const path7 = configFilePath(root);
|
|
79698
80137
|
let text2;
|
|
79699
80138
|
try {
|
|
79700
|
-
text2 = readFileSync97(
|
|
80139
|
+
text2 = readFileSync97(path7, "utf8");
|
|
79701
80140
|
} catch (error2) {
|
|
79702
|
-
throw refusal24(`${
|
|
80141
|
+
throw refusal24(`${path7} could not be read (${messageOf(error2)}). Nothing was pushed, set or copied.`);
|
|
79703
80142
|
}
|
|
79704
80143
|
try {
|
|
79705
|
-
return { path:
|
|
80144
|
+
return { path: path7, edit: withConfigSetting(text2, PR_BASE_KEY, stretchBranch(n), path7) };
|
|
79706
80145
|
} catch (error2) {
|
|
79707
80146
|
if (error2 instanceof ConfigSetRefusal) {
|
|
79708
80147
|
throw refusal24(`${PR_BASE_KEY} cannot be set: ${error2.message}. Nothing was pushed, set or copied.`);
|
|
@@ -79739,7 +80178,7 @@ function pushBranch2(steps, git, n, info2) {
|
|
|
79739
80178
|
return defaultBranch;
|
|
79740
80179
|
}
|
|
79741
80180
|
function setPrBase(steps, root, n, defaultBranch, now, info2) {
|
|
79742
|
-
const { path:
|
|
80181
|
+
const { path: path7, edit } = prBaseEdit(root, n);
|
|
79743
80182
|
const recordPath = stretchRecordPath(root, n);
|
|
79744
80183
|
if (existsSync85(recordPath)) {
|
|
79745
80184
|
info2(`keep ${recordPath}, written by an earlier start`);
|
|
@@ -79753,11 +80192,11 @@ function setPrBase(steps, root, n, defaultBranch, now, info2) {
|
|
|
79753
80192
|
});
|
|
79754
80193
|
}
|
|
79755
80194
|
if (!edit.changed) {
|
|
79756
|
-
info2(`${
|
|
80195
|
+
info2(`${path7} already reads ${PR_BASE_KEY}: ${stretchBranch(n)}`);
|
|
79757
80196
|
return;
|
|
79758
80197
|
}
|
|
79759
80198
|
steps.run(`rafa config set ${PR_BASE_KEY}=${stretchBranch(n)}`, () => {
|
|
79760
|
-
writeFileSync36(
|
|
80199
|
+
writeFileSync36(path7, edit.text, "utf8");
|
|
79761
80200
|
});
|
|
79762
80201
|
}
|
|
79763
80202
|
function copyStep2(steps, root, n, seams, info2) {
|
|
@@ -79937,7 +80376,7 @@ function defaultStretchStartSeams() {
|
|
|
79937
80376
|
operators: defaultOperatorsSeams(),
|
|
79938
80377
|
prompt: defaultPromptSeams(),
|
|
79939
80378
|
git: createGitRunner,
|
|
79940
|
-
which: (program,
|
|
80379
|
+
which: (program, path7) => Bun.which(program, { PATH: path7 ?? "" }),
|
|
79941
80380
|
runStep: spawnStep,
|
|
79942
80381
|
runSession: spawnSession,
|
|
79943
80382
|
sleep: (ms) => Bun.sleep(ms),
|
|
@@ -80306,6 +80745,14 @@ var STRETCH_BASE = new RegExp(`^${STRETCH_BRANCH_PREFIX}([1-9]\\d*)$`);
|
|
|
80306
80745
|
function itemLogPath(root, n, issue5) {
|
|
80307
80746
|
return join122(stretchFolder(root, n), `loop-${String(issue5)}.log`);
|
|
80308
80747
|
}
|
|
80748
|
+
var RULES_FILE = "rules.md";
|
|
80749
|
+
function rulesFilePath(root, n) {
|
|
80750
|
+
return join122(stretchFolder(root, n), RULES_FILE);
|
|
80751
|
+
}
|
|
80752
|
+
function stretchRulesFile(root, n) {
|
|
80753
|
+
const path7 = rulesFilePath(root, n);
|
|
80754
|
+
return statSync34(path7, { throwIfNoEntry: false })?.isFile() === true ? path7 : null;
|
|
80755
|
+
}
|
|
80309
80756
|
function stretchOfBase(prBase) {
|
|
80310
80757
|
const word = prBase === null ? undefined : STRETCH_BASE.exec(prBase)?.[1];
|
|
80311
80758
|
return word === undefined ? null : Number(word);
|
|
@@ -80393,18 +80840,25 @@ function childEnv(context, extra = {}) {
|
|
|
80393
80840
|
}
|
|
80394
80841
|
return { ...env, ...extra };
|
|
80395
80842
|
}
|
|
80396
|
-
async function planStep(context,
|
|
80843
|
+
async function planStep(context, step2, seams) {
|
|
80844
|
+
const { root, plans, line, rules } = step2;
|
|
80397
80845
|
const info2 = (text2) => context.output.info(text2);
|
|
80398
80846
|
const kept = existingPlan(plans, line.issue);
|
|
80399
80847
|
if (kept !== null) {
|
|
80400
80848
|
info2(`keep ${kept}, written by an earlier plan create`);
|
|
80849
|
+
if (rules !== null)
|
|
80850
|
+
info2(`stretch rules: ${rules} is not appended, as no plan create runs for a kept plan`);
|
|
80401
80851
|
return kept;
|
|
80402
80852
|
}
|
|
80403
80853
|
const argv = [...seams.rafa, "plan", "create", `--issue=${String(line.issue)}`];
|
|
80404
|
-
|
|
80854
|
+
const extra = rules === null ? {} : { [STRETCH_RULES_ENV]: rules };
|
|
80855
|
+
info2(rules === null ? lineText(argv) : `${STRETCH_RULES_ENV}=${lineText([rules])} ${lineText(argv)}`);
|
|
80856
|
+
if (rules !== null) {
|
|
80857
|
+
info2(`stretch rules: ${line.dryRun ? "would append" : "appends"} ${rules} to the snapshot`);
|
|
80858
|
+
}
|
|
80405
80859
|
if (line.dryRun)
|
|
80406
80860
|
return null;
|
|
80407
|
-
const exitCode = await seams.runRafa(argv, root, childEnv(context));
|
|
80861
|
+
const exitCode = await seams.runRafa(argv, root, childEnv(context, extra));
|
|
80408
80862
|
if (exitCode === null)
|
|
80409
80863
|
throw failure11(`${lineText(argv)} could not start. Nothing else was run.`);
|
|
80410
80864
|
if (exitCode !== 0) {
|
|
@@ -80416,8 +80870,8 @@ async function planStep(context, root, plans, line, seams) {
|
|
|
80416
80870
|
}
|
|
80417
80871
|
return made;
|
|
80418
80872
|
}
|
|
80419
|
-
function sizeOf(
|
|
80420
|
-
return statSync34(
|
|
80873
|
+
function sizeOf(path7) {
|
|
80874
|
+
return statSync34(path7, { throwIfNoEntry: false })?.size ?? 0;
|
|
80421
80875
|
}
|
|
80422
80876
|
function logTail(log, offset) {
|
|
80423
80877
|
let text2;
|
|
@@ -80526,7 +80980,7 @@ async function runStretchItem(context, seams) {
|
|
|
80526
80980
|
const issue5 = String(line.issue);
|
|
80527
80981
|
info2(`stretch item #${issue5}: stretch ${String(n)} (${PR_BASE_KEY} ${STRETCH_BRANCH_PREFIX}${String(n)})${line.dryRun ? ", dry run: each step is printed and none is run" : ""}`);
|
|
80528
80982
|
const log = itemLogPath(root, n, line.issue);
|
|
80529
|
-
const plan = await planStep(context, root, plans, line, seams);
|
|
80983
|
+
const plan = await planStep(context, { root, plans, line, rules: stretchRulesFile(root, n) }, seams);
|
|
80530
80984
|
const placeholder = posix14.join(plans.label, `PLAN-${boardId(line.issue)}-<slug>.md`);
|
|
80531
80985
|
info2(loopLineText(seams.rafa, plan, placeholder, log));
|
|
80532
80986
|
if (plan === null || line.dryRun) {
|
|
@@ -80567,7 +81021,7 @@ async function spawnOnTerminal(argv, cwd, env) {
|
|
|
80567
81021
|
function spawnDetached(argv, cwd, env, logPath) {
|
|
80568
81022
|
let fd;
|
|
80569
81023
|
try {
|
|
80570
|
-
fd =
|
|
81024
|
+
fd = openSync4(logPath, "a");
|
|
80571
81025
|
} catch {
|
|
80572
81026
|
return null;
|
|
80573
81027
|
}
|
|
@@ -80578,7 +81032,7 @@ function spawnDetached(argv, cwd, env, logPath) {
|
|
|
80578
81032
|
} catch {
|
|
80579
81033
|
return null;
|
|
80580
81034
|
} finally {
|
|
80581
|
-
|
|
81035
|
+
closeSync4(fd);
|
|
80582
81036
|
}
|
|
80583
81037
|
}
|
|
80584
81038
|
function defaultStretchItemSeams() {
|
|
@@ -80713,22 +81167,22 @@ init_rafa_effort();
|
|
|
80713
81167
|
init_rafa_inventory();
|
|
80714
81168
|
init_loop();
|
|
80715
81169
|
import { readFileSync as readFileSync101, realpathSync as realpathSync20 } from "fs";
|
|
80716
|
-
import { basename as
|
|
81170
|
+
import { basename as basename30, dirname as dirname49 } from "path";
|
|
80717
81171
|
var TIERS_SECTION_TITLE = "Skill tiers";
|
|
80718
81172
|
var CLAUDE_VERSION_TIMEOUT_MS = 1e4;
|
|
80719
81173
|
var VERSION_PATTERN = /^\s*(\d+\.\d+\.\d+)/;
|
|
80720
|
-
function readTextFile2(
|
|
81174
|
+
function readTextFile2(path7) {
|
|
80721
81175
|
try {
|
|
80722
|
-
return readFileSync101(
|
|
81176
|
+
return readFileSync101(path7, "utf8");
|
|
80723
81177
|
} catch {
|
|
80724
81178
|
return null;
|
|
80725
81179
|
}
|
|
80726
81180
|
}
|
|
80727
|
-
function realPathOf2(
|
|
81181
|
+
function realPathOf2(path7) {
|
|
80728
81182
|
try {
|
|
80729
|
-
return realpathSync20(
|
|
81183
|
+
return realpathSync20(path7);
|
|
80730
81184
|
} catch {
|
|
80731
|
-
return
|
|
81185
|
+
return path7;
|
|
80732
81186
|
}
|
|
80733
81187
|
}
|
|
80734
81188
|
function row2(kind, status, name2, detail, fix) {
|
|
@@ -80748,8 +81202,8 @@ async function readClaudeVersion(env, cwd) {
|
|
|
80748
81202
|
function collisionRows(collisions) {
|
|
80749
81203
|
return collisions.map((collision) => row2("collision", "warn", `${collision.kind} ${collision.name}`, `held by ${String(collision.holders.length)} loaded tiers with different contents: ` + `${collision.holders.map(place2).join(" and ")}; nothing serves it`, `pin the tier that serves it: ${collision.pinLine}`));
|
|
80750
81204
|
}
|
|
80751
|
-
function frontmatterOf(
|
|
80752
|
-
const text2 = readText13(
|
|
81205
|
+
function frontmatterOf(path7, readText13) {
|
|
81206
|
+
const text2 = readText13(path7);
|
|
80753
81207
|
if (text2 === null)
|
|
80754
81208
|
return null;
|
|
80755
81209
|
return readFrontmatter(text2) ?? {};
|
|
@@ -80774,7 +81228,7 @@ function keptHolder(item) {
|
|
|
80774
81228
|
return [item.winner, ...item.copies].find((holder) => holder.source === "rafa") ?? item.winner;
|
|
80775
81229
|
}
|
|
80776
81230
|
function deletion(holder) {
|
|
80777
|
-
return holder.kind === "skill" &&
|
|
81231
|
+
return holder.kind === "skill" && basename30(holder.path) === SKILL_FILE2 ? `delete ${dirname49(holder.path)} (only its ${SKILL_FILE2} was compared)` : `delete ${holder.path}`;
|
|
80778
81232
|
}
|
|
80779
81233
|
function copyRows(items2, realPath2 = realPathOf2) {
|
|
80780
81234
|
return items2.flatMap((item) => {
|
|
@@ -80856,6 +81310,102 @@ function renderDoctorTiers(reading2) {
|
|
|
80856
81310
|
return renderDeepSection({ title: TIERS_SECTION_TITLE, rows: reading2.rows });
|
|
80857
81311
|
}
|
|
80858
81312
|
|
|
81313
|
+
// src/commands/doctor-tsc.ts
|
|
81314
|
+
import { existsSync as existsSync86 } from "fs";
|
|
81315
|
+
import { join as join123 } from "path";
|
|
81316
|
+
init_sections();
|
|
81317
|
+
var TSC_ROW = "tsc";
|
|
81318
|
+
var TSC_PATH = ["node_modules", ".bin", "tsc"];
|
|
81319
|
+
var TSCONFIG = "tsconfig.json";
|
|
81320
|
+
async function spawnTscVersion(options) {
|
|
81321
|
+
const proc = Bun.spawn([...options.argv], {
|
|
81322
|
+
cwd: options.cwd,
|
|
81323
|
+
env: { ...options.env },
|
|
81324
|
+
stdin: "ignore",
|
|
81325
|
+
stdout: "pipe",
|
|
81326
|
+
stderr: "pipe"
|
|
81327
|
+
});
|
|
81328
|
+
const [stdout, stderr, exitCode] = await Promise.all([
|
|
81329
|
+
new Response(proc.stdout).text(),
|
|
81330
|
+
new Response(proc.stderr).text(),
|
|
81331
|
+
proc.exited
|
|
81332
|
+
]);
|
|
81333
|
+
return { exitCode, stdout, stderr };
|
|
81334
|
+
}
|
|
81335
|
+
function firstLine13(run2) {
|
|
81336
|
+
return `${run2.stdout}
|
|
81337
|
+
${run2.stderr}`.split(`
|
|
81338
|
+
`).map((line) => line.trim()).find((line) => line !== "") ?? null;
|
|
81339
|
+
}
|
|
81340
|
+
async function readDoctorTsc(root, env, seams = {}) {
|
|
81341
|
+
if (!existsSync86(join123(root, TSCONFIG)))
|
|
81342
|
+
return { kind: "none" };
|
|
81343
|
+
const tsc = join123(root, ...TSC_PATH);
|
|
81344
|
+
if (!existsSync86(tsc))
|
|
81345
|
+
return { kind: "missing", tsc };
|
|
81346
|
+
const run2 = seams.runTscVersion ?? spawnTscVersion;
|
|
81347
|
+
let result2;
|
|
81348
|
+
try {
|
|
81349
|
+
result2 = await run2({ cwd: root, argv: [tsc, "--version"], env });
|
|
81350
|
+
} catch (error2) {
|
|
81351
|
+
return { kind: "unspawned", tsc, problem: messageOf(error2) };
|
|
81352
|
+
}
|
|
81353
|
+
const said = firstLine13(result2);
|
|
81354
|
+
if (result2.exitCode === 0)
|
|
81355
|
+
return { kind: "ok", tsc, version: said ?? "no version printed" };
|
|
81356
|
+
if (CANNOT_START_CODES.includes(result2.exitCode)) {
|
|
81357
|
+
return { kind: "cannot-start", tsc, exitCode: result2.exitCode, said, interpreter: scriptInterpreter(tsc) };
|
|
81358
|
+
}
|
|
81359
|
+
return { kind: "broken", tsc, exitCode: result2.exitCode, said };
|
|
81360
|
+
}
|
|
81361
|
+
function exited(tsc, exitCode, said) {
|
|
81362
|
+
const heard = said === null ? "" : ` (${said})`;
|
|
81363
|
+
return `${tsc} exited ${String(exitCode)}${heard}`;
|
|
81364
|
+
}
|
|
81365
|
+
function cannotStartFix(tsc, interpreter) {
|
|
81366
|
+
return interpreter === null ? `Its first line names no interpreter: make ${tsc} runnable from the PATH the loop runs under.` : `tsc runs under ${interpreter}, which its first line names: put ${interpreter} on the PATH the loop runs under.`;
|
|
81367
|
+
}
|
|
81368
|
+
function tscRow(reading2) {
|
|
81369
|
+
switch (reading2.kind) {
|
|
81370
|
+
case "none":
|
|
81371
|
+
return null;
|
|
81372
|
+
case "missing":
|
|
81373
|
+
return { warn: true, lines: [`${TSC_ROW}: warn, ${TSCONFIG} is here and ${reading2.tsc} is not: the type step runs nothing`] };
|
|
81374
|
+
case "ok":
|
|
81375
|
+
return { warn: false, lines: [`${TSC_ROW}: ok, ${reading2.version} (${reading2.tsc})`] };
|
|
81376
|
+
case "cannot-start":
|
|
81377
|
+
return {
|
|
81378
|
+
warn: true,
|
|
81379
|
+
lines: [
|
|
81380
|
+
`${TSC_ROW}: fail, ${exited(reading2.tsc, reading2.exitCode, reading2.said)}`,
|
|
81381
|
+
` ${cannotStartFix(reading2.tsc, reading2.interpreter)}`
|
|
81382
|
+
]
|
|
81383
|
+
};
|
|
81384
|
+
case "broken":
|
|
81385
|
+
return { warn: true, lines: [`${TSC_ROW}: warn, ${exited(reading2.tsc, reading2.exitCode, reading2.said)}`] };
|
|
81386
|
+
case "unspawned":
|
|
81387
|
+
return { warn: true, lines: [`${TSC_ROW}: warn, ${reading2.tsc} could not be spawned: ${reading2.problem}`] };
|
|
81388
|
+
}
|
|
81389
|
+
}
|
|
81390
|
+
function tscRefusal(reading2) {
|
|
81391
|
+
if (reading2.kind !== "cannot-start")
|
|
81392
|
+
return null;
|
|
81393
|
+
return `rafa doctor: ${TSC_ROW}: ${exited(reading2.tsc, reading2.exitCode, reading2.said)}. ` + cannotStartFix(reading2.tsc, reading2.interpreter);
|
|
81394
|
+
}
|
|
81395
|
+
async function writeDoctorTsc(context, root, seams) {
|
|
81396
|
+
const reading2 = await readDoctorTsc(root, context.env, seams);
|
|
81397
|
+
const row3 = tscRow(reading2);
|
|
81398
|
+
if (row3 === null)
|
|
81399
|
+
return null;
|
|
81400
|
+
if (row3.warn)
|
|
81401
|
+
context.output.warn(row3.lines.join(`
|
|
81402
|
+
`));
|
|
81403
|
+
else if (context.outputMode !== "json")
|
|
81404
|
+
for (const line of row3.lines)
|
|
81405
|
+
context.output.info(line);
|
|
81406
|
+
return tscRefusal(reading2);
|
|
81407
|
+
}
|
|
81408
|
+
|
|
80859
81409
|
// src/commands/doctor.ts
|
|
80860
81410
|
var DEFAULT_DOCTOR_SEAMS = Object.freeze({ checks: Object.freeze({}) });
|
|
80861
81411
|
var NOTHING_CHECKED = "Nothing was checked.";
|
|
@@ -80895,19 +81445,19 @@ async function resolvedConfig(project, warn5) {
|
|
|
80895
81445
|
function defaultPlanPaths(root, planDir) {
|
|
80896
81446
|
return [...new Set([resolve43(root, planDir, DEFAULT_PLAN_FILE), resolve43(root, DEFAULT_PLAN_FILE)])];
|
|
80897
81447
|
}
|
|
80898
|
-
function planFileAt(
|
|
81448
|
+
function planFileAt(path7) {
|
|
80899
81449
|
try {
|
|
80900
|
-
return isFile2(
|
|
81450
|
+
return isFile2(path7);
|
|
80901
81451
|
} catch (error2) {
|
|
80902
|
-
throw refusal28([`rafa doctor: the plan at ${
|
|
81452
|
+
throw refusal28([`rafa doctor: the plan at ${path7} cannot be checked (${messageOf(error2)})`]);
|
|
80903
81453
|
}
|
|
80904
81454
|
}
|
|
80905
81455
|
function choosePlan(root, config, named8) {
|
|
80906
|
-
const
|
|
80907
|
-
if (planFileAt(
|
|
80908
|
-
return { plan:
|
|
81456
|
+
const path7 = resolvePlanPath(root, config.planDir, named8 ?? undefined);
|
|
81457
|
+
if (planFileAt(path7))
|
|
81458
|
+
return { plan: path7, lookedFor: [] };
|
|
80909
81459
|
if (named8 !== null)
|
|
80910
|
-
throw refusal28([`rafa doctor: no plan file at ${
|
|
81460
|
+
throw refusal28([`rafa doctor: no plan file at ${path7}`]);
|
|
80911
81461
|
return { plan: null, lookedFor: defaultPlanPaths(root, config.planDir) };
|
|
80912
81462
|
}
|
|
80913
81463
|
async function loadItems2(plan, config) {
|
|
@@ -80922,7 +81472,7 @@ async function loadItems2(plan, config) {
|
|
|
80922
81472
|
function refuseMalformedItems2(plan, items2) {
|
|
80923
81473
|
if (plan === null || items2.malformed.length === 0)
|
|
80924
81474
|
return;
|
|
80925
|
-
const file =
|
|
81475
|
+
const file = basename31(prerequisitesPathForPlan(plan) ?? plan);
|
|
80926
81476
|
const [head = "", ...rest] = malformedPrerequisiteLines(file, items2.malformed);
|
|
80927
81477
|
throw refusal28([
|
|
80928
81478
|
`rafa doctor: ${head}`,
|
|
@@ -80949,7 +81499,7 @@ function readStartTier(plan, items2) {
|
|
|
80949
81499
|
return { tier: NO_START_TIER, items: NO_ITEMS3 };
|
|
80950
81500
|
if (isFirstDispatch(plan))
|
|
80951
81501
|
return { tier: { checked: start.length, skipped: 0, tracker: null }, items: start };
|
|
80952
|
-
const tracker =
|
|
81502
|
+
const tracker = basename31(trackerPathFor(plan));
|
|
80953
81503
|
return { tier: { checked: 0, skipped: start.length, tracker }, items: NO_ITEMS3 };
|
|
80954
81504
|
}
|
|
80955
81505
|
async function checkPreflight(context, project, seams) {
|
|
@@ -81080,9 +81630,10 @@ async function runDoctor(context, seams) {
|
|
|
81080
81630
|
writeText(context, renderDoctorTiers(readings.tiers));
|
|
81081
81631
|
writeDoctorEffortSchema(context, effortSchema);
|
|
81082
81632
|
writeText(context, renderDoctorEffortSync(effortSync));
|
|
81633
|
+
const tsc = await writeDoctorTsc(context, project.root, seams);
|
|
81083
81634
|
const deep = await checkDeep(context, preflight, seams);
|
|
81084
81635
|
writeText(context, deep === null ? [] : renderDeep(deep));
|
|
81085
|
-
const refusal29 = doctorRefusal(preflight.report.halt, [effortSchemaRefusal(effortSchema), effortSyncRefusal(effortSync)]);
|
|
81636
|
+
const refusal29 = doctorRefusal(preflight.report.halt, [effortSchemaRefusal(effortSchema), effortSyncRefusal(effortSync), tsc]);
|
|
81086
81637
|
if (refusal29 !== null)
|
|
81087
81638
|
throw refusal29;
|
|
81088
81639
|
if (context.outputMode === "json")
|
|
@@ -81241,13 +81792,13 @@ init_command2();
|
|
|
81241
81792
|
init_copy();
|
|
81242
81793
|
init_location();
|
|
81243
81794
|
init_ndjson_files();
|
|
81244
|
-
import { join as
|
|
81795
|
+
import { join as join124, resolve as resolve44 } from "path";
|
|
81245
81796
|
var COMMAND_NAME20 = "rafa effort copy";
|
|
81246
81797
|
var COPY_USAGE = "rafa effort copy [--to=<dir>]";
|
|
81247
81798
|
var TO_FLAG2 = "to";
|
|
81248
81799
|
var REFUSED_EXIT8 = 1;
|
|
81249
81800
|
var FAILED_EXIT7 = 2;
|
|
81250
|
-
var SCRATCH_DIR =
|
|
81801
|
+
var SCRATCH_DIR = join124(".rafa", "scratch");
|
|
81251
81802
|
function effortDirLine(directory2) {
|
|
81252
81803
|
return `${EFFORT_DIR_VARIABLE}=${directory2}`;
|
|
81253
81804
|
}
|
|
@@ -81279,10 +81830,10 @@ function runCopy(context, seams) {
|
|
|
81279
81830
|
const root = requireProject(context, COMMAND_NAME20).root;
|
|
81280
81831
|
const named8 = readTarget(context, root);
|
|
81281
81832
|
refuseEffortDirOverride(context);
|
|
81282
|
-
const target = named8 ??
|
|
81833
|
+
const target = named8 ?? join124(root, SCRATCH_DIR, `effort-${fileStamp((seams.now ?? (() => new Date))())}`);
|
|
81283
81834
|
let result2;
|
|
81284
81835
|
try {
|
|
81285
|
-
result2 = copyEffortStore({ source:
|
|
81836
|
+
result2 = copyEffortStore({ source: join124(root, EFFORT_STORE_DIR), target });
|
|
81286
81837
|
} catch (error2) {
|
|
81287
81838
|
if (error2 instanceof EffortCopyRefusal)
|
|
81288
81839
|
throw new CommandExit(REFUSED_EXIT8, `\u274C ${COMMAND_NAME20}: ${error2.message}`);
|
|
@@ -81586,7 +82137,7 @@ init_merge_store();
|
|
|
81586
82137
|
init_merge_union();
|
|
81587
82138
|
init_rebuild_aside();
|
|
81588
82139
|
init_sqlite();
|
|
81589
|
-
import { join as
|
|
82140
|
+
import { join as join125, resolve as resolve45 } from "path";
|
|
81590
82141
|
var COMMAND_NAME23 = "rafa effort merge";
|
|
81591
82142
|
var MERGE_USAGE = "rafa effort merge <file> [--dry-run]";
|
|
81592
82143
|
var DRY_RUN_FLAG5 = "dry-run";
|
|
@@ -81625,7 +82176,7 @@ function renderMerge(result2, command63 = COMMAND_NAME23) {
|
|
|
81625
82176
|
}
|
|
81626
82177
|
function mergeTargetPath(context, root, command63 = COMMAND_NAME23) {
|
|
81627
82178
|
try {
|
|
81628
|
-
return
|
|
82179
|
+
return join125(effortStoreDir(root, context.env), SQLITE_STORE_FILE_NAME);
|
|
81629
82180
|
} catch (error2) {
|
|
81630
82181
|
throw new CommandExit(REFUSED_EXIT9, `\u274C ${command63}: ${messageOf(error2)}`);
|
|
81631
82182
|
}
|
|
@@ -81651,13 +82202,13 @@ async function runMerge2(context, seams) {
|
|
|
81651
82202
|
const file = expectOneArgument(context.args, MERGE_USAGE);
|
|
81652
82203
|
const dryRun = readSwitch2(DRY_RUN_FLAG5, context.flags[DRY_RUN_FLAG5], `Usage: ${MERGE_USAGE}`);
|
|
81653
82204
|
const project = requireProject(context, COMMAND_NAME23);
|
|
81654
|
-
const
|
|
82205
|
+
const path7 = mergeTargetPath(context, project.root);
|
|
81655
82206
|
const backend = (await resolveProjectConfig(project, COMMAND_NAME23, (message) => context.output.warn(message))).store;
|
|
81656
82207
|
const now = seams.now ?? (() => new Date);
|
|
81657
82208
|
const otherPath = resolve45((seams.cwd ?? (() => process.cwd()))(), file);
|
|
81658
82209
|
let result2;
|
|
81659
82210
|
try {
|
|
81660
|
-
result2 = mergeStore({ path:
|
|
82211
|
+
result2 = mergeStore({ path: path7, otherPath, backend, dryRun, stamp: fileStamp(now()), now, env: context.env, ...probeSeams(seams) });
|
|
81661
82212
|
} catch (error2) {
|
|
81662
82213
|
throw mergeRefusalExit(error2) ?? error2;
|
|
81663
82214
|
}
|
|
@@ -81806,7 +82357,7 @@ init_development_build();
|
|
|
81806
82357
|
init_location();
|
|
81807
82358
|
init_migrate();
|
|
81808
82359
|
init_sqlite();
|
|
81809
|
-
import { join as
|
|
82360
|
+
import { join as join126 } from "path";
|
|
81810
82361
|
var COMMAND_NAME25 = "rafa effort migrate";
|
|
81811
82362
|
var MIGRATE_USAGE = "rafa effort migrate [--dry-run]";
|
|
81812
82363
|
var DRY_RUN_FLAG7 = "dry-run";
|
|
@@ -81839,7 +82390,7 @@ function renderMigrate(result2) {
|
|
|
81839
82390
|
}
|
|
81840
82391
|
function storePath(context, root) {
|
|
81841
82392
|
try {
|
|
81842
|
-
return
|
|
82393
|
+
return join126(effortStoreDir(root, context.env), SQLITE_STORE_FILE_NAME);
|
|
81843
82394
|
} catch (error2) {
|
|
81844
82395
|
throw new CommandExit(REFUSED_EXIT10, `\u274C ${COMMAND_NAME25}: ${messageOf(error2)}`);
|
|
81845
82396
|
}
|
|
@@ -81847,12 +82398,12 @@ function storePath(context, root) {
|
|
|
81847
82398
|
function runMigrate(context, seams) {
|
|
81848
82399
|
expectNoArgument(context.args, MIGRATE_USAGE);
|
|
81849
82400
|
const dryRun = readSwitch2(DRY_RUN_FLAG7, context.flags[DRY_RUN_FLAG7], `Usage: ${MIGRATE_USAGE}`);
|
|
81850
|
-
const
|
|
82401
|
+
const path7 = storePath(context, requireProject(context, COMMAND_NAME25).root);
|
|
81851
82402
|
const now = seams.now ?? (() => new Date);
|
|
81852
82403
|
let result2;
|
|
81853
82404
|
try {
|
|
81854
82405
|
result2 = migrateStore({
|
|
81855
|
-
path:
|
|
82406
|
+
path: path7,
|
|
81856
82407
|
dryRun,
|
|
81857
82408
|
stamp: fileStamp(now()),
|
|
81858
82409
|
now,
|
|
@@ -81964,16 +82515,16 @@ function withSqliteStoreSetting(text2) {
|
|
|
81964
82515
|
return [...body, STORE_LINE, ""].join(`
|
|
81965
82516
|
`);
|
|
81966
82517
|
}
|
|
81967
|
-
function plannedConfig(
|
|
82518
|
+
function plannedConfig(path7) {
|
|
81968
82519
|
let text2;
|
|
81969
82520
|
try {
|
|
81970
|
-
text2 = readFileSync102(
|
|
82521
|
+
text2 = readFileSync102(path7, "utf8");
|
|
81971
82522
|
} catch (error2) {
|
|
81972
|
-
throw new MoveRefusal("config", `${
|
|
82523
|
+
throw new MoveRefusal("config", `${path7} could not be read: ${messageOf(error2)}. Nothing was moved.`);
|
|
81973
82524
|
}
|
|
81974
|
-
const refuse22 = (why) => new MoveRefusal("config", `${
|
|
82525
|
+
const refuse22 = (why) => new MoveRefusal("config", `${path7} ${why}, so this move cannot set ${STORE_LINE}. Nothing was moved. Set it by hand, then run the move again.`);
|
|
81975
82526
|
try {
|
|
81976
|
-
if (parseConfigText(text2,
|
|
82527
|
+
if (parseConfigText(text2, path7).values.store === MOVE_TARGET)
|
|
81977
82528
|
return null;
|
|
81978
82529
|
} catch (error2) {
|
|
81979
82530
|
throw refuse22(`cannot be read as a config (${messageOf(error2)})`);
|
|
@@ -81983,7 +82534,7 @@ function plannedConfig(path6) {
|
|
|
81983
82534
|
throw refuse22("spells store in a shape this command does not edit");
|
|
81984
82535
|
let read2;
|
|
81985
82536
|
try {
|
|
81986
|
-
read2 = parseConfigText(written5,
|
|
82537
|
+
read2 = parseConfigText(written5, path7).values.store;
|
|
81987
82538
|
} catch (error2) {
|
|
81988
82539
|
throw refuse22(`would not parse once edited (${messageOf(error2)})`);
|
|
81989
82540
|
}
|
|
@@ -82020,11 +82571,11 @@ function moveKind(kind, source, target) {
|
|
|
82020
82571
|
unparsed: reading2.unparsedLineCount
|
|
82021
82572
|
};
|
|
82022
82573
|
}
|
|
82023
|
-
function writeConfig(
|
|
82574
|
+
function writeConfig(path7, text2) {
|
|
82024
82575
|
try {
|
|
82025
|
-
writeFileSync37(
|
|
82576
|
+
writeFileSync37(path7, text2, "utf8");
|
|
82026
82577
|
} catch (error2) {
|
|
82027
|
-
throw new MoveRefusal("config", `${
|
|
82578
|
+
throw new MoveRefusal("config", `${path7} could not be written (${messageOf(error2)}). The rows were moved and checked; set ${STORE_LINE}` + " there by hand, or run the move again, which adds nothing.");
|
|
82028
82579
|
}
|
|
82029
82580
|
}
|
|
82030
82581
|
function moveToSqlite(options) {
|
|
@@ -82217,7 +82768,7 @@ init_plan_files2();
|
|
|
82217
82768
|
init_command2();
|
|
82218
82769
|
init_sections();
|
|
82219
82770
|
init_location();
|
|
82220
|
-
import { join as
|
|
82771
|
+
import { join as join127 } from "path";
|
|
82221
82772
|
init_sqlite();
|
|
82222
82773
|
var COMMAND_NAME27 = "rafa effort schema";
|
|
82223
82774
|
var SCHEMA_USAGE = "rafa effort schema [--check]";
|
|
@@ -82264,7 +82815,7 @@ function renderSchema(report4) {
|
|
|
82264
82815
|
}
|
|
82265
82816
|
function storePath2(context, root) {
|
|
82266
82817
|
try {
|
|
82267
|
-
return
|
|
82818
|
+
return join127(effortStoreDir(root, context.env), SQLITE_STORE_FILE_NAME);
|
|
82268
82819
|
} catch (error2) {
|
|
82269
82820
|
throw new CommandExit(REFUSED_EXIT12, `\u274C ${COMMAND_NAME27}: ${messageOf(error2)}`);
|
|
82270
82821
|
}
|
|
@@ -82272,19 +82823,19 @@ function storePath2(context, root) {
|
|
|
82272
82823
|
function runSchema(context, seams) {
|
|
82273
82824
|
expectNoArgument(context.args, SCHEMA_USAGE);
|
|
82274
82825
|
const check2 = readSwitch2(CHECK_FLAG2, context.flags[CHECK_FLAG2], `Usage: ${SCHEMA_USAGE}`);
|
|
82275
|
-
const
|
|
82826
|
+
const path7 = storePath2(context, requireProject(context, COMMAND_NAME27).root);
|
|
82276
82827
|
let report4;
|
|
82277
82828
|
try {
|
|
82278
|
-
report4 = readSchemaReport(
|
|
82829
|
+
report4 = readSchemaReport(path7, seams);
|
|
82279
82830
|
} catch (error2) {
|
|
82280
|
-
throw new CommandExit(FAILED_EXIT8, `\u274C ${COMMAND_NAME27}: ${
|
|
82831
|
+
throw new CommandExit(FAILED_EXIT8, `\u274C ${COMMAND_NAME27}: ${path7} cannot be read as an effort store: ${messageOf(error2)}`);
|
|
82281
82832
|
}
|
|
82282
82833
|
if (context.outputMode !== "json") {
|
|
82283
82834
|
for (const line of renderSchema(report4))
|
|
82284
82835
|
context.output.info(line);
|
|
82285
82836
|
}
|
|
82286
82837
|
if (check2 && report4.refused) {
|
|
82287
|
-
throw new CommandExit(REFUSED_EXIT12, `\u274C ${COMMAND_NAME27} --check: this rafa refuses ${
|
|
82838
|
+
throw new CommandExit(REFUSED_EXIT12, `\u274C ${COMMAND_NAME27} --check: this rafa refuses ${path7} (${report4.status}). Next safe step: ${report4.nextStep}`);
|
|
82288
82839
|
}
|
|
82289
82840
|
if (context.outputMode === "json")
|
|
82290
82841
|
context.output.result(report4);
|
|
@@ -82333,9 +82884,10 @@ init_command2();
|
|
|
82333
82884
|
init_config2();
|
|
82334
82885
|
init_load();
|
|
82335
82886
|
init_sections();
|
|
82336
|
-
import { existsSync as
|
|
82887
|
+
import { existsSync as existsSync89, readFileSync as readFileSync104 } from "fs";
|
|
82337
82888
|
import { homedir as homedir17 } from "os";
|
|
82338
|
-
import { join as
|
|
82889
|
+
import { join as join130, relative as relative31, sep as sep12 } from "path";
|
|
82890
|
+
init_roots();
|
|
82339
82891
|
init_project_id();
|
|
82340
82892
|
|
|
82341
82893
|
// src/project/gitignore.ts
|
|
@@ -82345,13 +82897,13 @@ init_hop_record2();
|
|
|
82345
82897
|
init_position();
|
|
82346
82898
|
init_scope2();
|
|
82347
82899
|
import { createHash as createHash10 } from "crypto";
|
|
82348
|
-
import { existsSync as
|
|
82349
|
-
import { dirname as dirname50, isAbsolute as isAbsolute28, join as
|
|
82900
|
+
import { existsSync as existsSync87, mkdirSync as mkdirSync35, readFileSync as readFileSync103, writeFileSync as writeFileSync38 } from "fs";
|
|
82901
|
+
import { dirname as dirname50, isAbsolute as isAbsolute28, join as join128 } from "path";
|
|
82350
82902
|
var GITIGNORE_FILE = ".gitignore";
|
|
82351
82903
|
var DIGEST_NAME = "tracking.digest";
|
|
82352
82904
|
var PRIVATE_TRIAGE = "triage/private";
|
|
82353
82905
|
var CACHE_DIR = "cache";
|
|
82354
|
-
var TRACKING_DIGEST_FILE =
|
|
82906
|
+
var TRACKING_DIGEST_FILE = join128(SCOPE_DIR, DIGEST_NAME);
|
|
82355
82907
|
var BLOCK_BEGIN = "# >>> rafa tracking: rafa rewrites the lines up to the end marker";
|
|
82356
82908
|
var BLOCK_END = "# <<< rafa tracking";
|
|
82357
82909
|
var SUB_PATHS = [
|
|
@@ -82440,13 +82992,13 @@ function attempt5(file, failure12, act) {
|
|
|
82440
82992
|
}
|
|
82441
82993
|
}
|
|
82442
82994
|
function readIfPresent4(file) {
|
|
82443
|
-
if (!
|
|
82995
|
+
if (!existsSync87(file))
|
|
82444
82996
|
return null;
|
|
82445
82997
|
return attempt5(file, "cannot be read", () => readFileSync103(file, "utf8"));
|
|
82446
82998
|
}
|
|
82447
82999
|
function writeTrackingGitignore(root, flags) {
|
|
82448
83000
|
requireAbsolute3(root);
|
|
82449
|
-
const file =
|
|
83001
|
+
const file = join128(root, GITIGNORE_FILE);
|
|
82450
83002
|
const text2 = readIfPresent4(file);
|
|
82451
83003
|
const next = withTrackingBlock(text2, flags, file);
|
|
82452
83004
|
if (next === text2)
|
|
@@ -82458,17 +83010,17 @@ function writeTrackingGitignore(root, flags) {
|
|
|
82458
83010
|
return { file, change };
|
|
82459
83011
|
}
|
|
82460
83012
|
function trackingDigest(flags) {
|
|
82461
|
-
const
|
|
83013
|
+
const section4 = [
|
|
82462
83014
|
`tracking.specs=${String(flags.trackingSpecs)}`,
|
|
82463
83015
|
`tracking.plans=${String(flags.trackingPlans)}`,
|
|
82464
83016
|
`tracking.all=${String(flags.trackingAll)}`
|
|
82465
83017
|
].join(`
|
|
82466
83018
|
`);
|
|
82467
|
-
return createHash10("sha256").update(
|
|
83019
|
+
return createHash10("sha256").update(section4).digest("hex");
|
|
82468
83020
|
}
|
|
82469
83021
|
function exposureNotice(root) {
|
|
82470
83022
|
return [
|
|
82471
|
-
`tracking.all is true, so ${
|
|
83023
|
+
`tracking.all is true, so ${join128(root, GITIGNORE_FILE)} no longer ignores ${SCOPE_DIR}/` + " and a commit can carry what it holds, including:",
|
|
82472
83024
|
" - unpatched issues described in specs and plans",
|
|
82473
83025
|
" - effort rows with model names and token counts",
|
|
82474
83026
|
" - instincts that may quote error output",
|
|
@@ -82481,7 +83033,7 @@ function printWarning2(message) {
|
|
|
82481
83033
|
}
|
|
82482
83034
|
function noticeTrackingChange(root, flags, print2 = printWarning2) {
|
|
82483
83035
|
requireAbsolute3(root);
|
|
82484
|
-
const digestFile =
|
|
83036
|
+
const digestFile = join128(root, TRACKING_DIGEST_FILE);
|
|
82485
83037
|
const recorded = `${trackingDigest(flags)}
|
|
82486
83038
|
`;
|
|
82487
83039
|
if (readIfPresent4(digestFile) === recorded) {
|
|
@@ -82501,9 +83053,10 @@ function applyTracking(root, flags, print2 = printWarning2) {
|
|
|
82501
83053
|
}
|
|
82502
83054
|
|
|
82503
83055
|
// src/project/root-choice.ts
|
|
83056
|
+
init_roots();
|
|
82504
83057
|
import { resolve as resolve47 } from "path";
|
|
82505
|
-
function chosen(
|
|
82506
|
-
return { root: { path:
|
|
83058
|
+
function chosen(path7, source) {
|
|
83059
|
+
return { root: { path: path7, source }, problem: null };
|
|
82507
83060
|
}
|
|
82508
83061
|
function problem(text2) {
|
|
82509
83062
|
return { root: null, problem: text2 };
|
|
@@ -82539,12 +83092,12 @@ function firstCandidate(found) {
|
|
|
82539
83092
|
return first.refusal === null ? chosen(first.path, first.source) : problem(first.refusal.reason);
|
|
82540
83093
|
}
|
|
82541
83094
|
function namedRoot(typed, start, source, seams) {
|
|
82542
|
-
const
|
|
82543
|
-
const refusal29 = rootRefusal(
|
|
83095
|
+
const path7 = resolve47(start, typed);
|
|
83096
|
+
const refusal29 = rootRefusal(path7, seams);
|
|
82544
83097
|
if (refusal29 !== null)
|
|
82545
83098
|
return problem(refusal29.reason);
|
|
82546
|
-
const
|
|
82547
|
-
return chosen(
|
|
83099
|
+
const fs4 = seams.fs ?? DISK_ROOTS_FILE_SYSTEM;
|
|
83100
|
+
return chosen(fs4.realpath(path7), source);
|
|
82548
83101
|
}
|
|
82549
83102
|
function numberedCandidate(digits, found) {
|
|
82550
83103
|
const count2 = found.candidates.length;
|
|
@@ -82582,8 +83135,8 @@ async function promptForRoot(found, prompter, seams) {
|
|
|
82582
83135
|
// src/project/scaffold.ts
|
|
82583
83136
|
init_rafa_inventory();
|
|
82584
83137
|
init_rafa_release();
|
|
82585
|
-
import { existsSync as
|
|
82586
|
-
import { join as
|
|
83138
|
+
import { existsSync as existsSync88, lstatSync as lstatSync3, mkdirSync as mkdirSync36, statSync as statSync35, writeFileSync as writeFileSync39 } from "fs";
|
|
83139
|
+
import { join as join129 } from "path";
|
|
82587
83140
|
init_config2();
|
|
82588
83141
|
init_sections();
|
|
82589
83142
|
init_scope2();
|
|
@@ -82782,18 +83335,18 @@ class ScaffoldError extends Error {
|
|
|
82782
83335
|
}
|
|
82783
83336
|
function layoutOf2(base2, tree) {
|
|
82784
83337
|
const scope = scopeAt(base2);
|
|
82785
|
-
return { dirs: [scope.dir, ...tree.map((name2) =>
|
|
83338
|
+
return { dirs: [scope.dir, ...tree.map((name2) => join129(scope.dir, name2))], configFile: configFilePath(base2) };
|
|
82786
83339
|
}
|
|
82787
|
-
function occupied(
|
|
82788
|
-
return lstatSync3(
|
|
83340
|
+
function occupied(path7) {
|
|
83341
|
+
return lstatSync3(path7, { throwIfNoEntry: false }) !== undefined;
|
|
82789
83342
|
}
|
|
82790
|
-
function isDirectory3(
|
|
82791
|
-
return statSync35(
|
|
83343
|
+
function isDirectory3(path7) {
|
|
83344
|
+
return statSync35(path7, { throwIfNoEntry: false })?.isDirectory() === true;
|
|
82792
83345
|
}
|
|
82793
83346
|
function directoryConflict(dir) {
|
|
82794
83347
|
if (!occupied(dir) || isDirectory3(dir))
|
|
82795
83348
|
return null;
|
|
82796
|
-
return
|
|
83349
|
+
return existsSync88(dir) ? `${dir} is not a directory` : `${dir} is a link to nothing`;
|
|
82797
83350
|
}
|
|
82798
83351
|
function layoutConflicts(layout) {
|
|
82799
83352
|
const [scopeDir, ...tree] = layout.dirs;
|
|
@@ -82801,34 +83354,34 @@ function layoutConflicts(layout) {
|
|
|
82801
83354
|
if (opening !== null)
|
|
82802
83355
|
return [opening];
|
|
82803
83356
|
const dirs = tree.flatMap((dir) => directoryConflict(dir) ?? []);
|
|
82804
|
-
const file = occupied(layout.configFile) && !
|
|
83357
|
+
const file = occupied(layout.configFile) && !existsSync88(layout.configFile) ? [`${layout.configFile} is a link to nothing`] : [];
|
|
82805
83358
|
return [...dirs, ...file];
|
|
82806
83359
|
}
|
|
82807
83360
|
function scaffoldConflicts(root, home) {
|
|
82808
83361
|
return [...layoutConflicts(layoutOf2(root, PROJECT_TREE)), ...layoutConflicts(layoutOf2(home, USER_TREE))];
|
|
82809
83362
|
}
|
|
82810
|
-
function attempt6(
|
|
83363
|
+
function attempt6(path7, failure12, act) {
|
|
82811
83364
|
try {
|
|
82812
83365
|
act();
|
|
82813
83366
|
} catch (error2) {
|
|
82814
|
-
throw new ScaffoldError(`${
|
|
83367
|
+
throw new ScaffoldError(`${path7} ${failure12} (${messageOf(error2)})`, { cause: error2 });
|
|
82815
83368
|
}
|
|
82816
83369
|
}
|
|
82817
|
-
function ensureDirectory(
|
|
82818
|
-
if (
|
|
82819
|
-
return { path:
|
|
82820
|
-
attempt6(
|
|
82821
|
-
mkdirSync36(
|
|
83370
|
+
function ensureDirectory(path7) {
|
|
83371
|
+
if (existsSync88(path7))
|
|
83372
|
+
return { path: path7, kind: "directory", change: "unchanged" };
|
|
83373
|
+
attempt6(path7, "cannot be created", () => {
|
|
83374
|
+
mkdirSync36(path7, { recursive: true });
|
|
82822
83375
|
});
|
|
82823
|
-
return { path:
|
|
83376
|
+
return { path: path7, kind: "directory", change: "created" };
|
|
82824
83377
|
}
|
|
82825
|
-
function ensureFile(
|
|
82826
|
-
if (
|
|
82827
|
-
return { path:
|
|
82828
|
-
attempt6(
|
|
82829
|
-
writeFileSync39(
|
|
83378
|
+
function ensureFile(path7, text2) {
|
|
83379
|
+
if (existsSync88(path7))
|
|
83380
|
+
return { path: path7, kind: "file", change: "unchanged" };
|
|
83381
|
+
attempt6(path7, "cannot be written", () => {
|
|
83382
|
+
writeFileSync39(path7, text2, { encoding: "utf8", flag: "wx" });
|
|
82830
83383
|
});
|
|
82831
|
-
return { path:
|
|
83384
|
+
return { path: path7, kind: "file", change: "created" };
|
|
82832
83385
|
}
|
|
82833
83386
|
function writeLayout(layout, text2) {
|
|
82834
83387
|
const [scopeDir, ...tree] = layout.dirs;
|
|
@@ -82861,8 +83414,8 @@ function missingChangelogLine(changelog) {
|
|
|
82861
83414
|
function noWrite(status, enabled, asked, warnings = []) {
|
|
82862
83415
|
return { status, asked, enabled, changed: false, warnings: Object.freeze([...warnings]) };
|
|
82863
83416
|
}
|
|
82864
|
-
function releaseRefusedWarning(
|
|
82865
|
-
return `${
|
|
83417
|
+
function releaseRefusedWarning(path7, why) {
|
|
83418
|
+
return `${path7} was left as it was: ${why}. Set ${RELEASE_ENABLED_SETTING} by hand, or run ${RELEASE_FIX}.`;
|
|
82866
83419
|
}
|
|
82867
83420
|
async function askRelease(prompter, settings, root) {
|
|
82868
83421
|
const reading2 = resolveReleaseEnabled(settings, root);
|
|
@@ -82885,14 +83438,14 @@ async function answered2(options) {
|
|
|
82885
83438
|
}
|
|
82886
83439
|
}
|
|
82887
83440
|
function writeSetting(root, text2, enabled) {
|
|
82888
|
-
const
|
|
83441
|
+
const path7 = configFilePath(root);
|
|
82889
83442
|
const written5 = withReleaseEnabled(text2, enabled);
|
|
82890
83443
|
if (written5 === null) {
|
|
82891
83444
|
return "it spells release in a shape this command does not edit";
|
|
82892
83445
|
}
|
|
82893
83446
|
let read2;
|
|
82894
83447
|
try {
|
|
82895
|
-
read2 = releaseEnabledIn(written5,
|
|
83448
|
+
read2 = releaseEnabledIn(written5, path7);
|
|
82896
83449
|
} catch (error2) {
|
|
82897
83450
|
return `the file this run would have written does not parse: ${messageOf(error2)}`;
|
|
82898
83451
|
}
|
|
@@ -82900,17 +83453,17 @@ function writeSetting(root, text2, enabled) {
|
|
|
82900
83453
|
return `the file this run would have written reads ${RELEASE_ENABLED_SETTING} as ${describeValue(read2)}`;
|
|
82901
83454
|
}
|
|
82902
83455
|
try {
|
|
82903
|
-
writeFileSync40(
|
|
83456
|
+
writeFileSync40(path7, written5, "utf8");
|
|
82904
83457
|
} catch (error2) {
|
|
82905
83458
|
return `it could not be written: ${messageOf(error2)}`;
|
|
82906
83459
|
}
|
|
82907
83460
|
return null;
|
|
82908
83461
|
}
|
|
82909
83462
|
async function runReleaseStep(options) {
|
|
82910
|
-
const
|
|
83463
|
+
const path7 = configFilePath(options.root);
|
|
82911
83464
|
const reading2 = readReleaseSetting(options.root);
|
|
82912
83465
|
if (reading2.problem !== null) {
|
|
82913
|
-
return noWrite("refused", null, false, [releaseRefusedWarning(
|
|
83466
|
+
return noWrite("refused", null, false, [releaseRefusedWarning(path7, reading2.problem)]);
|
|
82914
83467
|
}
|
|
82915
83468
|
let asked = false;
|
|
82916
83469
|
let answer5 = options.wanted;
|
|
@@ -82928,7 +83481,7 @@ async function runReleaseStep(options) {
|
|
|
82928
83481
|
return noWrite("present", reading2.enabled, asked);
|
|
82929
83482
|
const why = writeSetting(options.root, reading2.text, answer5);
|
|
82930
83483
|
if (why !== null)
|
|
82931
|
-
return noWrite("refused", reading2.enabled, asked, [releaseRefusedWarning(
|
|
83484
|
+
return noWrite("refused", reading2.enabled, asked, [releaseRefusedWarning(path7, why)]);
|
|
82932
83485
|
return { status: "set", asked, enabled: answer5, changed: true, warnings: Object.freeze([]) };
|
|
82933
83486
|
}
|
|
82934
83487
|
function stateOf3(enabled) {
|
|
@@ -83072,9 +83625,9 @@ async function resolvedConfig2(root, home, warn5) {
|
|
|
83072
83625
|
}
|
|
83073
83626
|
}
|
|
83074
83627
|
function checkGitignore(root, flags) {
|
|
83075
|
-
const file =
|
|
83628
|
+
const file = join130(root, GITIGNORE_FILE);
|
|
83076
83629
|
try {
|
|
83077
|
-
const text2 =
|
|
83630
|
+
const text2 = existsSync89(file) ? readFileSync104(file, "utf8") : null;
|
|
83078
83631
|
withTrackingBlock(text2, flags, file);
|
|
83079
83632
|
} catch (error2) {
|
|
83080
83633
|
const message = error2 instanceof GitignoreError ? error2.message : `rafa init: ${file} cannot be read (${messageOf(error2)})`;
|
|
@@ -83106,8 +83659,8 @@ async function initialise(root, start, home, context, entry) {
|
|
|
83106
83659
|
const resolved = await resolvedConfig2(root.path, home, warn5);
|
|
83107
83660
|
const config = resolved.config;
|
|
83108
83661
|
checkGitignore(root.path, config);
|
|
83109
|
-
const configExisted =
|
|
83110
|
-
const digestExisted =
|
|
83662
|
+
const configExisted = existsSync89(configFilePath(root.path));
|
|
83663
|
+
const digestExisted = existsSync89(join130(root.path, TRACKING_DIGEST_FILE));
|
|
83111
83664
|
const project = writeProjectScope(root.path);
|
|
83112
83665
|
const tracking = applyTracking(root.path, config, warn5);
|
|
83113
83666
|
const writes = [...project, ...trackingWrites(tracking, digestExisted), ...writeUserScope(home)];
|
|
@@ -84331,9 +84884,9 @@ init_command2();
|
|
|
84331
84884
|
// src/start.ts
|
|
84332
84885
|
init_rafa_effort();
|
|
84333
84886
|
init_rafa_pr();
|
|
84334
|
-
import
|
|
84887
|
+
import fs4 from "fs";
|
|
84335
84888
|
import { homedir as homedir19 } from "os";
|
|
84336
|
-
import
|
|
84889
|
+
import path7 from "path";
|
|
84337
84890
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
84338
84891
|
init_command2();
|
|
84339
84892
|
init_config2();
|
|
@@ -84351,12 +84904,12 @@ import { homedir as homedir18 } from "os";
|
|
|
84351
84904
|
// src/notices/notices.ts
|
|
84352
84905
|
init_sections();
|
|
84353
84906
|
import { mkdirSync as mkdirSync37, readFileSync as readFileSync105, writeFileSync as writeFileSync41 } from "fs";
|
|
84354
|
-
import { dirname as dirname51, join as
|
|
84907
|
+
import { dirname as dirname51, join as join131 } from "path";
|
|
84355
84908
|
var NOTICE_IDS = Object.freeze(["alpha", "danger"]);
|
|
84356
84909
|
var FEEDBACK_URL = "https://github.com/open-tomato/rafa/issues/new/choose";
|
|
84357
84910
|
var ROADMAP_URL = "https://github.com/open-tomato/rafa/issues/31";
|
|
84358
84911
|
function noticesPath(home) {
|
|
84359
|
-
return
|
|
84912
|
+
return join131(home, ".rafa", "notices.json");
|
|
84360
84913
|
}
|
|
84361
84914
|
function isNoticeId(value) {
|
|
84362
84915
|
return typeof value === "string" && NOTICE_IDS.includes(value);
|
|
@@ -84382,9 +84935,9 @@ function readDismissed(home) {
|
|
|
84382
84935
|
}
|
|
84383
84936
|
function writeDismissed(home, ids) {
|
|
84384
84937
|
const all = NOTICE_IDS.filter((id3) => ids.includes(id3) || readDismissed(home).includes(id3));
|
|
84385
|
-
const
|
|
84386
|
-
mkdirSync37(dirname51(
|
|
84387
|
-
writeFileSync41(
|
|
84938
|
+
const path7 = noticesPath(home);
|
|
84939
|
+
mkdirSync37(dirname51(path7), { recursive: true });
|
|
84940
|
+
writeFileSync41(path7, `${JSON.stringify({ dismissed: all }, null, 2)}
|
|
84388
84941
|
`);
|
|
84389
84942
|
}
|
|
84390
84943
|
function pendingNotices(dismissed) {
|
|
@@ -84504,7 +85057,7 @@ async function deferUntil(startAt, now = new Date, sleep = sleepFor) {
|
|
|
84504
85057
|
}
|
|
84505
85058
|
|
|
84506
85059
|
// src/start.ts
|
|
84507
|
-
var __dirname2 =
|
|
85060
|
+
var __dirname2 = path7.dirname(fileURLToPath8(import.meta.url));
|
|
84508
85061
|
var interrupted2 = false;
|
|
84509
85062
|
async function start(args, repoRoot) {
|
|
84510
85063
|
refuseDetachedRun(args);
|
|
@@ -84531,10 +85084,10 @@ async function start(args, repoRoot) {
|
|
|
84531
85084
|
if (startAt)
|
|
84532
85085
|
await deferUntil(startAt);
|
|
84533
85086
|
const planPath = resolvePlanPath(repoRoot, runConfig.config.planDir, plan);
|
|
84534
|
-
const rootPromptPath =
|
|
84535
|
-
const promptPath =
|
|
85087
|
+
const rootPromptPath = path7.join(repoRoot, "PROMPT.md");
|
|
85088
|
+
const promptPath = fs4.existsSync(rootPromptPath) ? rootPromptPath : path7.join(__dirname2, "PROMPT.md");
|
|
84536
85089
|
const trackerPath = trackerPathFor(planPath);
|
|
84537
|
-
if (!
|
|
85090
|
+
if (!fs4.existsSync(planPath)) {
|
|
84538
85091
|
throw new CommandExit(1, `\u274C Plan file not found: ${planPath}`);
|
|
84539
85092
|
}
|
|
84540
85093
|
const planStub2 = planStubFromPath(planPath);
|
|
@@ -84565,8 +85118,8 @@ async function start(args, repoRoot) {
|
|
|
84565
85118
|
return;
|
|
84566
85119
|
};
|
|
84567
85120
|
try {
|
|
84568
|
-
const planContent =
|
|
84569
|
-
const promptContent =
|
|
85121
|
+
const planContent = fs4.readFileSync(planPath, "utf8");
|
|
85122
|
+
const promptContent = fs4.readFileSync(promptPath, "utf8");
|
|
84570
85123
|
const injectSource = injectSourceLabel(runConfig);
|
|
84571
85124
|
announceRunDirs({ projectRoot: repoRoot, checkout });
|
|
84572
85125
|
activeOutput().info(`\uD83E\uDDED Task sessions are handed the plan as \`${injectMode}\` (${injectSource}); the wrap-up is handed all of it.`);
|
|
@@ -84642,11 +85195,11 @@ async function start(args, repoRoot) {
|
|
|
84642
85195
|
previousNeeded: continueRun.directive === null ? null : readPreviousDecisionNeeded(repoRoot, runPlace)
|
|
84643
85196
|
});
|
|
84644
85197
|
decisionsAtEnd = decisions.atRunEnd;
|
|
84645
|
-
if (!
|
|
84646
|
-
activeOutput().info(`\uD83D\uDCCB Creating new plan tracker at ${
|
|
84647
|
-
|
|
85198
|
+
if (!fs4.existsSync(trackerPath)) {
|
|
85199
|
+
activeOutput().info(`\uD83D\uDCCB Creating new plan tracker at ${path7.basename(trackerPath)}...`);
|
|
85200
|
+
fs4.copyFileSync(planPath, trackerPath);
|
|
84648
85201
|
} else {
|
|
84649
|
-
activeOutput().info(`\uD83D\uDCCB Resuming from existing ${
|
|
85202
|
+
activeOutput().info(`\uD83D\uDCCB Resuming from existing ${path7.basename(trackerPath)}...`);
|
|
84650
85203
|
}
|
|
84651
85204
|
process.on("SIGINT", () => {
|
|
84652
85205
|
interrupted2 = true;
|
|
@@ -84658,7 +85211,7 @@ async function start(args, repoRoot) {
|
|
|
84658
85211
|
await holdWhilePaused({ repoRoot, sessionId: session.id, isInterrupted: () => interrupted2 });
|
|
84659
85212
|
if (interrupted2)
|
|
84660
85213
|
break;
|
|
84661
|
-
const trackerContent =
|
|
85214
|
+
const trackerContent = fs4.readFileSync(trackerPath, "utf8");
|
|
84662
85215
|
const taskInfo = findNextTask(trackerContent, { skipLines: decisions.skipLines(trackerContent) });
|
|
84663
85216
|
const passedOver = taskInfo ? [] : decisions.atPlanEnd(trackerContent);
|
|
84664
85217
|
if (await decisions.atFirstTask(taskInfo, trackerContent))
|
|
@@ -85373,8 +85926,8 @@ function timeoutLine(minutes2, reading2) {
|
|
|
85373
85926
|
return ownLine("timeout", `no reason asked for in ${plural(minutes2, "awake minute")}${suspendedNote(reading2)}`);
|
|
85374
85927
|
}
|
|
85375
85928
|
function noEventsNote(following) {
|
|
85376
|
-
const
|
|
85377
|
-
return `Session ${following.record.sessionId} has no events file at ${
|
|
85929
|
+
const path8 = relative33(following.root, following.file);
|
|
85930
|
+
return `Session ${following.record.sessionId} has no events file at ${path8}: a run from an older rafa writes none,` + " and no event can answer until one appears.";
|
|
85378
85931
|
}
|
|
85379
85932
|
function firstAsked(events, until) {
|
|
85380
85933
|
for (const event of events) {
|
|
@@ -85980,10 +86533,10 @@ async function runNextChain(options) {
|
|
|
85980
86533
|
const homeStop = home === null ? null : await turn(home, null);
|
|
85981
86534
|
return homeStop === null ? stopOn("loop-started", state) : stopOn(homeStop, home ?? state);
|
|
85982
86535
|
}
|
|
85983
|
-
const
|
|
85984
|
-
const settleStop =
|
|
86536
|
+
const settle5 = followsMerge(state.action) ? options.afterMerge?.() ?? null : null;
|
|
86537
|
+
const settleStop = settle5 === null ? null : await turn(settle5, null);
|
|
85985
86538
|
if (settleStop !== null)
|
|
85986
|
-
return stopOn(settleStop,
|
|
86539
|
+
return stopOn(settleStop, settle5 ?? state);
|
|
85987
86540
|
if (steps.length >= MAX_ACTIONS)
|
|
85988
86541
|
return stopOn("capped", state);
|
|
85989
86542
|
previous = state;
|
|
@@ -86140,9 +86693,9 @@ init_command2();
|
|
|
86140
86693
|
// src/plan.ts
|
|
86141
86694
|
init_rafa_board();
|
|
86142
86695
|
init_rafa_inventory();
|
|
86143
|
-
import
|
|
86696
|
+
import fs6 from "fs";
|
|
86144
86697
|
import { homedir as homedir20 } from "os";
|
|
86145
|
-
import
|
|
86698
|
+
import path9 from "path";
|
|
86146
86699
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
86147
86700
|
init_adapters();
|
|
86148
86701
|
init_command2();
|
|
@@ -86159,20 +86712,20 @@ init_sections();
|
|
|
86159
86712
|
init_output();
|
|
86160
86713
|
init_plan();
|
|
86161
86714
|
import { readdirSync as readdirSync29, readFileSync as readFileSync106, realpathSync as realpathSync21, statSync as statSync36, writeFileSync as writeFileSync42 } from "fs";
|
|
86162
|
-
import { basename as
|
|
86715
|
+
import { basename as basename32, isAbsolute as isAbsolute30, join as join132, relative as relative34, resolve as resolve49, sep as sep13 } from "path";
|
|
86163
86716
|
init_tiers();
|
|
86164
86717
|
var SOURCE_DIR2 = "src";
|
|
86165
86718
|
var CODE_SPAN7 = /`([^`]+)`/gu;
|
|
86166
86719
|
var PATH_LIKE = /^\S+$/u;
|
|
86167
|
-
function realPathOrNull(
|
|
86720
|
+
function realPathOrNull(path8) {
|
|
86168
86721
|
try {
|
|
86169
|
-
return realpathSync21(
|
|
86722
|
+
return realpathSync21(path8);
|
|
86170
86723
|
} catch {
|
|
86171
86724
|
return null;
|
|
86172
86725
|
}
|
|
86173
86726
|
}
|
|
86174
|
-
function isFilePath(
|
|
86175
|
-
return statSync36(
|
|
86727
|
+
function isFilePath(path8) {
|
|
86728
|
+
return statSync36(path8, { throwIfNoEntry: false })?.isFile() === true;
|
|
86176
86729
|
}
|
|
86177
86730
|
function bundledAgents(root) {
|
|
86178
86731
|
if (root === null)
|
|
@@ -86185,11 +86738,11 @@ function bundledAgents(root) {
|
|
|
86185
86738
|
function bundledSkills(root) {
|
|
86186
86739
|
if (root === null)
|
|
86187
86740
|
return [];
|
|
86188
|
-
return readdirSync29(root).filter((name2) => isFilePath(
|
|
86741
|
+
return readdirSync29(root).filter((name2) => isFilePath(join132(root, name2, SKILL_FILE2))).sort((a, b) => a.localeCompare(b));
|
|
86189
86742
|
}
|
|
86190
86743
|
function readBundle(repoRoot) {
|
|
86191
|
-
const agentsRoot = realPathOrNull(
|
|
86192
|
-
const skillsRoot = realPathOrNull(
|
|
86744
|
+
const agentsRoot = realPathOrNull(join132(repoRoot, SOURCE_DIR2, BUNDLED_AGENTS_DIR));
|
|
86745
|
+
const skillsRoot = realPathOrNull(join132(repoRoot, SOURCE_DIR2, BUNDLED_SKILLS_DIR));
|
|
86193
86746
|
return { agentsRoot, skillsRoot, agents: bundledAgents(agentsRoot), skills: bundledSkills(skillsRoot) };
|
|
86194
86747
|
}
|
|
86195
86748
|
function skillHolding(bundle, realPath2) {
|
|
@@ -86236,10 +86789,10 @@ function findBundledEdits(markdown, seams) {
|
|
|
86236
86789
|
}
|
|
86237
86790
|
}
|
|
86238
86791
|
}
|
|
86239
|
-
return [...gathered.values()].map(({ item, path:
|
|
86792
|
+
return [...gathered.values()].map(({ item, path: path8, lines: lines3 }) => ({
|
|
86240
86793
|
kind: item.kind,
|
|
86241
86794
|
name: item.name,
|
|
86242
|
-
path:
|
|
86795
|
+
path: path8,
|
|
86243
86796
|
lines: [...lines3],
|
|
86244
86797
|
pinLine: pinLine(item.kind, item.name, "project")
|
|
86245
86798
|
}));
|
|
@@ -86254,9 +86807,9 @@ var HEADING_RE = /^#/u;
|
|
|
86254
86807
|
function tierPinItem(edit, planFileName2) {
|
|
86255
86808
|
return `- [ ] Pin the bundled ${edit.kind} \`${edit.name}\` to the project tier in each clone that merges` + ` \`${planFileName2}\`, and drop the pin once the installed rafa carries the new text: \`${edit.pinLine}\``;
|
|
86256
86809
|
}
|
|
86257
|
-
function readOrNull(
|
|
86810
|
+
function readOrNull(path8) {
|
|
86258
86811
|
try {
|
|
86259
|
-
return readFileSync106(
|
|
86812
|
+
return readFileSync106(path8, "utf8");
|
|
86260
86813
|
} catch (error2) {
|
|
86261
86814
|
const isAbsent2 = typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
|
|
86262
86815
|
if (isAbsent2)
|
|
@@ -86316,7 +86869,7 @@ function notePlanBundledEdits(repoRoot, generated, output = activeOutput()) {
|
|
|
86316
86869
|
let written5 = [];
|
|
86317
86870
|
if (file !== null) {
|
|
86318
86871
|
try {
|
|
86319
|
-
written5 = writeTierPins(resolve49(repoRoot, file),
|
|
86872
|
+
written5 = writeTierPins(resolve49(repoRoot, file), basename32(generated.planPath), edits);
|
|
86320
86873
|
} catch (error2) {
|
|
86321
86874
|
output.warn(`${file}: the tier pins could not be written: ${messageOf(error2)}`);
|
|
86322
86875
|
written5 = null;
|
|
@@ -86438,17 +86991,17 @@ function createPlanClaimContext(repoRoot, config) {
|
|
|
86438
86991
|
init_rafa_board();
|
|
86439
86992
|
init_sections();
|
|
86440
86993
|
init_output();
|
|
86441
|
-
import
|
|
86442
|
-
import
|
|
86994
|
+
import fs5 from "fs";
|
|
86995
|
+
import path8 from "path";
|
|
86443
86996
|
function recordInPlan(repoRoot, planPath, stamp2, line) {
|
|
86444
|
-
const file =
|
|
86997
|
+
const file = path8.resolve(repoRoot, planPath);
|
|
86445
86998
|
const unrecorded2 = (why) => {
|
|
86446
86999
|
activeOutput().warn(`${planPath} does not record ${line}: ${why}`);
|
|
86447
87000
|
return false;
|
|
86448
87001
|
};
|
|
86449
87002
|
let written5;
|
|
86450
87003
|
try {
|
|
86451
|
-
written5 =
|
|
87004
|
+
written5 = fs5.readFileSync(file, "utf8");
|
|
86452
87005
|
} catch (error2) {
|
|
86453
87006
|
return unrecorded2(messageOf(error2));
|
|
86454
87007
|
}
|
|
@@ -86457,7 +87010,7 @@ function recordInPlan(repoRoot, planPath, stamp2, line) {
|
|
|
86457
87010
|
return unrecorded2(stamped.note);
|
|
86458
87011
|
if (stamped.answer !== "unchanged") {
|
|
86459
87012
|
try {
|
|
86460
|
-
|
|
87013
|
+
fs5.writeFileSync(file, stamped.text, "utf8");
|
|
86461
87014
|
} catch (error2) {
|
|
86462
87015
|
return unrecorded2(messageOf(error2));
|
|
86463
87016
|
}
|
|
@@ -86518,33 +87071,33 @@ async function settleReview(gate, generated, skipReview) {
|
|
|
86518
87071
|
|
|
86519
87072
|
// src/commands/plan/store-check.ts
|
|
86520
87073
|
import { mkdirSync as mkdirSync38, readFileSync as readFileSync107, renameSync as renameSync14 } from "fs";
|
|
86521
|
-
import { basename as
|
|
87074
|
+
import { basename as basename33, dirname as dirname52, resolve as resolve50 } from "path";
|
|
86522
87075
|
init_command2();
|
|
86523
87076
|
init_sections();
|
|
86524
87077
|
init_output();
|
|
86525
87078
|
init_plan();
|
|
86526
|
-
function readFileOrNull(
|
|
86527
|
-
return
|
|
87079
|
+
function readFileOrNull(path9) {
|
|
87080
|
+
return path9 !== null && isFile2(path9) ? readFileSync107(path9, "utf8") : null;
|
|
86528
87081
|
}
|
|
86529
87082
|
function checkStoreRules(file, markdown) {
|
|
86530
87083
|
const prerequisitesPath = prerequisitesPathForPlan(file);
|
|
86531
87084
|
return findStoreRuleProblems({
|
|
86532
87085
|
plan: markdown,
|
|
86533
87086
|
prerequisites: readFileOrNull(prerequisitesPath),
|
|
86534
|
-
prerequisitesName:
|
|
87087
|
+
prerequisitesName: basename33(prerequisitesPath ?? "PREREQUISITES-<stub>.md")
|
|
86535
87088
|
});
|
|
86536
87089
|
}
|
|
86537
|
-
function moveRejected(repoRoot,
|
|
86538
|
-
const full = resolve50(repoRoot,
|
|
87090
|
+
function moveRejected(repoRoot, path9, output) {
|
|
87091
|
+
const full = resolve50(repoRoot, path9);
|
|
86539
87092
|
if (!isFile2(full))
|
|
86540
87093
|
return;
|
|
86541
|
-
const destination = rejectedPath(
|
|
87094
|
+
const destination = rejectedPath(path9);
|
|
86542
87095
|
try {
|
|
86543
87096
|
mkdirSync38(resolve50(repoRoot, dirname52(destination)), { recursive: true });
|
|
86544
87097
|
renameSync14(full, resolve50(repoRoot, destination));
|
|
86545
|
-
output.info(`\uD83D\uDDC3 Moved ${
|
|
87098
|
+
output.info(`\uD83D\uDDC3 Moved ${path9} to ${destination}: the plan breaks the effort-store rules.`);
|
|
86546
87099
|
} catch (error2) {
|
|
86547
|
-
output.warn(`${
|
|
87100
|
+
output.warn(`${path9} breaks the effort-store rules and could not be moved: ${messageOf(error2)}`);
|
|
86548
87101
|
}
|
|
86549
87102
|
}
|
|
86550
87103
|
function enforceStoreRules(repoRoot, generated, output = activeOutput()) {
|
|
@@ -86555,9 +87108,9 @@ function enforceStoreRules(repoRoot, generated, output = activeOutput()) {
|
|
|
86555
87108
|
if (problems.length === 0)
|
|
86556
87109
|
return;
|
|
86557
87110
|
const prerequisites = generated.prerequisitesPath ?? prerequisitesPathForPlan(generated.planPath);
|
|
86558
|
-
for (const
|
|
86559
|
-
if (
|
|
86560
|
-
moveRejected(repoRoot,
|
|
87111
|
+
for (const path9 of [generated.planPath, prerequisites]) {
|
|
87112
|
+
if (path9 !== null)
|
|
87113
|
+
moveRejected(repoRoot, path9, output);
|
|
86561
87114
|
}
|
|
86562
87115
|
throw new CommandExit(1, [
|
|
86563
87116
|
`\u274C ${generated.planPath}: ${plural(problems.length, "broken effort-store rule")};` + " rafa loop start would refuse this plan, so no plan stands.",
|
|
@@ -86567,7 +87120,7 @@ function enforceStoreRules(repoRoot, generated, output = activeOutput()) {
|
|
|
86567
87120
|
}
|
|
86568
87121
|
|
|
86569
87122
|
// src/plan.ts
|
|
86570
|
-
var __dirname3 =
|
|
87123
|
+
var __dirname3 = path9.dirname(fileURLToPath9(import.meta.url));
|
|
86571
87124
|
function argValue2(args, flag2) {
|
|
86572
87125
|
const hit = args.find((a) => a.startsWith(`${flag2}=`));
|
|
86573
87126
|
return hit?.slice(flag2.length + 1);
|
|
@@ -86593,16 +87146,16 @@ ${trimmed.slice(-PROGRESS_CAP_CHARS)}` : trimmed;
|
|
|
86593
87146
|
].join(`
|
|
86594
87147
|
`);
|
|
86595
87148
|
}
|
|
86596
|
-
var PLAN_FORMAT_SKILL =
|
|
87149
|
+
var PLAN_FORMAT_SKILL = path9.join(BUNDLED_SKILLS_DIR, "dev-planner", "SKILL.md");
|
|
86597
87150
|
function planFormatPath(moduleDir) {
|
|
86598
|
-
return
|
|
87151
|
+
return path9.join(moduleDir, PLAN_FORMAT_SKILL);
|
|
86599
87152
|
}
|
|
86600
87153
|
function readPlanFormat(moduleDir) {
|
|
86601
87154
|
const skill = planFormatPath(moduleDir);
|
|
86602
|
-
if (!
|
|
87155
|
+
if (!fs6.existsSync(skill)) {
|
|
86603
87156
|
throw new Error(`The plan format is missing: no dev-planner SKILL.md at ${skill}`);
|
|
86604
87157
|
}
|
|
86605
|
-
return
|
|
87158
|
+
return fs6.readFileSync(skill, "utf8");
|
|
86606
87159
|
}
|
|
86607
87160
|
var FRONTMATTER2 = /^---\r?\n[\s\S]*?\r?\n---\r?\n(?:\r?\n)*/;
|
|
86608
87161
|
function planFormatBody(skill) {
|
|
@@ -86726,7 +87279,7 @@ function buildPlanPrompt(template, planFormat, specContent, stub, planDir, progr
|
|
|
86726
87279
|
return template.replace(SLOT_PATTERN4, (_slot, name2) => values[name2]);
|
|
86727
87280
|
}
|
|
86728
87281
|
function stubFromSpecPath(specPath2) {
|
|
86729
|
-
return
|
|
87282
|
+
return path9.basename(specPath2).replace(/\.md$/, "");
|
|
86730
87283
|
}
|
|
86731
87284
|
function runBranchLine(planPath) {
|
|
86732
87285
|
const stub = planStubFromPath(planPath);
|
|
@@ -86758,6 +87311,7 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
86758
87311
|
dangerousAcceptStaleRefs
|
|
86759
87312
|
} = config;
|
|
86760
87313
|
const flags = readGateFlags(args);
|
|
87314
|
+
const readRules = stretchRulesReader(process.env, repoRoot);
|
|
86761
87315
|
const resolved = await resolveAndClaim({
|
|
86762
87316
|
resolve: (passOver) => resolveCreateSpec({
|
|
86763
87317
|
args,
|
|
@@ -86768,12 +87322,13 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
86768
87322
|
relationships: boardRelationships,
|
|
86769
87323
|
passOver,
|
|
86770
87324
|
branchTemplate: namingBranch,
|
|
86771
|
-
projectConfig: config
|
|
87325
|
+
projectConfig: config,
|
|
87326
|
+
readRules
|
|
86772
87327
|
}),
|
|
86773
87328
|
prepare: async (spec) => {
|
|
86774
|
-
const stub2 = argValue2(args, "--stub") ?? stubFromSpecPath(
|
|
87329
|
+
const stub2 = argValue2(args, "--stub") ?? stubFromSpecPath(path9.resolve(repoRoot, spec.path));
|
|
86775
87330
|
const planFile3 = planFilePath(planDir, `PLAN-${stub2}.md`);
|
|
86776
|
-
if (
|
|
87331
|
+
if (fs6.existsSync(path9.resolve(repoRoot, planFile3))) {
|
|
86777
87332
|
throw new CommandExit(1, `\u274C ${planFile3} already exists \u2014 remove it or pass a different --stub.`);
|
|
86778
87333
|
}
|
|
86779
87334
|
await checkCreateRefs({ spec, repoRoot, args, acceptStaleRefs: dangerousAcceptStaleRefs, roster });
|
|
@@ -86787,15 +87342,15 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
86787
87342
|
return;
|
|
86788
87343
|
const { stub } = resolved;
|
|
86789
87344
|
const specRequest = resolved.spec.path;
|
|
86790
|
-
const specPath2 =
|
|
87345
|
+
const specPath2 = path9.resolve(repoRoot, specRequest);
|
|
86791
87346
|
const planFile2 = planFilePath(planDir, `PLAN-${stub}.md`);
|
|
86792
|
-
const progressPath =
|
|
86793
|
-
const progressContent = !args.includes("--no-progress") &&
|
|
87347
|
+
const progressPath = path9.join(repoRoot, "progress.txt");
|
|
87348
|
+
const progressContent = !args.includes("--no-progress") && fs6.existsSync(progressPath) ? fs6.readFileSync(progressPath, "utf8") : undefined;
|
|
86794
87349
|
if (progressContent?.trim()) {
|
|
86795
87350
|
activeOutput().info("\uD83D\uDCCE Including findings from progress.txt (disable with --no-progress).");
|
|
86796
87351
|
}
|
|
86797
87352
|
const epic = await readPlanEpicContext(resolved.spec, createGhRunner({ cwd: repoRoot }));
|
|
86798
|
-
const template =
|
|
87353
|
+
const template = fs6.readFileSync(path9.join(__dirname3, "plan-prompt.md"), "utf8");
|
|
86799
87354
|
const planFormat = readPlanFormat(__dirname3);
|
|
86800
87355
|
const skillIndex = readPlanSkillIndex(repoRoot, home, config, fileURLToPath9(import.meta.url));
|
|
86801
87356
|
const planner = registry.resolve("planner", "claude").create({
|
|
@@ -86813,7 +87368,7 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
86813
87368
|
comment: flags.comment
|
|
86814
87369
|
};
|
|
86815
87370
|
await requireNoticesAnswered(settingSources);
|
|
86816
|
-
activeOutput().info(`\uD83D\uDCDD Generating ${planFile2} from ${
|
|
87371
|
+
activeOutput().info(`\uD83D\uDCDD Generating ${planFile2} from ${path9.basename(specPath2)}...`);
|
|
86817
87372
|
const answered3 = await generateOrExit(planner, { specPath: specRequest, stub }, gate, flags.skipReview);
|
|
86818
87373
|
enforceStoreRules(repoRoot, answered3);
|
|
86819
87374
|
const generated = notePlanBundledEdits(repoRoot, answered3);
|
|
@@ -87039,11 +87594,11 @@ function spawningRunners2(root) {
|
|
|
87039
87594
|
return { git: createGitRunner(root), gh: createGhRunner({ cwd: root }) };
|
|
87040
87595
|
}
|
|
87041
87596
|
function riskPlanPath(root, planDir, typed) {
|
|
87042
|
-
const
|
|
87043
|
-
if (isFile2(
|
|
87044
|
-
return
|
|
87597
|
+
const path10 = resolvePlanPath(root, planDir, typed ?? undefined);
|
|
87598
|
+
if (isFile2(path10))
|
|
87599
|
+
return path10;
|
|
87045
87600
|
if (typed !== null)
|
|
87046
|
-
throw new CommandExit(1, `\u274C Plan file not found: ${
|
|
87601
|
+
throw new CommandExit(1, `\u274C Plan file not found: ${path10}`);
|
|
87047
87602
|
const lookedFor = [...new Set([resolve51(root, planDir, DEFAULT_PLAN_FILE), resolve51(root, DEFAULT_PLAN_FILE)])];
|
|
87048
87603
|
throw new CommandExit(1, `\u274C No plan named, and no default plan at ${lookedFor.join(" or ")}
|
|
87049
87604
|
Usage: ${USAGE47}`);
|
|
@@ -87056,9 +87611,9 @@ function riskLine(finding2) {
|
|
|
87056
87611
|
function strictRefusal(report4) {
|
|
87057
87612
|
return `\u274C ${report4.plan}: ${plural(report4.total.high, "high finding")}; --strict refuses a plan with any`;
|
|
87058
87613
|
}
|
|
87059
|
-
async function readRisk(
|
|
87614
|
+
async function readRisk(path10, project, config, context, seams) {
|
|
87060
87615
|
const makeRunners = seams.runners ?? spawningRunners2;
|
|
87061
|
-
return assessPlanRisk({ path:
|
|
87616
|
+
return assessPlanRisk({ path: path10, text: readFileSync108(path10, "utf8") }, {
|
|
87062
87617
|
repoRoot: project.root,
|
|
87063
87618
|
home: project.home,
|
|
87064
87619
|
settingSources: config.settingSources,
|
|
@@ -87115,8 +87670,8 @@ function createPlanRiskCommand(seams = {}) {
|
|
|
87115
87670
|
const config = await resolveProjectConfig(project, COMMAND7, (message) => {
|
|
87116
87671
|
context.output.warn(message);
|
|
87117
87672
|
});
|
|
87118
|
-
const
|
|
87119
|
-
const report4 = await readRisk(
|
|
87673
|
+
const path10 = riskPlanPath(project.root, config.planDir, typed);
|
|
87674
|
+
const report4 = await readRisk(path10, project, config, context, seams);
|
|
87120
87675
|
const refused7 = strict && report4.total.high > 0;
|
|
87121
87676
|
if (context.outputMode === "json") {
|
|
87122
87677
|
if (!refused7) {
|
|
@@ -87146,7 +87701,7 @@ init_plan_files2();
|
|
|
87146
87701
|
init_command2();
|
|
87147
87702
|
init_plan();
|
|
87148
87703
|
import { readFileSync as readFileSync109 } from "fs";
|
|
87149
|
-
import { join as
|
|
87704
|
+
import { join as join133 } from "path";
|
|
87150
87705
|
var USAGE48 = "rafa plan show <stub> [--tracker]";
|
|
87151
87706
|
var COMMAND8 = "rafa plan show";
|
|
87152
87707
|
function readTrackerFlag(value) {
|
|
@@ -87164,9 +87719,9 @@ function showPlan(plans, stub, tracker) {
|
|
|
87164
87719
|
throw new CommandExit(1, `\u274C "${stub}" is no plan stub: a stub is letters, digits, ".", "_" and "-"`);
|
|
87165
87720
|
}
|
|
87166
87721
|
const name2 = planFileName(stub, tracker);
|
|
87167
|
-
const file =
|
|
87722
|
+
const file = join133(plans.path, name2);
|
|
87168
87723
|
if (!isFile2(file))
|
|
87169
|
-
throw new CommandExit(1, missingText(stub, tracker,
|
|
87724
|
+
throw new CommandExit(1, missingText(stub, tracker, join133(plans.label, name2)));
|
|
87170
87725
|
const model = parsePlan(readFileSync109(file, "utf8"));
|
|
87171
87726
|
const { header } = model;
|
|
87172
87727
|
return {
|
|
@@ -87190,7 +87745,7 @@ function taskLine2(task) {
|
|
|
87190
87745
|
return ` ${checkbox(task.status)} ${task.text}`;
|
|
87191
87746
|
}
|
|
87192
87747
|
function renderShownPlan(shown3, dirLabel) {
|
|
87193
|
-
const relative35 =
|
|
87748
|
+
const relative35 = join133(dirLabel, planFileName(shown3.stub, shown3.tracker));
|
|
87194
87749
|
const fileLabel = shown3.tracker ? "Tracker" : "File";
|
|
87195
87750
|
const lines3 = [`Plan: ${shown3.stub}`, `${fileLabel}: ${relative35}`];
|
|
87196
87751
|
if (shown3.header.issue !== null)
|
|
@@ -87262,7 +87817,7 @@ var show_default7 = command88;
|
|
|
87262
87817
|
// src/commands/plan/validate.ts
|
|
87263
87818
|
init_rafa_inventory();
|
|
87264
87819
|
import { readFileSync as readFileSync110 } from "fs";
|
|
87265
|
-
import { basename as
|
|
87820
|
+
import { basename as basename34, resolve as resolve52 } from "path";
|
|
87266
87821
|
init_plan_files2();
|
|
87267
87822
|
init_command2();
|
|
87268
87823
|
init_config2();
|
|
@@ -87305,14 +87860,14 @@ function readBundledEdits(context, markdown) {
|
|
|
87305
87860
|
return context.project === null ? [] : findBundledEdits(markdown, { repoRoot: context.project.root });
|
|
87306
87861
|
}
|
|
87307
87862
|
function writeBundledPins(context, plan2, edits, refused7) {
|
|
87308
|
-
const
|
|
87863
|
+
const path10 = prerequisitesPathForPlan(plan2.file);
|
|
87309
87864
|
const outcome2 = { file: prerequisitesPathForPlan(plan2.typed), refused: refused7, written: [], failed: false };
|
|
87310
|
-
if (refused7 ||
|
|
87865
|
+
if (refused7 || path10 === null || edits.length === 0)
|
|
87311
87866
|
return outcome2;
|
|
87312
87867
|
try {
|
|
87313
|
-
return { ...outcome2, written: writeTierPins(
|
|
87868
|
+
return { ...outcome2, written: writeTierPins(path10, basename34(plan2.file), edits) };
|
|
87314
87869
|
} catch (error2) {
|
|
87315
|
-
context.output.warn(`${outcome2.file ??
|
|
87870
|
+
context.output.warn(`${outcome2.file ?? path10}: the tier pins could not be written: ${messageOf(error2)}`);
|
|
87316
87871
|
return { ...outcome2, failed: true };
|
|
87317
87872
|
}
|
|
87318
87873
|
}
|
|
@@ -87583,7 +88138,7 @@ init_rafa_inventory();
|
|
|
87583
88138
|
init_command2();
|
|
87584
88139
|
init_load();
|
|
87585
88140
|
import { statSync as statSync37 } from "fs";
|
|
87586
|
-
import { join as
|
|
88141
|
+
import { join as join134, resolve as resolve53 } from "path";
|
|
87587
88142
|
var DEFAULT_BACKFILL_SEAMS = Object.freeze({
|
|
87588
88143
|
cwd: () => process.cwd()
|
|
87589
88144
|
});
|
|
@@ -87629,9 +88184,9 @@ Usage: ${BACKFILL_USAGE}`);
|
|
|
87629
88184
|
}
|
|
87630
88185
|
return resolve53(cwd(), value);
|
|
87631
88186
|
}
|
|
87632
|
-
function isDirectory4(
|
|
88187
|
+
function isDirectory4(path10) {
|
|
87633
88188
|
try {
|
|
87634
|
-
return statSync37(
|
|
88189
|
+
return statSync37(path10).isDirectory();
|
|
87635
88190
|
} catch {
|
|
87636
88191
|
return false;
|
|
87637
88192
|
}
|
|
@@ -87755,7 +88310,7 @@ function reviewedProposals(dir) {
|
|
|
87755
88310
|
return read2.flatMap((entry) => entry.result.file === null ? [] : [entry.result.file]);
|
|
87756
88311
|
}
|
|
87757
88312
|
function rowPaths(files, root) {
|
|
87758
|
-
return files.flatMap((file) => file.status !== REVIEWED_FILE ? [] : file.rows.filter((row3) => row3.status === ANSWERED_ROW).map((row3) =>
|
|
88313
|
+
return files.flatMap((file) => file.status !== REVIEWED_FILE ? [] : file.rows.filter((row3) => row3.status === ANSWERED_ROW).map((row3) => join134(root, ...row3.path.split("/"))));
|
|
87759
88314
|
}
|
|
87760
88315
|
function runApply(context, scope, backfillDir, projectRoot3) {
|
|
87761
88316
|
const options = checkOptions5(context, projectRoot3);
|
|
@@ -87801,7 +88356,7 @@ async function runBackfill(context, seams) {
|
|
|
87801
88356
|
const dir = readBackfillDirectory(context.args, seams.cwd);
|
|
87802
88357
|
const projectRoot3 = readConsumerRoot(context.flags["project"], seams.cwd);
|
|
87803
88358
|
const scope = backfillScopeOf(dir, projectOf14(context).home);
|
|
87804
|
-
const backfillDir =
|
|
88359
|
+
const backfillDir = join134(scope.base, BACKFILL_PATH);
|
|
87805
88360
|
if (mode === "propose") {
|
|
87806
88361
|
await runPropose(context, scope, backfillDir, seams);
|
|
87807
88362
|
return;
|
|
@@ -87919,7 +88474,7 @@ var check_default3 = command93;
|
|
|
87919
88474
|
// src/commands/skill/demote.ts
|
|
87920
88475
|
init_rafa_inventory();
|
|
87921
88476
|
init_command2();
|
|
87922
|
-
import { existsSync as
|
|
88477
|
+
import { existsSync as existsSync90, mkdirSync as mkdirSync39, readFileSync as readFileSync111, statSync as statSync38, writeFileSync as writeFileSync43 } from "fs";
|
|
87923
88478
|
import { dirname as dirname53, resolve as resolve54 } from "path";
|
|
87924
88479
|
var DEFAULT_DEMOTE_SEAMS = Object.freeze({
|
|
87925
88480
|
cwd: () => process.cwd()
|
|
@@ -87946,9 +88501,9 @@ Usage: ${DEMOTE_USAGE}`);
|
|
|
87946
88501
|
}
|
|
87947
88502
|
return resolve54(cwd(), dir);
|
|
87948
88503
|
}
|
|
87949
|
-
function isDirectory5(
|
|
88504
|
+
function isDirectory5(path10) {
|
|
87950
88505
|
try {
|
|
87951
|
-
return statSync38(
|
|
88506
|
+
return statSync38(path10).isDirectory();
|
|
87952
88507
|
} catch {
|
|
87953
88508
|
return false;
|
|
87954
88509
|
}
|
|
@@ -87975,13 +88530,13 @@ function verdictLine2(report4) {
|
|
|
87975
88530
|
const parts = DEMOTION_VERDICTS.map((verdict) => `${String(counts[verdict])} ${verdict}`);
|
|
87976
88531
|
return `${String(report4.rows.length)} file(s): ${parts.join(", ")}`;
|
|
87977
88532
|
}
|
|
87978
|
-
function previousReport(
|
|
87979
|
-
if (!
|
|
88533
|
+
function previousReport(path10, context) {
|
|
88534
|
+
if (!existsSync90(path10))
|
|
87980
88535
|
return null;
|
|
87981
|
-
const parsed2 = parseDemotionReport(readFileSync111(
|
|
88536
|
+
const parsed2 = parseDemotionReport(readFileSync111(path10, "utf8"));
|
|
87982
88537
|
if (parsed2.report !== null)
|
|
87983
88538
|
return parsed2.report;
|
|
87984
|
-
context.output.warn(`the report already at ${
|
|
88539
|
+
context.output.warn(`the report already at ${path10} does not parse, so no override in it is carried forward:` + ` ${parsed2.issues.map((issue5) => `line ${String(issue5.line)} ${issue5.code}`).join(", ")}`);
|
|
87985
88540
|
return null;
|
|
87986
88541
|
}
|
|
87987
88542
|
function runWrite(context, scope) {
|
|
@@ -88011,7 +88566,7 @@ function runWrite(context, scope) {
|
|
|
88011
88566
|
context.output.info(line);
|
|
88012
88567
|
}
|
|
88013
88568
|
function reviewedReport(scope) {
|
|
88014
|
-
if (!
|
|
88569
|
+
if (!existsSync90(scope.reportPath)) {
|
|
88015
88570
|
throw new CommandExit(1, `\u274C No report at ${scope.reportPath}; run "rafa skill demote ${scope.dir}" first, then review it`);
|
|
88016
88571
|
}
|
|
88017
88572
|
const parsed2 = parseDemotionReport(readFileSync111(scope.reportPath, "utf8"));
|
|
@@ -88370,11 +88925,11 @@ function housekeepingText(reading2) {
|
|
|
88370
88925
|
const { merged: merged2, stale, notPushed, worktrees } = reading2.counts;
|
|
88371
88926
|
return `${String(merged2)} merged, ${String(stale)} stale, ${String(notPushed)} not pushed,` + ` ${counted10(worktrees, "worktree")} (${String(reading2.idleWorktrees)} idle)`;
|
|
88372
88927
|
}
|
|
88373
|
-
function sectionLines2(key,
|
|
88928
|
+
function sectionLines2(key, section4, text2, body = () => []) {
|
|
88374
88929
|
const title2 = STATUS_SECTION_TITLES[key];
|
|
88375
|
-
if (!
|
|
88376
|
-
return [{ level: "warn", text: `${title2}: not read: ${
|
|
88377
|
-
return [info2(`${title2}: ${text2(
|
|
88930
|
+
if (!section4.read)
|
|
88931
|
+
return [{ level: "warn", text: `${title2}: not read: ${section4.problem}` }];
|
|
88932
|
+
return [info2(`${title2}: ${text2(section4)}`), ...body(section4)];
|
|
88378
88933
|
}
|
|
88379
88934
|
function renderStatus3(sections2) {
|
|
88380
88935
|
return [
|
|
@@ -88386,10 +88941,10 @@ function renderStatus3(sections2) {
|
|
|
88386
88941
|
...sectionLines2("housekeeping", sections2.housekeeping, housekeepingText)
|
|
88387
88942
|
];
|
|
88388
88943
|
}
|
|
88389
|
-
function sectionData(
|
|
88390
|
-
const copy2 = JSON.parse(JSON.stringify(
|
|
88944
|
+
function sectionData(section4) {
|
|
88945
|
+
const copy2 = JSON.parse(JSON.stringify(section4));
|
|
88391
88946
|
const reading2 = Object.fromEntries(Object.entries(copy2).filter(([key]) => key !== "read"));
|
|
88392
|
-
return { read:
|
|
88947
|
+
return { read: section4.read, ...reading2 };
|
|
88393
88948
|
}
|
|
88394
88949
|
function statusData(sections2) {
|
|
88395
88950
|
return {
|
|
@@ -88405,7 +88960,7 @@ function statusData(sections2) {
|
|
|
88405
88960
|
// src/status/sections.ts
|
|
88406
88961
|
init_rafa_board();
|
|
88407
88962
|
init_rafa_pr();
|
|
88408
|
-
import { existsSync as
|
|
88963
|
+
import { existsSync as existsSync91 } from "fs";
|
|
88409
88964
|
init_sections();
|
|
88410
88965
|
init_loop();
|
|
88411
88966
|
init_readings();
|
|
@@ -88680,7 +89235,7 @@ function nextOfPlace(current, epic, walk2) {
|
|
|
88680
89235
|
return epic?.members.some((member) => member.number === line.issue) === true ? line.issue : null;
|
|
88681
89236
|
}
|
|
88682
89237
|
function hasBoards(root, listing3) {
|
|
88683
|
-
if (
|
|
89238
|
+
if (existsSync91(positionFilePath(root)))
|
|
88684
89239
|
return true;
|
|
88685
89240
|
return listing3.some((issue5) => issue5.state === "OPEN" && issue5.labels.includes(ROADMAP_LABEL));
|
|
88686
89241
|
}
|
|
@@ -88863,8 +89418,8 @@ init_command2();
|
|
|
88863
89418
|
init_config2();
|
|
88864
89419
|
init_sections();
|
|
88865
89420
|
init_git2();
|
|
88866
|
-
import { existsSync as
|
|
88867
|
-
import { dirname as dirname54, join as
|
|
89421
|
+
import { existsSync as existsSync92, mkdirSync as mkdirSync40, readFileSync as readFileSync112, writeFileSync as writeFileSync44 } from "fs";
|
|
89422
|
+
import { dirname as dirname54, join as join135 } from "path";
|
|
88868
89423
|
var COMMAND_NAME30 = "rafa stretch end";
|
|
88869
89424
|
var STRETCH_END_USAGE = "rafa stretch end [--dry-run]";
|
|
88870
89425
|
var REPORT_FILE2 = "report.md";
|
|
@@ -88872,10 +89427,10 @@ var BODY_FILE = "pr-body.md";
|
|
|
88872
89427
|
var REFUSED_EXIT13 = 1;
|
|
88873
89428
|
var FAILED_EXIT9 = 2;
|
|
88874
89429
|
function reportPath(root, n) {
|
|
88875
|
-
return
|
|
89430
|
+
return join135(stretchFolder(root, n), REPORT_FILE2);
|
|
88876
89431
|
}
|
|
88877
89432
|
function bodyPath(root, n) {
|
|
88878
|
-
return
|
|
89433
|
+
return join135(stretchFolder(root, n), BODY_FILE);
|
|
88879
89434
|
}
|
|
88880
89435
|
function endTitle(n) {
|
|
88881
89436
|
return `Stretch ${String(n)}`;
|
|
@@ -88892,6 +89447,13 @@ ${closes2.join(`
|
|
|
88892
89447
|
`)}
|
|
88893
89448
|
`;
|
|
88894
89449
|
}
|
|
89450
|
+
function normalBody(body) {
|
|
89451
|
+
return body.replace(/\r\n?/g, `
|
|
89452
|
+
`).replace(/\n+$/, "");
|
|
89453
|
+
}
|
|
89454
|
+
function sameBody(stored, written5) {
|
|
89455
|
+
return normalBody(stored) === normalBody(written5);
|
|
89456
|
+
}
|
|
88895
89457
|
function refusal30(why) {
|
|
88896
89458
|
return new CommandExit(REFUSED_EXIT13, `\u274C ${COMMAND_NAME30}: ${why}`);
|
|
88897
89459
|
}
|
|
@@ -88910,43 +89472,43 @@ function requireStretchBase2(prBase) {
|
|
|
88910
89472
|
throw refusal30(`${PR_BASE_KEY} is ${found}, expected a ${STRETCH_BRANCH_PREFIX}<n> branch: the stretch to end is the one` + ` ${PR_BASE_KEY} points at, and a ${PR_BASE_KEY} already put back leaves none to end. Nothing was run.`);
|
|
88911
89473
|
}
|
|
88912
89474
|
function readReport2(root, n) {
|
|
88913
|
-
const
|
|
88914
|
-
if (!
|
|
88915
|
-
throw refusal30(`there is no ${
|
|
89475
|
+
const path10 = reportPath(root, n);
|
|
89476
|
+
if (!existsSync92(path10)) {
|
|
89477
|
+
throw refusal30(`there is no ${path10}: write the stretch report first, since it is the pull request's body. Nothing was run.`);
|
|
88916
89478
|
}
|
|
88917
89479
|
try {
|
|
88918
|
-
return readFileSync112(
|
|
89480
|
+
return readFileSync112(path10, "utf8");
|
|
88919
89481
|
} catch (error2) {
|
|
88920
|
-
throw refusal30(`${
|
|
89482
|
+
throw refusal30(`${path10} could not be read: ${messageOf(error2)}. Nothing was run.`);
|
|
88921
89483
|
}
|
|
88922
89484
|
}
|
|
88923
|
-
function recordText(record2, name2,
|
|
89485
|
+
function recordText(record2, name2, path10) {
|
|
88924
89486
|
const value = record2[name2];
|
|
88925
89487
|
if (typeof value === "string" && value !== "")
|
|
88926
89488
|
return value;
|
|
88927
|
-
throw refusal30(`${
|
|
89489
|
+
throw refusal30(`${path10} holds ${name2} ${describeValue(value)}, expected a branch name. Nothing was run.`);
|
|
88928
89490
|
}
|
|
88929
89491
|
function readStretchRecord(root, n) {
|
|
88930
|
-
const
|
|
88931
|
-
if (!
|
|
89492
|
+
const path10 = stretchRecordPath(root, n);
|
|
89493
|
+
if (!existsSync92(path10))
|
|
88932
89494
|
return null;
|
|
88933
89495
|
let value;
|
|
88934
89496
|
try {
|
|
88935
|
-
value = JSON.parse(readFileSync112(
|
|
89497
|
+
value = JSON.parse(readFileSync112(path10, "utf8"));
|
|
88936
89498
|
} catch (error2) {
|
|
88937
|
-
throw refusal30(`${
|
|
89499
|
+
throw refusal30(`${path10} could not be read as JSON: ${messageOf(error2)}. Nothing was run.`);
|
|
88938
89500
|
}
|
|
88939
89501
|
if (!isMapping(value))
|
|
88940
|
-
throw refusal30(`${
|
|
89502
|
+
throw refusal30(`${path10} holds ${describeValue(value)}, expected an object. Nothing was run.`);
|
|
88941
89503
|
const prBase = value["prBase"];
|
|
88942
89504
|
if (prBase !== null && (typeof prBase !== "string" || prBase === "")) {
|
|
88943
|
-
throw refusal30(`${
|
|
89505
|
+
throw refusal30(`${path10} holds prBase ${describeValue(prBase)}, expected a branch name or null. Nothing was run.`);
|
|
88944
89506
|
}
|
|
88945
89507
|
const startedAt = value["startedAt"];
|
|
88946
89508
|
return {
|
|
88947
89509
|
stretch: n,
|
|
88948
|
-
branch: recordText(value, "branch",
|
|
88949
|
-
defaultBranch: recordText(value, "defaultBranch",
|
|
89510
|
+
branch: recordText(value, "branch", path10),
|
|
89511
|
+
defaultBranch: recordText(value, "defaultBranch", path10),
|
|
88950
89512
|
prBase,
|
|
88951
89513
|
startedAt: typeof startedAt === "string" ? startedAt : ""
|
|
88952
89514
|
};
|
|
@@ -88974,16 +89536,16 @@ function putBack(context, input, merged2) {
|
|
|
88974
89536
|
if (record2.prBase === null) {
|
|
88975
89537
|
info3(`${stretchRecordPath(input.root, input.n)} records no ${PR_BASE_KEY}, so it is put back as ${value}, the branch the stretch was pushed from`);
|
|
88976
89538
|
}
|
|
88977
|
-
const
|
|
89539
|
+
const path10 = configFilePath(input.root);
|
|
88978
89540
|
let edit;
|
|
88979
89541
|
try {
|
|
88980
|
-
edit = withConfigSetting(readFileSync112(
|
|
89542
|
+
edit = withConfigSetting(readFileSync112(path10, "utf8"), PR_BASE_KEY, value, path10);
|
|
88981
89543
|
} catch (error2) {
|
|
88982
|
-
const why = error2 instanceof ConfigSetRefusal ? `${PR_BASE_KEY} cannot be set: ${error2.message}` : `${
|
|
89544
|
+
const why = error2 instanceof ConfigSetRefusal ? `${PR_BASE_KEY} cannot be set: ${error2.message}` : `${path10} could not be read: ${messageOf(error2)}`;
|
|
88983
89545
|
throw refusal30(`${why}. Nothing was set.`);
|
|
88984
89546
|
}
|
|
88985
89547
|
if (!edit.changed) {
|
|
88986
|
-
info3(`${
|
|
89548
|
+
info3(`${path10} already reads ${PR_BASE_KEY}: ${value}`);
|
|
88987
89549
|
return;
|
|
88988
89550
|
}
|
|
88989
89551
|
info3(`rafa config set ${PR_BASE_KEY}=${value}`);
|
|
@@ -88992,38 +89554,66 @@ function putBack(context, input, merged2) {
|
|
|
88992
89554
|
return;
|
|
88993
89555
|
}
|
|
88994
89556
|
try {
|
|
88995
|
-
writeFileSync44(
|
|
89557
|
+
writeFileSync44(path10, edit.text, "utf8");
|
|
88996
89558
|
} catch (error2) {
|
|
88997
|
-
throw failure12(`${
|
|
89559
|
+
throw failure12(`${path10} could not be written: ${messageOf(error2)}. ${PR_BASE_KEY} still reads ${branch}.`);
|
|
88998
89560
|
}
|
|
88999
89561
|
info3(`${PR_BASE_KEY}: ${branch} \u2192 ${value}; stretch ${String(input.n)} is ended`);
|
|
89000
89562
|
}
|
|
89001
|
-
|
|
89563
|
+
function openNamed(pull2, head) {
|
|
89564
|
+
return `#${String(pull2.number)} (${pull2.url}), the pull request already open from ${head}`;
|
|
89565
|
+
}
|
|
89566
|
+
async function refreshBody(context, pulls, pull2, input, body) {
|
|
89567
|
+
const path10 = bodyPath(input.root, input.n);
|
|
89568
|
+
const named8 = openNamed(pull2, stretchBranch(input.n));
|
|
89569
|
+
let stored;
|
|
89570
|
+
try {
|
|
89571
|
+
const detail = await pulls.get(pull2.number);
|
|
89572
|
+
if (detail === null)
|
|
89573
|
+
throw new Error("the provider answered no such pull request");
|
|
89574
|
+
stored = detail.body;
|
|
89575
|
+
} catch (error2) {
|
|
89576
|
+
throw refusal30(`the body of ${named8}, could not be read: ${messageOf(error2)}. ${path10} was written and the body was not updated.`);
|
|
89577
|
+
}
|
|
89578
|
+
if (sameBody(stored, body)) {
|
|
89579
|
+
context.output.info(`body unchanged: #${String(pull2.number)} already holds ${path10}`);
|
|
89580
|
+
return;
|
|
89581
|
+
}
|
|
89582
|
+
try {
|
|
89583
|
+
await pulls.editBody(pull2.number, body);
|
|
89584
|
+
} catch (error2) {
|
|
89585
|
+
throw refusal30(`the body of ${named8}, could not be updated: ${messageOf(error2)}. ${path10} was written and the body was not updated.`);
|
|
89586
|
+
}
|
|
89587
|
+
context.output.info(`body updated: #${String(pull2.number)} now holds ${path10}`);
|
|
89588
|
+
}
|
|
89589
|
+
async function openEnd(context, input, body, seams, pulls) {
|
|
89002
89590
|
const info3 = (text2) => context.output.info(text2);
|
|
89003
|
-
const
|
|
89591
|
+
const path10 = bodyPath(input.root, input.n);
|
|
89004
89592
|
const flags = {
|
|
89005
89593
|
head: stretchBranch(input.n),
|
|
89006
89594
|
base: input.defaultBranch,
|
|
89007
89595
|
title: endTitle(input.n),
|
|
89008
|
-
"body-file":
|
|
89596
|
+
"body-file": path10
|
|
89009
89597
|
};
|
|
89010
|
-
info3(`write ${
|
|
89598
|
+
info3(`write ${path10}: ${REPORT_FILE2} with the ledger's Closes lines`);
|
|
89011
89599
|
info3(lineText(["rafa", "pr", "open", ...Object.entries(flags).map(([name2, value]) => `--${name2}=${value}`)]));
|
|
89012
89600
|
if (input.dryRun) {
|
|
89013
|
-
info3(`dry run: would open ${flags.head} into ${flags.base}, or print the pull request already open from it; nothing was run`);
|
|
89601
|
+
info3(`dry run: would open ${flags.head} into ${flags.base}, or print the pull request already open from it and compare` + ` its body with ${BODY_FILE}, updating it when they differ; nothing was run`);
|
|
89014
89602
|
return;
|
|
89015
89603
|
}
|
|
89016
89604
|
try {
|
|
89017
|
-
mkdirSync40(dirname54(
|
|
89018
|
-
writeFileSync44(
|
|
89605
|
+
mkdirSync40(dirname54(path10), { recursive: true });
|
|
89606
|
+
writeFileSync44(path10, body, "utf8");
|
|
89019
89607
|
} catch (error2) {
|
|
89020
|
-
throw failure12(`${
|
|
89608
|
+
throw failure12(`${path10} could not be written: ${messageOf(error2)}. No pull request was opened.`);
|
|
89021
89609
|
}
|
|
89022
89610
|
const result2 = await openPull2({ ...context, args: [], flags }, seams.pr);
|
|
89023
89611
|
const warning = baseWarning(result2);
|
|
89024
89612
|
if (warning !== null)
|
|
89025
89613
|
context.output.warn(warning);
|
|
89026
89614
|
info3(renderOpen(result2));
|
|
89615
|
+
if (!result2.opened)
|
|
89616
|
+
await refreshBody(context, pulls, result2.pull, input, body);
|
|
89027
89617
|
info3(`once #${String(result2.pull.number)} has merged, run rafa stretch end again to put ${PR_BASE_KEY} back`);
|
|
89028
89618
|
}
|
|
89029
89619
|
async function runStretchEnd(context, seams) {
|
|
@@ -89045,7 +89635,7 @@ async function runStretchEnd(context, seams) {
|
|
|
89045
89635
|
putBack(context, input, merged2);
|
|
89046
89636
|
return;
|
|
89047
89637
|
}
|
|
89048
|
-
await openEnd(context, input, endBody(report4, closes2), seams);
|
|
89638
|
+
await openEnd(context, input, endBody(report4, closes2), seams, pr.pulls);
|
|
89049
89639
|
}
|
|
89050
89640
|
function defaultStretchEndSeams() {
|
|
89051
89641
|
return { pr: DEFAULT_PR_SEAMS, git: createGitRunner };
|
|
@@ -89056,7 +89646,7 @@ function createStretchEndCommand(seams) {
|
|
|
89056
89646
|
subject: "stretch",
|
|
89057
89647
|
action: "end",
|
|
89058
89648
|
summary: "open the stretch branch into the default branch, then put pr.base back once it has merged",
|
|
89059
|
-
description: "Ends the stretch `pr.base` names, refusing a `pr.base` that names no `stretch/<n>` branch and" + " a stretch with no `.rafa/stretch/<n>/report.md`. Run before the merge, it writes the report with every" + " `Closes` line of the item ledger appended to `.rafa/stretch/<n>/pr-body.md` and opens `stretch/<n>` into" + " the default branch through the `pr open` logic, printing the pull request already open from it instead" + " when there is one. Run once that pull request has merged, it sets `pr.base` back to what
|
|
89649
|
+
description: "Ends the stretch `pr.base` names, refusing a `pr.base` that names no `stretch/<n>` branch and" + " a stretch with no `.rafa/stretch/<n>/report.md`. Run before the merge, it writes the report with every" + " `Closes` line of the item ledger appended to `.rafa/stretch/<n>/pr-body.md` and opens `stretch/<n>` into" + " the default branch through the `pr open` logic, printing the pull request already open from it instead" + " when there is one and updating that pull request's body when it differs from `pr-body.md`, line endings" + " and the trailing newline left out, printing `body updated` or `body unchanged`. Run once that pull request" + " has merged, it sets `pr.base` back to what `.rafa/stretch/<n>/stretch.json` recorded, with every comment" + " kept. `--dry-run` prints every step in" + " order and runs none, reading no open pull request's body. Exit code 1 for a refusal and for a body that" + " could not be read or updated, 2 for a provider that is not `gh` or a file that could" + " not be written. Starts no session.",
|
|
89060
89650
|
args: [],
|
|
89061
89651
|
flags: [
|
|
89062
89652
|
{ name: "dry-run", description: "Print every step in order, and run none of them.", type: "boolean" }
|
|
@@ -89117,11 +89707,11 @@ init_rafa_board();
|
|
|
89117
89707
|
init_rafa_release();
|
|
89118
89708
|
init_sections();
|
|
89119
89709
|
init_scope2();
|
|
89120
|
-
import { existsSync as
|
|
89121
|
-
import { join as
|
|
89710
|
+
import { existsSync as existsSync93 } from "fs";
|
|
89711
|
+
import { join as join136 } from "path";
|
|
89122
89712
|
var DEPRECATIONS = Object.freeze([]);
|
|
89123
89713
|
function missingFolders(root) {
|
|
89124
|
-
return PROJECT_TREE.map((name2) =>
|
|
89714
|
+
return PROJECT_TREE.map((name2) => join136(SCOPE_DIR, name2)).filter((relative35) => !existsSync93(join136(root, relative35)));
|
|
89125
89715
|
}
|
|
89126
89716
|
async function readBoard3(access) {
|
|
89127
89717
|
if (access.gh === null)
|
|
@@ -89174,7 +89764,7 @@ class UpdateStepError extends Error {
|
|
|
89174
89764
|
}
|
|
89175
89765
|
}
|
|
89176
89766
|
function foldersNowThere(plan2) {
|
|
89177
|
-
return plan2.folders.filter((relative35) =>
|
|
89767
|
+
return plan2.folders.filter((relative35) => existsSync93(join136(plan2.root, relative35)));
|
|
89178
89768
|
}
|
|
89179
89769
|
function writeFolders(plan2) {
|
|
89180
89770
|
if (plan2.folders.length === 0)
|
|
@@ -89313,8 +89903,8 @@ function planLines2(plan2) {
|
|
|
89313
89903
|
];
|
|
89314
89904
|
}
|
|
89315
89905
|
function appliedLines(applied, plan2, context) {
|
|
89316
|
-
for (const
|
|
89317
|
-
context.output.info(`created ${
|
|
89906
|
+
for (const path10 of applied.folders)
|
|
89907
|
+
context.output.info(`created ${path10}`);
|
|
89318
89908
|
for (const part of applied.labels) {
|
|
89319
89909
|
if (part.outcome === "created")
|
|
89320
89910
|
context.output.info(`created label ${part.name}`);
|
|
@@ -89483,7 +90073,7 @@ var SKILL_SUBJECT = { name: "skill", summary: "check a skills directory; list ea
|
|
|
89483
90073
|
var INSTINCT_SUBJECT = { name: "instinct", summary: "check an instincts directory; list, show, flag and promote its records" };
|
|
89484
90074
|
var UPDATE_SUBJECT = { name: "update", summary: "bring this project to the installed rafa; the other updates are in development" };
|
|
89485
90075
|
var CONFIG_SUBJECT = { name: "config", summary: "show every setting and where it came from; set one key in the project's config, keeping every comment" };
|
|
89486
|
-
var CI_SUBJECT = { name: "ci", summary: "read
|
|
90076
|
+
var CI_SUBJECT = { name: "ci", summary: "read every CI workflow on a branch's head commit: its state, the commit and the cases it failed" };
|
|
89487
90077
|
var STRETCH_SUBJECT = { name: "stretch", summary: "open a stretch: its integration branch, pr.base pointed at it, and the operators in tmux" };
|
|
89488
90078
|
var BUG_SUBJECT = { name: "bug", summary: "list the cause codes a bug can carry, rank the closest to a cause in words, check for codes that read alike, and recheck whether a bug still reproduces" };
|
|
89489
90079
|
var DOCS_SUBJECT = { name: "docs", summary: "write a plan repairing the open lines of the stale-docs issues" };
|
|
@@ -89616,9 +90206,26 @@ var CORE_REGISTRY = createRosterRegistry();
|
|
|
89616
90206
|
// src/service-registry.ts
|
|
89617
90207
|
init_rafa_pr();
|
|
89618
90208
|
init_rafa_release();
|
|
90209
|
+
init_git2();
|
|
89619
90210
|
init_services();
|
|
90211
|
+
function newestReleaseHere() {
|
|
90212
|
+
return newestRootRelease(createGitRunner(process.cwd()));
|
|
90213
|
+
}
|
|
90214
|
+
function addStaleDocLineWithRelease(readNewestRelease2 = newestReleaseHere) {
|
|
90215
|
+
return (options) => {
|
|
90216
|
+
if (options.newestRelease !== undefined)
|
|
90217
|
+
return addStaleDocLine(options);
|
|
90218
|
+
let newestRelease;
|
|
90219
|
+
try {
|
|
90220
|
+
newestRelease = readNewestRelease2();
|
|
90221
|
+
} catch {
|
|
90222
|
+
newestRelease = undefined;
|
|
90223
|
+
}
|
|
90224
|
+
return addStaleDocLine({ ...options, newestRelease });
|
|
90225
|
+
};
|
|
90226
|
+
}
|
|
89620
90227
|
var CORE_SERVICES = Object.freeze({
|
|
89621
|
-
addStaleDocLine,
|
|
90228
|
+
addStaleDocLine: addStaleDocLineWithRelease(),
|
|
89622
90229
|
endWithNextStep,
|
|
89623
90230
|
pullRequestsIn: ghPullRequestsIn,
|
|
89624
90231
|
readStaleDocsVersion,
|
|
@@ -89686,7 +90293,7 @@ function noticeLine(previous, current) {
|
|
|
89686
90293
|
// src/status/seen.ts
|
|
89687
90294
|
init_rafa_pr();
|
|
89688
90295
|
import { mkdirSync as mkdirSync41, readFileSync as readFileSync113, renameSync as renameSync15, writeFileSync as writeFileSync45 } from "fs";
|
|
89689
|
-
import { dirname as dirname55, join as
|
|
90296
|
+
import { dirname as dirname55, join as join137 } from "path";
|
|
89690
90297
|
init_sections();
|
|
89691
90298
|
init_loop();
|
|
89692
90299
|
init_readings();
|
|
@@ -89694,7 +90301,7 @@ init_scope2();
|
|
|
89694
90301
|
var SEEN_FILE = "status-seen.json";
|
|
89695
90302
|
var SEEN_VERSION = 1;
|
|
89696
90303
|
function seenFilePath(root) {
|
|
89697
|
-
return
|
|
90304
|
+
return join137(scopeAt(root).dir, SEEN_FILE);
|
|
89698
90305
|
}
|
|
89699
90306
|
function readSeenSessions(root, isAlive) {
|
|
89700
90307
|
const sessions = {};
|