@tablation/crew 0.149.6 → 0.150.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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +424 -178
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -252,7 +252,7 @@ crew release [route] merge what QA verified, version it, ship it
252
252
  crew merge [route] merge verified branches and stop
253
253
  crew deploy [route] release now, even with nothing new to merge
254
254
  crew watch [route] live view of what the crew is doing
255
- crew status [route] paused/running state, led by what the operator owes (needs_info assigned to them, needs_planning, ships needing attention)
255
+ crew status [route] [--verbose] what is running and what needs a person; --verbose adds configuration and full lists
256
256
  crew doctor [route] [--fix] preflight; --fix enables clean routes, offers crew install
257
257
  crew selftest [route] [--toolchain NAME] [--json] launch each toolchain as a run would and prove it reaches the tracker
258
258
  crew sample-ticket [route] [--remove] [--dry-run] [--json] file one ticket on a throwaway repo that walks the dev, QA and release loop
package/dist/cli.js CHANGED
@@ -24965,6 +24965,90 @@ function renderInbox(items, byConnection = false, subject) {
24965
24965
  return out.join("\n");
24966
24966
  }
24967
24967
 
24968
+ // src/status-render.ts
24969
+ var WAITING_SHOWN = 5;
24970
+ var plural = (n, w, many = `${w}s`) => `${n} ${n === 1 ? w : many}`;
24971
+ function stateWord(v) {
24972
+ const bits = [];
24973
+ if (v.crewPaused) bits.push("crew paused");
24974
+ else if (v.releasePaused) bits.push("release paused");
24975
+ for (const r of v.pausedRoles) bits.push(`${r} paused`);
24976
+ if (!v.route.enabled) bits.push("route disabled");
24977
+ return bits.length ? bits.join(", ") : "active";
24978
+ }
24979
+ var byRecent = (items, at) => [...items].sort((a, b) => Date.parse(at(b) ?? "") - Date.parse(at(a) ?? "") || 0);
24980
+ function waitingReasonCounts(w) {
24981
+ const counts = /* @__PURE__ */ new Map();
24982
+ for (const t of w) for (const r of t.reasons) counts.set(r, (counts.get(r) ?? 0) + 1);
24983
+ return [...counts].map(([r, n]) => `${r} ${n}`).join(", ");
24984
+ }
24985
+ var waitingLine = (t) => `${t.key} \u2014 ${t.reasons.join(", ")}${t.title ? ` \u2014 ${t.title}` : ""}`;
24986
+ function renderStatus(v, opts) {
24987
+ const now = opts.now ?? Date.now();
24988
+ const out = [];
24989
+ const verbose = opts.verbose;
24990
+ out.push(`${v.ship.name} \xB7 ${v.route.name} \xB7 ${stateWord(v)}`);
24991
+ if (v.runs.length) {
24992
+ for (const x of v.runs) {
24993
+ out.push(`running: ${x.role} \u2014 ${x.ticket ?? "(no ticket)"}${x.repo ? ` in ${x.repo}` : ""} for ${since(x.spawnedAt, now)}` + (verbose ? ` (pid ${x.pid}, since ${x.spawnedAt}${x.deadline ? `, deadline ${x.deadline}` : ""})` : ""));
24994
+ }
24995
+ } else {
24996
+ const last = byRecent(v.lastRuns, (l) => l.finishedAt)[0];
24997
+ out.push(last ? `running: nothing (last run ${since(last.finishedAt, now)} ago)` : "running: nothing");
24998
+ }
24999
+ if (v.reloadRequestedSecondsAgo !== null) {
25000
+ out.push(`reload: requested ${v.reloadRequestedSecondsAgo}s ago, not yet honored \u2014 \`crew reload --now\` forces it`);
25001
+ }
25002
+ const own = byRecent(v.attention, (a) => a.since);
25003
+ const others = v.ships.filter((s) => s.name !== v.ship.name && s.attention.length);
25004
+ const unsafe = v.repos.filter((r) => r.unsafeDetail);
25005
+ if (own.length || others.length || unsafe.length || v.heldReleases.length || v.starved) {
25006
+ out.push("needs attention:");
25007
+ for (const i of own) out.push(` ${i.kind} \u2014 ${i.message}`);
25008
+ for (const r of unsafe) out.push(` base ${r.name} \u2014 UNSAFE, no worktree cuts or releases: ${r.unsafeDetail}`);
25009
+ for (const l of v.heldReleases) out.push(` release: ${l}`);
25010
+ if (v.starved) {
25011
+ out.push(` waiting: ${v.starved.ticket} for ${since(v.starved.since, now)} (passed over ${plural(v.starved.streak, "cycle")} running)`);
25012
+ }
25013
+ for (const s of others) {
25014
+ if (verbose) for (const i of s.attention) out.push(` ship ${s.name}: ${i.kind} \u2014 ${i.message}`);
25015
+ else out.push(` ship ${s.name}: ${plural(s.attention.length, "item")} (\`crew status --verbose\` lists them)`);
25016
+ }
25017
+ }
25018
+ if (v.waiting.length) {
25019
+ const sorted2 = byRecent(v.waiting, (t) => t.updatedAt);
25020
+ out.push(`waiting on you: ${v.waiting.length} (${waitingReasonCounts(v.waiting)})`);
25021
+ const shown = verbose ? sorted2 : sorted2.slice(0, WAITING_SHOWN);
25022
+ for (const t of shown) out.push(` ${waitingLine(t)}`);
25023
+ if (shown.length < sorted2.length) out.push(` \u2026 ${sorted2.length - shown.length} more (\`crew status --verbose\` lists all)`);
25024
+ }
25025
+ const notable = v.repos.filter((r) => verbose || r.notable);
25026
+ for (const r of notable) out.push(`releaser: ${r.name} \u2014 ${r.releaser}`);
25027
+ const rest = v.repos.length - notable.length;
25028
+ if (rest > 0) out.push(`releases: ${plural(rest, "repository", "repositories")} idle, no lock held`);
25029
+ for (const s of v.ships.filter((x) => x.name !== v.ship.name)) out.push(`other ship: ${s.line}`);
25030
+ if (verbose) {
25031
+ out.push("");
25032
+ out.push(`ship: ${v.ship.name} (${v.ship.platform})`);
25033
+ out.push(`route: ${v.route.name} -> ${v.route.dir}`);
25034
+ out.push(`enabled: ${v.route.enabled}`);
25035
+ out.push(`crew: ${v.crewPaused ? "paused" : "active"}`);
25036
+ out.push(`release: ${v.releasePaused ? "paused" : "active"}`);
25037
+ for (const r of v.pausedRoles) out.push(`role ${r}: paused`);
25038
+ out.push(`periscopes: ${v.periscopes.summary}`);
25039
+ if (v.periscopes.relayUrl) out.push(`relay: ${v.periscopes.relayUrl}`);
25040
+ for (const p of v.periscopes.live) out.push(`periscope: ${p}`);
25041
+ out.push(`watermark: ${v.watermark}`);
25042
+ if (v.projects.length) out.push(`projects: ${v.projects.join(", ")}`);
25043
+ for (const l of byRecent(v.lastRuns, (x) => x.finishedAt)) {
25044
+ out.push(`last run: ${l.role} \u2014 ${l.ticket ?? "(no ticket)"} ${l.outcome}, ${since(l.finishedAt, now)} ago`);
25045
+ }
25046
+ const self = v.ships.find((s) => s.name === v.ship.name);
25047
+ if (self) out.push(`ship row: ${self.line}`);
25048
+ }
25049
+ return out;
25050
+ }
25051
+
24968
25052
  // src/connect.ts
24969
25053
  var ConnectHttpError = class extends Error {
24970
25054
  status;
@@ -26470,6 +26554,176 @@ function planSampleTicket(i) {
26470
26554
  };
26471
26555
  }
26472
26556
 
