@tablation/crew 0.146.1 → 0.147.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.
Files changed (2) hide show
  1. package/dist/cli.js +219 -11
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1633,9 +1633,9 @@ function inferenceHeaders(inf) {
1633
1633
  return lines2.length > 0 ? lines2.join("\n") : void 0;
1634
1634
  }
1635
1635
  function workspaceSettings(baseUrl, headers) {
1636
- const blank = BILLING_VARS_TO_UNSET.filter((v) => v !== "ANTHROPIC_AUTH_TOKEN");
1636
+ const blank2 = BILLING_VARS_TO_UNSET.filter((v) => v !== "ANTHROPIC_AUTH_TOKEN");
1637
1637
  return JSON.stringify({ env: {
1638
- ...Object.fromEntries(blank.map((v) => [v, ""])),
1638
+ ...Object.fromEntries(blank2.map((v) => [v, ""])),
1639
1639
  ANTHROPIC_BASE_URL: baseUrl,
1640
1640
  ...headers ? { ANTHROPIC_CUSTOM_HEADERS: headers } : {}
1641
1641
  } });
@@ -2576,18 +2576,23 @@ var ForgeError = class extends Error {
2576
2576
  };
2577
2577
  var DEFAULT_FORGE_USERNAME = "x-access-token";
2578
2578
  var DEFAULT_FORGE_HOST = "github.com";
2579
+ var encodeSegments = (name) => name.split("/").map(encodeURIComponent).join("/");
2579
2580
  var FORGE_DESCRIPTORS = {
2580
2581
  github: {
2581
2582
  kind: "github",
2582
2583
  httpsUrl: (host, remote) => `https://${host}/${remote}.git`,
2583
2584
  sshUrl: (host, remote) => `git@${host}:${remote}.git`,
2584
- credentialUsername: DEFAULT_FORGE_USERNAME
2585
+ credentialUsername: DEFAULT_FORGE_USERNAME,
2586
+ branchUrl: (host, remote, branch) => `https://${host}/${remote}/tree/${encodeSegments(branch)}`,
2587
+ pullUrl: (host, remote, number) => `https://${host}/${remote}/pull/${number}`
2585
2588
  },
2586
2589
  gitlab: {
2587
2590
  kind: "gitlab",
2588
2591
  httpsUrl: (host, remote) => `https://${host}/${remote}.git`,
2589
2592
  sshUrl: (host, remote) => `git@${host}:${remote}.git`,
2590
- credentialUsername: "oauth2"
2593
+ credentialUsername: "oauth2",
2594
+ branchUrl: (host, remote, branch) => `https://${host}/${remote}/-/tree/${encodeSegments(branch)}`,
2595
+ pullUrl: (host, remote, number) => `https://${host}/${remote}/-/merge_requests/${number}`
2591
2596
  }
2592
2597
  };
2593
2598
  function normalizeForgeHost(host) {
@@ -2597,6 +2602,18 @@ function normalizeForgeHost(host) {
2597
2602
  function forgeDescriptorFor(host) {
2598
2603
  return normalizeForgeHost(host).includes("gitlab") ? FORGE_DESCRIPTORS.gitlab : FORGE_DESCRIPTORS.github;
2599
2604
  }
2605
+ function branchWebUrl(forgeHost, remote, branch) {
2606
+ const r = remote?.trim().replace(/^\/+|\/+$/g, "");
2607
+ if (!r || !branch) return null;
2608
+ const host = normalizeForgeHost(forgeHost);
2609
+ return forgeDescriptorFor(host).branchUrl(host, r, branch);
2610
+ }
2611
+ function pullWebUrl(forgeHost, remote, number) {
2612
+ const r = remote?.trim().replace(/^\/+|\/+$/g, "");
2613
+ if (!r) return null;
2614
+ const host = normalizeForgeHost(forgeHost);
2615
+ return forgeDescriptorFor(host).pullUrl(host, r, number);
2616
+ }
2600
2617
  var DEFAULT_KEYCHAIN_SERVICE = "crew-forge";
2601
2618
  function defaultTokenFilePath(stateDir, host) {
2602
2619
  return join15(stateDir, "forges", `${host.replace(/[^a-z0-9.-]/gi, "_")}.token`);
@@ -8750,6 +8767,8 @@ var DEFAULT_CONTRACT = {
8750
8767
  resolutionNote: "resolution_note",
8751
8768
  verifiedSha: "verified_sha",
8752
8769
  prRef: "pr_ref",
8770
+ branchUrl: "branch_url",
8771
+ prUrl: "pr_url",
8753
8772
  externalId: "external_id",
8754
8773
  position: "position",
8755
8774
  agentRuns: "agent_runs",
@@ -9807,6 +9826,20 @@ var Tracker = class {
9807
9826
  const fields = await this.columnNames(this.models.issues);
9808
9827
  return {
9809
9828
  verifiedSha: fields.has(this.contract.columns.verifiedSha),
9829
+ prRef: fields.has(this.contract.columns.prRef),
9830
+ prUrl: fields.has(this.contract.columns.prUrl)
9831
+ };
9832
+ }
9833
+ /**
9834
+ * Which of the optional link columns (`branch_url`, `pr_url`; CREW-3255) the
9835
+ * Issues table carries. A table without them has not adopted the links and
9836
+ * crew writes around them, with no extra forge calls.
9837
+ */
9838
+ async linkColumns() {
9839
+ const fields = await this.columnNames(this.models.issues);
9840
+ return {
9841
+ branchUrl: fields.has(this.contract.columns.branchUrl),
9842
+ prUrl: fields.has(this.contract.columns.prUrl),
9810
9843
  prRef: fields.has(this.contract.columns.prRef)
9811
9844
  };
9812
9845
  }
@@ -10570,6 +10603,16 @@ ${shipName2 ? `Ship: ${shipName2}
10570
10603
 
10571
10604
  ${v.reason[0].toUpperCase()}${v.reason.slice(1)}. ${pushError ? ` The runner tried a plain push and git refused it: \`${pushError}\`.` : ""} Set back to \`in_progress\`, still held by this ship; push with a plain \`git push --set-upstream ${v.remote} <branch>\` (never \`--force\`) and set \`fixed\` again. Your brief authorizes this push: it is the hand-off, not a release, so do it now rather than asking for permission.`;
10572
10605
  }
10606
+ async function postPushed(i, ticketId, sha, remote, branch, log) {
10607
+ await i.writer.postEvent(ticketId, pushedEventBody(sha, remote, branch), i.seatId, "pushed");
10608
+ const url = i.branchLink?.url(branch);
10609
+ if (!i.branchLink || !url) return;
10610
+ try {
10611
+ await i.writer.updateTicket(ticketId, { [i.branchLink.column]: url });
10612
+ } catch {
10613
+ i.log.warn(`pushed, but the branch link could not be recorded`, log);
10614
+ }
10615
+ }
10573
10616
  async function takenOverSince(i, ticketRow) {
10574
10617
  if (!i.since || !i.writer.events) return false;
10575
10618
  const from = Date.parse(i.since);
@@ -10655,7 +10698,7 @@ async function enforceHandoff(i) {
10655
10698
  }
10656
10699
  }
10657
10700
  if (v.kind === "pushed") {
10658
- await i.writer.postEvent(t.id, pushedEventBody(v.sha, v.remote, v.branch), i.seatId, "pushed");
10701
+ await postPushed(i, t.id, v.sha, v.remote, v.branch, log);
10659
10702
  i.log.emit(`${t.issue_id} pushed at ${v.sha.slice(0, 7)} \u2014 handed on to QA`, log);
10660
10703
  return { kind: "pushed", sha: v.sha };
10661
10704
  }
@@ -10683,7 +10726,7 @@ async function enforceHandoff(i) {
10683
10726
  pushBranchUpstream(wt?.path ?? i.dir, v.remote, v.branch);
10684
10727
  const again = inspectHandoff(i.dir, i.cfg, t, i.role);
10685
10728
  if (again.kind === "pushed") {
10686
- await i.writer.postEvent(t.id, pushedEventBody(again.sha, again.remote, again.branch), i.seatId, "pushed");
10729
+ await postPushed(i, t.id, again.sha, again.remote, again.branch, log);
10687
10730
  await i.writer.postEvent(
10688
10731
  t.id,
10689
10732
  `The runner pushed \`${again.branch}\` to \`${again.remote}\` on ${i.shipName ? `${i.shipName}'s` : "this ship's"} behalf: the ${i.role} seat set \`${i.contract.statuses.handoff}\` without pushing. Plain fast-forward push.${i.cfg.hooks.ci_status ? " The repo's `ci_status` hook was NOT run by the hand-off guard, so CI was not checked by the builder." : ""}`,
@@ -10763,6 +10806,10 @@ async function guardRunHandoff(route2, ship, tracker, role, workingId, log, sinc
10763
10806
  hold: affinity ? { column: affinity.column, shipId: affinity.shipId } : void 0,
10764
10807
  since: since2,
10765
10808
  log,
10809
+ ...await branchLinkFor(tracker, {
10810
+ remote: target.remote ?? (t.repo_id ? route2.resolved?.repoRemotes?.[t.repo_id] : void 0),
10811
+ forgeHost: target.forgeHost ?? (t.repo_id ? route2.resolved?.repoForgeHosts?.[t.repo_id] : void 0)
10812
+ }),
10766
10813
  ...origin ? { origin } : {}
10767
10814
  });
10768
10815
  if (origin) {
@@ -10780,6 +10827,14 @@ async function guardRunHandoff(route2, ship, tracker, role, workingId, log, sinc
10780
10827
  return null;
10781
10828
  }
10782
10829
  }
10830
+ async function branchLinkFor(tracker, target) {
10831
+ try {
10832
+ if (!target.remote || !(await tracker.linkColumns()).branchUrl) return {};
10833
+ } catch {
10834
+ return {};
10835
+ }
10836
+ return { branchLink: { column: tracker.contract.columns.branchUrl, url: (b) => branchWebUrl(target.forgeHost, target.remote, b) } };
10837
+ }
10783
10838
  async function retireRunWorktree(tracker, dir, cfg, t, role, seatId, shipName2, log) {
10784
10839
  try {
10785
10840
  const branch = existingBranchForTicket(dir, cfg, t, role);
@@ -20292,6 +20347,127 @@ async function applyExternalClosures(tracker, closures, contract, emit, dryRun,
20292
20347
  return stamped;
20293
20348
  }
20294
20349
 
20350
+ // src/pr-links.ts
20351
+ function selectPull(pulls, firstPushedAt) {
20352
+ const byNewest = [...pulls].sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt));
20353
+ const open = byNewest.find((p) => p.open);
20354
+ if (open) return open;
20355
+ const cutoff = firstPushedAt ? Date.parse(firstPushedAt) : NaN;
20356
+ if (Number.isNaN(cutoff)) return null;
20357
+ return byNewest.find((p) => Date.parse(p.createdAt) > cutoff) ?? null;
20358
+ }
20359
+ function pushedBranchOf(message) {
20360
+ const m = /^pushed \S+ to [^/\s]+\/(\S+)/.exec((message ?? "").trim());
20361
+ return m ? m[1] : null;
20362
+ }
20363
+ function prUrlFromRef(ref, forgeHost, remote) {
20364
+ const r = ref?.trim();
20365
+ if (!r) return null;
20366
+ if (/^https?:\/\/\S+$/.test(r)) return r;
20367
+ const n = /^#?(\d+)$/.exec(r);
20368
+ return n ? pullWebUrl(forgeHost, remote, n[1]) : null;
20369
+ }
20370
+ async function listPulls(host, remote, branch, token, fetcher = fetch) {
20371
+ const h = normalizeForgeHost(host);
20372
+ const kind = forgeDescriptorFor(h).kind;
20373
+ const signal = AbortSignal.timeout(15e3);
20374
+ if (kind === "gitlab") {
20375
+ const url2 = `https://${h}/api/v4/projects/${encodeURIComponent(remote)}/merge_requests?source_branch=${encodeURIComponent(branch)}&state=all&order_by=created_at&sort=desc&per_page=30`;
20376
+ const res2 = await fetcher(url2, { headers: { "PRIVATE-TOKEN": token, Accept: "application/json" }, signal });
20377
+ if (!res2.ok) throw new Error(`${h} answered ${res2.status}`);
20378
+ const rows2 = await res2.json();
20379
+ return rows2.filter((r) => r.web_url && r.created_at).map((r) => ({
20380
+ url: r.web_url,
20381
+ number: r.iid ?? 0,
20382
+ open: r.state === "opened",
20383
+ createdAt: r.created_at
20384
+ }));
20385
+ }
20386
+ const owner = remote.split("/")[0] ?? "";
20387
+ const api = h === "github.com" ? "https://api.github.com" : `https://${h}/api/v3`;
20388
+ const url = `${api}/repos/${remote}/pulls?head=${encodeURIComponent(`${owner}:${branch}`)}&state=all&sort=created&direction=desc&per_page=30`;
20389
+ const res = await fetcher(url, {
20390
+ headers: { Authorization: `Bearer ${token}`, Accept: "application/vnd.github+json", "User-Agent": "crew" },
20391
+ signal
20392
+ });
20393
+ if (!res.ok) throw new Error(`${h} answered ${res.status}`);
20394
+ const rows = await res.json();
20395
+ return rows.filter((r) => r.html_url && r.created_at).map((r) => ({
20396
+ url: r.html_url,
20397
+ number: r.number ?? 0,
20398
+ open: r.state === "open",
20399
+ createdAt: r.created_at
20400
+ }));
20401
+ }
20402
+ var processWarned = /* @__PURE__ */ new Set();
20403
+ var blank = (v) => typeof v !== "string" || v.trim() === "";
20404
+ async function discoverPullRequests(i) {
20405
+ const warned = i.warnedHosts ?? processWarned;
20406
+ const cols = i.tracker.contract.columns;
20407
+ try {
20408
+ const have = await i.tracker.linkColumns();
20409
+ if (!have.prUrl) return 0;
20410
+ const candidates2 = i.tickets.filter((t) => blank(t[cols.prUrl]) && t.repo_id);
20411
+ if (candidates2.length === 0) return 0;
20412
+ const pushed = await i.tracker.events("pushed");
20413
+ let found = 0;
20414
+ for (const t of candidates2) {
20415
+ const mine = pushed.filter((e) => e.record_id === t.id);
20416
+ if (mine.length === 0) continue;
20417
+ const stamp = (e) => e.occurred_at ?? e.created_at ?? "";
20418
+ const ordered = [...mine].sort((a, b) => Date.parse(stamp(a)) - Date.parse(stamp(b)));
20419
+ const branch = pushedBranchOf(ordered[ordered.length - 1].message);
20420
+ if (!branch) continue;
20421
+ const target = repoTargetFor(i.route, t.repo_id);
20422
+ const remote = target?.remote ?? i.route.resolved?.repoRemotes?.[t.repo_id];
20423
+ const host = normalizeForgeHost(target?.forgeHost ?? i.route.resolved?.repoForgeHosts?.[t.repo_id]);
20424
+ if (!remote) continue;
20425
+ let token = null;
20426
+ try {
20427
+ token = readForgeToken(i.forges, host, i.stateDir, i.env);
20428
+ } catch {
20429
+ }
20430
+ if (!token) continue;
20431
+ try {
20432
+ const pull = selectPull(await listPulls(host, remote, branch, token, i.fetcher), stamp(ordered[0]) || null);
20433
+ if (!pull) continue;
20434
+ const patch2 = { [cols.prUrl]: pull.url };
20435
+ if (have.prRef && blank(t[cols.prRef])) patch2[cols.prRef] = pull.url;
20436
+ await i.tracker.updateTicket(t.id, patch2);
20437
+ i.log.emit(`found pull request ${pull.url}`, { ticket: t.issue_id, step: "review" });
20438
+ found++;
20439
+ } catch (e) {
20440
+ if (!warned.has(host)) {
20441
+ warned.add(host);
20442
+ i.log.warn(`pull request discovery on ${host} skipped: ${e.message}`, { step: "review" });
20443
+ }
20444
+ }
20445
+ }
20446
+ return found;
20447
+ } catch (e) {
20448
+ i.log.warn(`pull request discovery skipped: ${e.message}`, { step: "review" });
20449
+ return 0;
20450
+ }
20451
+ }
20452
+ async function discoverForRoute(route2, ship, tickets, log, tracker = new Tracker(route2, ship)) {
20453
+ return discoverPullRequests({ tracker, route: route2, forges: ship.forges, stateDir: ship.stateDir, tickets, log });
20454
+ }
20455
+ function linkDoctorLines(have, repos, forges, stateDir, env = process.env) {
20456
+ const out = [
20457
+ have.branchUrl ? "branch links: branch_url present" : "branch links: branch_url absent \u2014 the pushed branch is not linked; add it to the Issues template",
20458
+ have.prUrl ? "pull requests: pr_url present \u2014 discovery runs each cycle" : "pull requests: pr_url absent \u2014 pull requests a person opens are not linked; add it to the Issues template"
20459
+ ];
20460
+ if (have.prUrl) {
20461
+ for (const r of repos) {
20462
+ const host = normalizeForgeHost(r.host);
20463
+ if (!hasForgeToken(forges, host, stateDir, env)) {
20464
+ out.push(`pull requests: discovery unavailable for ${r.name}: no forge token stored for ${host} (see \`crew forge\`)`);
20465
+ }
20466
+ }
20467
+ }
20468
+ return out;
20469
+ }
20470
+
20295
20471
  // src/review.ts
20296
20472
  function reviewApplies(repo, contract) {
20297
20473
  return repo.release.mode === "external" && !!contract.statuses.reviewing;
@@ -20377,6 +20553,10 @@ async function runReview(r, verified, reviewing) {
20377
20553
  if (res && res.code !== 0) handoff.prFailure = { code: res.code, tail: lastLines(res.output, 5).trim() };
20378
20554
  else if (res) handoff.prRef = parsePrRef(res.output);
20379
20555
  }
20556
+ if (handoff.prRef && r.columns.prUrl) {
20557
+ const url = prUrlFromRef(handoff.prRef, r.forge?.host, r.forge?.remote);
20558
+ if (url) handoff.prUrl = url;
20559
+ }
20380
20560
  out.handoffs.push(handoff);
20381
20561
  }
20382
20562
  return out;
@@ -20400,7 +20580,8 @@ ${h.prFailure.tail}
20400
20580
  try {
20401
20581
  await tracker.updateTicket(t.id, {
20402
20582
  [contract.columns.status]: reviewing,
20403
- ...h.prRef && columns.prRef ? { [contract.columns.prRef]: h.prRef } : {}
20583
+ ...h.prRef && columns.prRef ? { [contract.columns.prRef]: h.prRef } : {},
20584
+ ...h.prUrl && columns.prUrl ? { [contract.columns.prUrl]: h.prUrl } : {}
20404
20585
  }, t.updated_at);
20405
20586
  await tracker.postEvent(t.id, lines2.join("\n\n"), seat, "review");
20406
20587
  emit.emit(`moved to ${reviewing}`, { ticket: t.issue_id });
@@ -20572,6 +20753,7 @@ async function reviewHandoff(o, closures, verifiedCandidates, reviewing) {
20572
20753
  emit: o.emit,
20573
20754
  dryRun: o.dryRun,
20574
20755
  columns: o.reviewColumns ?? { verifiedSha: false, prRef: false },
20756
+ ...o.forge ? { forge: o.forge } : {},
20575
20757
  runPrHook: async (env) => {
20576
20758
  const r = await hook(o, "pr", env);
20577
20759
  return r ? { code: r.code, output: r.output } : null;
@@ -23061,6 +23243,7 @@ async function applyRouteDecision(o, ctx, decision) {
23061
23243
  const tracker = new Tracker(o.route, o.ship);
23062
23244
  await applyHoldReleases(tracker, decision.holdReleases, tracker.contract, emit);
23063
23245
  }
23246
+ await discoverForRoute(o.route, o.ship, decision.tickets, emit);
23064
23247
  {
23065
23248
  const tracker = new Tracker(o.route, o.ship);
23066
23249
  const memberId = o.route.resolved?.seats.qa ?? o.route.resolved?.seats.dev;
@@ -26208,7 +26391,7 @@ function warnOrphanedWorktreeDirs(paths, log, held) {
26208
26391
  }
26209
26392
  }
26210
26393
  }
26211
- async function applyWorktreeSweep(cwd, actions, dryRun, log, remote = "origin", base, held) {
26394
+ async function applyWorktreeSweep(cwd, actions, dryRun, log, remote = "origin", base, held, onRemoteBranchDeleted) {
26212
26395
  const refused = [];
26213
26396
  const refuse2 = (a, reason, detail) => {
26214
26397
  refused.push(a.path);
@@ -26293,6 +26476,11 @@ async function applyWorktreeSweep(cwd, actions, dryRun, log, remote = "origin",
26293
26476
  gitOk(cwd, ["branch", "-D", a.branch]);
26294
26477
  if (remoteConfigured(cwd, remote) && !deleteRemoteBranch(cwd, remote, a.branch)) {
26295
26478
  log.warn(`could not delete ${remote}/${a.branch} \u2014 leaving it for the next sweep`, { ticket: a.ticket.issue_id, step: "worktree" });
26479
+ } else if (remoteConfigured(cwd, remote)) {
26480
+ try {
26481
+ await onRemoteBranchDeleted?.(a.ticket);
26482
+ } catch {
26483
+ }
26296
26484
  }
26297
26485
  }
26298
26486
  log.emit(
@@ -26539,7 +26727,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
26539
26727
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
26540
26728
  import { join as join58 } from "path";
26541
26729
  function builtVersion() {
26542
- return true ? "0.146.1" : null;
26730
+ return true ? "0.147.0" : null;
26543
26731
  }
26544
26732
  var REBUILD_HINT = "rebuild with npm run build";
26545
26733
  function newestMtime(path) {
@@ -28509,6 +28697,14 @@ var CREW_HOME = isCompiledBinary(import.meta.url) ? dirname37(process.execPath)
28509
28697
  var RELEASE_LOCK_TTL_MS = 20 * 60 * 1e3;
28510
28698
  var CYCLE_SECONDS2 = 120;
28511
28699
  var STALE_CYCLES = 3;
28700
+ function clearBranchLink(tracker) {
28701
+ return async (t) => {
28702
+ const col = tracker.contract.columns.branchUrl;
28703
+ const v = t[col];
28704
+ if (typeof v !== "string" || !v.trim()) return;
28705
+ await tracker.updateTicket(t.id, { [col]: null });
28706
+ };
28707
+ }
28512
28708
  async function duplicateLivePeriscopeProblems(route2, ship) {
28513
28709
  try {
28514
28710
  const tr = new Tracker(route2, ship);
@@ -29835,7 +30031,7 @@ ${changed2.map((c) => ` - ${c}
29835
30031
  warnOrphanedWorktreeDirs(orphanDirs, remit, dryRun2 ? void 0 : { state, repo: target.name });
29836
30032
  if (actions.length) {
29837
30033
  remit.enter("worktree");
29838
- const r = await applyWorktreeSweep(target.dir, actions, dryRun2, remit, branch.remote, branch.base, { state, repo: target.name });
30034
+ const r = await applyWorktreeSweep(target.dir, actions, dryRun2, remit, branch.remote, branch.base, { state, repo: target.name }, clearBranchLink(tracker));
29839
30035
  remit.emit(`swept ${r.removed} worktree(s), kept ${r.keptBranches} branch(es)`, { step: "worktree" });
29840
30036
  if (!dryRun2) reconcileHeldWorktrees(state, target.name, remit, /* @__PURE__ */ new Set([...r.refused, ...orphanDirs]));
29841
30037
  } else if (!dryRun2) reconcileHeldWorktrees(state, target.name, remit, new Set(orphanDirs));
@@ -30156,6 +30352,7 @@ ${changed2.map((c) => ` - ${c}
30156
30352
  ...contractRefusal ? { contractRefusal: contractRefusal.message } : {},
30157
30353
  state: state.release(scope),
30158
30354
  reviewColumns: repo.release.mode === "external" ? await tracker.reviewColumns() : void 0,
30355
+ forge: { host: target.forgeHost, remote: target.remote },
30159
30356
  dryRun,
30160
30357
  skipTests: flag("skip-tests"),
30161
30358
  shell: cfg.ship.shell,
@@ -30507,6 +30704,10 @@ ${f.tail.trimEnd()}
30507
30704
  const tracker = new Tracker(e.route, cfg.ship);
30508
30705
  await applyHoldReleases(tracker, e.decision.holdReleases, tracker.contract, emit.forRoute(e.route.route));
30509
30706
  }
30707
+ for (const e of fleet.entries) {
30708
+ if (dryRun || e.error || !e.decision) continue;
30709
+ await discoverForRoute(e.route, cfg.ship, e.decision.tickets, emit.forRoute(e.route.route));
30710
+ }
30510
30711
  for (const e of fleet.entries) {
30511
30712
  if (e.error || !e.decision || !e.decision.sweep.length) continue;
30512
30713
  const remit = emit.forRoute(e.route.route);
@@ -30766,6 +30967,7 @@ ${f.tail.trimEnd()}
30766
30967
  const tracker = new Tracker(route2, cfg.ship);
30767
30968
  await applyHoldReleases(tracker, decision.holdReleases, tracker.contract, emit);
30768
30969
  }
30970
+ if (!dryRun) await discoverForRoute(route2, cfg.ship, decision.tickets, emit);
30769
30971
  const role = value("role") ?? decision.selection.selected;
30770
30972
  if (command === "poll") break;
30771
30973
  if (!dryRun) {
@@ -32992,7 +33194,7 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
32992
33194
  continue;
32993
33195
  }
32994
33196
  anything = true;
32995
- const res = await applyWorktreeSweep(r.dir, actions, dryRun, emit, r.config.branch.remote, r.config.branch.base, { state, repo: r.name });
33197
+ const res = await applyWorktreeSweep(r.dir, actions, dryRun, emit, r.config.branch.remote, r.config.branch.base, { state, repo: r.name }, clearBranchLink(tracker));
32996
33198
  if (!dryRun) reconcileHeldWorktrees(state, r.name, emit, /* @__PURE__ */ new Set([...res.refused, ...orphanDirs]));
32997
33199
  emit.emit(
32998
33200
  `swept ${res.removed} worktree(s) for ${r.name}, kept ${res.keptBranches} branch(es)`,
@@ -34787,6 +34989,12 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
34787
34989
  missingRuntime.length === 0 ? "runtime columns: forge_host, kind, instance_class, relay_url present\n" : `runtime columns: missing ${missingRuntime.join(", ")} \u2014 read as their defaults; update the Issues template
34788
34990
  `
34789
34991
  );
34992
+ {
34993
+ const have = await tracker.linkColumns();
34994
+ const lines2 = linkDoctorLines(have, reposOf(route2).map((t) => ({ name: t.name, host: t.forgeHost })), cfg.ship.forges, cfg.ship.stateDir);
34995
+ process.stdout.write(`${lines2.join("\n")}
34996
+ `);
34997
+ }
34790
34998
  process.stdout.write(
34791
34999
  await tracker.hasPublicReplyColumn() ? `public replies: Comments.${tracker.contract.comments.publicReply} present \u2014 public reporters are labelled in the digest
34792
35000
  ` : `public replies: Comments.${tracker.contract.comments.publicReply} absent \u2014 no public intake form, nothing to guard
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.146.1",
3
+ "version": "0.147.0",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",