@tablation/crew 0.163.1 → 0.164.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 +30 -23
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1352,7 +1352,7 @@ var Emitter = class _Emitter {
1352
1352
  const e = {
1353
1353
  at: this.now().toISOString(),
1354
1354
  cycle: this.cycle,
1355
- route: this.opts.route,
1355
+ route: extra.route ?? this.opts.route,
1356
1356
  step: extra.step ?? this.step,
1357
1357
  level: extra.level ?? "info",
1358
1358
  message,
@@ -9188,6 +9188,7 @@ var STATUS_MEANINGS = [
9188
9188
  { id: "wontFix", label: "Won\u2019t fix", defaultValue: "closed_wont_fix", contractKey: "wontFix", open: false, resolved: true, meaning: "Called off without merging." },
9189
9189
  { id: "duplicate", label: "Duplicate", defaultValue: "closed_duplicate", open: false, resolved: true, meaning: "Closed in favor of another ticket." },
9190
9190
  { id: "completed", label: "Completed", defaultValue: "closed_completed", open: false, resolved: true, meaning: "Done with nothing to deploy." },
9191
+ { id: "obsolete", label: "Obsolete", defaultValue: "closed_obsolete", open: false, resolved: true, optional: true, mappedOnly: true, meaning: "Overtaken or no longer wanted, closed without being built. Releases a dependent exactly as Won\u2019t fix does (interface 1.4)." },
9191
9192
  { id: "cantReproduce", label: "Can\u2019t reproduce", defaultValue: "closed_cant_reproduce", open: false, resolved: true, meaning: "Closed as written, unreproducible." },
9192
9193
  { id: "draft", label: "Draft", defaultValue: "draft", contractKey: "draft", open: false, resolved: false, optional: true, meaning: "Held back; never polled." }
9193
9194
  ];
@@ -9209,10 +9210,10 @@ function defaultQuestionStatuses() {
9209
9210
  return { open: v("open"), answered: v("answered"), withdrawn: v("withdrawn") };
9210
9211
  }
9211
9212
  function defaultStatusValues() {
9212
- const open2 = STATUS_MEANINGS.filter((s) => s.open && s.defaultValue).map((s) => s.defaultValue);
9213
- const resolved = STATUS_MEANINGS.filter((s) => s.resolved && s.defaultValue).map((s) => s.defaultValue);
9213
+ const open2 = STATUS_MEANINGS.filter((s) => s.open && s.defaultValue && !s.mappedOnly).map((s) => s.defaultValue);
9214
+ const resolved = STATUS_MEANINGS.filter((s) => s.resolved && s.defaultValue && !s.mappedOnly).map((s) => s.defaultValue);
9214
9215
  const single2 = {};
9215
- for (const s of STATUS_MEANINGS) if (s.contractKey) single2[s.contractKey] = s.defaultValue || null;
9216
+ for (const s of STATUS_MEANINGS) if (s.contractKey && !s.mappedOnly) single2[s.contractKey] = s.defaultValue || null;
9216
9217
  return { open: open2, resolved, single: single2 };
9217
9218
  }
9218
9219
  function versionLabel(v) {
@@ -9252,7 +9253,7 @@ function contractFromMapping(base, mapping) {
9252
9253
  const open2 = [];
9253
9254
  const resolved = [];
9254
9255
  for (const s of STATUS_MEANINGS) {
9255
- const v = mapped[s.id] ?? (s.defaultValue || null);
9256
+ const v = mapped[s.id] ?? (s.mappedOnly ? null : s.defaultValue || null);
9256
9257
  if (s.contractKey) Object.assign(next.statuses, { [s.contractKey]: v });
9257
9258
  if (!v) continue;
9258
9259
  if (s.open && !open2.includes(v)) open2.push(v);
@@ -18861,18 +18862,19 @@ function blockerInfoMap(tickets, extra = []) {
18861
18862
  }
18862
18863
  return info;
18863
18864
  }
18864
- function computeBlockedIds(tickets, info) {
18865
+ function computeBlockedIds(tickets, info, opts = {}) {
18865
18866
  const blocked = /* @__PURE__ */ new Set();
18866
- for (const t of tickets) if (unresolvedBlockers(t, info).length > 0) blocked.add(t.id);
18867
+ for (const t of tickets) if (unresolvedBlockers(t, info, opts).length > 0) blocked.add(t.id);
18867
18868
  return blocked;
18868
18869
  }
18869
18870
  function unresolvedBlockers(t, info, opts = {}) {
18870
18871
  const mergeGated = opts.mergeGated ?? true;
18872
+ const resolved = opts.resolved ?? RESOLVED_STATUSES;
18871
18873
  return (t.blocked_by ?? []).filter((id) => {
18872
18874
  const b = info[id];
18873
18875
  const status2 = b?.status;
18874
18876
  if (!b || status2 === void 0) return false;
18875
- if (!RESOLVED_STATUSES.has(status2)) return true;
18877
+ if (!resolved.has(status2)) return true;
18876
18878
  return mergeGated && status2 === "verified" && !!t.repo_id && b.repo_id === t.repo_id && !b.merged_at && !b.commit_sha;
18877
18879
  });
18878
18880
  }
@@ -18967,9 +18969,9 @@ This is automatic and reversible: a ticket that would change a file another acti
18967
18969
  }
18968
18970
  return step.action === "park" ? `Parked as **Blocked** by the crew \u2014 waiting on: ${step.blockers}.
18969
18971
 
18970
- 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})` : ""}.
18972
+ 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\`, \`closed_duplicate\` or \`closed_obsolete\` (where the app maps it), 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})` : ""}.
18971
18973
 
18972
- 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.`;
18974
+ 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\`, \`closed_duplicate\` or \`closed_obsolete\` (where the app maps it) this ticket may still not be buildable as written \u2014 that is a call for a human, not the crew.`;
18973
18975
  }
18974
18976
  async function applySweep(writer, steps, memberId, log) {
18975
18977
  let parked = 0;
@@ -19541,7 +19543,7 @@ ${p.finalText.split("\n").map((l) => `> ${l}`).join("\n")}
19541
19543
  "\nWork the first one you are not required to skip. Tickets waiting on an\nunresolved dependency are already out of this table \u2014 see Blocked below.\n",
19542
19544
  table(step2, i, header, row),
19543
19545
  "\n### Blocked \u2014 waiting on a dependency, not yours to start\n",
19544
- '\nListed rather than hidden so "nothing to do" stays distinguishable from\n"everything is parked". The loop parks and restores these itself, on every\npoll: an approved ticket whose `Blocked by` entries are unresolved moves to\n`blocked`, and back to `accepted` once the last one resolves. **Do not pick\none up, do not set or clear `blocked` by hand, and do not "unblock" one by\nediting its `Blocked by` field** \u2014 if a blocker looks wrong, say so in your\nrun summary. A blocker counts as resolved at `closed_deployed`,\n`closed_wont_fix` or `closed_duplicate`, or at `verified` when it is in another\nrepository or already merged; `fixed` is still an unmerged branch awaiting QA,\nand a `verified` blocker in the same repository as the blocked ticket is unmerged until the\nrelease merges it, so neither counts.\n',
19546
+ '\nListed rather than hidden so "nothing to do" stays distinguishable from\n"everything is parked". The loop parks and restores these itself, on every\npoll: an approved ticket whose `Blocked by` entries are unresolved moves to\n`blocked`, and back to `accepted` once the last one resolves. **Do not pick\none up, do not set or clear `blocked` by hand, and do not "unblock" one by\nediting its `Blocked by` field** \u2014 if a blocker looks wrong, say so in your\nrun summary. A blocker counts as resolved at `closed_deployed`,\n`closed_wont_fix`, `closed_duplicate` or `closed_obsolete`, or at `verified` when it is in another\nrepository or already merged; `fixed` is still an unmerged branch awaiting QA,\nand a `verified` blocker in the same repository as the blocked ticket is unmerged until the\nrelease merges it, so neither counts.\n',
19545
19547
  blockedTable(i.tickets.filter(isBlocked)),
19546
19548
  ...heldTable ? [heldTable] : []
19547
19549
  ]);
