@botbuddy/cli 1.67.0 → 1.68.1

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.68.1
4
+
5
+ - The bb-status band now binds a Claude Code session whose repo has no BotBuddy SessionStart hook, such as Supply Guard worktrees, instead of showing "BB identity belongs to another session". When the worktree has no session cache, an unbound one or an expired one, `bb status-band read` bootstraps this session once (ticketless, the same bootstrap `bb bootstrap` runs) and reads again. A cache another live session holds is never taken over.
6
+
7
+ ## 1.68.0
8
+
9
+ - The bb-status band for Claude Code now ships in this package. `bb setup` and `bb update` install it once, at user scope, through `bb status-band install`. They point the `botbuddy-labs` marketplace at the plugin inside the installed CLI, so every worktree shows the band with no plugin command, and no repo checkout is needed. The band's reads and live wake run from the installed CLI (`bb status-band read` and `bb status-band relay`).
10
+ - The band hides the PR and epic rows when the session has none, and says when it couldn't read them. Each PR row shows its code-review count. A red staging banner links to the latest staging readiness page. The band holds a live wait only while the session is on screen.
11
+ - `bb wait 'event:type=staging_incident'` wakes when one of your tenant's staging incidents opens or closes.
12
+
3
13
  ## 1.67.0
4
14
 
