@botbuddy/cli 1.93.0 → 1.94.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.94.0
4
+
5
+ - BOT-3417: the bb-status band (plugin 1.8.0) shows each ticket's Linear customers as badges on its row, at most three and then `+N`. `bb status-band read` carries them from `get_session_status.tickets[].customers` (MCP 2.135.0), BB's own copy of Linear's customer requests; Linear is not called for them. A ticket BB holds no customers for shows no badge.
6
+
7
+ ## 1.93.1
8
+
9
+ - BOT-3362: the `bb push` receipt's `push` field gains `failed_hooks`, which names each lefthook job that refused the push, read from lefthook's summary. A push refused by a job that runs outside lane telemetry (for example `pr-docs`) is now `hooks_failed`, not `push_failed`. A remote rejection, with every hook passed, stays `push_failed`.
10
+
3
11
  ## 1.93.0
4
12
 
5
13
  - BOT-3362: `bb push [git push args]` runs the push (pre-push lanes and the push) as a tracked, detached command run and returns at once with its run id. `bb wait 'push:id=<id>'` returns the terminal receipt. Its `push` field lists each lane's result, its compute slot wait and load wait, the totals, the outcome (`pushed`, `hooks_failed`, `push_failed`, `interrupted`, `timed_out`) and the gate (`gated`, `no_hooks`, `ungated` for `LEFTHOOK=0`). `waiting_over=<s>` also wakes once the push has held for host compute that long; this wake is local. The live phase is written to `~/.botbuddy/command-runs/<id>.context.json.push.json`. A second push from the same worktree is refused (exit 4 `push_in_progress`) and names the first push.
@@ -11,7 +11,7 @@
11
11
  "name": "bb-status",
12
12
  "source": "./bb-status",
13
13
  "description": "BB session status above the prompt: tickets, PRs with review counts, epic, staging, context use and active waits, for BotBuddy and Supply Guard sessions",
14
- "version": "1.7.0"
14
+ "version": "1.8.0"
15
15
  },