26557
+ // src/doctor-report.ts
26558
+ var DOCTOR_SECTIONS = [
26559
+ { id: "ship", title: "Ship" },
26560
+ { id: "tracker", title: "Tracker" },
26561
+ { id: "repositories", title: "Repositories" },
26562
+ { id: "seats", title: "Seats" },
26563
+ { id: "tools", title: "Tools" },
26564
+ { id: "passengers", title: "Periscopes, passengers and sandbox" }
26565
+ ];
26566
+ var RANK = { ok: 0, info: 1, note: 2, warning: 3, blocker: 4 };
26567
+ var worse = (a, b) => RANK[b] > RANK[a] ? b : a;
26568
+ function classifySeverity(label, text2) {
26569
+ const s = `${label} ${text2}`;
26570
+ if (/\b(BLOCKER|ERROR)\b/.test(s)) return "blocker";
26571
+ if (/^attention$/i.test(label)) return "warning";
26572
+ if (/\b(WARN|WARNING|ATTENTION|DEAD|NOT FOUND|NOT READY|NOT AVAILABLE|NOT installed|NO row|MISMATCH|STALE|FAILED)\b|\(missing\)|\bMISSING\b|\bnot registered\b|\b\d{3} —/.test(s)) return "warning";
26573
+ if (/\bNOTE\b|cannot enforce|\bnot run\b|release readiness|\babsent\b|\bmissing\b|^none\b|\bnot minted\b|could not (be )?check|\bunknown\b|no operator|\bwithout\b|discovery unavailable/.test(s)) return "note";
26574
+ return "ok";
26575
+ }
26576
+ var SECTION_BY_LABEL = [
26577
+ ["seats", /^(seat |operator identity|api key role|can mint|capability)/],
26578
+ ["passengers", /^(periscopes?\b|periscope mcp|host passengers|docker|ssh-keygen|image|relay (host|control|tunnel)|sandbox|attention|foreign launchd)/],
26579
+ ["tracker", /^(contract|authorship|runtime columns|link columns|public replies|crew assisted|release seat|ship (record|row|holds)|crew manifest|branch\/pull|pull request|branch links)/],
26580
+ ["tools", /^(agent binary|toolchain|git\b|mcp|pair\b|auth\b|credential helper|hook |repo toolchain|push auth|gh\b|node\b|docker\b)/],
26581
+ ["ship", /^(ship|routes?|bundle|role concurrency|persona avatar|key store|events log|scheduler unit|passengers unit|daemon|reload request|crew version)/]
26582
+ ];
26583
+ function sectionOf(label) {
26584
+ for (const [id, re] of SECTION_BY_LABEL) if (re.test(label)) return id;
26585
+ return void 0;
26586
+ }
26587
+ var LABEL_RE = /^([A-Za-z][\w.\-/ ]{0,38}?):\s+(\S.*)$/;
26588
+ var MARKER_RE = /^(WARNING|WARN|ERROR|BLOCKER|ATTENTION|NOTE|MISSING|NOT)\b/;
26589
+ var DoctorReport = class {
26590
+ findings = [];
26591
+ /** Set while a repository's block is being written; lines are filed under it and grouped across repositories. */
26592
+ repo;
26593
+ /** Repository names of the route; a line outside a repo block that names exactly one is grouped with the same line for the others. */
26594
+ repoNames = [];
26595
+ last;
26596
+ mentionedRepo(text2) {
26597
+ const hits = this.repoNames.filter((n) => text2.split("\n").some((l) => l.includes(`${n}:`) && new RegExp(`(?:^|[\\s/])${n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}:`).test(l)));
26598
+ return hits.length === 1 ? hits[0] : void 0;
26599
+ }
26600
+ /** Take one check's output (one or more lines, as it would have been printed). */
26601
+ line(raw, ctx = {}) {
26602
+ const repo = ctx.repo ?? this.repo;
26603
+ for (const physical of raw.split("\n")) {
26604
+ if (physical.trim() === "") continue;
26605
+ const continuation = /^\s{2,}/.test(physical);
26606
+ const body = physical.trim().replace(/^-\s+/, "");
26607
+ const m = MARKER_RE.test(body) ? null : /^(repo \S+?):(\/\S.*)$/.exec(body) ?? LABEL_RE.exec(body);
26608
+ if (continuation && this.last && !m && !MARKER_RE.test(body)) {
26609
+ this.last.text += `
26610
+ ${body}`;
26611
+ this.last.severity = worse(this.last.severity, classifySeverity("", body));
26612
+ continue;
26613
+ }
26614
+ const label = m ? m[1].trim() : "";
26615
+ const text2 = m ? m[2].trim() : body;
26616
+ const parent = continuation ? this.last : void 0;
26617
+ const section = repo ? "repositories" : sectionOf(label) ?? parent?.section ?? this.last?.section ?? "ship";
26618
+ const f = { severity: classifySeverity(label, text2), section, label, text: text2, ...repo ? { repo } : {} };
26619
+ if (!repo) {
26620
+ const mentions = this.mentionedRepo(text2);
26621
+ if (mentions) f.mentions = mentions;
26622
+ }
26623
+ this.findings.push(f);
26624
+ this.last = f;
26625
+ }
26626
+ }
26627
+ counts() {
26628
+ const merged = groupFindings(this.findings.filter((f) => RANK[f.severity] >= RANK.note));
26629
+ const c = { blocker: 0, warning: 0, note: 0, passed: 0 };
26630
+ for (const g of merged) c[g.severity]++;
26631
+ c.passed = this.findings.filter((f) => RANK[f.severity] < RANK.note).length;
26632
+ return c;
26633
+ }
26634
+ };
26635
+ function groupFindings(findings) {
26636
+ const out = [];
26637
+ const byKey = /* @__PURE__ */ new Map();
26638
+ for (const f of findings) {
26639
+ const repo = f.repo ?? f.mentions;
26640
+ if (!repo) {
26641
+ out.push({ ...f, repos: [] });
26642
+ continue;
26643
+ }
26644
+ const norm = (s) => s.split(repo).join("<repo>");
26645
+ const key = [f.severity, f.section, norm(f.label), norm(f.text)].join("\0");
26646
+ const hit = byKey.get(key);
26647
+ if (hit) {
26648
+ if (!hit.repos.includes(repo)) hit.repos.push(repo);
26649
+ continue;
26650
+ }
26651
+ const g = { ...f, repos: [repo] };
26652
+ byKey.set(key, g);
26653
+ out.push(g);
26654
+ }
26655
+ return out;
26656
+ }
26657
+ var plural2 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
26658
+ function reposPhrase(repos) {
26659
+ return repos.length <= 5 ? `repositories ${repos.join(", ")}` : `${repos.length} repositories (${repos.slice(0, 3).join(", ")}, \u2026)`;
26660
+ }
26661
+ var SEVERITY_WORD = { blocker: "BLOCKER", warning: "WARNING", note: "NOTE " };
26662
+ function verdictLine(c) {
26663
+ const parts = [];
26664
+ if (c.blocker) parts.push(plural2(c.blocker, "blocker"));
26665
+ if (c.warning) parts.push(plural2(c.warning, "warning"));
26666
+ if (c.note) parts.push(plural2(c.note, "note"));
26667
+ if (parts.length === 0) return `verdict: all clear \u2014 ${plural2(c.passed, "check")} passed`;
26668
+ const lead = c.blocker ? "needs action" : c.warning ? "usable, with warnings" : "ok, with notes";
26669
+ return `verdict: ${lead} \u2014 ${parts.join(", ")}; ${plural2(c.passed, "check")} passed`;
26670
+ }
26671
+ function indentContinuation(text2, pad) {
26672
+ return text2.split("\n").map((l, i) => i === 0 ? l : `${" ".repeat(pad)}${l}`).join("\n");
26673
+ }
26674
+ function renderDoctor(report, header, verbose) {
26675
+ const c = report.counts();
26676
+ const out = [...header];
26677
+ if (!verbose) {
26678
+ const shown = groupFindings(report.findings.filter((f) => RANK[f.severity] >= RANK.note)).sort((a, b) => RANK[b.severity] - RANK[a.severity]);
26679
+ for (const g of shown) {
26680
+ const sev = SEVERITY_WORD[g.severity];
26681
+ const where = g.repos.length ? ` [${reposPhrase(g.repos)}]` : "";
26682
+ const head = `${sev} ${g.label ? `${g.label}: ` : ""}`;
26683
+ let text2 = g.text.replace(/^(WARNING|WARN|NOTE|BLOCKER|ERROR|ATTENTION)\s+/, "");
26684
+ if (g.repos.length > 1) for (const r of g.repos) text2 = text2.split(r).join("<repo>");
26685
+ out.push(`${head}${indentContinuation(text2, 4)}${where}`);
26686
+ }
26687
+ if (shown.length) out.push("");
26688
+ if (c.passed) out.push(`${plural2(c.passed, "check")} passed (\`crew doctor --verbose\` lists them)`);
26689
+ out.push(verdictLine(c));
26690
+ return `${out.join("\n")}
26691
+ `;
26692
+ }
26693
+ for (const s of DOCTOR_SECTIONS) {
26694
+ const inSection = report.findings.filter((f) => f.section === s.id);
26695
+ if (inSection.length === 0) continue;
26696
+ out.push("", s.title, "-".repeat(s.title.length));
26697
+ const block = (items, indent, strip) => {
26698
+ const labelOf2 = (f) => strip && f.label === `repo ${strip}` ? "path" : f.label;
26699
+ const width = Math.min(26, Math.max(...items.map((f) => labelOf2(f) ? labelOf2(f).length + 1 : 0))) + 1;
26700
+ for (const f of items) {
26701
+ const l = labelOf2(f);
26702
+ const lab = l ? `${l}:` : "";
26703
+ const col = lab.length >= width ? `${lab} ` : lab.padEnd(width);
26704
+ out.push(`${" ".repeat(indent)}${col}${indentContinuation(f.text, indent + col.length)}`);
26705
+ }
26706
+ };
26707
+ if (s.id === "repositories") {
26708
+ const names = [...new Set(inSection.map((f) => f.repo ?? ""))];
26709
+ for (const n of names) {
26710
+ out.push(n ? ` ${n}` : "");
26711
+ block(inSection.filter((f) => (f.repo ?? "") === n), 4, n);
26712
+ }
26713
+ } else block(inSection, 0);
26714
+ }
26715
+ out.push("", verdictLine(c));
26716
+ return `${out.join("\n")}
26717
+ `;
26718
+ }
26719
+ function fixPhaseNothingToOffer(o) {
26720
+ const lines2 = o.notes.map((n) => `fix: ${n}`);
26721
+ if (!o.fixFlag) return lines2;
26722
+ const outstanding = o.blockers + o.warnings;
26723
+ lines2.push(outstanding ? `fix: no automatic fix applies; the ${plural2(outstanding, "finding")} above ${outstanding === 1 ? "needs" : "need"} action` : "fix: no automatic fix applies, and nothing needs one");
26724
+ return lines2;
26725
+ }
26726
+
26473
26727
  // src/worktree-sweep.ts
26474
26728
  import { existsSync as existsSync54, readFileSync as readFileSync53, readdirSync as readdirSync16 } from "fs";
26475
26729
  import { basename as basename14, dirname as dirname33, join as join56, resolve as resolve5 } from "path";
@@ -26905,7 +27159,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
26905
27159
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
26906
27160
  import { join as join58 } from "path";
26907
27161
  function builtVersion() {
26908
- return true ? "0.149.6" : null;
27162
+ return true ? "0.150.0" : null;
26909
27163
  }
