@tablation/crew 0.155.0 → 0.156.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 +264 -38
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -569,13 +569,13 @@ function ensureMainIndex(d, s) {
|
|
|
569
569
|
const p = serenaPaths(s.stateDir, s.route, String(s.ticket));
|
|
570
570
|
const head = d.headOf(s.mainCheckout);
|
|
571
571
|
if (!head) return "unavailable";
|
|
572
|
-
const
|
|
573
|
-
if (d.read(
|
|
572
|
+
const stamp2 = join5(p.mainProject, "indexed-commit");
|
|
573
|
+
if (d.read(stamp2)?.trim() === head) return "fresh";
|
|
574
574
|
const pidFile = join5(p.mainProject, "indexing.pid");
|
|
575
575
|
const running = Number(d.read(pidFile));
|
|
576
576
|
if (running > 0 && d.alive(running)) return "running";
|
|
577
577
|
prepareFolder(d, p.mainHome, p.mainProject, s.mainCheckout);
|
|
578
|
-
const pid = d.spawnIndex(serenaIndexArgs(s.mainCheckout), { SERENA_HOME: p.mainHome }, join5(p.mainProject, "index.log"),
|
|
578
|
+
const pid = d.spawnIndex(serenaIndexArgs(s.mainCheckout), { SERENA_HOME: p.mainHome }, join5(p.mainProject, "index.log"), stamp2, head);
|
|
579
579
|
d.write(pidFile, String(pid));
|
|
580
580
|
return "started";
|
|
581
581
|
}
|
|
@@ -638,7 +638,7 @@ function realSerenaDeps(onPath2, extraEnv = process.env) {
|
|
|
638
638
|
},
|
|
639
639
|
spawnDetached: detached,
|
|
640
640
|
// `&&` so the stamp exists only for an index that finished; a killed one is retried next start.
|
|
641
|
-
spawnIndex: (args, env, log,
|
|
641
|
+
spawnIndex: (args, env, log, stamp2, stampText) => detached("sh", ["-c", 'serena "$@" && printf %s "$STAMP_TEXT" > "$STAMP_FILE"', "serena", ...args], { ...env, STAMP_FILE: stamp2, STAMP_TEXT: stampText }, log),
|
|
642
642
|
link: (target, path) => symlinkSync(target, path),
|
|
643
643
|
alive: (pid) => {
|
|
644
644
|
try {
|
|
@@ -1222,9 +1222,9 @@ function rotateEventsFile(file, maxBytes, now = /* @__PURE__ */ new Date()) {
|
|
|
1222
1222
|
}
|
|
1223
1223
|
try {
|
|
1224
1224
|
if (statSync2(file).size <= maxBytes) return void 0;
|
|
1225
|
-
const
|
|
1226
|
-
let dest = join8(dirname4(file), `events.${
|
|
1227
|
-
for (let n = 1; existsSync9(dest); n++) dest = join8(dirname4(file), `events.${
|
|
1225
|
+
const stamp2 = now.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
|
|
1226
|
+
let dest = join8(dirname4(file), `events.${stamp2}.jsonl`);
|
|
1227
|
+
for (let n = 1; existsSync9(dest); n++) dest = join8(dirname4(file), `events.${stamp2}-${n}.jsonl`);
|
|
1228
1228
|
renameSync(file, dest);
|
|
1229
1229
|
return dest;
|
|
1230
1230
|
} finally {
|
|
@@ -10402,6 +10402,168 @@ function materializeBranchForTicket(dir, cfg, t, role, onProblem, onReset) {
|
|
|
10402
10402
|
return loc.branch;
|
|
10403
10403
|
}
|
|
10404
10404
|
|
|
10405
|
+
// src/footprint.ts
|
|
10406
|
+
var FOOTPRINT_DECLARED_EVENT = "footprint_declared";
|
|
10407
|
+
var LOCKFILES = /* @__PURE__ */ new Set([
|
|
10408
|
+
"package-lock.json",
|
|
10409
|
+
"npm-shrinkwrap.json",
|
|
10410
|
+
"pnpm-lock.yaml",
|
|
10411
|
+
"yarn.lock",
|
|
10412
|
+
"bun.lock",
|
|
10413
|
+
"bun.lockb",
|
|
10414
|
+
"Cargo.lock",
|
|
10415
|
+
"Gemfile.lock",
|
|
10416
|
+
"poetry.lock",
|
|
10417
|
+
"Pipfile.lock",
|
|
10418
|
+
"composer.lock",
|
|
10419
|
+
"go.sum",
|
|
10420
|
+
"uv.lock",
|
|
10421
|
+
"pdm.lock",
|
|
10422
|
+
"Podfile.lock",
|
|
10423
|
+
"Package.resolved"
|
|
10424
|
+
]);
|
|
10425
|
+
var normalizePath = (p) => p.trim().replace(/\\/g, "/").replace(/^\.\//, "");
|
|
10426
|
+
function isIgnoredPath(path, extra = /* @__PURE__ */ new Set()) {
|
|
10427
|
+
const p = normalizePath(path);
|
|
10428
|
+
return extra.has(p) || LOCKFILES.has(p.slice(p.lastIndexOf("/") + 1));
|
|
10429
|
+
}
|
|
10430
|
+
function countedPaths(raw, extra) {
|
|
10431
|
+
const list = Array.isArray(raw) ? raw : typeof raw === "string" ? raw.split(/[\n,]/) : [];
|
|
10432
|
+
return [...new Set(list.map((p) => normalizePath(String(p))).filter((p) => p && !isIgnoredPath(p, extra)))];
|
|
10433
|
+
}
|
|
10434
|
+
var stamp = (e) => e.occurred_at ?? e.created_at ?? "";
|
|
10435
|
+
function declarations(events) {
|
|
10436
|
+
const out = /* @__PURE__ */ new Map();
|
|
10437
|
+
for (const e of events) {
|
|
10438
|
+
if (out.has(e.record_id)) continue;
|
|
10439
|
+
out.set(e.record_id, { paths: countedPaths(e.metadata?.paths), at: stamp(e) });
|
|
10440
|
+
}
|
|
10441
|
+
return out;
|
|
10442
|
+
}
|
|
10443
|
+
function pushes(events) {
|
|
10444
|
+
const out = /* @__PURE__ */ new Map();
|
|
10445
|
+
for (const e of events) {
|
|
10446
|
+
if (out.has(e.record_id)) continue;
|
|
10447
|
+
const raw = e.metadata?.paths;
|
|
10448
|
+
out.set(e.record_id, { at: stamp(e), ...Array.isArray(raw) ? { paths: raw.map((p) => normalizePath(String(p))).filter(Boolean) } : {} });
|
|
10449
|
+
}
|
|
10450
|
+
return out;
|
|
10451
|
+
}
|
|
10452
|
+
function isActive(t) {
|
|
10453
|
+
const s = String(t.status);
|
|
10454
|
+
return s === "in_progress" || s === "fixed" || s === "qa" || s === "verified" && !t.merged_at;
|
|
10455
|
+
}
|
|
10456
|
+
var isWaiting = (t) => t.status === "accepted" || t.status === "blocked";
|
|
10457
|
+
function footprintOf(t, declared, pushed, extra) {
|
|
10458
|
+
const actual = countedPaths(pushed.get(t.id)?.paths, extra);
|
|
10459
|
+
if (t.status === "in_progress") return [.../* @__PURE__ */ new Set([...countedPaths(declared.get(t.id)?.paths, extra), ...actual])];
|
|
10460
|
+
if (isWaiting(t)) return countedPaths(declared.get(t.id)?.paths, extra);
|
|
10461
|
+
return actual;
|
|
10462
|
+
}
|
|
10463
|
+
function byAge(a, b) {
|
|
10464
|
+
const n = (t) => Number(String(t.issue_id).replace(/\D/g, "")) || 0;
|
|
10465
|
+
return n(a) - n(b) || displayKey(a).localeCompare(displayKey(b));
|
|
10466
|
+
}
|
|
10467
|
+
var repoOf = (t) => t.repo_id ?? "";
|
|
10468
|
+
function planFootprints(input) {
|
|
10469
|
+
const waits = /* @__PURE__ */ new Map();
|
|
10470
|
+
const byRepo = /* @__PURE__ */ new Map();
|
|
10471
|
+
for (const t of input.tickets) byRepo.set(repoOf(t), [...byRepo.get(repoOf(t)) ?? [], t]);
|
|
10472
|
+
for (const [repoId, tickets] of byRepo) {
|
|
10473
|
+
const extra = input.ignoreByRepo?.get(repoId);
|
|
10474
|
+
const held = tickets.filter(isActive).map((t) => ({ ticket: t, files: new Set(footprintOf(t, input.declared, input.pushed, extra)) }));
|
|
10475
|
+
const candidates2 = tickets.filter((t) => isWaiting(t) && !input.dependencyBlocked?.has(t.id)).sort(byAge);
|
|
10476
|
+
for (const t of candidates2) {
|
|
10477
|
+
const mine = footprintOf(t, input.declared, input.pushed, extra);
|
|
10478
|
+
const hits = held.filter((h) => h.ticket.id !== t.id && mine.some((f) => h.files.has(f)));
|
|
10479
|
+
if (mine.length === 0 || hits.length === 0) {
|
|
10480
|
+
if (mine.length) held.push({ ticket: t, files: new Set(mine) });
|
|
10481
|
+
continue;
|
|
10482
|
+
}
|
|
10483
|
+
waits.set(t.id, {
|
|
10484
|
+
ticket: t,
|
|
10485
|
+
waitingFor: hits.map((h) => displayKey(h.ticket)),
|
|
10486
|
+
files: [...new Set(hits.flatMap((h) => mine.filter((f) => h.files.has(f))))].sort()
|
|
10487
|
+
});
|
|
10488
|
+
}
|
|
10489
|
+
}
|
|
10490
|
+
return { waits };
|
|
10491
|
+
}
|
|
10492
|
+
function mustYieldTo(self, input) {
|
|
10493
|
+
const extra = input.ignoreByRepo?.get(repoOf(self));
|
|
10494
|
+
const mine = footprintOf(self, input.declared, input.pushed, extra);
|
|
10495
|
+
if (mine.length === 0) return null;
|
|
10496
|
+
const newly = (t) => t.status === "in_progress" && input.declared.has(t.id) && !input.pushed.has(t.id);
|
|
10497
|
+
const number = (t) => Number(String(t.issue_id).replace(/\D/g, "")) || 0;
|
|
10498
|
+
const earlier = (a, b) => {
|
|
10499
|
+
const x = input.declared.get(a.id).at, y = input.declared.get(b.id).at;
|
|
10500
|
+
return x !== y ? x < y : number(a) < number(b);
|
|
10501
|
+
};
|
|
10502
|
+
const hits = input.tickets.filter((o) => o.id !== self.id && repoOf(o) === repoOf(self) && isActive(o)).filter((o) => !(newly(self) && newly(o) && earlier(self, o))).map((o) => ({ o, shared: footprintOf(o, input.declared, input.pushed, extra).filter((f) => mine.includes(f)) })).filter((h) => h.shared.length > 0);
|
|
10503
|
+
if (hits.length === 0) return null;
|
|
10504
|
+
return { waitingFor: hits.map((h) => displayKey(h.o)), files: [...new Set(hits.flatMap((h) => h.shared))].sort() };
|
|
10505
|
+
}
|
|
10506
|
+
function describeFiles(files, shown = 3) {
|
|
10507
|
+
const head = files.slice(0, shown).map((f) => `\`${f}\``).join(", ");
|
|
10508
|
+
return files.length > shown ? `${head} and ${files.length - shown} more` : head;
|
|
10509
|
+
}
|
|
10510
|
+
function footprintWaitNote(w) {
|
|
10511
|
+
return `waiting for ${w.waitingFor.join(", ")}, which changes the same ${w.files.length === 1 ? "file" : "files"}: ${describeFiles(w.files)}`;
|
|
10512
|
+
}
|
|
10513
|
+
function footprintDigestSection(recorded) {
|
|
10514
|
+
const lines2 = recorded.length ? recorded.map((r) => `- ${r.ticket}: ${r.paths.length ? describeFiles(r.paths, 8) : "none"}`).join("\n") : "- none recorded yet";
|
|
10515
|
+
return `### Footprint \u2014 declare before you build
|
|
10516
|
+
|
|
10517
|
+
The crew keeps tickets that would change the same files from being built at the same time. When you pick up a ticket that has **no branch or worktree yet**, before you cut a worktree or change anything:
|
|
10518
|
+
|
|
10519
|
+
1. Read the ticket and the code and list the repo-relative files you expect to change, including files you expect to create. A guess is fine; an empty list is allowed when you cannot tell.
|
|
10520
|
+
2. Run \`crew footprint <ticket number> <path>...\` (just \`crew footprint <ticket number>\` when a footprint is already recorded below). It records the list once, then checks it against the active work.
|
|
10521
|
+
3. If it prints \`YIELD\`, stop there: set the ticket back to \`accepted\`, clear \`assignee_id\`, comment in one line that you declared a footprint and yielded, and end the run without a worktree. The crew parks the ticket as \`blocked\` and restores it when the tickets it waits for are released. If it prints \`PROCEED\`, or the command fails or is not available, go on: a ticket with no footprint simply runs.
|
|
10522
|
+
|
|
10523
|
+
Footprints already recorded:
|
|
10524
|
+
|
|
10525
|
+
${lines2}
|
|
10526
|
+
`;
|
|
10527
|
+
}
|
|
10528
|
+
var MAX_PUSHED_PATHS = 2e3;
|
|
10529
|
+
function pushedMetadata(diffNameOnly) {
|
|
10530
|
+
if (diffNameOnly === null) return void 0;
|
|
10531
|
+
return { paths: [...new Set(diffNameOnly.split("\n").map(normalizePath).filter(Boolean))].slice(0, MAX_PUSHED_PATHS) };
|
|
10532
|
+
}
|
|
10533
|
+
function footprintVerdictText(ticket, y) {
|
|
10534
|
+
return y ? `YIELD ${ticket}: ${footprintWaitNote(y)}. Set the ticket back to accepted, clear assignee_id, comment in one line and end the run without a worktree; the crew parks it and restores it when they are released.` : `PROCEED ${ticket}: no active ticket shares its files.`;
|
|
10535
|
+
}
|
|
10536
|
+
|
|
10537
|
+
// src/footprint-run.ts
|
|
10538
|
+
async function readFootprintEvents(tracker) {
|
|
10539
|
+
return {
|
|
10540
|
+
declared: declarations(await tracker.events(FOOTPRINT_DECLARED_EVENT)),
|
|
10541
|
+
pushed: pushes(await tracker.events("pushed"))
|
|
10542
|
+
};
|
|
10543
|
+
}
|
|
10544
|
+
function ignoreByRepo(route2) {
|
|
10545
|
+
const out = /* @__PURE__ */ new Map();
|
|
10546
|
+
const names = route2.resolved?.repoNames ?? {};
|
|
10547
|
+
for (const target of reposOf(route2)) {
|
|
10548
|
+
let ignored;
|
|
10549
|
+
try {
|
|
10550
|
+
const cfg = resolveRepoConfig(loadRepoConfigTolerant(target.dir), void 0, target.dir);
|
|
10551
|
+
ignored = new Set([...cfg.release.versionFiles, ...cfg.release.changelog ? [cfg.release.changelog] : []].map(normalizePath));
|
|
10552
|
+
} catch {
|
|
10553
|
+
continue;
|
|
10554
|
+
}
|
|
10555
|
+
const ids = Object.entries(names).filter(([, n]) => n === target.name).map(([id]) => id);
|
|
10556
|
+
for (const id of ids.length ? ids : [""]) out.set(id, ignored);
|
|
10557
|
+
}
|
|
10558
|
+
return out;
|
|
10559
|
+
}
|
|
10560
|
+
function planFootprintsFor(route2, tickets, ev, dependencyBlocked) {
|
|
10561
|
+
return planFootprints({ tickets, ...ev, ignoreByRepo: ignoreByRepo(route2), dependencyBlocked });
|
|
10562
|
+
}
|
|
10563
|
+
function pushedEventExtra(dir, remote, base, sha) {
|
|
10564
|
+
return pushedMetadata(gitOk(dir, ["diff", "--no-renames", "--name-only", `${remote}/${base}...${sha}`]));
|
|
10565
|
+
}
|
|
10566
|
+
|
|
10405
10567
|
// src/pending-handoff.ts
|
|
10406
10568
|
import { existsSync as existsSync22, mkdirSync as mkdirSync17, readdirSync as readdirSync7, readFileSync as readFileSync24, rmSync as rmSync13, writeFileSync as writeFileSync18 } from "fs";
|
|
10407
10569
|
import { join as join25 } from "path";
|
|
@@ -10471,7 +10633,7 @@ async function replayPendingHandoffs(i) {
|
|
|
10471
10633
|
});
|
|
10472
10634
|
if (!seen) await i.writer.postComment(t.id, text2, seatId);
|
|
10473
10635
|
}
|
|
10474
|
-
await i.writer.postEvent(t.id, pushedEventBody(v.sha, v.remote, v.branch), seatId, "pushed");
|
|
10636
|
+
await i.writer.postEvent(t.id, pushedEventBody(v.sha, v.remote, v.branch), seatId, "pushed", co ? pushedEventExtra(co.dir, v.remote, co.cfg.branch.base, v.sha) : void 0);
|
|
10475
10637
|
await i.writer.updateTicket(t.id, rec.patch);
|
|
10476
10638
|
removePendingHandoff(i.stateDir, rec.ticketRecordId);
|
|
10477
10639
|
i.log.emit(`${displayKey(t)}: replayed a pending hand-off at ${v.sha.slice(0, 7)} \u2014 handed on to QA`, at);
|
|
@@ -10943,7 +11105,7 @@ async function deliverNote(i, ticketId, note, type, log) {
|
|
|
10943
11105
|
}
|
|
10944
11106
|
}
|
|
10945
11107
|
async function postPushed(i, ticketId, sha, remote, branch, log) {
|
|
10946
|
-
await i.writer.postEvent(ticketId, pushedEventBody(sha, remote, branch), i.seatId, "pushed");
|
|
11108
|
+
await i.writer.postEvent(ticketId, pushedEventBody(sha, remote, branch), i.seatId, "pushed", pushedEventExtra(i.dir, remote, i.cfg.branch.base, sha));
|
|
10947
11109
|
const url = i.branchLink?.url(branch);
|
|
10948
11110
|
if (!i.branchLink || !url) return;
|
|
10949
11111
|
try {
|
|
@@ -11300,7 +11462,7 @@ ${i.shipName ? `${i.shipName}'s ` : "A "}${i.role} run set it to \`${st.handoff}
|
|
|
11300
11462
|
const v = inspectHandoff(co.dir, co.cfg, t, i.role);
|
|
11301
11463
|
i.log.warn(`${displayKey(t)} was handed off by a run that did not claim it`, at);
|
|
11302
11464
|
if (v.kind === "pushed") {
|
|
11303
|
-
await i.writer.postEvent(t.id, pushedEventBody(v.sha, v.remote, v.branch), i.seatId, "pushed");
|
|
11465
|
+
await i.writer.postEvent(t.id, pushedEventBody(v.sha, v.remote, v.branch), i.seatId, "pushed", pushedEventExtra(co.dir, v.remote, co.cfg.branch.base, v.sha));
|
|
11304
11466
|
} else if (v.kind === "bounce") {
|
|
11305
11467
|
if (v.origin && v.local && !isAncestor(co.dir, v.origin, v.local)) {
|
|
11306
11468
|
i.log.warn(`${displayKey(t)}: \`${v.remote}/${v.branch}\` is at ${v.origin.slice(0, 7)}, not a tip this checkout built \u2014 left alone`, at);
|
|
@@ -18215,11 +18377,19 @@ function sweepDiagnostics(tickets, info) {
|
|
|
18215
18377
|
return { dangling, selfBlocked: [...new Set(selfBlocked)] };
|
|
18216
18378
|
}
|
|
18217
18379
|
var describeBlockers = (t, info) => (t.blocked_by ?? []).map((id) => `${info[id]?.issue_tag ?? info[id]?.issue_id ?? "?"} (${info[id]?.status ?? "unknown"})`).join(", ");
|
|
18218
|
-
function planSweep(tickets, info, blocked, wm) {
|
|
18380
|
+
function planSweep(tickets, info, blocked, wm, footprintWaits) {
|
|
18219
18381
|
const steps = [];
|
|
18220
18382
|
for (const t of withinWorkMode(tickets, wm)) {
|
|
18221
18383
|
if (t.status === "accepted" && blocked.has(t.id)) {
|
|
18222
|
-
|
|
18384
|
+
const fw = footprintWaits?.get(t.id);
|
|
18385
|
+
const byFiles = fw && unresolvedBlockers(t, info).length === 0;
|
|
18386
|
+
steps.push({
|
|
18387
|
+
action: "park",
|
|
18388
|
+
ticket: t,
|
|
18389
|
+
blockers: byFiles ? footprintWaitNote(fw) : describeBlockers(t, info),
|
|
18390
|
+
to: "blocked",
|
|
18391
|
+
...byFiles ? { footprint: { waitingFor: fw.waitingFor, files: fw.files } } : {}
|
|
18392
|
+
});
|
|
18223
18393
|
} else if (t.status === "blocked" && !blocked.has(t.id)) {
|
|
18224
18394
|
steps.push({ action: "restore", ticket: t, blockers: describeBlockers(t, info), to: "accepted" });
|
|
18225
18395
|
}
|
|
@@ -18276,9 +18446,14 @@ function unroutableChanges(unroutable, previous, tickets, externalIdColumn) {
|
|
|
18276
18446
|
};
|
|
18277
18447
|
}
|
|
18278
18448
|
function sweepComment(step) {
|
|
18449
|
+
if (step.action === "park" && step.footprint) {
|
|
18450
|
+
return `Parked as **Blocked** by the crew \u2014 ${footprintWaitNote(step.footprint)}.
|
|
18451
|
+
|
|
18452
|
+
This is automatic and reversible: a ticket that would change a file another active ticket changes waits for it instead of being built in parallel and conflicting at release. The oldest waiting ticket starts first, and this one is restored on the first poll after the tickets it waits for are released, closed or parked for a person. Nothing else about the ticket changes.`;
|
|
18453
|
+
}
|
|
18279
18454
|
return step.action === "park" ? `Parked as **Blocked** by the crew \u2014 waiting on: ${step.blockers}.
|
|
18280
18455
|
|
|
18281
|
-
This is automatic and reversible: an approved ticket whose \`Blocked by\` entries are not all resolved is parked out of the queue, and restored on the first poll after the last one resolves. Nothing else about the ticket changes. A blocker counts as resolved at \`closed_deployed\`, \`closed_wont_fix\` or \`closed_duplicate\`, or at \`verified\` when it is in a different repository or already merged (\`merged_at\` set) \u2014 not at \`fixed\`, which is still an unmerged branch awaiting QA, and not at \`verified\` for a blocker in this ticket's own repository until the release has merged it, so nothing gets built stacked on an unmerged branch.` : `Restored to **Approved** by the crew \u2014 every blocker has resolved${step.blockers && step.blockers !== "\u2014" ? ` (${step.blockers})` : ""}.
|
|
18456
|
+
This is automatic and reversible: an approved ticket whose \`Blocked by\` entries are not all resolved is parked out of the queue, and restored on the first poll after the last one resolves. Nothing else about the ticket changes. A blocker counts as resolved at \`closed_deployed\`, \`closed_wont_fix\` or \`closed_duplicate\`, or at \`verified\` when it is in a different repository or already merged (\`merged_at\` set) \u2014 not at \`fixed\`, which is still an unmerged branch awaiting QA, and not at \`verified\` for a blocker in this ticket's own repository until the release has merged it, so nothing gets built stacked on an unmerged branch.` : `Restored to **Approved** by the crew \u2014 ${step.blockers ? "every blocker has resolved" : "nothing holds it back now (the tickets it waited for no longer hold its files)"}${step.blockers && step.blockers !== "\u2014" ? ` (${step.blockers})` : ""}.
|
|
18282
18457
|
|
|
18283
18458
|
This restores the status it was approved at before being parked; it is back in the queue and a role may pick it up. If a blocker resolved as \`closed_wont_fix\` or \`closed_duplicate\` this ticket may still not be buildable as written \u2014 that is a call for a human, not the crew.`;
|
|
18284
18459
|
}
|
|
@@ -19248,6 +19423,9 @@ async function decideCycle(o) {
|
|
|
19248
19423
|
const extra = await tracker.ticketsByIds(missingBlockerIds(tickets));
|
|
19249
19424
|
const info = blockerInfoMap(tickets, extra);
|
|
19250
19425
|
const blocked = computeBlockedIds(tickets, info);
|
|
19426
|
+
const footprintEvents = await optional("footprint events", readFootprintEvents(tracker), { declared: /* @__PURE__ */ new Map(), pushed: /* @__PURE__ */ new Map() });
|
|
19427
|
+
const footprintPlan = planFootprintsFor(route2, tickets, footprintEvents, new Set(blocked));
|
|
19428
|
+
for (const id of footprintPlan.waits.keys()) blocked.add(id);
|
|
19251
19429
|
emit.enter("sweep");
|
|
19252
19430
|
const roster = buildRoster(configuredMembers(route2), crewRows);
|
|
19253
19431
|
const holds2 = new Set(holdIds(roster));
|
|
@@ -19257,7 +19435,7 @@ async function decideCycle(o) {
|
|
|
19257
19435
|
if (diag.selfBlocked.length) {
|
|
19258
19436
|
emit.warn(`ticket(s) blocking themselves, parked permanently: ${diag.selfBlocked.join(", ")}`);
|
|
19259
19437
|
}
|
|
19260
|
-
const sweep = planSweep(tickets, info, blocked, workModes);
|
|
19438
|
+
const sweep = planSweep(tickets, info, blocked, workModes, footprintPlan.waits);
|
|
19261
19439
|
const holdReleases = planHoldReleases(tickets, tracker.contract);
|
|
19262
19440
|
const stalled = planStalled(tickets, comments, ships, tracker.contract, holds2, Date.now(), workModes, stalledEvents);
|
|
19263
19441
|
const skipped = skippedByMode(tickets, workModes);
|
|
@@ -19372,6 +19550,8 @@ async function decideCycle(o) {
|
|
|
19372
19550
|
roster,
|
|
19373
19551
|
ships,
|
|
19374
19552
|
blocked,
|
|
19553
|
+
footprints: footprintPlan,
|
|
19554
|
+
footprintEvents,
|
|
19375
19555
|
info,
|
|
19376
19556
|
sweep,
|
|
19377
19557
|
epicSync,
|
|
@@ -19487,7 +19667,11 @@ function writeDigest(o, d, role, stateDir, runId, own) {
|
|
|
19487
19667
|
blocked: d.blocked,
|
|
19488
19668
|
blockerInfo: d.info
|
|
19489
19669
|
};
|
|
19490
|
-
const
|
|
19670
|
+
const fp = d.footprintEvents;
|
|
19671
|
+
const recorded = fp ? d.tickets.filter((t) => fp.declared.has(t.id) && !["fixed", "qa", "verified"].includes(String(t.status))).map((t) => ({ ticket: displayKey(t), paths: footprintOf(t, fp.declared, fp.pushed) })) : [];
|
|
19672
|
+
const body = role === "qa" ? qaDigest(input) : `${buildingDigest(input)}
|
|
19673
|
+
|
|
19674
|
+
${footprintDigestSection(recorded)}`;
|
|
19491
19675
|
const text2 = own ? `${ownRunBanner(own)}
|
|
19492
19676
|
|
|
19493
19677
|
${body}` : body;
|
|
@@ -19569,11 +19753,11 @@ async function resolveOne(tracker, t, seat, approvedStatus, buildingStatus, affi
|
|
|
19569
19753
|
return { ticket: t, claimed: false, contended, unservable, held, reaccepted: false, tookOverFrom: null };
|
|
19570
19754
|
}
|
|
19571
19755
|
if (affinity && t[affinity.column] !== affinity.shipId) {
|
|
19572
|
-
const
|
|
19573
|
-
if (
|
|
19574
|
-
return { ticket:
|
|
19756
|
+
const stamp2 = await stampResumption(tracker, t, affinity);
|
|
19757
|
+
if (stamp2.outcome === "stamped") {
|
|
19758
|
+
return { ticket: stamp2.ticket, claimed: false, contended, unservable, held, reaccepted: false, tookOverFrom: displacedHolder(t, affinity) };
|
|
19575
19759
|
}
|
|
19576
|
-
(
|
|
19760
|
+
(stamp2.outcome === "held" ? held : contended).push(t.issue_id);
|
|
19577
19761
|
return "walk";
|
|
19578
19762
|
}
|
|
19579
19763
|
return { ticket: t, claimed: false, contended, unservable, held, reaccepted: false, tookOverFrom: null };
|
|
@@ -19756,9 +19940,9 @@ function worktreeForBranch(cwd, branch) {
|
|
|
19756
19940
|
var stampOf = (e) => e.occurred_at ?? e.created_at ?? "";
|
|
19757
19941
|
var priorBounces = (ticket, events) => {
|
|
19758
19942
|
const mine = events.filter((e) => e.record_id === ticket.id);
|
|
19759
|
-
const
|
|
19943
|
+
const pushes2 = mine.filter((e) => e.event_type === "pushed").map(stampOf);
|
|
19760
19944
|
return mine.filter(
|
|
19761
|
-
(e) => e.event_type === "conflict_handed_back" &&
|
|
19945
|
+
(e) => e.event_type === "conflict_handed_back" && pushes2.some((p) => p > stampOf(e))
|
|
19762
19946
|
).length;
|
|
19763
19947
|
};
|
|
19764
19948
|
var baseShaOf = (e) => {
|
|
@@ -19768,8 +19952,8 @@ var baseShaOf = (e) => {
|
|
|
19768
19952
|
};
|
|
19769
19953
|
var lastActedHandBack = (ticket, events) => {
|
|
19770
19954
|
const mine = events.filter((e) => e.record_id === ticket.id);
|
|
19771
|
-
const
|
|
19772
|
-
return mine.filter((e) => e.event_type === "conflict_handed_back" &&
|
|
19955
|
+
const pushes2 = mine.filter((e) => e.event_type === "pushed").map(stampOf);
|
|
19956
|
+
return mine.filter((e) => e.event_type === "conflict_handed_back" && pushes2.some((p) => p > stampOf(e))).sort((a, b) => stampOf(b).localeCompare(stampOf(a)))[0];
|
|
19773
19957
|
};
|
|
19774
19958
|
var MAX_ABSORBED_HANDBACKS = 2;
|
|
19775
19959
|
function planConflictBounce(cwd, ticket, branch, base, paths, events, merged = []) {
|
|
@@ -19969,14 +20153,14 @@ ${b.tail.trimEnd()}
|
|
|
19969
20153
|
Nothing was written to \`${b.base}\` for this ticket; the rest of the release shipped without it.`;
|
|
19970
20154
|
}
|
|
19971
20155
|
function priorBuildFailures(ticket, events) {
|
|
19972
|
-
const
|
|
20156
|
+
const stamp2 = (e) => e.occurred_at ?? e.created_at ?? "";
|
|
19973
20157
|
const mine = events.filter((e) => e.record_id === ticket.id);
|
|
19974
|
-
const
|
|
19975
|
-
return mine.filter((e) => e.event_type === "build_failed" &&
|
|
20158
|
+
const pushes2 = mine.filter((e) => e.event_type === "pushed").map(stamp2);
|
|
20159
|
+
return mine.filter((e) => e.event_type === "build_failed" && pushes2.some((p) => p > stamp2(e))).length;
|
|
19976
20160
|
}
|
|
19977
20161
|
function priorFailureNote(ticket, events) {
|
|
19978
|
-
const
|
|
19979
|
-
return events.filter((e) => e.record_id === ticket.id && e.event_type === "build_failed").sort((a, b) =>
|
|
20162
|
+
const stamp2 = (e) => e.occurred_at ?? e.created_at ?? "";
|
|
20163
|
+
return events.filter((e) => e.record_id === ticket.id && e.event_type === "build_failed").sort((a, b) => stamp2(a).localeCompare(stamp2(b))).map((e) => e.message ?? "").pop();
|
|
19980
20164
|
}
|
|
19981
20165
|
function failureComparison(b, previousNote) {
|
|
19982
20166
|
const now = b.failingFiles ?? failingPaths(b.tail, b.cwd ?? "/\0");
|
|
@@ -20994,8 +21178,8 @@ async function discoverPullRequests(i) {
|
|
|
20994
21178
|
for (const t of candidates2) {
|
|
20995
21179
|
const mine = pushed.filter((e) => e.record_id === t.id);
|
|
20996
21180
|
if (mine.length === 0) continue;
|
|
20997
|
-
const
|
|
20998
|
-
const ordered = [...mine].sort((a, b) => Date.parse(
|
|
21181
|
+
const stamp2 = (e) => e.occurred_at ?? e.created_at ?? "";
|
|
21182
|
+
const ordered = [...mine].sort((a, b) => Date.parse(stamp2(a)) - Date.parse(stamp2(b)));
|
|
20999
21183
|
const branch = pushedBranchOf(ordered[ordered.length - 1].message);
|
|
21000
21184
|
if (!branch) continue;
|
|
21001
21185
|
const target = repoTargetFor(i.route, t.repo_id);
|
|
@@ -21009,7 +21193,7 @@ async function discoverPullRequests(i) {
|
|
|
21009
21193
|
}
|
|
21010
21194
|
if (!token) continue;
|
|
21011
21195
|
try {
|
|
21012
|
-
const pull = selectPull(await listPulls(host, remote, branch, token, i.fetcher),
|
|
21196
|
+
const pull = selectPull(await listPulls(host, remote, branch, token, i.fetcher), stamp2(ordered[0]) || null);
|
|
21013
21197
|
if (!pull) continue;
|
|
21014
21198
|
const patch2 = { [cols.prUrl]: pull.url };
|
|
21015
21199
|
if (have.prRef && blank(t[cols.prRef])) patch2[cols.prRef] = pull.url;
|
|
@@ -25615,6 +25799,9 @@ function renderStatus(v, opts) {
|
|
|
25615
25799
|
for (const t of shown) out.push(` ${waitingLine(t)}`);
|
|
25616
25800
|
if (shown.length < sorted2.length) out.push(` \u2026 ${sorted2.length - shown.length} more (\`crew status --verbose\` lists all)`);
|
|
25617
25801
|
}
|
|
25802
|
+
for (const w of v.waits ?? []) {
|
|
25803
|
+
out.push(`waiting: ${w.ticket} \u2014 for ${w.waitingFor.join(", ")} on ${describeFiles(w.files)}`);
|
|
25804
|
+
}
|
|
25618
25805
|
const notable = v.repos.filter((r) => verbose || r.notable);
|
|
25619
25806
|
for (const r of notable) out.push(`releaser: ${r.name} \u2014 ${r.releaser}`);
|
|
25620
25807
|
const rest = v.repos.length - notable.length;
|
|
@@ -27834,7 +28021,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
27834
28021
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
27835
28022
|
import { join as join60 } from "path";
|
|
27836
28023
|
function builtVersion() {
|
|
27837
|
-
return true ? "0.
|
|
28024
|
+
return true ? "0.156.0" : null;
|
|
27838
28025
|
}
|
|
27839
28026
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
27840
28027
|
function newestMtime(path) {
|
|
@@ -30064,6 +30251,7 @@ function usage(problem, requested = false) {
|
|
|
30064
30251
|
crew shell-init [--shell zsh|bash|fish] print the periscope shell function (install: eval "$(crew shell-init)")
|
|
30065
30252
|
crew worktree [route] NNN cut (or refresh) this run's worktree for a ticket from the remote; prints its path
|
|
30066
30253
|
crew unassign [route] NNN hand back a session's ticket \u2014 clears assignee, next cycle picks it up
|
|
30254
|
+
crew footprint [route] NNN [path...] record the files a ticket will change (once), then print PROCEED or YIELD against active work
|
|
30067
30255
|
crew sandbox cache [--refresh|--prune|--reset] [--json] list the sandbox cache volume's mirrors; --refresh runs the daemon's cache pass once (creates missing mirrors), --prune drops unserved repositories, --reset recreates the volume
|
|
30068
30256
|
crew sync [route] fast-forward the checkout and its worktrees from the remote
|
|
30069
30257
|
crew pause|resume [route] [R|release] pause everything, one role, or releases only (merge/deploy/release; passengers keeps running).
|
|
@@ -30193,6 +30381,7 @@ var KNOWN_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
30193
30381
|
"status",
|
|
30194
30382
|
"sync",
|
|
30195
30383
|
"unassign",
|
|
30384
|
+
"footprint",
|
|
30196
30385
|
"uninstall",
|
|
30197
30386
|
"watch",
|
|
30198
30387
|
"whoami",
|
|
@@ -34737,7 +34926,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`);
|
|
|
34737
34926
|
}
|
|
34738
34927
|
await trD.updateTicket(id, patch2);
|
|
34739
34928
|
},
|
|
34740
|
-
postPushed: (id, sha, rem, branch) => trD.postEvent(id, pushedEventBody(sha, rem, branch), memberD, "pushed"),
|
|
34929
|
+
postPushed: (id, sha, rem, branch) => trD.postEvent(id, pushedEventBody(sha, rem, branch), memberD, "pushed", pushedEventExtra(repoD.dir, rem, base, sha)),
|
|
34741
34930
|
stopTunnel: (id) => {
|
|
34742
34931
|
const sc = readPeriscopeSidecars(cfg.ship.stateDir).find((x) => x.ticketRecordId === id);
|
|
34743
34932
|
return sc && stopRecordedTunnel(sc) ? 1 : 0;
|
|
@@ -35074,6 +35263,43 @@ ${where.join("\n")}`);
|
|
|
35074
35263
|
}
|
|
35075
35264
|
break;
|
|
35076
35265
|
}
|
|
35266
|
+
case "footprint": {
|
|
35267
|
+
const args = positional.slice(1);
|
|
35268
|
+
const at = args.findIndex((a) => parseTicketNumber(a) !== null);
|
|
35269
|
+
const n = at >= 0 ? parseTicketNumber(args[at]) : null;
|
|
35270
|
+
if (!n) {
|
|
35271
|
+
die("crew footprint", "need a ticket number (326, ISSUE-326, or TABL-326)", "`crew footprint 326 src/a.ts src/b.ts`");
|
|
35272
|
+
}
|
|
35273
|
+
const trF = new Tracker(route2, cfg.ship);
|
|
35274
|
+
const cF = trF.contract;
|
|
35275
|
+
const openF = await trF.openTickets();
|
|
35276
|
+
const ticketF = openF.find((t) => t[cF.columns.key] === `ISSUE-${n}`);
|
|
35277
|
+
if (!ticketF) {
|
|
35278
|
+
die("crew footprint", `no open ticket ISSUE-${n} on ${route2.route}`, "`crew inbox` to list open tickets");
|
|
35279
|
+
}
|
|
35280
|
+
let evF = await readFootprintEvents(trF);
|
|
35281
|
+
if (!evF.declared.has(ticketF.id)) {
|
|
35282
|
+
const listed = countedPaths(args.slice(at + 1));
|
|
35283
|
+
if (dryRun) {
|
|
35284
|
+
emit.emit(`would record a footprint of ${listed.length} file(s) on ${displayKey(ticketF)}`);
|
|
35285
|
+
break;
|
|
35286
|
+
}
|
|
35287
|
+
const seatF = route2.resolved?.seats.dev ?? route2.resolved?.operator ?? "";
|
|
35288
|
+
await trF.postEvent(
|
|
35289
|
+
ticketF.id,
|
|
35290
|
+
`footprint: ${listed.length ? listed.join(", ") : "none given"}`,
|
|
35291
|
+
seatF,
|
|
35292
|
+
FOOTPRINT_DECLARED_EVENT,
|
|
35293
|
+
{ paths: listed }
|
|
35294
|
+
);
|
|
35295
|
+
evF = await readFootprintEvents(trF);
|
|
35296
|
+
if (!evF.declared.has(ticketF.id)) evF.declared.set(ticketF.id, { paths: listed, at: (/* @__PURE__ */ new Date()).toISOString() });
|
|
35297
|
+
}
|
|
35298
|
+
const verdictF = mustYieldTo(ticketF, { tickets: openF, ...evF, ignoreByRepo: ignoreByRepo(route2) });
|
|
35299
|
+
process.stdout.write(`${footprintVerdictText(displayKey(ticketF), verdictF)}
|
|
35300
|
+
`);
|
|
35301
|
+
break;
|
|
35302
|
+
}
|
|
35077
35303
|
case "sync": {
|
|
35078
35304
|
emit.enter("worktree");
|
|
35079
35305
|
let tracked2 = 0;
|
|
@@ -35787,14 +36013,13 @@ ${where.join("\n")}`);
|
|
|
35787
36013
|
}
|
|
35788
36014
|
const shipAttention = openShipAttention(state);
|
|
35789
36015
|
let heldReleases = [];
|
|
36016
|
+
let waitViews = [];
|
|
35790
36017
|
let deferredReleases = [];
|
|
35791
36018
|
try {
|
|
35792
36019
|
const open = await statusTracker.openTickets();
|
|
35793
|
-
|
|
35794
|
-
|
|
35795
|
-
|
|
35796
|
-
blockerInfoMap(open, await statusTracker.ticketsByIds(missingBlockerIds(open)))
|
|
35797
|
-
));
|
|
36020
|
+
const blockerInfo = blockerInfoMap(open, await statusTracker.ticketsByIds(missingBlockerIds(open)));
|
|
36021
|
+
heldReleases = describeHeld(heldByBlockers(open, statusTracker.contract.statuses.verified, blockerInfo));
|
|
36022
|
+
waitViews = [...planFootprintsFor(route2, open, await readFootprintEvents(statusTracker), computeBlockedIds(open, blockerInfo)).waits.values()].map((w) => ({ ticket: displayKey(w.ticket), waitingFor: w.waitingFor, files: w.files }));
|
|
35798
36023
|
const minutes = Math.min(...(await resolvedRepos(route2)).map((r) => r.config.release.rightOfWayMinutes ?? DEFAULT_RIGHT_OF_WAY_MINUTES), DEFAULT_RIGHT_OF_WAY_MINUTES);
|
|
35799
36024
|
if (open.some((t) => t.status === statusTracker.contract.statuses.verified)) {
|
|
35800
36025
|
deferredReleases = deferredFromLog(
|
|
@@ -35845,6 +36070,7 @@ ${where.join("\n")}`);
|
|
|
35845
36070
|
})),
|
|
35846
36071
|
repos: repoViews,
|
|
35847
36072
|
heldReleases,
|
|
36073
|
+
waits: waitViews,
|
|
35848
36074
|
deferredReleases,
|
|
35849
36075
|
starved: waiting ? { ticket: waiting.ticket, since: waiting.since, streak: fairness.streak() } : void 0,
|
|
35850
36076
|
ships: shipRows.map((s) => ({
|
package/package.json
CHANGED