16
16
  {
17
17
  "name": "bb-session",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bb-status",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "BB session status above the prompt: tickets, PRs with review counts, epic, staging, context use and active waits, live only while the session is on screen.",
5
5
  "author": {
6
6
  "name": "BotBuddy"
@@ -235,6 +235,15 @@ going idle, so while the badge is shown each quiet relay timeout (about 9.5
235
235
  minutes) reads again. BB reads the project's newest 200 coordinator edges; a
236
236
  full page is a failed read (no badge), never `No coordinator`.
237
237
 
238
+ **BOT-3417 customer badges.** Each ticket row shows the ticket's Linear
239
+ customers as badges between its status badge and its title, at most three, then
240
+ `+N`. They come from `get_session_status.tickets[].customers`, BB's own copy of
241
+ Linear's customer requests (BOT-3293), which the Linear webhook keeps current;
242
+ neither the CLI nor the MCP asks Linear for them. A ticket BB holds no customers
243
+ for, or an older CLI or MCP, shows no badge, never "no customers". No wait
244
+ signal carries a customer change yet, so an open band shows it on its next
245
+ read (a relay wake, Refresh or a new session).
246
+
238
247
  **BOT-3245 STATUS and WAITS.** The band opens with up to two titled rows on
239
248
  the tree's grid: `STATUS` (staging red, its release manager and link, the
240
249
  context alarm) and `WAITS` (each active wait, three at most, then `+N more`).
@@ -189,7 +189,10 @@ function validSnapshot(value, harness, now) {
189
189
  safeLabel(t.title) &&
190
190
  safeLabel(t.status, 40) &&
191
191
  // BOT-3223: the ticket's project; absent is unknown, null is none.
192
- (t.project === undefined || t.project === null || PROJECT.test(t.project)),
192
+ (t.project === undefined || t.project === null || PROJECT.test(t.project)) &&
193
+ // BOT-3417: the ticket's Linear customers; absent is "BB did not say".
194
+ (t.customers === undefined ||
195
+ (Array.isArray(t.customers) && t.customers.length <= 20 && t.customers.every((c) => safeLabel(c, 40)))),
193
196
  ) ||
194
197
  // BOT-3213: only a coordinator's project binding may carry no ticket.
195
198
  (value.tickets.length === 0
@@ -968,6 +971,9 @@ function bandLine(el, spec, widths, right) {
968
971
  for (const link of spec.links || []) {
969
972
  title.push(el.Link({ href: link.href, label: link.label }), dim(el, " · "));
970
973
  }
974
+ // BOT-3417: the ticket's customers lead the title, after the status badge.
975
+ const customers = customerBadges(el, spec.key + "-customers", spec.customers);
976
+ if (customers) title.push(customers);
971
977
  title.push(el.Text({ wrap: "wrap", dimColor: spec.dim || undefined, children: [spec.title] }));
972
978
  if (spec.note) title.push(dim(el, " " + spec.note));
973
979
  const children = [
@@ -982,6 +988,21 @@ function bandLine(el, spec, widths, right) {
982
988
  // Top-aligned: with a wrapped title, the id and status sit on its first line.
983
989
  return el.Box({ key: spec.key, flexDirection: "row", alignItems: "flex-start", columnGap: 1, children });
984
990
  }
991
+ // BOT-3417: one badge per Linear customer of a ticket, at most
992
+ // MAX_CUSTOMER_BADGES, then "+N". None, or BB did not say: no badge at all.
993
+ const MAX_CUSTOMER_BADGES = 3;
994
+ const CUSTOMER_FILL = "#37474f";
995
+ function customerBadges(el, key, customers) {
996
+ if (!Array.isArray(customers) || !customers.length) return null;
997
+ const svg = pills() && typeof el.Svg === "function";
998
+ const shown = customers.slice(0, MAX_CUSTOMER_BADGES).map((name, i) =>
999
+ svg
1000
+ ? el.Box({ key: key + "-" + i, flexDirection: "row", flexShrink: 0, children: [pillSvg(el, { text: name, fill: CUSTOMER_FILL, alt: "customer " + name })] })
1001
+ : el.Box({ key: key + "-" + i, flexDirection: "row", flexShrink: 0, backgroundColor: CUSTOMER_FILL, paddingX: 1, children: [el.Text({ color: "#ffffff", children: [name] })] }),
1002
+ );
1003
+ if (customers.length > shown.length) shown.push(dim(el, "+" + (customers.length - shown.length)));
1004
+ return el.Box({ key, flexDirection: "row", flexShrink: 0, flexWrap: "wrap", columnGap: 1, marginRight: 1, alignItems: "center", children: shown });
1005
+ }
985
1006
  // BOT-3211/BOT-3217: "Context 62%", or null when the runtime has no fill
986
1007
  // figure (a fresh or just-compacted session): hidden, never "0%".
987
1008
  function contextText(c) {
@@ -1278,6 +1299,7 @@ function bandLines(el, $, inPane) {
1278
1299
  status: [{ text: t.status }],
1279
1300
  title: t.title,
1280
1301
  note,
1302
+ customers: t.customers,
1281
1303
  });
1282
1304
  const prSpec = (p, prefix, note) => {
1283
1305
  const hex = p.conflict && p.state !== "merged" && p.state !== "closed" ? ICON.pr.closed : ICON.pr[p.state];
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.93.0",
3
- "source_commit": "5f725b542bdc9a9b70237cd6fab5b8fd7afab6ce",
4
- "source_sha256": "733c52c77401497b156d678fca78ad0075aaba4b768ef615d0e6275c4d0886a3",
2
+ "release_version": "1.94.0",
3
+ "source_commit": "9d0d1710dc3d98dc9c799cad5f04afd1b703c838",
4
+ "source_sha256": "1d61ef38322de190ed2fdf00e651c56cfc5926b70d09272bd275ec69b176fa4b",
5
5
  "target": "darwin-arm64",
6
- "sha256": "a481ec7dde1b215228b000aadf59b6b039f52594cf5fe437c5d0936d7b6a25f8"
6
+ "sha256": "6ddf01a476e4e70b2b17ee69e04bd1758de26323574680f236809850c7f0d5f0"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.93.0",
3
- "source_commit": "5f725b542bdc9a9b70237cd6fab5b8fd7afab6ce",
4
- "source_sha256": "733c52c77401497b156d678fca78ad0075aaba4b768ef615d0e6275c4d0886a3",
2
+ "release_version": "1.94.0",
3
+ "source_commit": "9d0d1710dc3d98dc9c799cad5f04afd1b703c838",
4
+ "source_sha256": "1d61ef38322de190ed2fdf00e651c56cfc5926b70d09272bd275ec69b176fa4b",
5
5
  "target": "linux-x64",
6
- "sha256": "82453b27c5c4d174414b9186f6043a05a798ba63c5dfc3bea080cefec1f02e24"
6
+ "sha256": "322bb5d8ea0c0289a2f5e2c3dc4a303e92c92029b1f9c8e88c2560c0180ed0c6"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.93.0",
4
- "source_commit": "5f725b542bdc9a9b70237cd6fab5b8fd7afab6ce",
5
- "source_sha256": "733c52c77401497b156d678fca78ad0075aaba4b768ef615d0e6275c4d0886a3",
3
+ "release_version": "1.94.0",
4
+ "source_commit": "9d0d1710dc3d98dc9c799cad5f04afd1b703c838",
5
+ "source_sha256": "1d61ef38322de190ed2fdf00e651c56cfc5926b70d09272bd275ec69b176fa4b",
6
6
  "targets": {
7
7
  "darwin-arm64": {
8
8
  "goos": "darwin",
9
9
  "goarch": "arm64",
10
10
  "binary": "daemon/bin/darwin-arm64/botbuddy-daemon",
11
- "sha256": "a481ec7dde1b215228b000aadf59b6b039f52594cf5fe437c5d0936d7b6a25f8",
11
+ "sha256": "6ddf01a476e4e70b2b17ee69e04bd1758de26323574680f236809850c7f0d5f0",
12
12
  "mode": "0755"
13
13
  },
14
14
  "linux-x64": {
15
15
  "goos": "linux",
16
16
  "goarch": "amd64",
17
17
  "binary": "daemon/bin/linux-x64/botbuddy-daemon",
18
- "sha256": "82453b27c5c4d174414b9186f6043a05a798ba63c5dfc3bea080cefec1f02e24",
18
+ "sha256": "322bb5d8ea0c0289a2f5e2c3dc4a303e92c92029b1f9c8e88c2560c0180ed0c6",
19
19
  "mode": "0755"
20
20
  }
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbuddy/cli",
3
- "version": "1.93.0",
3
+ "version": "1.94.0",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -86,21 +86,39 @@ const sumOrNull = (values) => {
86
86
  return present.length ? present.reduce((a, b) => a + b, 0) : null;
87
87
  };
88
88
 
89
+ const ANSI = /\u001b\[[0-9;]*m/g;
90
+
91
+ /**
92
+ * The lefthook jobs that failed, from lefthook's own summary in the push's output
93
+ * (`✗ <job> (<n> seconds)`). It names every refusing job, including the ones that
94
+ * run outside lane telemetry (BOT-3362 acceptance, run aa131db8: `pr-docs`).
95
+ */
96
+ export function failedHooksFromOutput(output) {
97
+ const failed = [];
98
+ for (const line of String(output ?? "").replace(ANSI, "").split("\n")) {
99
+ const match = /^\s*✗\s+([A-Za-z0-9_.:@/-]+)\s+\(/.exec(line);
100
+ if (match && !failed.includes(match[1])) failed.push(match[1]);
101
+ }
102
+ return failed;
103
+ }
104
+
89
105
  /** The receipt's `push` field: each lane's result and compute wait, and the outcome. */
90
- export function pushSummary({ status, gate, launchedAt, invocationState }) {
106
+ export function pushSummary({ status, gate, launchedAt, invocationState, hookOutput = "" }) {
91
107
  const own = gate === "ungated" ? null : ownInvocation(invocationState, launchedAt);
92
108
  const lanes = Object.entries(own?.lanes ?? {}).map(([lane, v]) => ({
93
109
  lane, outcome: v?.outcome ?? null, waiting_ms: v?.waiting_ms ?? 0,
94
110
  slot_wait_ms: v?.compute?.slot_wait_ms ?? null, load_wait_ms: v?.compute?.load_wait_ms ?? null,
95
111
  load_ratio_at_start: v?.compute?.load_ratio_at_start ?? null,
96
112
  }));
113
+ const failedHooks = status === "success" ? [] : failedHooksFromOutput(hookOutput);
97
114
  const outcome = {
98
115
  success: "pushed", cancelled: "interrupted", timed_out: "timed_out", owner_lost: "owner_lost",
99
- failure: lanes.some((l) => FAILED_LANE_OUTCOMES.has(l.outcome)) ? "hooks_failed" : "push_failed",
116
+ failure: lanes.some((l) => FAILED_LANE_OUTCOMES.has(l.outcome)) || failedHooks.length ? "hooks_failed" : "push_failed",
100
117
  }[status] ?? status;
101
118
  return {
102
119
  outcome,
103
120
  gate: gate === "ungated" ? "ungated" : own ? "gated" : "no_hooks",
121
+ failed_hooks: failedHooks,
104
122
  invocation_id: own?.invocation_id ?? null,
105
123
  lanes,
106
124
  slot_wait_ms: sumOrNull(lanes.map((l) => l.slot_wait_ms)),
package/src/push.mjs CHANGED
@@ -214,8 +214,8 @@ export function startPushMonitor(context, call, {
214
214
  }
215
215
 
216
216
  /** The receipt's push summary for a finished run, and release of the worktree lock. */
217
- export function finishPush(context, status) {
218
- const summary = pushSummary({ status, gate: context.push.gate, launchedAt: context.launched_at, invocationState: readInvocationState(context.push.root) });
217
+ export function finishPush(context, status, hookOutput = "") {
218
+ const summary = pushSummary({ status, gate: context.push.gate, launchedAt: context.launched_at, invocationState: readInvocationState(context.push.root), hookOutput });
219
219
  const lockPath = join(context.push.root, ".botbuddy", PUSH_LOCK_FILE);
220
220
  if (readJson(lockPath)?.run_id === context.run_id) rmSync(lockPath, { force: true });
221
221
  return summary;
package/src/run.mjs CHANGED
@@ -1215,7 +1215,7 @@ async function finalize(context, state, call, retry = {}) {
1215
1215
  }
1216
1216
  // BOT-3362: each pre-push lane's result and compute wait, and the push's outcome.
1217
1217
  if (context.push) {
1218
- try { receipt.push = finishPush(context, state.status); } catch { /* the command receipt stands without it */ }
1218
+ try { receipt.push = finishPush(context, state.status, boundedLog); } catch { /* the command receipt stands without it */ }
1219
1219
  }
1220
1220
  await writeJson(context.receipt_path, receipt);
1221
1221
  const bytes = await stat(context.receipt_path);
@@ -457,9 +457,18 @@ export async function readStatus({
457
457
  const e = epics.find((x) => UUID_LOWER.test(x?.epic_project_id) && (x.children || []).some((c) => c?.external_id === k));
458
458
  return e ? e.epic_project_id : Array.isArray(epicHealth?.epics) ? null : undefined;
459
459
  };
460
+ // BOT-3417: each ticket's Linear customers, from BB's own mirror (never from
461
+ // Linear here). No key when BB said nothing, so the band shows no badge.
462
+ const customersOf = (k) => {
463
+ if (!ownOk) return {};
464
+ const t = own.tickets.find((x) => String(x?.key || "").toUpperCase() === k);
465
+ if (!Array.isArray(t?.customers)) return {};
466
+ const names = t.customers.map((c) => safeText(c?.name, 40)).filter(Boolean).slice(0, 20);
467
+ return { customers: names };
468
+ };
460
469
  const tickets = keys.map((k) => {
461
470
  const project = projectOf(k);
462
- const where = project === undefined ? {} : { project };
471
+ const where = { ...(project === undefined ? {} : { project }), ...customersOf(k) };
463
472
  if (linearTicket && k === key)
464
473
  return { key: k, title: linearTicket.title, status: linearTicket.status, ...where };
465
474
  const found = fromBb(k);