26910
27164
  var REBUILD_HINT = "rebuild with npm run build";
26911
27165
  function newestMtime(path) {
@@ -29103,7 +29357,7 @@ function usage(problem, requested = false) {
29103
29357
  crew deploy [route] release now, even with nothing new to merge
29104
29358
  crew watch [route] live view of what the crew is doing
29105
29359
  crew --version [--json] print the crew version on one line (also: crew version); --json adds home and compiled
29106
- crew status [route] [--json] paused/running state; --json for a machine reader
29360
+ crew status [route] [--json] [--verbose] what is running and what needs a person; --verbose adds configuration and full lists; --json for a machine reader
29107
29361
  crew projects [--route R] [--json] the Projects rows each route can read (id, name, prefix, work mode)
29108
29362
  crew provision --key K --route WS[/PROJECT] [--forge-host H] [--ship-name N] [--json] one non-interactive run: connect, forge tokens,
29109
29363
  enable routes, install units with lingering, start the daemon; safe to re-run (CREW_CONNECT_KEY,
@@ -29116,7 +29370,7 @@ function usage(problem, requested = false) {
29116
29370
  crew credential get|store|erase git credential helper answering from ship.forges (git runs it; not for hand use)
29117
29371
  crew whoami [route] [--json] the signed-in identity, key role, operator Crew row and credential source per route
29118
29372
  crew reload make the running daemon re-read crew.yaml (--now: restart it immediately)
29119
- crew doctor [route] [--fix] [--offline] [--json] preflight; --fix enables clean routes and offers crew install;
29373
+ crew doctor [route] [--fix] [--offline] [--verbose] [--json] preflight: findings first, then a verdict; --verbose lists every check; --fix enables clean routes and offers crew install;
29120
29374
  --offline skips push probes; --json prints push-auth and tool checks only
29121
29375
  crew selftest [route] [--toolchain NAME] [--json] launch each toolchain as a run would and prove it reaches the tracker
29122
29376
  crew sample-ticket [route] [--remove] [--dry-run] [--json] file one ticket on a throwaway repo that walks the dev, QA and release loop
@@ -30115,12 +30369,13 @@ if (command === "passenger-sync-daemon") {
30115
30369
  const crontab = o.host === "linux" ? spawnSync14("crontab", ["-l"], { encoding: "utf8" }).stdout ?? "" : "";
30116
30370
  const schedulerAbsent = o.host !== "windows" ? !schedulerInstalled(planInstall(cfg.ship, CREW_HOME, o.host, detectSystemd(), "run", installContext()), unitExists, crontab) : true;
30117
30371
  const plan = planFix({ routes, schedulerAbsent, host: o.host });
30118
- for (const n of plan.notes) process.stdout.write(`fix: ${n}
30119
- `);
30120
30372
  if (plan.actions.length === 0) {
30121
- process.stdout.write("fix: nothing to change\n");
30373
+ for (const l of fixPhaseNothingToOffer({ notes: plan.notes, fixFlag: o.fixFlag, blockers: o.blockers, warnings: o.warnings })) process.stdout.write(`${l}
30374
+ `);
30122
30375
  return;
30123
30376
  }
30377
+ for (const n of plan.notes) process.stdout.write(`fix: ${n}
30378
+ `);
30124
30379
  const prompter = o.prompt ? terminalPrompter() : void 0;
30125
30380
  const changed2 = [];
30126
30381
  const enabledSound = new Set(routes.filter((r) => r.enabled && r.hasRepos && r.problems.length === 0).map((r) => r.route));
@@ -30294,13 +30549,14 @@ ${changed2.map((c) => ` - ${c}
30294
30549
  async function releaserLine(tracker, routeName, repo, release) {
30295
30550
  const who2 = release.ship ? `released by ${release.ship}` : "any ship may release";
30296
30551
  let lock2;
30552
+ let lockHeld = false;
30297
30553
  try {
30298
30554
  const st = await tracker.lockState(releaseLockScope(routeName, repo));
30299
- lock2 = st === void 0 ? "no Locks table" : !st.exists ? "lock row MISSING (run crew connect)" : st.holder ? `lock held by ${st.holder}` : "lock row free";
30555
+ lock2 = st === void 0 ? "no Locks table" : !st.exists ? "lock row MISSING (run crew connect)" : st.holder ? (lockHeld = true, `lock held by ${st.holder}`) : "lock row free";
30300
30556
  } catch (e) {
30301
30557
  lock2 = `lock unreadable (${e.message})`;
30302
30558
  }
30303
- return `${who2}; ${lock2}`;
30559
+ return { line: `${who2}; ${lock2}`, lockHeld };
30304
30560
  }
30305
30561
  async function sweepClosedTickets(c, target, branch, tracker, dryRun2, remit, idle = false) {
30306
30562
  if (remoteOf(target.dir)) return;
@@ -34796,81 +35052,63 @@ ${where.join("\n")}`);
34796
35052
  `);
34797
35053
  break;
34798
35054
  }
34799
- const owed = [
34800
- ...todo.map((i) => `${displayKey(i.ticket)} \u2014 ${i.reasons.join(", ")}${i.ticket.title ? ` \u2014 ${i.ticket.title}` : ""}`),
34801
- ...openShipAttention(state).map((i) => `ship ${cfg.ship.name}: ${i.kind} \u2014 ${i.message}`),
34802
- ...shipRows.filter((s) => s.name !== cfg.ship.name).flatMap((s) => (s.attention ?? []).map((i) => `ship ${s.name}: ${i.kind} \u2014 ${i.message}`))
34803
- ];
34804
- if (owed.length) process.stdout.write(`to do (${owed.length}):
34805
- ${owed.map((l) => ` ${l}
34806
- `).join("")}
34807
- `);
34808
- process.stdout.write(
34809
- `ship: ${cfg.ship.name} (${cfg.ship.platform})
34810
- route: ${route2.route} -> ${route2.dir}
34811
- enabled: ${route2.enabled}
34812
- periscopes: ${periscopeSummary(cfg)}
34813
- ` + (routeRelayUrl(route2) ? `relay: ${routeRelayUrl(route2)}
34814
- ` : "") + periscopes.map((p) => `periscope: ${p.ticket} ${p.repo} ${p.url} ${p.state}${p.serving ? "" : " (not serving)"} expires ${p.expiresAt}
34815
- `).join("") + `crew: ${state.isPaused() ? "paused" : "active"}
34816
- release: ${state.releaseSkipReason() ? "paused" : "active"}
34817
- watermark: ${state.watermark(routeSlug(route2.route))}
34818
- `
34819
- );
34820
- for (const r of ["dev", "design", "qa"]) {
34821
- if (state.isRolePaused(r)) process.stdout.write(`role ${r}: paused
34822
- `);
34823
- }
34824
- const reloadWaitingAt = readReloadRequestedAt(cfg.ship.stateDir);
34825
- if (reloadWaitingAt !== null) {
34826
- process.stdout.write(`reload: requested ${Math.max(0, Math.round((Date.now() - reloadWaitingAt) / 1e3))}s ago, not yet honored \u2014 \`crew reload --now\` forces it
34827
- `);
34828
- }
34829
- if (projects.length) process.stdout.write(`projects: ${projects.map((p) => p.label).join(", ")}
34830
- `);
34831
- for (const i of openShipAttention(state)) {
34832
- process.stdout.write(`attention: ${i.kind} \u2014 ${i.message}
34833
- `);
34834
- }
34835
- for (const r of await resolvedRepos(route2)) {
34836
- const bh = baseHealth(r);
34837
- if (bh.unsafe) process.stdout.write(`base: ${r.name} \u2014 UNSAFE, no worktree cuts or releases: ${bh.detail}
34838
- `);
34839
- process.stdout.write(`releaser: ${r.name} \u2014 ${await releaserLine(statusTracker, route2.route, r.name, r.config.release)}
34840
- `);
34841
- }
35055
+ const shipAttention = openShipAttention(state);
35056
+ let heldReleases = [];
34842
35057
  try {
34843
35058
  const open = await statusTracker.openTickets();
34844
- const held = heldByBlockers(
35059
+ heldReleases = describeHeld(heldByBlockers(
34845
35060
  open,
34846
35061
  statusTracker.contract.statuses.verified,
34847
35062
  blockerInfoMap(open, await statusTracker.ticketsByIds(missingBlockerIds(open)))
34848
- );
34849
- for (const line of describeHeld(held)) process.stdout.write(`release: ${line}
34850
- `);
35063
+ ));
34851
35064
  } catch {
34852
35065
  }
34853
- if (waiting) {
34854
- process.stdout.write(
34855
- `waiting: ${waiting.ticket} for ${since(waiting.since)} (passed over ${fairness.streak()} cycle${fairness.streak() === 1 ? "" : "s"} running)
34856
- `
34857
- );
34858
- }
34859
- for (const x of runs) {
34860
- process.stdout.write(`running: ${x.role} \u2014 ${x.ticket ?? "(no ticket)"}${x.repo ? ` in ${x.repo}` : ""} (pid ${x.pid}, since ${x.spawnedAt}${x.deadline ? `, deadline ${x.deadline}` : ""})
34861
- `);
35066
+ const repoViews = [];
35067
+ for (const r of await resolvedRepos(route2)) {
35068
+ const bh = baseHealth(r);
35069
+ const rel = await releaserLine(statusTracker, route2.route, r.name, r.config.release);
35070
+ repoViews.push({
35071
+ name: r.name,
35072
+ unsafeDetail: bh.unsafe ? bh.detail : void 0,
35073
+ releaser: rel.line,
35074
+ notable: rel.lockHeld || !!r.config.release.ship && r.config.release.ship !== cfg.ship.name
35075
+ });
34862
35076
  }
34863
- if (shipRows.length) {
34864
- process.stdout.write("ships:\n");
34865
- for (const s of shipRows) {
34866
- process.stdout.write(` ${renderShipLine(s, issueLabelById)}
34867
- `);
34868
- if (s.name !== cfg.ship.name) {
34869
- for (const i of s.attention ?? []) process.stdout.write(` attention: ${i.kind} \u2014 ${i.message}
35077
+ const reloadWaitingAt = readReloadRequestedAt(cfg.ship.stateDir);
35078
+ const lastRunView = [...lastRuns.values()].filter((l) => l.route === routeSlug(route2.route)).map((l) => ({ role: l.role, ticket: l.ticket, finishedAt: l.finishedAt, outcome: l.outcome }));
35079
+ for (const line of renderStatus({
35080
+ ship: { name: cfg.ship.name, platform: cfg.ship.platform },
35081
+ route: { name: route2.route, dir: route2.dir, enabled: route2.enabled },
35082
+ crewPaused: state.isPaused(),
35083
+ releasePaused: state.releaseSkipReason() !== null,
35084
+ pausedRoles: ["dev", "design", "qa"].filter((r) => state.isRolePaused(r)),
35085
+ periscopes: {
35086
+ summary: periscopeSummary(cfg),
35087
+ relayUrl: routeRelayUrl(route2) || void 0,
35088
+ live: periscopes.map((p) => `${p.ticket} ${p.repo} ${p.url} ${p.state}${p.serving ? "" : " (not serving)"} expires ${p.expiresAt}`)
35089
+ },
35090
+ watermark: String(state.watermark(routeSlug(route2.route))),
35091
+ projects: projects.map((p) => p.label),
35092
+ reloadRequestedSecondsAgo: reloadWaitingAt === null ? null : Math.max(0, Math.round((Date.now() - reloadWaitingAt) / 1e3)),
35093
+ runs: runs.map((x) => ({ role: x.role, ticket: x.ticket, repo: x.repo, pid: x.pid, spawnedAt: x.spawnedAt, deadline: x.deadline })),
35094
+ lastRuns: lastRunView,
35095
+ attention: shipAttention.map((i) => ({ kind: i.kind, message: i.message, since: i.since })),
35096
+ waiting: todo.map((i) => ({
35097
+ key: displayKey(i.ticket),
35098
+ title: i.ticket.title,
35099
+ reasons: i.reasons,
35100
+ updatedAt: i.ticket.updated_at
35101
+ })),
35102
+ repos: repoViews,
35103
+ heldReleases,
35104
+ starved: waiting ? { ticket: waiting.ticket, since: waiting.since, streak: fairness.streak() } : void 0,
35105
+ ships: shipRows.map((s) => ({
35106
+ name: s.name ?? "(unnamed)",
35107
+ line: renderShipLine(s, issueLabelById),
35108
+ attention: (s.attention ?? []).map((i) => ({ kind: i.kind, message: i.message }))
35109
+ }))
35110
+ }, { verbose: flag("verbose") })) process.stdout.write(`${line}
34870
35111
  `);
34871
- }
34872
- }
34873
- }
34874
35112
  break;
34875
35113
  }
34876
35114
  case "doctor": {
@@ -35030,50 +35268,51 @@ watermark: ${state.watermark(routeSlug(route2.route))}
35030
35268
  `);
35031
35269
  break;
35032
35270
  }
35033
- process.stdout.write(
35271
+ const R = new DoctorReport();
35272
+ R.line(
35034
35273
  `ship: ${cfg.ship.name} (${host})
35035
35274
  routes: ${cfg.routes.map((c) => c.route).join(", ")}
35036
35275
  `
35037
35276
  );
35038
35277
  if (staleBundle) {
35039
- process.stdout.write(`bundle: BLOCKER ${staleBundle.message}
35278
+ R.line(`bundle: BLOCKER ${staleBundle.message}
35040
35279
  `);
35041
35280
  process.exitCode = 1;
35042
35281
  }
35043
35282
  const dockerFinding = dockerDaemonFinding({ needed: await shipNeedsDocker(), up: dockerAvailable() });
35044
35283
  const dockerNote = dockerFinding ? " (consequence of the Docker finding above)" : "";
35045
35284
  if (dockerFinding) {
35046
- process.stdout.write(`docker: BLOCKER ${dockerFinding.message} \u2014 ${dockerFinding.remedy}
35285
+ R.line(`docker: BLOCKER ${dockerFinding.message} \u2014 ${dockerFinding.remedy}
35047
35286
  `);
35048
35287
  process.exitCode = 1;
35049
35288
  }
35050
35289
  for (const f of deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerFinding))) {
35051
- process.stdout.write(`tunnel: DEAD ${f.message} \u2014 ${f.remedy}
35290
+ R.line(`tunnel: DEAD ${f.message} \u2014 ${f.remedy}
35052
35291
  `);
35053
35292
  }
35054
- for (const w of roleCapWarnings(cfg.ship)) process.stdout.write(`role concurrency: WARN ${w}
35293
+ for (const w of roleCapWarnings(cfg.ship)) R.line(`role concurrency: WARN ${w}
35055
35294
  `);
35056
- for (const r of cfg.routes) for (const f of routeAvatarFailures(cfg.ship.stateDir, r.route)) process.stdout.write(`persona avatar: WARN ${r.route}: ${f.role} avatar failed to upload (${f.detail}); run \`crew agents sync\` again
35295
+ for (const r of cfg.routes) for (const f of routeAvatarFailures(cfg.ship.stateDir, r.route)) R.line(`persona avatar: WARN ${r.route}: ${f.role} avatar failed to upload (${f.detail}); run \`crew agents sync\` again
35057
35296
  `);
35058
- for (const t of rejectedTunnels(cfg.ship.stateDir)) process.stdout.write(`relay tunnel: ATTENTION ${tunnelRejectedMessage(t.workspaceId, t.quickExits)}
35297
+ for (const t of rejectedTunnels(cfg.ship.stateDir)) R.line(`relay tunnel: ATTENTION ${tunnelRejectedMessage(t.workspaceId, t.quickExits)}
35059
35298
  `);
35060
- for (const workspaceId of controlRefusedTunnels(cfg.ship.stateDir)) process.stdout.write(`relay tunnel: ATTENTION ${relayControlUnsupportedMessage(workspaceId)}
35299
+ for (const workspaceId of controlRefusedTunnels(cfg.ship.stateDir)) R.line(`relay tunnel: ATTENTION ${relayControlUnsupportedMessage(workspaceId)}
35061
35300
  `);
35062
- process.stdout.write(`periscopes: ${periscopeSummary(cfg)}
35301
+ R.line(`periscopes: ${periscopeSummary(cfg)}
35063
35302
  `);
35064
- process.stdout.write(`key store: ${describeKeyStore(cfg.ship)}
35303
+ R.line(`key store: ${describeKeyStore(cfg.ship)}
35065
35304
  `);
35066
35305
  const previewProblem = await previewHostProblem(cfg);
35067
35306
  if (previewProblem) {
35068
35307
  const blocks = previewHostFinding(previewProblem).severity === "blocker";
35069
- process.stdout.write(` ${blocks ? "BLOCKER" : "ATTENTION"} ${previewProblem}
35308
+ R.line(` ${blocks ? "BLOCKER" : "ATTENTION"} ${previewProblem}
35070
35309
  `);
35071
35310
  if (blocks) process.exitCode = 1;
35072
35311
  }
35073
35312
  try {
35074
35313
  const evFile = eventFileFor(cfg.ship.stateDir);
35075
35314
  const evSize = existsSync60(evFile) ? statSync19(evFile).size : 0;
35076
- process.stdout.write(
35315
+ R.line(
35077
35316
  evSize > cfg.ship.eventsRotateBytes * 4 ? `events log: WARN ${evFile} is ${Math.round(evSize / 1048576)} MB (> 4x eventsRotateBytes); run \`crew reap\` to rotate it
35078
35317
  ` : "events log: ok\n"
35079
35318
  );
@@ -35089,7 +35328,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
35089
35328
  }
35090
35329
  });
35091
35330
  if (abandons === false) {
35092
- process.stdout.write(
35331
+ R.line(
35093
35332
  "scheduler unit: WARN the installed unit does not leave agent runs alone when the daemon restarts (no AbandonProcessGroup / KillMode=process) \u2014 a daemon crash or relaunch kills the run in flight; run `crew install`\n"
35094
35333
  );
35095
35334
  }
@@ -35104,7 +35343,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
35104
35343
  }
35105
35344
  });
35106
35345
  if (keeps === false) {
35107
- process.stdout.write(
35346
+ R.line(
35108
35347
  "passengers unit: WARN the installed unit lacks KillMode=process, so systemd kills the relay tunnel each time the sync exits (tunnel never reaches connected); run `crew install`\n"
35109
35348
  );
35110
35349
  }
@@ -35115,19 +35354,19 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
35115
35354
  if (ctl.statusCommand && unitPlan.unitPaths.some((p) => existsSync60(p))) {
35116
35355
  const st = spawnSync14(ctl.statusCommand[0], ctl.statusCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8" });
35117
35356
  if (!st.error && st.status !== 0) {
35118
- process.stdout.write("daemon unit: WARN installed but not running \u2014 no work is picked up; run `crew reload` (or `crew daemon start`), and `crew install` if the unit still says Restart=on-failure\n");
35357
+ R.line("daemon unit: WARN installed but not running \u2014 no work is picked up; run `crew reload` (or `crew daemon start`), and `crew install` if the unit still says Restart=on-failure\n");
35119
35358
  }
35120
35359
  }
35121
35360
  }
35122
35361
  if (daemonLiveness) {
35123
- process.stdout.write(`daemon: ${daemonLineText(daemonLiveness)}
35362
+ R.line(`daemon: ${daemonLineText(daemonLiveness)}
35124
35363
  `);
35125
35364
  if (daemonLiveness.state === "exited") process.exitCode = 1;
35126
35365
  }
35127
35366
  const daemonDead = daemonKnownDead(daemonLiveness);
35128
35367
  const reloadAt = readReloadRequestedAt(cfg.ship.stateDir);
35129
35368
  if (reloadAt !== null) {
35130
- process.stdout.write(
35369
+ R.line(
35131
35370
  `reload request: ${reloadRequestText(Math.max(0, Math.round((Date.now() - reloadAt) / 1e3)), daemonLiveness, liveRuns(cfg.ship.stateDir).length)}
35132
35371
  `
35133
35372
  );
@@ -35136,7 +35375,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
35136
35375
  if (daemonStartedAt !== null) {
35137
35376
  const changed2 = configChangedAfter(daemonConfigPaths(cfg), daemonStartedAt);
35138
35377
  if (changed2) {
35139
- process.stdout.write(
35378
+ R.line(
35140
35379
  daemonDead ? `daemon config: WARN ${changed2} changed at ${new Date(statSync19(changed2).mtimeMs).toISOString()} \u2014 no daemon is running; the new config applies when it starts
35141
35380
  ` : `daemon config: WARN ${changed2} changed at ${new Date(statSync19(changed2).mtimeMs).toISOString()} but the daemon started at ${new Date(daemonStartedAt).toISOString()} \u2014 run \`crew reload\`
35142
35381
  `
@@ -35148,82 +35387,85 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
35148
35387
  const have = sentVersion(cfg.ship);
35149
35388
  const floor = await readCrewFloor(route2, cfg.ship);
35150
35389
  if (have && floor) {
35151
- process.stdout.write(
35390
+ R.line(
35152
35391
  `crew version: ${belowFloor(have, floor) ? "WARN " : ""}${have} (workspace requires ${floor})${belowFloor(have, floor) ? " \u2014 update crew (the Crew app, or `npm install -g @tablation/crew`)" : ""}
35153
35392
  `
35154
35393
  );
35155
35394
  } else if (have) {
35156
- process.stdout.write(`crew version: ${have}${floor === null ? " (workspace sets no minimum)" : ""}
35395
+ R.line(`crew version: ${have}${floor === null ? " (workspace sets no minimum)" : ""}
35157
35396
  `);
35158
35397
  }
35159
35398
  }
35160
35399
  const contractProblems = validateContract(tracker.contract);
35161
- process.stdout.write(
35400
+ R.line(
35162
35401
  contractProblems.length ? `contract: ${contractProblems.length} problem(s)
35163
35402
  ` + contractProblems.map((p) => ` - ${p}
35164
35403
  `).join("") : "contract: consistent\n"
35165
35404
  );
35405
+ R.repoNames = reposOf(route2).map((t) => t.name);
35166
35406
  for (const r of await resolvedRepos(route2)) {
35167
35407
  const { config } = r;
35408
+ R.repo = r.name;
35168
35409
  const worktreePattern = config.worktrees.name ?? (config.provenance["worktrees.prefix"] !== "default" ? `${config.worktrees.prefix}<number>` : `${basename17(r.dir.replace(/[/\\]+$/, ""))}-${effectiveBranchTemplate(config, void 0)}`);
35169
- process.stdout.write(
35410
+ R.line(
35170
35411
  `${`repo ${r.name}:`.padEnd(19)}${r.dir}
35171
35412
  worktrees at ../${worktreePattern} (${config.provenance["worktrees.name"] ?? config.provenance["worktrees.prefix"] ?? "default"}), branch ${config.branch.name}
35172
35413
  requires ${config.platform} \u2014 ${satisfies(host, config.platform) ? "OK" : "MISMATCH"}
35173
35414
  `
35174
35415
  );
35175
35416
  if (config.shadowed.length) {
35176
- process.stdout.write(
35417
+ R.line(
35177
35418
  ` this ship declares ${config.shadowed.join(", ")}, and ${r.name} overrides it \u2014 the repo wins
35178
35419
  `
35179
35420
  );
35180
35421
  }
35181
35422
  for (const p2 of validateEffective(config)) {
35182
- process.stdout.write(` - release readiness: ${p2}
35423
+ R.line(` - release readiness: ${p2}
35183
35424
  `);
35184
35425
  }
35185
- process.stdout.write(` release self-repair: ${selfRepairLine(config.release.isolateFailures?.maxCandidates)}
35426
+ R.line(` release self-repair: ${selfRepairLine(config.release.isolateFailures?.maxCandidates)}
35186
35427
  `);
35187
35428
  const dh = doctorBaseReport(r, config.branch.base, baseHealth);
35188
- process.stdout.write(dh.text);
35429
+ R.line(dh.text);
35189
35430
  if (dh.failed) process.exitCode = 1;
35190
35431
  if (dh.skipRest) continue;
35191
35432
  if (config.release.ship) {
35192
- process.stdout.write(` release.ship ${config.release.ship}${config.release.ship === cfg.ship.name ? " (this ship)" : ""}
35433
+ R.line(` release.ship ${config.release.ship}${config.release.ship === cfg.ship.name ? " (this ship)" : ""}
35193
35434
  `);
35194
35435
  } else {
35195
35436
  const warn = missingReleaserWarning(r.name, config.release, await tracker.shipRows().catch(() => []));
35196
- if (warn) process.stdout.write(` WARNING ${warn}
35437
+ if (warn) R.line(` WARNING ${warn}
35197
35438
  `);
35198
35439
  }
35199
35440
  const scope = releaseLockScope(route2.route, r.name);
35200
35441
  const lock2 = await tracker.lockState(scope).catch(() => void 0);
35201
35442
  if (lock2?.holder && staleOwnLockClaim(lock2.holder, cfg.ship.name)) {
35202
- process.stdout.write(` ${formatStaleOwnLock(scope, lock2.holder)}`);
35443
+ R.line(` ${formatStaleOwnLock(scope, lock2.holder)}`);
35203
35444
  }
35204
35445
  }
35446
+ R.repo = void 0;
35205
35447
  const missingAuthorship = await tracker.missingAuthorshipColumns();
35206
- process.stdout.write(
35448
+ R.line(
35207
35449
  missingAuthorship.length === 0 ? "authorship: filed_by_id, ship_id present\n" : `authorship: missing ${missingAuthorship.join(", ")} \u2014 update the Issues template
35208
35450
  `
35209
35451
  );
35210
35452
  const missingRuntime = await tracker.missingRuntimeColumns();
35211
- process.stdout.write(
35453
+ R.line(
35212
35454
  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
35213
35455
  `
35214
35456
  );
35215
35457
  {
35216
35458
  const have = await tracker.linkColumns();
35217
35459
  const lines2 = linkDoctorLines(have, reposOf(route2).map((t) => ({ name: t.name, host: t.forgeHost })), cfg.ship.forges, cfg.ship.stateDir);
35218
- process.stdout.write(`${lines2.join("\n")}
35460
+ R.line(`${lines2.join("\n")}
35219
35461
  `);
35220
35462
  }
35221
- process.stdout.write(
35463
+ R.line(
35222
35464
  await tracker.hasPublicReplyColumn() ? `public replies: Comments.${tracker.contract.comments.publicReply} present \u2014 public reporters are labelled in the digest
35223
35465
  ` : `public replies: Comments.${tracker.contract.comments.publicReply} absent \u2014 no public intake form, nothing to guard
35224
35466
  `
35225
35467
  );
35226
- process.stdout.write(
35468
+ R.line(
35227
35469
  await tracker.hasCrewAssistedColumn() ? `crew assisted: Issues.${tracker.contract.columns.crewAssisted} present \u2014 Dev/QA runs mark the ticket
35228
35470
  ` : `crew assisted: Issues.${tracker.contract.columns.crewAssisted} absent \u2014 tickets are not marked; update the Issues template to adopt it
35229
35471
  `
@@ -35237,44 +35479,44 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
35237
35479
  tablePresent: periscopes.present,
35238
35480
  repos: settled.map((r) => ({ name: r.name, hasPreviewHook: !!r.config.hooks.preview }))
35239
35481
  })) {
35240
- process.stdout.write(`periscopes: ${f.severity.toUpperCase()} ${f.message}
35482
+ R.line(`periscopes: ${f.severity.toUpperCase()} ${f.message}
35241
35483
  `);
35242
35484
  }
35243
35485
  if (!flag("offline")) {
35244
35486
  for (const f of await duplicateLivePeriscopeProblems(route2, cfg.ship)) {
35245
- process.stdout.write(`periscopes: ${f.severity.toUpperCase()} ${f.message}
35487
+ R.line(`periscopes: ${f.severity.toUpperCase()} ${f.message}
35246
35488
  `);
35247
35489
  }
35248
35490
  }
35249
35491
  }
35250
- process.stdout.write(
35492
+ R.line(
35251
35493
  !periscopes.present ? "periscopes: Periscopes table absent \u2014 this workspace cannot host periscopes\n" : periscopes.missing.length === 0 ? `periscopes: Periscopes table present (${periscopes.modelId})
35252
35494
  ` : `periscopes: Periscopes table present (${periscopes.modelId}) but missing ${periscopes.missing.join(", ")} \u2014 update the Issues template
35253
35495
  `
35254
35496
  );
35255
- process.stdout.write(
35497
+ R.line(
35256
35498
  route2.resolved?.releaseSeat ? "release seat: this ship has its own Release Crew row\n" : "release seat: none \u2014 release comments are credited to the dev seat; run `crew connect` once the Crew table has this ship's row\n"
35257
35499
  );
35258
35500
  const keyRole = route2.resolved?.role ?? await fetchKeyRole(route2, cfg.ship.userAgent);
35259
35501
  const roleRoute = route2.resolved && keyRole ? { ...route2, resolved: { ...route2.resolved, role: keyRole } } : route2;
35260
- process.stdout.write(`api key role: ${keyRole ?? "unknown"}
35502
+ R.line(`api key role: ${keyRole ?? "unknown"}
35261
35503
  `);
35262
- for (const m of route2.resolved?.capabilityMisses ?? []) process.stdout.write(`capability: MISSING ${m} (re-run \`crew connect\` once granted)
35504
+ for (const m of route2.resolved?.capabilityMisses ?? []) R.line(`capability: MISSING ${m} (re-run \`crew connect\` once granted)
35263
35505
  `);
35264
35506
  const canMint = await canMintAgentKeys(roleRoute, { userAgent: cfg.ship.userAgent });
35265
- process.stdout.write(`can mint agent keys: ${canMint === void 0 ? "unknown" : canMint ? "yes" : "no"}
35507
+ R.line(`can mint agent keys: ${canMint === void 0 ? "unknown" : canMint ? "yes" : "no"}
35266
35508
  `);
35267
35509
  for (const role of SEAT_KEY_ROLES) {
35268
35510
  if (!route2.resolved?.seats[role]) continue;
35269
35511
  const id = await resolveSeatKey(roleRoute, role);
35270
- process.stdout.write(
35512
+ R.line(
35271
35513
  `seat identity: ${role} writes as ${id.kind === "agent" ? `its own agent (${id.agentId})` : `the ship (${id.reason})`}
35272
35514
  `
35273
35515
  );
35274
35516
  }
35275
35517
  if (route2.resolved?.releaseSeat) {
35276
35518
  const id = await resolveReleaseKey(roleRoute);
35277
- process.stdout.write(
35519
+ R.line(
35278
35520
  `seat identity: release writes as ${id.kind === "agent" ? `its own agent (${id.agentId})` : `the ship (${id.reason})`}
35279
35521
  `
35280
35522
  );
@@ -35282,54 +35524,54 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
35282
35524
  if (!flag("offline")) {
35283
35525
  for (const p of await probeSeatReads(roleRoute, { userAgent: cfg.ship.userAgent })) {
35284
35526
  if (p.state === "forbidden") {
35285
- process.stdout.write(`${describeSeatForbidden(p.role, p.tables)}
35527
+ R.line(`${describeSeatForbidden(p.role, p.tables)}
35286
35528
  `);
35287
35529
  process.exitCode = 1;
35288
35530
  } else {
35289
- process.stdout.write(p.state === "ok" ? `${describeSeatTables(p.role, p.tables)}
35531
+ R.line(p.state === "ok" ? `${describeSeatTables(p.role, p.tables)}
35290
35532
  ` : `seat read: ${p.role} could not be checked (${p.detail})
35291
35533
  `);
35292
35534
  }
35293
35535
  }
35294
35536
  for (const w of await probeSeatWrites(roleRoute, { userAgent: cfg.ship.userAgent })) {
35295
35537
  if (w.state === "forbidden") {
35296
- process.stdout.write(`seat write: ERROR ${seatCannotWriteMessage(w.role, w.tables)} (READ only) \u2014 ${SEAT_NO_WRITE_REMEDY}
35538
+ R.line(`seat write: ERROR ${seatCannotWriteMessage(w.role, w.tables)} (READ only) \u2014 ${SEAT_NO_WRITE_REMEDY}
35297
35539
  `);
35298
35540
  process.exitCode = 1;
35299
- } else if (w.state === "ok") process.stdout.write(`seat write: ${w.role}: ok
35541
+ } else if (w.state === "ok") R.line(`seat write: ${w.role}: ok
35300
35542
  `);
35301
35543
  }
35302
35544
  }
35303
35545
  const [ships, crewRows] = await Promise.all([tracker.shipRows(), tracker.crewRows()]);
35304
35546
  if (ships.length === 0) {
35305
- process.stdout.write("ship record: this workspace has no Ships table (fine)\n");
35547
+ R.line("ship record: this workspace has no Ships table (fine)\n");
35306
35548
  } else {
35307
35549
  const matched = matchShipRows(ships, cfg.ship.name, doctorMachineId(cfg.ship.stateDir));
35308
35550
  const mine = matched.rows;
35309
- process.stdout.write(
35551
+ R.line(
35310
35552
  matched.hasColumn ? `ship row: ${mine.length === 1 ? `matched by ${matched.by === "machine_id" ? "machine id" : "name"}` : "not matched"}
35311
35553
  ` : "ship row: matched by name only \u2014 the Ships table has no machine_id column (update the Issues template)\n"
35312
35554
  );
35313
35555
  if (mine.length === 0) {
35314
- process.stdout.write(
35556
+ R.line(
35315
35557
  `ship record: NO row named "${cfg.ship.name}" \u2014 have: ${ships.map((s2) => s2.name).join(", ")}
35316
35558
  `
35317
35559
  );
35318
35560
  } else if (mine.length > 1) {
35319
- process.stdout.write(`ship record: ${mine.length} rows named "${cfg.ship.name}" \u2014 ambiguous
35561
+ R.line(`ship record: ${mine.length} rows named "${cfg.ship.name}" \u2014 ambiguous
35320
35562
  `);
35321
35563
  } else {
35322
35564
  const row = mine[0];
35323
35565
  const seats2 = crewRows.filter((c) => c.ship_id === row.id);
35324
35566
  const declared = row.platform;
35325
- process.stdout.write(
35567
+ R.line(
35326
35568
  `ship record: ${row.name} (${declared ?? "no platform"})${declared && declared !== host ? ` \u2014 MISMATCH, this host is ${host}` : ""}
35327
35569
  crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "none"}
35328
35570
  `
35329
35571
  );
35330
- for (const w of managedRuntimeWarnings(row.kind, cfg.ship)) process.stdout.write(`managed runtime: WARN ${w}
35572
+ for (const w of managedRuntimeWarnings(row.kind, cfg.ship)) R.line(`managed runtime: WARN ${w}
35331
35573
  `);
35332
- for (const w of managedGitIdentityWarnings(row.kind, readGlobalGitIdentity())) process.stdout.write(`managed git: WARN ${w}
35574
+ for (const w of managedGitIdentityWarnings(row.kind, readGlobalGitIdentity())) R.line(`managed git: WARN ${w}
35333
35575
  `);
35334
35576
  }
35335
35577
  }
@@ -35337,20 +35579,20 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35337
35579
  const op = route2.resolved?.operator;
35338
35580
  const row = op ? crewRows.find((c) => c.id === op) : void 0;
35339
35581
  if (!op) {
35340
- process.stdout.write("operator identity: no operator on this route \u2014 run `crew connect`\n");
35582
+ R.line("operator identity: no operator on this route \u2014 run `crew connect`\n");
35341
35583
  } else if (!row) {
35342
- process.stdout.write(`operator identity: ERROR operator ${op} is not a row of the Crew table
35584
+ R.line(`operator identity: ERROR operator ${op} is not a row of the Crew table
35343
35585
  `);
35344
35586
  process.exitCode = 1;
35345
35587
  } else if (!row.user_id) {
35346
- process.stdout.write(
35588
+ R.line(
35347
35589
  `operator identity: ERROR Crew row "${row.name ?? op}" has no user_id \u2014 their UI comments will read "(no identity)"; re-run \`crew connect\` to link it
35348
35590
  `
35349
35591
  );
35350
35592
  process.exitCode = 1;
35351
35593
  } else {
35352
35594
  const resolves = memberByIdentity(buildRoster(configuredMembers(route2), crewRows), row.user_id);
35353
- process.stdout.write(
35595
+ R.line(
35354
35596
  resolves ? `operator identity: comments from ${row.name ?? op} resolve to ${crewLabel(resolves)}
35355
35597
  ` : `operator identity: ERROR user_id ${row.user_id} does not resolve through the roster
35356
35598
  `
@@ -35362,12 +35604,12 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35362
35604
  try {
35363
35605
  const humanHolds = new Set(holdIds(buildRoster(configuredMembers(route2), crewRows)));
35364
35606
  const warnings = holdWarnings(await tracker.openTickets(), ships, tracker.contract, humanHolds);
35365
- process.stdout.write(
35607
+ R.line(
35366
35608
  warnings.length === 0 ? "ship holds: every in-flight ticket is held by a live ship\n" : warnings.map((w) => `ship holds: WARNING ${w}
35367
35609
  `).join("")
35368
35610
  );
35369
35611
  } catch (e) {
35370
- process.stdout.write(`ship holds: could not check \u2014 ${e.message}
35612
+ R.line(`ship holds: could not check \u2014 ${e.message}
35371
35613
  `);
35372
35614
  }
35373
35615
  }
@@ -35381,16 +35623,16 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35381
35623
  const binPath = findOnPath(runBin, schedulerPath);
35382
35624
  if (!binPath) allBinsFound = false;
35383
35625
  const label = tc.name === defaultToolchain ? "agent binary: " : `toolchain ${tc.name}:`.padEnd(18);
35384
- process.stdout.write(
35626
+ R.line(
35385
35627
  `${label} ${runBin} \u2014 ${binPath ? `OK (${binPath})` : "NOT FOUND on the scheduler PATH"}${tc.name === defaultToolchain ? "" : ` [${adapter.displayName}]`}
35386
35628
  `
35387
35629
  );
35388
- for (const limit of adapter.limitations) process.stdout.write(` cannot enforce: ${limit}
35630
+ for (const limit of adapter.limitations) R.line(` cannot enforce: ${limit}
35389
35631
  `);
35390
35632
  if (isOmlxLauncher(tc)) {
35391
35633
  const s = readOmlxSettings();
35392
35634
  if (!s) {
35393
- process.stdout.write(` omlx: ~/.omlx/settings.json not found or has no server.port \u2014 cannot check the server
35635
+ R.line(` omlx: ~/.omlx/settings.json not found or has no server.port \u2014 cannot check the server
35394
35636
  `);
35395
35637
  } else {
35396
35638
  let status2;
@@ -35400,32 +35642,32 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35400
35642
  status2 = void 0;
35401
35643
  }
35402
35644
  const probe = interpretOmlxProbe(status2);
35403
- process.stdout.write(` omlx server: ${s.host}:${s.port} \u2014 ${probe.detail}${probe.up ? "" : " (start oMLX)"}
35645
+ R.line(` omlx server: ${s.host}:${s.port} \u2014 ${probe.detail}${probe.up ? "" : " (start oMLX)"}
35404
35646
  `);
35405
- process.stdout.write(
35647
+ R.line(
35406
35648
  ` omlx model: ${tc.model} \u2014 ${omlxModelPresent(tc.model, s.modelDirs) ? "present" : `NOT FOUND in ${s.modelDirs.join(", ") || "any model dir"}`}
35407
35649
  `
35408
35650
  );
35409
35651
  }
35410
- process.stdout.write(` local model: tool-call reliability and prefill speed vary by model
35652
+ R.line(` local model: tool-call reliability and prefill speed vary by model
35411
35653
  `);
35412
35654
  }
35413
35655
  if (isOriLauncher(tc)) {
35414
- process.stdout.write(` ori: headless auth under the scheduler is unverified \u2014 run \`ori login\` as the scheduler user, then confirm a run records provider openrouter (see docs/toolchains.md)
35656
+ R.line(` ori: headless auth under the scheduler is unverified \u2014 run \`ori login\` as the scheduler user, then confirm a run records provider openrouter (see docs/toolchains.md)
35415
35657
  `);
35416
35658
  }
35417
35659
  }
35418
35660
  for (const [repoName, ov] of Object.entries(route2.repoOverrides)) {
35419
- if (ov.toolchain) process.stdout.write(`repo toolchain: ${repoName} \u2192 ${ov.toolchain} (binary and MCP checked above, as for every ship toolchain)
35661
+ if (ov.toolchain) R.line(`repo toolchain: ${repoName} \u2192 ${ov.toolchain} (binary and MCP checked above, as for every ship toolchain)
35420
35662
  `);
35421
35663
  }
35422
- if (cfg.ship.forges) process.stdout.write(formatPushAuth("credential helper", probeCredentialHelper(crewCommandLine())).replace("push auth credential helper:", "credential helper:".padEnd(19)));
35423
- for (const p of pushAuth) process.stdout.write(formatPushAuth(`${p.repo}`, p.result));
35424
- for (const t of toolRows) process.stdout.write(formatToolCheck(t));
35425
- process.stdout.write(`git: ${gitPath ? `OK (${gitPath})` : "NOT FOUND on the scheduler PATH"}
35664
+ if (cfg.ship.forges) R.line(formatPushAuth("credential helper", probeCredentialHelper(crewCommandLine())).replace("push auth credential helper:", "credential helper:".padEnd(19)));
35665
+ for (const p of pushAuth) R.line(formatPushAuth(`${p.repo}`, p.result), { repo: p.repo });
35666
+ for (const t of toolRows) R.line(formatToolCheck(t));
35667
+ R.line(`git: ${gitPath ? `OK (${gitPath})` : "NOT FOUND on the scheduler PATH"}
35426
35668
  `);
35427
35669
  if (!allBinsFound || !gitPath) {
35428
- process.stdout.write(
35670
+ R.line(
35429
35671
  ` scheduler PATH is ${schedulerPath} \u2014 add the directory holding the missing binary to ship.extraPath in crew.yaml, then re-run \`crew doctor\`.
35430
35672
  `
35431
35673
  );
@@ -35439,7 +35681,7 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35439
35681
  seenMcp.add(id);
35440
35682
  const adapter = adapterFor(tc.harness);
35441
35683
  const m = adapter.inspectMcp({ bin: tc.bin, url: mcpUrl, key: route2.apiKey });
35442
- process.stdout.write(
35684
+ R.line(
35443
35685
  m.state === "registered" ? `mcp: tablation registered (user scope) \u2192 ${m.url}
35444
35686
  ` : m.state === "no-binary" ? `mcp: ${tc.bin} not found \u2014 ${adapter.displayName} was not checked
35445
35687
  ` : m.state === "different" ? `mcp: tablation registered but not for this route \u2014 ${m.detail}
@@ -35451,11 +35693,11 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35451
35693
  for (const h of shipPair(cfg.ship).filter((x) => x !== "claude")) {
35452
35694
  const inst = pairInstallerFor(h);
35453
35695
  const v = inst.verifyPair({ url: mcpUrlFor(route2.baseUrl) });
35454
- process.stdout.write(`pair ${h}:`.padEnd(19) + (v.ok ? ` installed (${v.detail})
35696
+ R.line(`pair ${h}:`.padEnd(19) + (v.ok ? ` installed (${v.detail})
35455
35697
  ` : ` NOT installed \u2014 ${v.detail}; run crew connect
35456
35698
  `));
35457
35699
  const envWarn = inst.envWarning?.({ url: mcpUrlFor(route2.baseUrl) });
35458
- if (envWarn) process.stdout.write(`pair ${h} env:`.padEnd(19) + ` WARN \u2014 ${envWarn}
35700
+ if (envWarn) R.line(`pair ${h} env:`.padEnd(19) + ` WARN \u2014 ${envWarn}
35459
35701
  `);
35460
35702
  }
35461
35703
  const shipVendors = new Set(shipToolchains(cfg.ship).map(toolchainVendor));
@@ -35465,11 +35707,11 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35465
35707
  const persona = await fetchSeatPersona(route2, role, { userAgent: cfg.ship.userAgent });
35466
35708
  if (persona?.vendor && !shipVendors.has(persona.vendor)) {
35467
35709
  flagged++;
35468
- process.stdout.write(`seat vendor: ${role} persona wants "${persona.vendor}" \u2014 no toolchain on this ship serves it (have: ${[...shipVendors].join(", ")}); it will run ${resolveSeat(cfg.ship, route2, role).toolchain.name} with a warning
35710
+ R.line(`seat vendor: ${role} persona wants "${persona.vendor}" \u2014 no toolchain on this ship serves it (have: ${[...shipVendors].join(", ")}); it will run ${resolveSeat(cfg.ship, route2, role).toolchain.name} with a warning
35469
35711
  `);
35470
35712
  }
35471
35713
  }
35472
- if (flagged === 0) process.stdout.write("seat vendor: OK (every persona vendor has a toolchain on this ship)\n");
35714
+ if (flagged === 0) R.line("seat vendor: OK (every persona vendor has a toolchain on this ship)\n");
35473
35715
  }
35474
35716
  for (const c of cfg.routes.filter((r) => r.enabled)) {
35475
35717
  let repos;
@@ -35498,8 +35740,8 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35498
35740
  clearShipAttention(state, key);
35499
35741
  continue;
35500
35742
  }
35501
- process.stdout.write(`hook ${c.route}/${r.name} ${name}: \`${cmd}\` NOT FOUND in the sandbox image
35502
- `);
35743
+ R.line(`hook ${c.route}/${r.name} ${name}: \`${cmd}\` NOT FOUND in the sandbox image
35744
+ `, { repo: r.name });
35503
35745
  await raiseShipAttention({ state, emit, route: c, ship: cfg.ship }, { kind: "hook_missing", key, message: gap.message, since: (/* @__PURE__ */ new Date()).toISOString() });
35504
35746
  continue;
35505
35747
  }
@@ -35507,8 +35749,8 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35507
35749
  clearShipAttention(state, key);
35508
35750
  continue;
35509
35751
  }
35510
- process.stdout.write(`hook ${c.route}/${r.name} ${name}: \`${cmd}\` NOT FOUND on the scheduler PATH
35511
- `);
35752
+ R.line(`hook ${c.route}/${r.name} ${name}: \`${cmd}\` NOT FOUND on the scheduler PATH
35753
+ `, { repo: r.name });
35512
35754
  await raiseShipAttention({ state, emit, route: c, ship: cfg.ship }, {
35513
35755
  kind: "hook_missing",
35514
35756
  key,
@@ -35519,33 +35761,33 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
35519
35761
  }
35520
35762
  }
35521
35763
  for (const i of visibleAttention(openShipAttention(state), Boolean(dockerFinding))) {
35522
- process.stdout.write(`attention: ${i.kind} \u2014 ${i.message} (since ${i.since})
35764
+ R.line(`attention: ${i.kind} \u2014 ${i.message} (since ${i.since})
35523
35765
  `);
35524
35766
  }
35525
35767
  if (host === "macos") {
35526
35768
  const foreign = describeForeignLaunchdUnits(CREW_HOME);
35527
35769
  if (foreign.length > 0) {
35528
- process.stdout.write(`foreign launchd units (not this checkout's \u2014 \`crew install\` or \`crew uninstall --all\` clears them):
35529
- ${foreign.join("\n")}
35770
+ R.line(`foreign launchd units: not this checkout's \u2014 \`crew install\` or \`crew uninstall --all\` clears them
35771
+ ${foreign.map((f) => ` ${f.trim()}`).join("\n")}
35530
35772
  `);
35531
35773
  }
35532
35774
  }
35533
35775
  if (cfg.ship.runner === "sandbox") {
35534
35776
  const sb = checkSandboxRunner(cfg.ship.sandbox);
35535
- process.stdout.write(`sandbox runner: ${sb.ok ? `OK (${sb.detail})` : `NOT READY \u2014 ${sb.detail}`}
35777
+ R.line(`sandbox runner: ${sb.ok ? `OK (${sb.detail})` : `NOT READY \u2014 ${sb.detail}`}
35536
35778
  `);
35537
35779
  } else {
35538
- process.stdout.write("sandbox runner: off (ship.runner is host)\n");
35780
+ R.line("sandbox runner: off (ship.runner is host)\n");
35539
35781
  }
35540
35782
  const passengerRoutes = cfg.routes.filter((r) => r.enabled && r.hostPassengers);
35541
35783
  if (passengerRoutes.length === 0) {
35542
- process.stdout.write("host passengers: off (no enabled route sets hostPassengers: true)\n");
35784
+ R.line("host passengers: off (no enabled route sets hostPassengers: true)\n");
35543
35785
  } else {
35544
35786
  const dockerOk = dockerAvailable();
35545
35787
  const dockerPathIssue = dockerPathProblem(cfg.ship);
35546
35788
  const dockerKey = "docker_missing";
35547
35789
  if (dockerPathIssue) {
35548
- process.stdout.write(`docker on scheduler PATH: NOT FOUND \u2014 ${dockerPathIssue}
35790
+ R.line(`docker on scheduler PATH: NOT FOUND \u2014 ${dockerPathIssue}
35549
35791
  `);
35550
35792
  await raiseShipAttention({ state, emit, route: passengerRoutes[0], ship: cfg.ship }, {
35551
35793
  kind: "docker_missing",
@@ -35559,7 +35801,7 @@ ${foreign.join("\n")}
35559
35801
  const keygenOk = sshKeygenAvailable();
35560
35802
  const image = passengerImageRef(cfg);
35561
35803
  const imageOk = dockerOk && imagePresent(image);
35562
- process.stdout.write(
35804
+ R.line(
35563
35805
  `host passengers: ON for ${passengerRoutes.map((r) => r.route).join(", ")}
35564
35806
  docker: ${dockerOk ? "OK" : `NOT AVAILABLE${dockerNote}`}
35565
35807
  ssh-keygen: ${keygenOk ? "OK" : "NOT AVAILABLE"}
@@ -35568,12 +35810,12 @@ ${foreign.join("\n")}
35568
35810
  `
35569
35811
  );
35570
35812
  if (!dockerOk) {
35571
- process.stdout.write(
35813
+ R.line(
35572
35814
  " Docker Desktop (or another Docker daemon) is required for Host Passengers \u2014 install/start it, then re-run `crew doctor`. The toggle stays armed in crew.yaml but nothing will start until Docker answers `docker info`.\n"
35573
35815
  );
35574
35816
  }
35575
35817
  if (!keygenOk) {
35576
- process.stdout.write(
35818
+ R.line(
35577
35819
  " `ssh-keygen` is required to mint this ship's tunnel identity \u2014 install OpenSSH, then re-run `crew connect` to sync a key onto this workspace's Ships row.\n"
35578
35820
  );
35579
35821
  }
@@ -35582,24 +35824,24 @@ ${foreign.join("\n")}
35582
35824
  const ws = r.resolved?.workspaceId;
35583
35825
  const slug2 = ws ? readPersistedTunnel(cfg.ship.stateDir, ws)?.slug : void 0;
35584
35826
  if (!ws) continue;
35585
- process.stdout.write(
35827
+ R.line(
35586
35828
  ` ${r.route} url: ${slug2 ? publicUrlFor(slug2, cfg.ship.relayHost, cfg.ship.relayHttpPort, cfg.ship.relayPublicDomain) : "not minted yet (first tunnel cycle creates it)"}
35587
35829
  `
35588
35830
  );
35589
35831
  const controlUrl = slug2 && readPersistedTunnel(cfg.ship.stateDir, ws)?.controlSocket ? `${relayBaseUrlFor(slug2, cfg.ship.relayHost, cfg.ship.relayHttpPort, cfg.ship.relayPublicDomain)}/control` : void 0;
35590
- process.stdout.write(` ${r.route} control url: ${controlUrl ?? "none (the tunnel carries passengers only)"}
35832
+ R.line(` ${r.route} control url: ${controlUrl ?? "none (the tunnel carries passengers only)"}
35591
35833
  `);
35592
35834
  const api = endpointApiFor([r])(ws);
35593
35835
  if (!api) continue;
35594
35836
  const probe = await probeEndpointAccess(api, ws);
35595
- process.stdout.write(
35837
+ R.line(
35596
35838
  ` ${r.route} mcp endpoints: ` + (probe === "ok" ? "OK (key may register its endpoint)" : probe === "forbidden" ? `403 \u2014 ${REGISTER_MCP_ENDPOINTS_HINT}` : `could not check (${probe.error})`) + "\n"
35597
35839
  );
35598
35840
  }
35599
35841
  }
35600
35842
  for (const r of passengerRoutes) {
35601
35843
  const included = passengerRepoTargets(r);
35602
- process.stdout.write(
35844
+ R.line(
35603
35845
  ` ${r.route}: ${included.length ? included.map((t) => t.name).join(", ") : "(no repos included)"}
35604
35846
  `
35605
35847
  );
@@ -35610,19 +35852,19 @@ ${foreign.join("\n")}
35610
35852
  const stateS = readSandboxState(cfg.ship.stateDir);
35611
35853
  for (const r of declaredS) {
35612
35854
  const st = sandboxImageStatus(stateS, planSandbox(r.name, r.decl, r.warm, r.bridge));
35613
- process.stdout.write(`sandbox image: ${r.name}: ${st.status.toUpperCase()} \u2014 ${st.detail}${st.status === "ok" ? "" : dockerNote}
35855
+ R.line(`sandbox image: ${r.name}: ${st.status.toUpperCase()} \u2014 ${st.detail}${st.status === "ok" ? "" : dockerNote}
35614
35856
  `);
35615
35857
  }
35616
35858
  }
35617
35859
  for (const e of listPeriscopeEndpoints(cfg.ship.stateDir)) {
35618
35860
  const secret = readPeriscopeSecret(cfg.ship.stateDir, e.ticketRecordId) ? "live" : "ended, awaiting removal";
35619
- process.stdout.write(`periscope mcp: ${e.ticket} ${e.route} ${e.url} (${secret}, attached only)
35861
+ R.line(`periscope mcp: ${e.ticket} ${e.route} ${e.url} (${secret}, attached only)
35620
35862
  `);
35621
35863
  }
35622
35864
  if (cfg.ship.relayHost && !flag("offline")) {
35623
35865
  const relayUrl = routeRelayUrl(route2);
35624
35866
  if (!relayUrl) {
35625
- process.stdout.write("relay control: no tunnel URL yet (the first `crew passengers` cycle opens it)\n");
35867
+ R.line("relay control: no tunnel URL yet (the first `crew passengers` cycle opens it)\n");
35626
35868
  } else {
35627
35869
  let key;
35628
35870
  try {
@@ -35631,29 +35873,33 @@ ${foreign.join("\n")}
35631
35873
  key = void 0;
35632
35874
  }
35633
35875
  const relayLine = key ? describeRelayProbe(relayUrl, await probeRelayControl(relayUrl, key, cfg.ship.userAgent)) : "relay control: could not check (no API key for this route)";
35634
- process.stdout.write(`${relayLine}${/FAILED/.test(relayLine) ? dockerNote : ""}
35876
+ R.line(`${relayLine}${/FAILED/.test(relayLine) ? dockerNote : ""}
35635
35877
  `);
35636
35878
  }
35637
35879
  }
35638
35880
  for (const l of doctorSelftestLines(readSelftest(cfg.ship.stateDir), shipToolchains(cfg.ship).map((t) => t.name))) {
35639
- process.stdout.write(`${l}
35881
+ R.line(`${l}
35640
35882
  `);
35641
35883
  }
35642
35884
  for (const t of shipToolchains(cfg.ship).filter((t2) => t2.harness === "claude")) {
35643
35885
  if (t.auth === "workspace") {
35644
35886
  for (const r of cfg.routes.filter((r2) => r2.enabled)) {
35645
35887
  const inference = r.resolved ? { baseUrl: inferenceBaseUrl(r.baseUrl, r.resolved.workspaceId), token: "" } : void 0;
35646
- process.stdout.write(`auth: ${t.name}: ${r.route}: ${describeClaudeAuth({ ...t, inference })}
35888
+ R.line(`auth: ${t.name}: ${r.route}: ${describeClaudeAuth({ ...t, inference })}
35647
35889
  `);
35648
35890
  }
35649
35891
  continue;
35650
35892
  }
35651
- process.stdout.write(`auth: ${t.name}: ${describeClaudeAuth(t)}
35893
+ R.line(`auth: ${t.name}: ${describeClaudeAuth(t)}
35652
35894
  `);
35653
35895
  }
35654
35896
  const interactive = !!(process.stdin.isTTY && process.stdout.isTTY);
35897
+ const counts = R.counts();
35898
+ process.stdout.write(renderDoctor(R, [
35899
+ `ship ${cfg.ship.name} (${host}) \xB7 route ${route2.route} \xB7 crew ${sentVersion(cfg.ship) ?? "unknown version"}${daemonLiveness ? ` \xB7 daemon ${daemonLineText(daemonLiveness)}` : ""}`
35900
+ ], flag("verbose")));
35655
35901
  if (flag("fix") || interactive) {
35656
- await doctorFix({ prompt: !flag("fix") || interactive, host });
35902
+ await doctorFix({ prompt: !flag("fix") || interactive, host, fixFlag: flag("fix"), blockers: counts.blocker, warnings: counts.warning });
35657
35903
  }
35658
35904
  break;
35659
35905
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.149.6",
3
+ "version": "0.150.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",