@@ -19570,7 +19572,7 @@ function qaDigest(i) {
19570
19572
  ### Waiting on blockers \u2014 not yours to verify yet
19571
19573
 
19572
19574
  A \`fixed\` or \`qa\` ticket whose \`Blocked by\` names something not yet resolved
19573
- (\`closed_deployed\`, \`closed_wont_fix\` or \`closed_duplicate\`, or \`verified\` once merged or in another repository) is held out of
19575
+ (\`closed_deployed\`, \`closed_wont_fix\`, \`closed_duplicate\` or \`closed_obsolete\` (where the app maps it), or \`verified\` once merged or in another repository) is held out of
19574
19576
  verification: its change needs the blocker released first. It becomes yours on
19575
19577
  the first poll after the last blocker resolves. No one needs to change the ticket.
19576
19578
 
@@ -20088,7 +20090,7 @@ async function decideCycle(o) {
20088
20090
  const extra = await tracker.ticketsByIds(missingBlockerIds(tickets));
20089
20091
  const info = blockerInfoMap(tickets, extra);
20090
20092
  await reportTruncated(tracker, route2.route, state, emit);
20091
- const blocked = computeBlockedIds(tickets, info);
20093
+ const blocked = computeBlockedIds(tickets, info, { resolved: new Set(tracker.contract.statuses.resolved) });
20092
20094
  const footprintEvents = await optional("footprint events", readFootprintEvents(tracker), { declared: /* @__PURE__ */ new Map(), pushed: /* @__PURE__ */ new Map() });
20093
20095
  const footprintPlan = planFootprintsFor(route2, tickets, footprintEvents, new Set(blocked));
20094
20096
  for (const id of footprintPlan.waits.keys()) blocked.add(id);
@@ -21501,9 +21503,10 @@ function checkGuards(cwd, base = "main") {
21501
21503
  detail: `working tree has ${changes.length} change(s)${untrackedNote}: ${names}${more}`
21502
21504
  };
21503
21505
  }
21504
- function heldByBlockers(tickets, verifiedStatus, info) {
21506
+ function heldByBlockers(tickets, verifiedStatus, info, resolved) {
21505
21507
  if (!info) return [];
21506
- return tickets.filter((t) => t.status === verifiedStatus && unresolvedBlockers(t, info, { mergeGated: false }).length > 0).map((ticket) => ({ ticket, blockers: describeUnresolved(ticket, info, { mergeGated: false }) }));
21508
+ const opts = { mergeGated: false, resolved };
21509
+ return tickets.filter((t) => t.status === verifiedStatus && unresolvedBlockers(t, info, opts).length > 0).map((ticket) => ({ ticket, blockers: describeUnresolved(ticket, info, opts) }));
21507
21510
  }
21508
21511
  var describeHeld = (held) => held.map((h) => `${h.ticket.issue_tag ?? h.ticket.issue_id} held: blocked by ${h.blockers}`);
21509
21512
  var CHANGELOG_LINE = /^Changelog:[ \t]*(.*)$/gm;
@@ -21531,7 +21534,7 @@ function dedupeChangelogEntries(entries, ticket) {
21531
21534
  }
21532
21535
  var BUMP_LINE = /^Bump:[ \t]*(major|minor|patch)\b/gim;
21533
21536
  function planMerge(cwd, tickets, contract, lastReleased, branchFor = (t) => branchForIssue(cwd, t.issue_id), base = "main", blockerInfo, ref = "HEAD") {
21534
- const held = new Set(heldByBlockers(tickets, contract.statuses.verified, blockerInfo).map((h) => h.ticket.id));
21537
+ const held = new Set(heldByBlockers(tickets, contract.statuses.verified, blockerInfo, new Set(contract.statuses.resolved)).map((h) => h.ticket.id));
21535
21538
  const verified = tickets.filter((t) => t.status === contract.statuses.verified && !held.has(t.id)).sort((a, b) => Number.parseInt(a.issue_id.replace(/^\D+/, ""), 10) - Number.parseInt(b.issue_id.replace(/^\D+/, ""), 10));
21536
21539
  return verified.map((ticket) => {
21537
21540
  const branch = branchFor(ticket);
@@ -21665,7 +21668,7 @@ function decideRelease(cwd, tickets, contract, opts = {}) {
21665
21668
  return {
21666
21669
  block,
21667
21670
  merges,
21668
- held: heldByBlockers(tickets, contract.statuses.verified, opts.blockerInfo),
21671
+ held: heldByBlockers(tickets, contract.statuses.verified, opts.blockerInfo, new Set(contract.statuses.resolved)),
21669
21672
  head,
21670
21673
  lastTag,
21671
21674
  lastReleased,
@@ -29177,7 +29180,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
29177
29180
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
29178
29181
  import { join as join60 } from "path";
29179
29182
  function builtVersion() {
29180
- return true ? "0.163.1" : null;
29183
+ return true ? "0.164.0" : null;
29181
29184
  }
29182
29185
  var REBUILD_HINT = "rebuild with npm run build";
29183
29186
  function newestMtime(path) {
@@ -31666,8 +31669,11 @@ if (command === "passenger-sync-daemon") {
31666
31669
  let routineLine = function(line) {
31667
31670
  if (flag("verbose")) process.stderr.write(`${line}
31668
31671
  `);
31672
+ }, failureScope = function() {
31673
+ const given = value("route") ?? positional[1];
31674
+ return { step: command ?? "crew", route: given !== void 0 && cfg.routes.some((r) => r.route === given) ? given : "" };
31669
31675
  }, die = function(command2, message, fix, code = 2) {
31670
- emit.error(withFix(`${command2}: ${message}`, fix));
31676
+ emit.error(withFix(`${command2}: ${message}`, fix), failureScope());
31671
31677
  return process.exit(code);
31672
31678
  }, requireArmed = function(what) {
31673
31679
  if (dryRun || route2.enabled) return;
@@ -31878,7 +31884,7 @@ if (command === "passenger-sync-daemon") {
31878
31884
  }
31879
31885
  };
31880
31886
  };
31881
- routineLine2 = routineLine, die2 = die, requireArmed2 = requireArmed, parseTicketNumber2 = parseTicketNumber, routeRelayUrl2 = routeRelayUrl, previewRelayFor2 = previewRelayFor, passengerApiKeys2 = passengerApiKeys, endpointApiFor2 = endpointApiFor, periscopeEndpointDeps2 = periscopeEndpointDeps, periscopeMcpDeps2 = periscopeMcpDeps, endpointReconcileDeps2 = endpointReconcileDeps, sweepStateDir2 = sweepStateDir, releaseRefused2 = releaseRefused, doctorMachineId2 = doctorMachineId, baseHealth2 = baseHealth, sandboxCacheRepos2 = sandboxCacheRepos, buildSandboxCachePass2 = buildSandboxCachePass, sandboxTickDeps2 = sandboxTickDeps;
31887
+ routineLine2 = routineLine, failureScope2 = failureScope, die2 = die, requireArmed2 = requireArmed, parseTicketNumber2 = parseTicketNumber, routeRelayUrl2 = routeRelayUrl, previewRelayFor2 = previewRelayFor, passengerApiKeys2 = passengerApiKeys, endpointApiFor2 = endpointApiFor, periscopeEndpointDeps2 = periscopeEndpointDeps, periscopeMcpDeps2 = periscopeMcpDeps, endpointReconcileDeps2 = endpointReconcileDeps, sweepStateDir2 = sweepStateDir, releaseRefused2 = releaseRefused, doctorMachineId2 = doctorMachineId, baseHealth2 = baseHealth, sandboxCacheRepos2 = sandboxCacheRepos, buildSandboxCachePass2 = buildSandboxCachePass, sandboxTickDeps2 = sandboxTickDeps;
31882
31888
  async function failDaemonStart(o) {
31883
31889
  const failEmit = new Emitter({
31884
31890
  route: "",
@@ -35362,7 +35368,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
35362
35368
  const apiKeyVar = "CREW_API_KEY";
35363
35369
  if (firstRunFromFlags && agentBinSearched && !dryRun && !isManagedShipKind(value("ship-kind"))) {
35364
35370
  const msg = `no agent binary: "claude" was not found on PATH or in ${agentBinSearched.join(", ")} \u2014 pass --agent-bin /absolute/path`;
35365
- emit.error(`crew connect: ${msg}`);
35371
+ emit.error(`crew connect: ${msg}`, failureScope());
35366
35372
  stopWithProblem(msg, "wizard");
35367
35373
  }
35368
35374
  const storeLabel = () => {
@@ -37356,8 +37362,8 @@ ${where.join("\n")}`);
37356
37362
  try {
37357
37363
  const open2 = await statusTracker.openTickets();
37358
37364
  const blockerInfo = blockerInfoMap(open2, await statusTracker.ticketsByIds(missingBlockerIds(open2)));
37359
- heldReleases = describeHeld(heldByBlockers(open2, statusTracker.contract.statuses.verified, blockerInfo));
37360
- waitViews = [...planFootprintsFor(route2, open2, await readFootprintEvents(statusTracker), computeBlockedIds(open2, blockerInfo)).waits.values()].map((w) => ({ ticket: displayKey(w.ticket), waitingFor: w.waitingFor, files: w.files }));
37365
+ heldReleases = describeHeld(heldByBlockers(open2, statusTracker.contract.statuses.verified, blockerInfo, new Set(statusTracker.contract.statuses.resolved)));
37366
+ waitViews = [...planFootprintsFor(route2, open2, await readFootprintEvents(statusTracker), computeBlockedIds(open2, blockerInfo, { resolved: new Set(statusTracker.contract.statuses.resolved) })).waits.values()].map((w) => ({ ticket: displayKey(w.ticket), waitingFor: w.waitingFor, files: w.files }));
37361
37367
  const minutes = Math.min(...(await resolvedRepos(route2)).map((r) => r.config.release.rightOfWayMinutes ?? DEFAULT_RIGHT_OF_WAY_MINUTES), DEFAULT_RIGHT_OF_WAY_MINUTES);
37362
37368
  if (open2.some((t) => t.status === statusTracker.contract.statuses.verified)) {
37363
37369
  deferredReleases = deferredFromLog(
@@ -38295,6 +38301,7 @@ ${foreign.map((f2) => ` ${f2.trim()}`).join("\n")}
38295
38301
  lock?.release();
38296
38302
  }
38297
38303
  var routineLine2;
38304
+ var failureScope2;
38298
38305
  var die2;
38299
38306
  var requireArmed2;
38300
38307
  var parseTicketNumber2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.163.1",
3
+ "version": "0.164.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",