@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/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
withSqliteStore,
|
|
83
83
|
writeNames,
|
|
84
84
|
writeSqliteStore
|
|
85
|
-
} from "./index-
|
|
85
|
+
} from "./index-j518r1yt.js";
|
|
86
86
|
import {
|
|
87
87
|
ACTION_SHAPE,
|
|
88
88
|
CONFIG_DEFAULTS,
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
renderTitle,
|
|
99
99
|
suggestedEnvironment,
|
|
100
100
|
titleRoundTrips
|
|
101
|
-
} from "./index-
|
|
101
|
+
} from "./index-nqaqh4zz.js";
|
|
102
102
|
import {
|
|
103
103
|
ABSENT,
|
|
104
104
|
ACCEPT_REFS_FLAG,
|
|
@@ -269,7 +269,7 @@ import {
|
|
|
269
269
|
writeHopRecord,
|
|
270
270
|
writePositionFile,
|
|
271
271
|
writeRefsBlock
|
|
272
|
-
} from "./index-
|
|
272
|
+
} from "./index-chm1d3xn.js";
|
|
273
273
|
import {
|
|
274
274
|
BLOCKER_GAP,
|
|
275
275
|
PLAN_BLOCK_KINDS,
|
|
@@ -321,7 +321,7 @@ import {
|
|
|
321
321
|
parseWorkingTree,
|
|
322
322
|
registerAdapters,
|
|
323
323
|
restoreAdapters
|
|
324
|
-
} from "./index-
|
|
324
|
+
} from "./index-h9vwrj54.js";
|
|
325
325
|
import {
|
|
326
326
|
activeOutput,
|
|
327
327
|
activeOutputMode,
|
|
@@ -340,7 +340,7 @@ import {
|
|
|
340
340
|
codeProblem,
|
|
341
341
|
familyOf,
|
|
342
342
|
isKnownCode
|
|
343
|
-
} from "./index-
|
|
343
|
+
} from "./index-jjxnyqvy.js";
|
|
344
344
|
import {
|
|
345
345
|
CONFIG_FILE,
|
|
346
346
|
CORE_SECTION,
|
|
@@ -11981,6 +11981,12 @@ function readTags(git) {
|
|
|
11981
11981
|
const tags = releaseTagsOf(result.stdout);
|
|
11982
11982
|
return { tags, latest: tags.find((tag) => tag.package === null) ?? null, problem: null };
|
|
11983
11983
|
}
|
|
11984
|
+
function newestRootRelease(git) {
|
|
11985
|
+
const reading = readTags(git);
|
|
11986
|
+
if (reading.problem !== null)
|
|
11987
|
+
return;
|
|
11988
|
+
return reading.latest?.version ?? null;
|
|
11989
|
+
}
|
|
11984
11990
|
function readUntagged(root, configured, tags) {
|
|
11985
11991
|
const resolved = join25(root, configured);
|
|
11986
11992
|
const text = textOf(resolved);
|
|
@@ -12967,6 +12973,21 @@ var DOC_UPDATE_TASK_PREFIX = "Repair the stale doc line at ";
|
|
|
12967
12973
|
function staleDocsTitle(version) {
|
|
12968
12974
|
return `Release ${version}: update stale docs`;
|
|
12969
12975
|
}
|
|
12976
|
+
var STALE_DOCS_TITLE = /^Release (\S+): update stale docs$/;
|
|
12977
|
+
function staleDocsTitleVersion(title) {
|
|
12978
|
+
return STALE_DOCS_TITLE.exec(title)?.[1] ?? null;
|
|
12979
|
+
}
|
|
12980
|
+
function isUnreleasedVersion(version, newestRelease) {
|
|
12981
|
+
if (version === NEXT_VERSION)
|
|
12982
|
+
return true;
|
|
12983
|
+
const parsed = parseSemanticVersion(version);
|
|
12984
|
+
if (parsed === null)
|
|
12985
|
+
return false;
|
|
12986
|
+
if (newestRelease === null)
|
|
12987
|
+
return true;
|
|
12988
|
+
const newest = parseSemanticVersion(newestRelease);
|
|
12989
|
+
return newest !== null && compareVersions(parsed, newest) > 0;
|
|
12990
|
+
}
|
|
12970
12991
|
function staleDocsVersion(input) {
|
|
12971
12992
|
if (!input.releaseEnabled)
|
|
12972
12993
|
return NEXT_VERSION;
|
|
@@ -13021,8 +13042,81 @@ async function call(step, action) {
|
|
|
13021
13042
|
return { ok: false, problem: oneLine5(`${step} failed: ${messageOf(error)}`) };
|
|
13022
13043
|
}
|
|
13023
13044
|
}
|
|
13024
|
-
function
|
|
13025
|
-
|
|
13045
|
+
function createdMs(issue4) {
|
|
13046
|
+
if (issue4.createdAt === null)
|
|
13047
|
+
return null;
|
|
13048
|
+
const ms = Date.parse(issue4.createdAt);
|
|
13049
|
+
return Number.isNaN(ms) ? null : ms;
|
|
13050
|
+
}
|
|
13051
|
+
function idOrder(left, right) {
|
|
13052
|
+
const [a, b] = [Number(left), Number(right)];
|
|
13053
|
+
if (Number.isSafeInteger(a) && Number.isSafeInteger(b))
|
|
13054
|
+
return a - b;
|
|
13055
|
+
return left.localeCompare(right);
|
|
13056
|
+
}
|
|
13057
|
+
function olderFirst(left, right) {
|
|
13058
|
+
const [a, b] = [createdMs(left), createdMs(right)];
|
|
13059
|
+
if (a !== null && b !== null && a !== b)
|
|
13060
|
+
return a - b;
|
|
13061
|
+
return idOrder(left.ref.externalId, right.ref.externalId);
|
|
13062
|
+
}
|
|
13063
|
+
function releaseReading(newestRelease) {
|
|
13064
|
+
return typeof newestRelease === "string" && parseSemanticVersion(newestRelease) === null ? undefined : newestRelease;
|
|
13065
|
+
}
|
|
13066
|
+
function mayTake(issue4, choice) {
|
|
13067
|
+
if (!issue4.body.includes(STALE_DOCS_MARKER))
|
|
13068
|
+
return false;
|
|
13069
|
+
if (choice.newestRelease === undefined)
|
|
13070
|
+
return issue4.title === choice.title;
|
|
13071
|
+
const version = staleDocsTitleVersion(issue4.title);
|
|
13072
|
+
return version !== null && isUnreleasedVersion(version, choice.newestRelease);
|
|
13073
|
+
}
|
|
13074
|
+
function chooseIssue(open, choice) {
|
|
13075
|
+
const candidates = open.filter((issue4) => mayTake(issue4, choice)).sort(olderFirst);
|
|
13076
|
+
return candidates.find((issue4) => issue4.title === choice.title) ?? candidates[0];
|
|
13077
|
+
}
|
|
13078
|
+
function issueChange(found, title, line, held) {
|
|
13079
|
+
if (held)
|
|
13080
|
+
return { title };
|
|
13081
|
+
const body = appendItem(found.body, line.item);
|
|
13082
|
+
return found.title === title ? { body } : { title, body };
|
|
13083
|
+
}
|
|
13084
|
+
async function addToIssue(tracker, found, title, line) {
|
|
13085
|
+
const held = bodyHoldsLine(found.body, line.text);
|
|
13086
|
+
const action = held ? "held" : "appended";
|
|
13087
|
+
if (held && found.title === title)
|
|
13088
|
+
return { action, title, ref: found.ref };
|
|
13089
|
+
const change = issueChange(found, title, line, held);
|
|
13090
|
+
const edited = await call("editing the stale-docs issue", () => tracker.edit(found.ref, change));
|
|
13091
|
+
if (!edited.ok)
|
|
13092
|
+
return { action: "failed", title, problem: edited.problem };
|
|
13093
|
+
return found.title === title ? { action, title, ref: found.ref } : { action, title, ref: found.ref, retitledFrom: found.title };
|
|
13094
|
+
}
|
|
13095
|
+
async function closeDuplicate(tracker, duplicate, older) {
|
|
13096
|
+
const id = duplicate.externalId;
|
|
13097
|
+
const commented = await call(`commenting on the duplicate issue ${id}`, () => tracker.comment(duplicate, `Duplicate of #${older.externalId}`));
|
|
13098
|
+
if (!commented.ok)
|
|
13099
|
+
return commented;
|
|
13100
|
+
return call(`closing the duplicate issue ${id}`, () => tracker.transition(duplicate, "cancelled"));
|
|
13101
|
+
}
|
|
13102
|
+
async function createAndConverge(tracker, choice, line) {
|
|
13103
|
+
const { title } = choice;
|
|
13104
|
+
const created = await call("creating the stale-docs issue", () => tracker.create(issueDraft(title, line.item)));
|
|
13105
|
+
if (!created.ok)
|
|
13106
|
+
return { action: "failed", title, problem: created.problem };
|
|
13107
|
+
const ref = created.value;
|
|
13108
|
+
const relisted = await call(`listing the open chore issues after creating issue ${ref.externalId}`, () => tracker.openIssues("chore"));
|
|
13109
|
+
if (!relisted.ok)
|
|
13110
|
+
return { action: "failed", title, problem: relisted.problem };
|
|
13111
|
+
const own = relisted.value.find((issue4) => issue4.ref.externalId === ref.externalId) ?? { ref, title, body: "", createdAt: null };
|
|
13112
|
+
const older = chooseIssue(relisted.value.filter((issue4) => issue4.ref.externalId !== ref.externalId && olderFirst(issue4, own) < 0), choice);
|
|
13113
|
+
if (older === undefined)
|
|
13114
|
+
return { action: "created", title, ref };
|
|
13115
|
+
const added = await addToIssue(tracker, older, title, line);
|
|
13116
|
+
if (added.action !== "appended" && added.action !== "held")
|
|
13117
|
+
return added;
|
|
13118
|
+
const closed = await closeDuplicate(tracker, ref, older.ref);
|
|
13119
|
+
return closed.ok ? { ...added, duplicate: ref } : { action: "failed", title, problem: closed.problem };
|
|
13026
13120
|
}
|
|
13027
13121
|
async function addStaleDocLine(options) {
|
|
13028
13122
|
const { tracker, version, entry } = options;
|
|
@@ -13030,20 +13124,13 @@ async function addStaleDocLine(options) {
|
|
|
13030
13124
|
if (!canHoldIssue(tracker))
|
|
13031
13125
|
return { action: "kept", title, reason: NO_EDITABLE_TRACKER };
|
|
13032
13126
|
const text = staleDocLineText(entry);
|
|
13033
|
-
const
|
|
13127
|
+
const line = { text, item: `${UNTICKED}${text}` };
|
|
13128
|
+
const choice = { title, newestRelease: releaseReading(options.newestRelease) };
|
|
13034
13129
|
const listed2 = await call("listing the open chore issues", () => tracker.openIssues("chore"));
|
|
13035
13130
|
if (!listed2.ok)
|
|
13036
13131
|
return { action: "failed", title, problem: listed2.problem };
|
|
13037
|
-
const found =
|
|
13038
|
-
|
|
13039
|
-
const created = await call("creating the stale-docs issue", () => tracker.create(issueDraft(title, item)));
|
|
13040
|
-
return created.ok ? { action: "created", title, ref: created.value } : { action: "failed", title, problem: created.problem };
|
|
13041
|
-
}
|
|
13042
|
-
if (bodyHoldsLine(found.body, text))
|
|
13043
|
-
return { action: "held", title, ref: found.ref };
|
|
13044
|
-
const body = appendItem(found.body, item);
|
|
13045
|
-
const edited = await call("editing the stale-docs issue", () => tracker.edit(found.ref, { body }));
|
|
13046
|
-
return edited.ok ? { action: "appended", title, ref: found.ref } : { action: "failed", title, problem: edited.problem };
|
|
13132
|
+
const found = chooseIssue(listed2.value, choice);
|
|
13133
|
+
return found === undefined ? createAndConverge(tracker, choice, line) : addToIssue(tracker, found, title, line);
|
|
13047
13134
|
}
|
|
13048
13135
|
function docUpdateLineText(taskText) {
|
|
13049
13136
|
if (!taskText.startsWith(DOC_UPDATE_TASK_PREFIX))
|
|
@@ -23116,20 +23203,22 @@ async function runStartPreflight(options) {
|
|
|
23116
23203
|
}
|
|
23117
23204
|
|
|
23118
23205
|
// packages/rafa-run/src/start/type-step.ts
|
|
23119
|
-
import { existsSync as existsSync32, mkdtempSync as mkdtempSync2, realpathSync as realpathSync4, rmSync as rmSync6, symlinkSync as symlinkSync2, writeFileSync as writeFileSync10 } from "fs";
|
|
23206
|
+
import { closeSync as closeSync2, existsSync as existsSync32, mkdtempSync as mkdtempSync2, openSync as openSync2, readSync as readSync2, realpathSync as realpathSync4, rmSync as rmSync6, symlinkSync as symlinkSync2, writeFileSync as writeFileSync10 } from "fs";
|
|
23120
23207
|
import { tmpdir as tmpdir2 } from "os";
|
|
23121
|
-
import { dirname as dirname15, join as join41, relative as relative14, resolve as resolve18, sep as sep6 } from "path";
|
|
23208
|
+
import { basename as basename11, dirname as dirname15, join as join41, relative as relative14, resolve as resolve18, sep as sep6 } from "path";
|
|
23122
23209
|
var TEST_FILE_SUFFIX = ".test.ts";
|
|
23123
23210
|
var TSC_FLAGS = ["--noEmit", "--pretty", "false"];
|
|
23211
|
+
var CANNOT_START_CODES = [126, 127];
|
|
23212
|
+
var SHEBANG_BYTES = 256;
|
|
23124
23213
|
var ERRORS_LISTED = 10;
|
|
23125
23214
|
var NODE_MODULES2 = "node_modules";
|
|
23126
23215
|
var TSC_BIN = [".bin", "tsc"];
|
|
23127
23216
|
var SCRATCH_NAME = "tsconfig.json";
|
|
23128
23217
|
var FILE_ERROR = /^(.+)\((\d+),(\d+)\): error (TS\d+): (.*)$/;
|
|
23129
23218
|
var GLOBAL_ERROR = /^error (TS\d+): (.*)$/;
|
|
23130
|
-
var NOTHING_RAN = { ran: false, red: false, interrupted: false, blocker: null };
|
|
23131
|
-
var GREEN = { ran: true, red: false, interrupted: false, blocker: null };
|
|
23132
|
-
var INTERRUPTED2 = { ran: true, red: false, interrupted: true, blocker: null };
|
|
23219
|
+
var NOTHING_RAN = { ran: false, red: false, interrupted: false, cannotStart: false, blocker: null };
|
|
23220
|
+
var GREEN = { ran: true, red: false, interrupted: false, cannotStart: false, blocker: null };
|
|
23221
|
+
var INTERRUPTED2 = { ran: true, red: false, interrupted: true, cannotStart: false, blocker: null };
|
|
23133
23222
|
async function runTsc(options) {
|
|
23134
23223
|
const proc = Bun.spawn([...options.argv], {
|
|
23135
23224
|
cwd: options.cwd,
|
|
@@ -23276,6 +23365,32 @@ function typeBlockerText(label, base2, errors) {
|
|
|
23276
23365
|
function brokenBlockerText(label, run, said) {
|
|
23277
23366
|
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}`}`;
|
|
23278
23367
|
}
|
|
23368
|
+
function scriptInterpreter(path3) {
|
|
23369
|
+
let head;
|
|
23370
|
+
try {
|
|
23371
|
+
const fd = openSync2(path3, "r");
|
|
23372
|
+
try {
|
|
23373
|
+
const buffer = Buffer.alloc(SHEBANG_BYTES);
|
|
23374
|
+
head = buffer.toString("utf8", 0, readSync2(fd, buffer, 0, SHEBANG_BYTES, 0));
|
|
23375
|
+
} finally {
|
|
23376
|
+
closeSync2(fd);
|
|
23377
|
+
}
|
|
23378
|
+
} catch {
|
|
23379
|
+
return null;
|
|
23380
|
+
}
|
|
23381
|
+
const first = head.split(`
|
|
23382
|
+
`)[0] ?? "";
|
|
23383
|
+
if (!first.startsWith("#!"))
|
|
23384
|
+
return null;
|
|
23385
|
+
const [program = "", ...rest] = first.slice(2).trim().split(/\s+/u);
|
|
23386
|
+
const named = basename11(program) === "env" ? rest.find((word) => !word.startsWith("-") && !word.includes("=")) : program;
|
|
23387
|
+
return named === undefined || named === "" ? null : basename11(named);
|
|
23388
|
+
}
|
|
23389
|
+
function cannotStartBlockerText(label, tsc, run, said, interpreter) {
|
|
23390
|
+
const heard = said === undefined ? "" : ` (${said})`;
|
|
23391
|
+
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`;
|
|
23392
|
+
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.`;
|
|
23393
|
+
}
|
|
23279
23394
|
function configError(errors, scratch, cwd) {
|
|
23280
23395
|
const config = relative14(cwd, scratch);
|
|
23281
23396
|
return errors.find((error) => error.file === null || error.file === config);
|
|
@@ -23298,6 +23413,8 @@ async function checkTree(input, modules, tree, files) {
|
|
|
23298
23413
|
}
|
|
23299
23414
|
if (run.exitCode === input.stopCode || input.isInterrupted?.() === true)
|
|
23300
23415
|
return { kind: "interrupted" };
|
|
23416
|
+
if (CANNOT_START_CODES.includes(run.exitCode))
|
|
23417
|
+
return { kind: "cannot-start", run, said: firstLine7(run) };
|
|
23301
23418
|
const errors = parseTscOutput(run.stdout, tree);
|
|
23302
23419
|
const config = configError(errors, scratch, tree);
|
|
23303
23420
|
if (config !== undefined)
|
|
@@ -23343,6 +23460,8 @@ async function baseErrors(input, label, modules, files) {
|
|
|
23343
23460
|
return { outcome: GREEN };
|
|
23344
23461
|
if (run.kind === "interrupted")
|
|
23345
23462
|
return { outcome: interrupted(label) };
|
|
23463
|
+
if (run.kind === "cannot-start")
|
|
23464
|
+
return { outcome: cannotStart(label, modules, run) };
|
|
23346
23465
|
if (run.kind !== "read") {
|
|
23347
23466
|
const why = run.kind === "threw" ? run.why : brokenBlockerText(label, run.run, run.said);
|
|
23348
23467
|
activeOutput().warn(`\u26A0\uFE0F The ${label} could not check the files at ${input.base} (${why}); it reads no error as new.`);
|
|
@@ -23355,6 +23474,12 @@ function interrupted(label) {
|
|
|
23355
23474
|
activeOutput().info(`\u23F9 The ${label} was interrupted by SIGINT: read as a stop, not as errors.`);
|
|
23356
23475
|
return INTERRUPTED2;
|
|
23357
23476
|
}
|
|
23477
|
+
function cannotStart(label, modules, run) {
|
|
23478
|
+
const tsc = join41(modules, ...TSC_BIN);
|
|
23479
|
+
const blocker = cannotStartBlockerText(label, tsc, run.run, run.said, scriptInterpreter(tsc));
|
|
23480
|
+
activeOutput().warn(`\u26A0\uFE0F ${blocker}`);
|
|
23481
|
+
return { ran: false, red: false, interrupted: false, cannotStart: true, blocker };
|
|
23482
|
+
}
|
|
23358
23483
|
function filesToCheck(input, label) {
|
|
23359
23484
|
if (!existsSync32(join41(input.checkout, "tsconfig.json"))) {
|
|
23360
23485
|
activeOutput().info(`\uD83D\uDD0E ${label}: no tsconfig.json at the checkout root; nothing to type-check.`);
|
|
@@ -23381,10 +23506,12 @@ async function runTypeStep(input) {
|
|
|
23381
23506
|
}
|
|
23382
23507
|
if (head.kind === "interrupted")
|
|
23383
23508
|
return interrupted(label);
|
|
23509
|
+
if (head.kind === "cannot-start")
|
|
23510
|
+
return cannotStart(label, modules, head);
|
|
23384
23511
|
if (head.kind === "broken") {
|
|
23385
23512
|
const blocker = brokenBlockerText(label, head.run, head.said);
|
|
23386
23513
|
activeOutput().info(`\uD83D\uDD0E ${label}: ${blocker}`);
|
|
23387
|
-
return { ran: true, red: true, interrupted: false, blocker };
|
|
23514
|
+
return { ran: true, red: true, interrupted: false, cannotStart: false, blocker };
|
|
23388
23515
|
}
|
|
23389
23516
|
const ran = `\uD83D\uDD0E ${label}: tsc over ${files.length} test file(s)`;
|
|
23390
23517
|
if (head.errors.length === 0) {
|
|
@@ -23400,7 +23527,7 @@ async function runTypeStep(input) {
|
|
|
23400
23527
|
activeOutput().info(` ${line}`);
|
|
23401
23528
|
if (added.length === 0)
|
|
23402
23529
|
return GREEN;
|
|
23403
|
-
return { ran: true, red: true, interrupted: false, blocker: typeBlockerText(label, input.base, added) };
|
|
23530
|
+
return { ran: true, red: true, interrupted: false, cannotStart: false, blocker: typeBlockerText(label, input.base, added) };
|
|
23404
23531
|
}
|
|
23405
23532
|
|
|
23406
23533
|
// packages/rafa-run/src/start/task-gate-lines.ts
|
|
@@ -24906,12 +25033,19 @@ function createStartStaleDocs(options) {
|
|
|
24906
25033
|
const redact = (text) => local(redactSecrets(text, secrets));
|
|
24907
25034
|
const kept = new Map;
|
|
24908
25035
|
let version = null;
|
|
25036
|
+
let newestRelease = null;
|
|
24909
25037
|
let tracker = null;
|
|
24910
25038
|
let docUpdatePlan;
|
|
24911
25039
|
const versionOnce = () => {
|
|
24912
25040
|
version ??= (options.readVersion ?? (() => readStaleDocsVersion(options)))();
|
|
24913
25041
|
return version;
|
|
24914
25042
|
};
|
|
25043
|
+
const newestReleaseOnce = () => {
|
|
25044
|
+
newestRelease ??= {
|
|
25045
|
+
value: (options.readNewestRelease ?? (() => newestRootRelease(createGitRunner(options.checkout))))()
|
|
25046
|
+
};
|
|
25047
|
+
return newestRelease.value;
|
|
25048
|
+
};
|
|
24915
25049
|
const resolveOnce = () => {
|
|
24916
25050
|
tracker ??= (options.resolve ?? resolveTracker)({
|
|
24917
25051
|
config: options.config,
|
|
@@ -24939,7 +25073,12 @@ function createStartStaleDocs(options) {
|
|
|
24939
25073
|
}
|
|
24940
25074
|
};
|
|
24941
25075
|
const addLine = async (entry) => {
|
|
24942
|
-
const result = await addStaleDocLine({
|
|
25076
|
+
const result = await addStaleDocLine({
|
|
25077
|
+
tracker: await resolveOnce(),
|
|
25078
|
+
version: versionOnce(),
|
|
25079
|
+
entry,
|
|
25080
|
+
newestRelease: newestReleaseOnce()
|
|
25081
|
+
});
|
|
24943
25082
|
const text = staleDocLineText(entry);
|
|
24944
25083
|
if (result.action === "kept")
|
|
24945
25084
|
kept.set(text, result.title);
|
|
@@ -25096,17 +25235,17 @@ function announceRunStepOnly(items) {
|
|
|
25096
25235
|
// packages/rafa-run/src/start/suite-step.ts
|
|
25097
25236
|
import { readFileSync as readFileSync38 } from "fs";
|
|
25098
25237
|
import { constants as constants3 } from "os";
|
|
25099
|
-
import { basename as
|
|
25238
|
+
import { basename as basename14, join as join48 } from "path";
|
|
25100
25239
|
|
|
25101
25240
|
// packages/rafa-run/src/suite/baseline.ts
|
|
25102
25241
|
import { existsSync as existsSync35, mkdirSync as mkdirSync6, readFileSync as readFileSync33, renameSync as renameSync2, writeFileSync as writeFileSync11 } from "fs";
|
|
25103
|
-
import { basename as
|
|
25242
|
+
import { basename as basename12, dirname as dirname16, join as join43 } from "path";
|
|
25104
25243
|
var BASELINE_VERSION = 1;
|
|
25105
25244
|
var BASELINE_FILE_PREFIX = "SUITE_BASELINE";
|
|
25106
25245
|
var PLAN_FILE_NAME2 = /^PLAN(?:_TRACKER)?(-.+)?\.md$/;
|
|
25107
25246
|
var JUNIT_READINGS = ["read", "missing", "unreadable"];
|
|
25108
25247
|
function baselinePathFor(trackerPath) {
|
|
25109
|
-
const match = PLAN_FILE_NAME2.exec(
|
|
25248
|
+
const match = PLAN_FILE_NAME2.exec(basename12(trackerPath));
|
|
25110
25249
|
if (match === null) {
|
|
25111
25250
|
throw new RangeError(`baselinePathFor: ${trackerPath} is not a PLAN or PLAN_TRACKER file`);
|
|
25112
25251
|
}
|
|
@@ -25595,12 +25734,12 @@ function announceStepOnly(context, settling) {
|
|
|
25595
25734
|
|
|
25596
25735
|
// packages/rafa-run/src/start/suite-stage-ledger.ts
|
|
25597
25736
|
import { existsSync as existsSync38, mkdirSync as mkdirSync7, readFileSync as readFileSync35, renameSync as renameSync3, writeFileSync as writeFileSync12 } from "fs";
|
|
25598
|
-
import { basename as
|
|
25737
|
+
import { basename as basename13, dirname as dirname17, join as join47 } from "path";
|
|
25599
25738
|
var STAGE_LEDGER_PREFIX = "SUITE_STAGES";
|
|
25600
25739
|
var STAGE_LEDGER_VERSION = 1;
|
|
25601
25740
|
function stageLedgerPathFor(trackerPath) {
|
|
25602
25741
|
const baselinePath = baselinePathFor(trackerPath);
|
|
25603
|
-
const name =
|
|
25742
|
+
const name = basename13(baselinePath).replace(BASELINE_FILE_PREFIX, STAGE_LEDGER_PREFIX);
|
|
25604
25743
|
return join47(dirname17(baselinePath), name);
|
|
25605
25744
|
}
|
|
25606
25745
|
function isLedgerEntry(value) {
|
|
@@ -25635,7 +25774,7 @@ function readStageLedger(path3) {
|
|
|
25635
25774
|
}
|
|
25636
25775
|
if (typeof parsed !== "string")
|
|
25637
25776
|
return parsed;
|
|
25638
|
-
activeOutput().warn(`\u26A0\uFE0F ${
|
|
25777
|
+
activeOutput().warn(`\u26A0\uFE0F ${basename13(path3)} does not read (${parsed}); every finished stage's step is taken again.`);
|
|
25639
25778
|
return [];
|
|
25640
25779
|
}
|
|
25641
25780
|
function writeStageLedger(path3, entries) {
|
|
@@ -25654,7 +25793,7 @@ function addToLedger(trackerPath, added) {
|
|
|
25654
25793
|
try {
|
|
25655
25794
|
writeStageLedger(path3, [...entries, ...fresh]);
|
|
25656
25795
|
} catch (error) {
|
|
25657
|
-
activeOutput().warn(`\u26A0\uFE0F Could not write ${
|
|
25796
|
+
activeOutput().warn(`\u26A0\uFE0F Could not write ${basename13(path3)} (${messageOf(error)}); the next run takes these stage steps again.`);
|
|
25658
25797
|
}
|
|
25659
25798
|
}
|
|
25660
25799
|
function sameStage(a, b) {
|
|
@@ -26001,6 +26140,9 @@ function typeCheckTask(context, seams, input) {
|
|
|
26001
26140
|
const isInterrupted = context.isInterrupted ?? (() => false);
|
|
26002
26141
|
return runTypeStep({ checkout: context.checkout, base: input.base, task: input.task, git: seams.git, runTypes: seams.runTypes, stopCode: SIGINT_EXIT_CODE, isInterrupted });
|
|
26003
26142
|
}
|
|
26143
|
+
function isCheckUnstartable(settling) {
|
|
26144
|
+
return settling.types?.cannotStart === true;
|
|
26145
|
+
}
|
|
26004
26146
|
async function taskDiffChecks(context, seams, input, result) {
|
|
26005
26147
|
if (isStepInterrupted(context, result))
|
|
26006
26148
|
return {};
|
|
@@ -26246,7 +26388,7 @@ function settleStep(context, seams, settling) {
|
|
|
26246
26388
|
const tested = isRed(verdict) ? [blockerText(label, result, verdict, alone)] : [];
|
|
26247
26389
|
const blocker = [...tested, ...checked].join(" ");
|
|
26248
26390
|
activeOutput().error(`\u274C ${blocker}`);
|
|
26249
|
-
const written = settling.repair === null ? null : writeRepairTask(context.trackerPath, blocker, { ...settling.repair, commit: readHead(seams.git) });
|
|
26391
|
+
const written = settling.repair === null || isCheckUnstartable(settling) ? null : writeRepairTask(context.trackerPath, blocker, { ...settling.repair, commit: readHead(seams.git) });
|
|
26250
26392
|
if (written !== null)
|
|
26251
26393
|
activeOutput().error(written.inserted ? ` A repair task (line ${written.line + 1}) is inserted, blocked on it.` : ` The repair task (line ${written.line + 1}) is marked blocked on it again.`);
|
|
26252
26394
|
return { kind, step: step2, red: true, interrupted: false, blocker, blockedLine: written?.line ?? null, repairInserted: written?.inserted ?? false };
|
|
@@ -26290,13 +26432,13 @@ async function ensureBaseline(context) {
|
|
|
26290
26432
|
const reading = readBaseline(path3);
|
|
26291
26433
|
if (reading.state === "read" && !failedOutsideAnyCase(reading.baseline)) {
|
|
26292
26434
|
const known = reading.baseline.failures.length;
|
|
26293
|
-
activeOutput().info(`\uD83D\uDCCF Suite baseline reused from ${
|
|
26435
|
+
activeOutput().info(`\uD83D\uDCCF Suite baseline reused from ${basename14(path3)} (${reading.baseline.recordedAt}): ${known} known failure(s).`);
|
|
26294
26436
|
return { baseline: reading.baseline, step: null, interrupted: false, halted: false };
|
|
26295
26437
|
}
|
|
26296
26438
|
if (reading.state === "unreadable")
|
|
26297
|
-
activeOutput().warn(`\u26A0\uFE0F ${
|
|
26439
|
+
activeOutput().warn(`\u26A0\uFE0F ${basename14(path3)} does not read (${reading.reason}); recording the baseline again.`);
|
|
26298
26440
|
if (reading.state === "read")
|
|
26299
|
-
activeOutput().warn(storedOutsideCaseLine(
|
|
26441
|
+
activeOutput().warn(storedOutsideCaseLine(basename14(path3), reading.baseline));
|
|
26300
26442
|
const commit = readHead(seams.git);
|
|
26301
26443
|
const result = await runOne(context, seams, "baseline", {});
|
|
26302
26444
|
const baseline = baselineOf(result, seams.now(), commit);
|
|
@@ -26312,7 +26454,7 @@ async function ensureBaseline(context) {
|
|
|
26312
26454
|
try {
|
|
26313
26455
|
writeBaseline(path3, baseline);
|
|
26314
26456
|
} catch (error) {
|
|
26315
|
-
activeOutput().warn(`\u26A0\uFE0F Could not write ${
|
|
26457
|
+
activeOutput().warn(`\u26A0\uFE0F Could not write ${basename14(path3)} (${messageOf(error)}); the next run records the baseline again.`);
|
|
26316
26458
|
}
|
|
26317
26459
|
const outcome = settleStep(context, seams, settling);
|
|
26318
26460
|
const covered = completeStages(readFileSync38(context.trackerPath, "utf8"));
|
|
@@ -27232,7 +27374,7 @@ function issueDraft2(stub, lines) {
|
|
|
27232
27374
|
function canHoldIssue2(tracker) {
|
|
27233
27375
|
return tracker !== null && tracker.openIssues !== undefined && tracker.edit !== undefined;
|
|
27234
27376
|
}
|
|
27235
|
-
function
|
|
27377
|
+
function findIssue(open, stub) {
|
|
27236
27378
|
const marker = followUpsMarker(stub);
|
|
27237
27379
|
const title = followUpsTitle(stub);
|
|
27238
27380
|
return open.find((issue4) => issue4.body.includes(marker) && issue4.title === title);
|
|
@@ -27249,7 +27391,7 @@ async function fileOn(tracker, stub, lines) {
|
|
|
27249
27391
|
const listed3 = await call2("listing the open bug issues", () => tracker.openIssues("bug"));
|
|
27250
27392
|
if ("problem" in listed3)
|
|
27251
27393
|
return { action: "failed", problem: listed3.problem };
|
|
27252
|
-
const found =
|
|
27394
|
+
const found = findIssue(listed3.value, stub);
|
|
27253
27395
|
if (found === undefined) {
|
|
27254
27396
|
const created = await call2("creating the follow-up issue", () => tracker.create(issueDraft2(stub, lines)));
|
|
27255
27397
|
return "problem" in created ? { action: "failed", problem: created.problem } : { action: "created", title, ref: created.value, lines };
|
|
@@ -28319,8 +28461,24 @@ function deliverySeamsIn(context) {
|
|
|
28319
28461
|
};
|
|
28320
28462
|
}
|
|
28321
28463
|
// src/service-registry.ts
|
|
28464
|
+
function newestReleaseHere() {
|
|
28465
|
+
return newestRootRelease(createGitRunner(process.cwd()));
|
|
28466
|
+
}
|
|
28467
|
+
function addStaleDocLineWithRelease(readNewestRelease = newestReleaseHere) {
|
|
28468
|
+
return (options) => {
|
|
28469
|
+
if (options.newestRelease !== undefined)
|
|
28470
|
+
return addStaleDocLine(options);
|
|
28471
|
+
let newestRelease;
|
|
28472
|
+
try {
|
|
28473
|
+
newestRelease = readNewestRelease();
|
|
28474
|
+
} catch {
|
|
28475
|
+
newestRelease = undefined;
|
|
28476
|
+
}
|
|
28477
|
+
return addStaleDocLine({ ...options, newestRelease });
|
|
28478
|
+
};
|
|
28479
|
+
}
|
|
28322
28480
|
var CORE_SERVICES = Object.freeze({
|
|
28323
|
-
addStaleDocLine,
|
|
28481
|
+
addStaleDocLine: addStaleDocLineWithRelease(),
|
|
28324
28482
|
endWithNextStep,
|
|
28325
28483
|
pullRequestsIn: ghPullRequestsIn,
|
|
28326
28484
|
readStaleDocsVersion,
|
|
@@ -28333,14 +28491,14 @@ function registerCoreServices() {
|
|
|
28333
28491
|
return activeServices();
|
|
28334
28492
|
}
|
|
28335
28493
|
// src/plan.ts
|
|
28336
|
-
import
|
|
28494
|
+
import fs5 from "fs";
|
|
28337
28495
|
import { homedir as homedir15 } from "os";
|
|
28338
|
-
import
|
|
28496
|
+
import path7 from "path";
|
|
28339
28497
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
28340
28498
|
|
|
28341
28499
|
// src/commands/plan/bundled-check.ts
|
|
28342
28500
|
import { readdirSync as readdirSync12, readFileSync as readFileSync40, realpathSync as realpathSync6, statSync as statSync10, writeFileSync as writeFileSync13 } from "fs";
|
|
28343
|
-
import { basename as
|
|
28501
|
+
import { basename as basename15, isAbsolute as isAbsolute14, join as join49, relative as relative19, resolve as resolve21, sep as sep8 } from "path";
|
|
28344
28502
|
var SOURCE_DIR2 = "src";
|
|
28345
28503
|
var CODE_SPAN6 = /`([^`]+)`/gu;
|
|
28346
28504
|
var PATH_LIKE = /^\S+$/u;
|
|
@@ -28496,7 +28654,7 @@ function notePlanBundledEdits(repoRoot, generated, output = activeOutput()) {
|
|
|
28496
28654
|
let written = [];
|
|
28497
28655
|
if (file !== null) {
|
|
28498
28656
|
try {
|
|
28499
|
-
written = writeTierPins(resolve21(repoRoot, file),
|
|
28657
|
+
written = writeTierPins(resolve21(repoRoot, file), basename15(generated.planPath), edits);
|
|
28500
28658
|
} catch (error) {
|
|
28501
28659
|
output.warn(`${file}: the tier pins could not be written: ${messageOf(error)}`);
|
|
28502
28660
|
written = null;
|
|
@@ -28708,7 +28866,7 @@ function createPlanBlockedOffer(seams = DEFAULT_BLOCKED_SEAMS) {
|
|
|
28708
28866
|
|
|
28709
28867
|
// src/commands/plan/ready-offer.ts
|
|
28710
28868
|
var runIssueReadyLazily = async (options) => {
|
|
28711
|
-
const { runIssueReady: run } = await import("./ready-
|
|
28869
|
+
const { runIssueReady: run } = await import("./ready-dph3z1nz.js");
|
|
28712
28870
|
return run(options);
|
|
28713
28871
|
};
|
|
28714
28872
|
var DEFAULT_OFFER_SEAMS = Object.freeze({});
|
|
@@ -28798,6 +28956,7 @@ async function resolveCreateSpec(options, seams = DEFAULT_ROUTE_SEAMS) {
|
|
|
28798
28956
|
const makeReadyOffer = seams.makeReadyOffer ?? createPlanReadyOffer;
|
|
28799
28957
|
const makeAlternativeOffer = seams.makeAlternativeOffer ?? createPlanBlockedOffer;
|
|
28800
28958
|
const makeRefreshOffer = seams.makeRefreshOffer ?? createPlanRefreshOffer;
|
|
28959
|
+
const rules = source.request.kind === "spec" ? null : options.readRules?.() ?? null;
|
|
28801
28960
|
return await resolve22({
|
|
28802
28961
|
request: source.request,
|
|
28803
28962
|
refresh: source.refresh,
|
|
@@ -28813,13 +28972,14 @@ async function resolveCreateSpec(options, seams = DEFAULT_ROUTE_SEAMS) {
|
|
|
28813
28972
|
offerRefresh: makeRefreshOffer(),
|
|
28814
28973
|
...options.passOver === undefined ? {} : { passOver: options.passOver },
|
|
28815
28974
|
...options.branchTemplate === undefined ? {} : { branchTemplate: options.branchTemplate },
|
|
28816
|
-
...options.projectConfig === undefined ? {} : { projectConfig: options.projectConfig }
|
|
28975
|
+
...options.projectConfig === undefined ? {} : { projectConfig: options.projectConfig },
|
|
28976
|
+
...rules === null ? {} : { rules }
|
|
28817
28977
|
});
|
|
28818
28978
|
}
|
|
28819
28979
|
|
|
28820
28980
|
// src/commands/plan/store-check.ts
|
|
28821
28981
|
import { mkdirSync as mkdirSync8, readFileSync as readFileSync41, renameSync as renameSync4 } from "fs";
|
|
28822
|
-
import { basename as
|
|
28982
|
+
import { basename as basename16, dirname as dirname18, resolve as resolve22 } from "path";
|
|
28823
28983
|
function readFileOrNull(path6) {
|
|
28824
28984
|
return path6 !== null && isFile(path6) ? readFileSync41(path6, "utf8") : null;
|
|
28825
28985
|
}
|
|
@@ -28828,7 +28988,7 @@ function checkStoreRules(file, markdown) {
|
|
|
28828
28988
|
return findStoreRuleProblems({
|
|
28829
28989
|
plan: markdown,
|
|
28830
28990
|
prerequisites: readFileOrNull(prerequisitesPath),
|
|
28831
|
-
prerequisitesName:
|
|
28991
|
+
prerequisitesName: basename16(prerequisitesPath ?? "PREREQUISITES-<stub>.md")
|
|
28832
28992
|
});
|
|
28833
28993
|
}
|
|
28834
28994
|
function moveRejected(repoRoot, path6, output) {
|
|
@@ -28863,6 +29023,66 @@ function enforceStoreRules(repoRoot, generated, output = activeOutput()) {
|
|
|
28863
29023
|
`));
|
|
28864
29024
|
}
|
|
28865
29025
|
|
|
29026
|
+
// src/commands/plan/stretch-rules.ts
|
|
29027
|
+
import fs4 from "fs";
|
|
29028
|
+
import path6 from "path";
|
|
29029
|
+
var STRETCH_RULES_ENV = "RAFA_STRETCH_RULES";
|
|
29030
|
+
var STRETCH_RULES_REFUSAL_EXIT = 1;
|
|
29031
|
+
function missingRulesMessage(value) {
|
|
29032
|
+
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}`;
|
|
29033
|
+
}
|
|
29034
|
+
function notRulesFileMessage(value, what) {
|
|
29035
|
+
return `${STRETCH_RULES_ENV}=${value} names ${what}, not a file; point it at the stretch's rules.md`;
|
|
29036
|
+
}
|
|
29037
|
+
function unreadableRulesMessage(value, reason) {
|
|
29038
|
+
return `${STRETCH_RULES_ENV}=${value} could not be read: ${reason}`;
|
|
29039
|
+
}
|
|
29040
|
+
function describeEntry(stat) {
|
|
29041
|
+
return stat.isDirectory() ? "a directory" : "something other than a file";
|
|
29042
|
+
}
|
|
29043
|
+
function displayPath2(repoRoot, absolute) {
|
|
29044
|
+
const relative20 = path6.relative(repoRoot, absolute);
|
|
29045
|
+
return relative20 === "" || relative20.startsWith("..") || path6.isAbsolute(relative20) ? absolute : relative20;
|
|
29046
|
+
}
|
|
29047
|
+
function readStretchRules(env, repoRoot) {
|
|
29048
|
+
const value = env[STRETCH_RULES_ENV];
|
|
29049
|
+
if (value === undefined || value.trim() === "")
|
|
29050
|
+
return null;
|
|
29051
|
+
const absolute = path6.resolve(repoRoot, value);
|
|
29052
|
+
let stat;
|
|
29053
|
+
try {
|
|
29054
|
+
stat = fs4.statSync(absolute);
|
|
29055
|
+
} catch (error) {
|
|
29056
|
+
if (errorCode(error) === "ENOENT") {
|
|
29057
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, missingRulesMessage(value));
|
|
29058
|
+
}
|
|
29059
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, unreadableRulesMessage(value, messageOf(error)));
|
|
29060
|
+
}
|
|
29061
|
+
if (!stat.isFile()) {
|
|
29062
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, notRulesFileMessage(value, describeEntry(stat)));
|
|
29063
|
+
}
|
|
29064
|
+
try {
|
|
29065
|
+
return Object.freeze({ path: displayPath2(repoRoot, absolute), text: fs4.readFileSync(absolute, "utf8") });
|
|
29066
|
+
} catch (error) {
|
|
29067
|
+
throw new CommandExit(STRETCH_RULES_REFUSAL_EXIT, unreadableRulesMessage(value, messageOf(error)));
|
|
29068
|
+
}
|
|
29069
|
+
}
|
|
29070
|
+
function stretchRulesReader(env, repoRoot) {
|
|
29071
|
+
let reading = null;
|
|
29072
|
+
return () => {
|
|
29073
|
+
if (reading === null) {
|
|
29074
|
+
try {
|
|
29075
|
+
reading = { ok: true, rules: readStretchRules(env, repoRoot) };
|
|
29076
|
+
} catch (error) {
|
|
29077
|
+
reading = { ok: false, error };
|
|
29078
|
+
}
|
|
29079
|
+
}
|
|
29080
|
+
if (reading.ok)
|
|
29081
|
+
return reading.rules;
|
|
29082
|
+
throw reading.error;
|
|
29083
|
+
};
|
|
29084
|
+
}
|
|
29085
|
+
|
|
28866
29086
|
// src/notices/run.ts
|
|
28867
29087
|
import { homedir as homedir14 } from "os";
|
|
28868
29088
|
|
|
@@ -28899,9 +29119,9 @@ function readDismissed(home) {
|
|
|
28899
29119
|
}
|
|
28900
29120
|
function writeDismissed(home, ids) {
|
|
28901
29121
|
const all = NOTICE_IDS.filter((id2) => ids.includes(id2) || readDismissed(home).includes(id2));
|
|
28902
|
-
const
|
|
28903
|
-
mkdirSync9(dirname19(
|
|
28904
|
-
writeFileSync14(
|
|
29122
|
+
const path7 = noticesPath(home);
|
|
29123
|
+
mkdirSync9(dirname19(path7), { recursive: true });
|
|
29124
|
+
writeFileSync14(path7, `${JSON.stringify({ dismissed: all }, null, 2)}
|
|
28905
29125
|
`);
|
|
28906
29126
|
}
|
|
28907
29127
|
function pendingNotices(dismissed) {
|
|
@@ -28991,7 +29211,7 @@ async function requireNoticesAnswered(settingSources) {
|
|
|
28991
29211
|
}
|
|
28992
29212
|
|
|
28993
29213
|
// src/plan.ts
|
|
28994
|
-
var __dirname2 =
|
|
29214
|
+
var __dirname2 = path7.dirname(fileURLToPath5(import.meta.url));
|
|
28995
29215
|
function argValue2(args, flag) {
|
|
28996
29216
|
const hit = args.find((a) => a.startsWith(`${flag}=`));
|
|
28997
29217
|
return hit?.slice(flag.length + 1);
|
|
@@ -29017,16 +29237,16 @@ ${trimmed.slice(-PROGRESS_CAP_CHARS)}` : trimmed;
|
|
|
29017
29237
|
].join(`
|
|
29018
29238
|
`);
|
|
29019
29239
|
}
|
|
29020
|
-
var PLAN_FORMAT_SKILL =
|
|
29240
|
+
var PLAN_FORMAT_SKILL = path7.join(BUNDLED_SKILLS_DIR, "dev-planner", "SKILL.md");
|
|
29021
29241
|
function planFormatPath(moduleDir) {
|
|
29022
|
-
return
|
|
29242
|
+
return path7.join(moduleDir, PLAN_FORMAT_SKILL);
|
|
29023
29243
|
}
|
|
29024
29244
|
function readPlanFormat(moduleDir) {
|
|
29025
29245
|
const skill = planFormatPath(moduleDir);
|
|
29026
|
-
if (!
|
|
29246
|
+
if (!fs5.existsSync(skill)) {
|
|
29027
29247
|
throw new Error(`The plan format is missing: no dev-planner SKILL.md at ${skill}`);
|
|
29028
29248
|
}
|
|
29029
|
-
return
|
|
29249
|
+
return fs5.readFileSync(skill, "utf8");
|
|
29030
29250
|
}
|
|
29031
29251
|
var FRONTMATTER2 = /^---\r?\n[\s\S]*?\r?\n---\r?\n(?:\r?\n)*/;
|
|
29032
29252
|
function planFormatBody(skill) {
|
|
@@ -29150,7 +29370,7 @@ function buildPlanPrompt(template, planFormat, specContent, stub, planDir, progr
|
|
|
29150
29370
|
return template.replace(SLOT_PATTERN3, (_slot, name) => values[name]);
|
|
29151
29371
|
}
|
|
29152
29372
|
function stubFromSpecPath(specPath) {
|
|
29153
|
-
return
|
|
29373
|
+
return path7.basename(specPath).replace(/\.md$/, "");
|
|
29154
29374
|
}
|
|
29155
29375
|
function runBranchLine(planPath) {
|
|
29156
29376
|
const stub = planStubFromPath(planPath);
|
|
@@ -29182,6 +29402,7 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
29182
29402
|
dangerousAcceptStaleRefs
|
|
29183
29403
|
} = config;
|
|
29184
29404
|
const flags = readGateFlags(args);
|
|
29405
|
+
const readRules = stretchRulesReader(process.env, repoRoot);
|
|
29185
29406
|
const resolved = await resolveAndClaim({
|
|
29186
29407
|
resolve: (passOver) => resolveCreateSpec({
|
|
29187
29408
|
args,
|
|
@@ -29192,12 +29413,13 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
29192
29413
|
relationships: boardRelationships,
|
|
29193
29414
|
passOver,
|
|
29194
29415
|
branchTemplate: namingBranch,
|
|
29195
|
-
projectConfig: config
|
|
29416
|
+
projectConfig: config,
|
|
29417
|
+
readRules
|
|
29196
29418
|
}),
|
|
29197
29419
|
prepare: async (spec) => {
|
|
29198
|
-
const stub2 = argValue2(args, "--stub") ?? stubFromSpecPath(
|
|
29420
|
+
const stub2 = argValue2(args, "--stub") ?? stubFromSpecPath(path7.resolve(repoRoot, spec.path));
|
|
29199
29421
|
const planFile2 = planFilePath(planDir, `PLAN-${stub2}.md`);
|
|
29200
|
-
if (
|
|
29422
|
+
if (fs5.existsSync(path7.resolve(repoRoot, planFile2))) {
|
|
29201
29423
|
throw new CommandExit(1, `\u274C ${planFile2} already exists \u2014 remove it or pass a different --stub.`);
|
|
29202
29424
|
}
|
|
29203
29425
|
await checkCreateRefs({ spec, repoRoot, args, acceptStaleRefs: dangerousAcceptStaleRefs, roster });
|
|
@@ -29211,15 +29433,15 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
29211
29433
|
return;
|
|
29212
29434
|
const { stub } = resolved;
|
|
29213
29435
|
const specRequest = resolved.spec.path;
|
|
29214
|
-
const specPath =
|
|
29436
|
+
const specPath = path7.resolve(repoRoot, specRequest);
|
|
29215
29437
|
const planFile = planFilePath(planDir, `PLAN-${stub}.md`);
|
|
29216
|
-
const progressPath =
|
|
29217
|
-
const progressContent = !args.includes("--no-progress") &&
|
|
29438
|
+
const progressPath = path7.join(repoRoot, "progress.txt");
|
|
29439
|
+
const progressContent = !args.includes("--no-progress") && fs5.existsSync(progressPath) ? fs5.readFileSync(progressPath, "utf8") : undefined;
|
|
29218
29440
|
if (progressContent?.trim()) {
|
|
29219
29441
|
activeOutput().info("\uD83D\uDCCE Including findings from progress.txt (disable with --no-progress).");
|
|
29220
29442
|
}
|
|
29221
29443
|
const epic = await readPlanEpicContext(resolved.spec, createGhRunner({ cwd: repoRoot }));
|
|
29222
|
-
const template =
|
|
29444
|
+
const template = fs5.readFileSync(path7.join(__dirname2, "plan-prompt.md"), "utf8");
|
|
29223
29445
|
const planFormat = readPlanFormat(__dirname2);
|
|
29224
29446
|
const skillIndex = readPlanSkillIndex(repoRoot, home, config, fileURLToPath5(import.meta.url));
|
|
29225
29447
|
const planner = registry.resolve("planner", "claude").create({
|
|
@@ -29237,7 +29459,7 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
29237
29459
|
comment: flags.comment
|
|
29238
29460
|
};
|
|
29239
29461
|
await requireNoticesAnswered(settingSources);
|
|
29240
|
-
activeOutput().info(`\uD83D\uDCDD Generating ${planFile} from ${
|
|
29462
|
+
activeOutput().info(`\uD83D\uDCDD Generating ${planFile} from ${path7.basename(specPath)}...`);
|
|
29241
29463
|
const answered = await generateOrExit(planner, { specPath: specRequest, stub }, gate, flags.skipReview);
|
|
29242
29464
|
enforceStoreRules(repoRoot, answered);
|
|
29243
29465
|
const generated = notePlanBundledEdits(repoRoot, answered);
|
|
@@ -29257,9 +29479,9 @@ async function plan(args, repoRoot, roster, registry = CORE_ADAPTER_REGISTRY) {
|
|
|
29257
29479
|
}
|
|
29258
29480
|
}
|
|
29259
29481
|
// src/start.ts
|
|
29260
|
-
import
|
|
29482
|
+
import fs6 from "fs";
|
|
29261
29483
|
import { homedir as homedir16 } from "os";
|
|
29262
|
-
import
|
|
29484
|
+
import path8 from "path";
|
|
29263
29485
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
29264
29486
|
|
|
29265
29487
|
// src/utils/schedule.ts
|
|
@@ -29292,7 +29514,7 @@ async function deferUntil(startAt, now = new Date, sleep = sleepFor) {
|
|
|
29292
29514
|
}
|
|
29293
29515
|
|
|
29294
29516
|
// src/start.ts
|
|
29295
|
-
var __dirname3 =
|
|
29517
|
+
var __dirname3 = path8.dirname(fileURLToPath6(import.meta.url));
|
|
29296
29518
|
var interrupted2 = false;
|
|
29297
29519
|
async function start(args, repoRoot) {
|
|
29298
29520
|
refuseDetachedRun(args);
|
|
@@ -29319,10 +29541,10 @@ async function start(args, repoRoot) {
|
|
|
29319
29541
|
if (startAt)
|
|
29320
29542
|
await deferUntil(startAt);
|
|
29321
29543
|
const planPath = resolvePlanPath(repoRoot, runConfig.config.planDir, plan2);
|
|
29322
|
-
const rootPromptPath =
|
|
29323
|
-
const promptPath =
|
|
29544
|
+
const rootPromptPath = path8.join(repoRoot, "PROMPT.md");
|
|
29545
|
+
const promptPath = fs6.existsSync(rootPromptPath) ? rootPromptPath : path8.join(__dirname3, "PROMPT.md");
|
|
29324
29546
|
const trackerPath = trackerPathFor(planPath);
|
|
29325
|
-
if (!
|
|
29547
|
+
if (!fs6.existsSync(planPath)) {
|
|
29326
29548
|
throw new CommandExit(1, `\u274C Plan file not found: ${planPath}`);
|
|
29327
29549
|
}
|
|
29328
29550
|
const planStub = planStubFromPath(planPath);
|
|
@@ -29353,8 +29575,8 @@ async function start(args, repoRoot) {
|
|
|
29353
29575
|
return;
|
|
29354
29576
|
};
|
|
29355
29577
|
try {
|
|
29356
|
-
const planContent =
|
|
29357
|
-
const promptContent =
|
|
29578
|
+
const planContent = fs6.readFileSync(planPath, "utf8");
|
|
29579
|
+
const promptContent = fs6.readFileSync(promptPath, "utf8");
|
|
29358
29580
|
const injectSource = injectSourceLabel(runConfig);
|
|
29359
29581
|
announceRunDirs({ projectRoot: repoRoot, checkout });
|
|
29360
29582
|
activeOutput().info(`\uD83E\uDDED Task sessions are handed the plan as \`${injectMode}\` (${injectSource}); the wrap-up is handed all of it.`);
|
|
@@ -29430,11 +29652,11 @@ async function start(args, repoRoot) {
|
|
|
29430
29652
|
previousNeeded: continueRun.directive === null ? null : readPreviousDecisionNeeded(repoRoot, runPlace)
|
|
29431
29653
|
});
|
|
29432
29654
|
decisionsAtEnd = decisions.atRunEnd;
|
|
29433
|
-
if (!
|
|
29434
|
-
activeOutput().info(`\uD83D\uDCCB Creating new plan tracker at ${
|
|
29435
|
-
|
|
29655
|
+
if (!fs6.existsSync(trackerPath)) {
|
|
29656
|
+
activeOutput().info(`\uD83D\uDCCB Creating new plan tracker at ${path8.basename(trackerPath)}...`);
|
|
29657
|
+
fs6.copyFileSync(planPath, trackerPath);
|
|
29436
29658
|
} else {
|
|
29437
|
-
activeOutput().info(`\uD83D\uDCCB Resuming from existing ${
|
|
29659
|
+
activeOutput().info(`\uD83D\uDCCB Resuming from existing ${path8.basename(trackerPath)}...`);
|
|
29438
29660
|
}
|
|
29439
29661
|
process.on("SIGINT", () => {
|
|
29440
29662
|
interrupted2 = true;
|
|
@@ -29446,7 +29668,7 @@ async function start(args, repoRoot) {
|
|
|
29446
29668
|
await holdWhilePaused({ repoRoot, sessionId: session.id, isInterrupted: () => interrupted2 });
|
|
29447
29669
|
if (interrupted2)
|
|
29448
29670
|
break;
|
|
29449
|
-
const trackerContent =
|
|
29671
|
+
const trackerContent = fs6.readFileSync(trackerPath, "utf8");
|
|
29450
29672
|
const taskInfo = findNextTask(trackerContent, { skipLines: decisions.skipLines(trackerContent) });
|
|
29451
29673
|
const passedOver = taskInfo ? [] : decisions.atPlanEnd(trackerContent);
|
|
29452
29674
|
if (await decisions.atFirstTask(taskInfo, trackerContent))
|