5
15
  - New `bb release-notes submit <note.json>` submits one governed release note for your tenant through the MCP tool `submit_release_note`. It sends the file unchanged, prints the stored source key, state and revision, and exits 1 with the named refusal (`schema_invalid`, `type_unknown`, `markup_refused`, `link_refused`, `entitlement_missing`) when nothing was stored.
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "botbuddy-labs",
3
+ "owner": {
4
+ "name": "BotBuddy"
5
+ },
6
+ "metadata": {
7
+ "description": "BotBuddy's Claude Code mods, shipped inside the bb CLI package. bb setup and bb update install them (BOT-3152)."
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "bb-status",
12
+ "source": "./bb-status",
13
+ "description": "BB session status above the prompt: tickets, PRs with review counts, epic and staging, for BotBuddy and Supply Guard sessions",
14
+ "version": "1.0.0"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "bb-status",
3
+ "version": "1.0.0",
4
+ "description": "BB session status above the prompt: tickets, PRs with review counts, epic and staging, live only while the session is on screen.",
5
+ "author": {
6
+ "name": "BotBuddy"
7
+ },
8
+ "license": "MIT"
9
+ }
@@ -0,0 +1,156 @@
1
+ # BB status — Claude Code mod
2
+
3
+ Shows the session's work in Claude Code as a three-line band above the prompt:
4
+
5
+ ```
6
+ ◆ BOT-3110 · In Progress · Go daemon crash-loops when it reaps … Details
7
+ ⎇ #1585 · Open · fix(BOT-3110): a never-provisioned remote lease …
8
+ ◇ cbce84018a75 · 0% done · A third party adds a Linux Docker host …
9
+ ```
10
+
11
+ Every id is a link. A ticket opens BB's ticket drawer and an epic opens BB's
12
+ project drawer (`?card=ticket:KEY`, `?card=project:<uuid>`, BOT-2896/BOT-3100).
13
+ BB has no PR drawer yet, so a PR id opens its Testing pipeline row as the
14
+ placeholder. BB has no must-have field either, so the epic line shows BB's own
15
+ progress (done over non-canceled members) as the placeholder. `/bb-status` opens
16
+ the detail pane: agent, the same three rows, blockers and links. Opening it, pressing buttons, and refreshing
17
+ run host code without model calls, extra tools, or status text in Claude's context.
18
+
19
+ It reads **BotBuddy** (BOT-*) and **SupplyGuard** (ENT-*) sessions; the repo's
20
+ committed `.botbuddy-agent.json` tenant picks which. A repo with no binding shows
21
+ no band at all. Normal Chat and Cowork do not load this UI.
22
+
23
+ **BOT-3152 band rules.** A session with no PR or no epic shows no row for it. A
24
+ failed read shows "Couldn't read …" instead, never the empty state. Each PR row
25
+ shows its code-review rounds (`pr_state.review_rounds`, which `get_pr_state`
26
+ returns as `reviewRounds`). While the tenant's staging is red, a `▲ Staging red`
27
+ banner links to `/release-readiness/staging/latest`, the web Staging chip's
28
+ status and link. Unreadable staging says `staging: couldn't read`, never green.
29
+ The relay is parked, with no child and no server wait, while
30
+ `$.session.surfaces()` is empty, which is the case while Desktop shows another
31
+ session. Once a surface draws the session again, the 5 s display tick does one
32
+ read and re-arms the relay.
33
+
34
+ ## Install
35
+
36
+ The bb CLI ships this mod and installs it (BOT-3152). `bb setup` and `bb update`
37
+ run `bb status-band install`. That command points Claude Code's `botbuddy-labs`
38
+ marketplace at `claude-plugin/` inside the installed `@botbuddy/cli` package, and
39
+ installs `bb-status` at **user scope**, so every worktree gets the band at session
40
+ start. A marketplace still pointing at a repo checkout is re-pointed. The band's
41
+ reads and live wake run from the installed CLI (`bb status-band read` and
42
+ `bb status-band relay`), so deleting a checkout never breaks a running relay.
43
+ Open sessions pick up a new version with `/reload-plugins`.
44
+
45
+ Requirements: Claude Code >=2.1.287 and Node >=20, with `bb` on Claude's PATH.
46
+
47
+ For development, run against this checkout without installing:
48
+
49
+ ```sh
50
+ claude --plugin-dir "$PWD/cli/claude-plugin/bb-status"
51
+ ```
52
+
53
+ Then run `/bb-status demo` to inspect the UI without credentials, or `/bb-status`
54
+ to read the current session. `/bb-status live BOT-2644` explicitly selects a ticket;
55
+ Refresh keeps that selection. `/bb-status live` returns to the current branch's
56
+ BOT ticket. Demo is always labelled and never makes network requests.
57
+
58
+ ## Live mode
59
+
60
+ Use the existing BB SessionStart connection in the **same worktree and Claude
61
+ session**. The adapter requires its private `.botbuddy/agent-state.json`, including
62
+ the canonical work-graph session, agent, tenant, worktree, expiry, and harness id.
63
+ It refuses another session's cache. Do not copy an agent-state file between sessions.
64
+ The committed `.botbuddy-agent.json` must declare `tenant: "botbuddy"` or
65
+ `"supply-guard"`, and the branch or `/bb-status live KEY[,KEY…]` names tickets
66
+ with that tenant's prefix.
67
+
68
+ For BotBuddy, `LINEAR_BB_API_KEY` must reach Claude's child processes; use the existing Keychain /
69
+ launch-environment setup in the repository README. Never put a credential in the
70
+ plugin, its options, a prompt, or a snapshot. A missing or expired connection is
71
+ shown as Unknown with a recovery instruction; the mod does not mint identities,
72
+ refresh credentials, approve tools, or change Linear tickets.
73
+
74
+ Reads are limited to BB's authenticated REST aliases (`whoami`,
75
+ `list_work_items`, `get_pr_state`, `get_epic_health`) and, for BotBuddy only,
76
+ Linear's `organization` plus the exact issue and incoming `blocks` relations.
77
+ PRs are this worktree's branch's. SupplyGuard status comes from BB's synced
78
+ tickets and shows no blockers. A refused BB read blanks only its own line.
79
+ It validates the returned BB agent against the cache and the Linear workspace /
80
+ team / issue against BotBuddy, and re-checks the cache after both requests.
81
+ Credentials stay inside the Node adapter; only allowlisted display fields reach
82
+ the mod. Requests refuse redirects and time out after 8 seconds each. Raw errors,
83
+ headers, stderr, and API responses never enter the UI.
84
+
85
+ Data refreshes **when BB reports a change** (BOT-3135). After each live read the
86
+ mod starts one relay child, `bb status-band relay`. The relay runs the installed CLI's own `bb wait`
87
+ on the band's subjects:
88
+ - each ticket (`linear:issue=`);
89
+ - each open or draft PR (`pr-state:`);
90
+ - for BotBuddy blockers, each ticket's last blocker clearing (`unblocked:`).
91
+ - the epic's Linear project (`event:type=linear_project,subject=<uuid>`, BOT-3136);
92
+ - when the tenant has staging configured, its staging incidents opening or closing
93
+ (`event:type=staging_incident`, BOT-3152).
94
+
95
+ **What the band shows comes from the registered session** (BOT-3136). The adapter reads
96
+ `get_session_status`, which returns the tickets, PRs and epic this BB session registered
97
+ (`register_agent`, or a ticket declared by `heartbeat`), in one read of at most 4 KB. Only
98
+ when the session registered no ticket does it fall back to the key in the branch name.
99
+ The snapshot's `binding` field says which happened: `session`, `branch`, or `selected`
100
+ (from `/bb-status live KEY`).
101
+
102
+ It uses the `bb` beside the `node` that runs it and the worktree's cached BB session.
103
+
104
+ | The wait ends with | The mod |
105
+ |---|---|
106
+ | A wake (exit 0) | Re-reads once, redraws, and re-arms from the wait's cursor. |
107
+ | A quiet 570 s timeout (exit 2) | Re-arms from the cursor with no read. |
108
+ | Backend unavailable (exit 5) | Backs off 30 s, doubling to 5 min, then reads once. |
109
+ | Expired cursor (exit 6) | Reads, then re-arms without one. |
110
+ | Expired session (exit 3) or any other exit | Stops and marks the band **STALE** with what to do. It never retries in a loop. |
111
+
112
+ Reads the relay triggers are at least 15 s apart. Refresh, demo, the end of the
113
+ session and a mod reload each end the child, so a session has at most one.
114
+
115
+ The band's waits run under the agent's own BB session. They show in `/waits` and in
116
+ `register_agent`'s `existing_waits` with the short-timeout reason
117
+ "bb-status band relay…". An agent recovering from a crash must not `bb wait resume`
118
+ them, because the band re-arms its own. Epic progress has no wait condition yet (BOT-3136); it
119
+ refreshes with each wake.
120
+
121
+ Without a live relay, a local display clock marks snapshots older than 60 seconds as
122
+ **STALE**. That clock makes no network requests. Agent Working/Idle/Stopped comes from
123
+ Claude turn events and is separate from Linear state.
124
+ The POC rejects incomplete blocker pages (>100 relations) rather than showing a
125
+ false unblocked state. Demo dependencies are illustrative, not current Linear facts.
126
+
127
+ ## Verification
128
+
129
+ See [EVIDENCE.md](EVIDENCE.md) for the recorded receipts and limits.
130
+
131
+ ```sh
132
+ node --test cli/src/status-band*.test.mjs cli/claude-plugin/bb-status/hooks/*.test.mjs
133
+ claude plugin validate cli/claude-plugin/bb-status --strict
134
+ claude plugin test cli/claude-plugin/bb-status
135
+ ```
136
+
137
+ The native test suite requires Claude Code >=2.1.293 for its mock session helper.
138
+
139
+ Native tests use Claude's own `claude-code/testing` kit and validate element trees
140
+ and interactions for both `terminal` and `desktop`. They require no sign-in or
141
+ model. The live fixture was captured on 2026-10-21 by the real adapter with BB and
142
+ Linear, using this implementation's Codex session; it contains no credential.
143
+ Synthetic test variants cover failure cases and dependency changes. That live read
144
+ proves the adapter boundary, not an interactive Claude Desktop paint or login.
145
+
146
+ The browser preview renders the **actual mod hooks and returned element tree**,
147
+ using a lightweight host adapter. It is explicitly a preview, not a screenshot of
148
+ Claude Desktop. It can exercise live reads when its server is started in this
149
+ worktree with `BB_STATUS_PREVIEW_HARNESS_SESSION_ID` set to this session's id:
150
+
151
+ ```sh
152
+ BB_STATUS_PREVIEW_HARNESS_SESSION_ID=<current-harness-uuid> \
153
+ node cli/claude-plugin/bb-status/preview/server.mjs --port <claimed-local-port>
154
+ ```
155
+
156
+ Live receipts for each BOT-3152 criterion are on the ticket.
@@ -0,0 +1 @@
1
+ { "modules": ["./register.js"] }