@botbuddy/cli 1.73.7 → 1.74.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 +8 -0
- package/claude-plugin/.claude-plugin/marketplace.json +1 -1
- package/claude-plugin/bb-status/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/bb-status/README.md +14 -0
- package/claude-plugin/bb-status/hooks/register.js +87 -24
- package/daemon/bin/darwin-arm64/botbuddy-daemon +0 -0
- package/daemon/bin/linux-x64/botbuddy-daemon +0 -0
- package/daemon-release/darwin-arm64.json +4 -4
- package/daemon-release/linux-x64.json +4 -4
- package/daemon-release/manifest.json +5 -5
- package/package.json +1 -1
- package/src/commands.mjs +2 -0
- package/src/release-notes.mjs +106 -0
- package/src/status-band-read.mjs +20 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.74.1
|
|
4
|
+
|
|
5
|
+
- When staging is red, the bb-status band names the staging release manager BB elected for the incident (BOT-3241): `▲ Staging red 20m Release manager: Fanie Sanchez Open staging ↗`. In Claude Code Desktop the name is a button that opens that agent's Claude Code or Codex session; in the terminal it is a link to it. Without a known session the name is plain text, and before anyone is elected the row says `No release manager yet`. Each badge pill now holds its words to the width it was drawn for, so they never run past its rounded end whatever font or zoom Desktop uses (BOT-3230 follow-up), and a wait for staging to go green reads `Until staging green` rather than `Staging green`, which looked like a status beside a red staging. The band now opens with two titled rows on the same grid as the tickets (BOT-3245): `STATUS` (staging red with its release manager and link, then the context alarm) and `WAITS` (each active wait), each title in the id column and every badge starting in the status-badge column, so a wait never sits among the statuses. The plugin version moves to 1.4.4, so `bb update` installs it.
|
|
6
|
+
|
|
7
|
+
## 1.74.0
|
|
8
|
+
|
|
9
|
+
- `bb release-notes grants list|add|remove` (BOT-3160). A tenant owner names who may submit or manage release notes: `grants add <email> <submit|manage>` grants one scope to one member of the tenant, `grants remove` revokes it, and `grants list` prints the owners (who manage implicitly), the effective grants and the newest changes. The commands use your own sign-in (`bb login`), never the agent session, and take `--tenant <slug>` and `--json`. A refusal names its code (`scope_missing`, `member_not_in_tenant`, `owner_scope_is_implicit`, `scope_unknown`, `entitlement_missing`) and changes nothing; repeating a grant or a revoke changes nothing twice.
|
|
10
|
+
|
|
3
11
|
## 1.73.7
|
|
4
12
|
|
|
5
13
|
- `bb stack run` says why a stack failed to provision and whose fault it was (BOT-3238). When the serving host rolls a provision back, the receipt now carries a typed `code` (`STACK_SCHEMA_FAILED` or `STACK_PROVISION_FAILED`, where before it was `null`), the lease's `reap_reason`, a `failure_kind` (`schema` or `platform`) and, when the host sent it, `provision_failure: { stage, sqlstate, migration }`. One stderr line names the cause. When Postgres rejects your own migrations or seed (a schema-stage failure with a SQLSTATE that is not a resource, connection or server condition), the run is recorded as a `script` failure and no platform feedback is offered, because retrying or moving host fails the same way. A lease that failed with no recorded reason says `reason_unavailable: true`. The exit code (6) is unchanged.
|
|
@@ -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.4.
|
|
14
|
+
"version": "1.4.4"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "bb-session",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bb-status",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
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"
|
|
@@ -214,3 +214,17 @@ words inside, its width estimated from the words. A Claude Code `Box` has no
|
|
|
214
214
|
corner radius, and a border draws a whole row above and below. Links stay
|
|
215
215
|
`Link` elements beside the pill. Failure notes are their own dim line under
|
|
216
216
|
the tree. The terminal keeps filled `Box` badges.
|
|
217
|
+
|
|
218
|
+
**BOT-3241 release manager.** While staging is red the row names the release
|
|
219
|
+
manager BB elected for the open incident (`staging.release_manager`). On Desktop
|
|
220
|
+
the name is a Button that runs macOS `open` on their session link (a plugin
|
|
221
|
+
`Link` off the terminal only opens `https:`); in the terminal it is a `Link`.
|
|
222
|
+
Only `claude://claude.ai/epitaxy/local_<uuid>` and `codex://threads/<uuid>` are
|
|
223
|
+
accepted; any other link rejects the snapshot. No session: the name is plain
|
|
224
|
+
text; none elected: `No release manager yet`.
|
|
225
|
+
|
|
226
|
+
**BOT-3245 STATUS and WAITS.** The band opens with up to two titled rows on
|
|
227
|
+
the tree's grid: `STATUS` (staging red, its release manager and link, the
|
|
228
|
+
context alarm) and `WAITS` (each active wait, three at most, then `+N more`).
|
|
229
|
+
Each title fills the id column (at least six cells wide); the badges start in
|
|
230
|
+
the status-badge column and wrap there. A row with no badges is not drawn.
|
|
@@ -207,7 +207,12 @@ function validSnapshot(value, harness, now) {
|
|
|
207
207
|
!(
|
|
208
208
|
typeof value.staging.configured === "boolean" &&
|
|
209
209
|
typeof value.staging.red === "boolean" &&
|
|
210
|
-
(value.staging.since === null || Number.isFinite(Date.parse(value.staging.since)))
|
|
210
|
+
(value.staging.since === null || Number.isFinite(Date.parse(value.staging.since))) &&
|
|
211
|
+
// BOT-3241: the release manager: absent (unknown), null (none) or a
|
|
212
|
+
// safe name with a verified session link or none.
|
|
213
|
+
(value.staging.release_manager == null ||
|
|
214
|
+
(safeLabel(value.staging.release_manager.name, 80) &&
|
|
215
|
+
(value.staging.release_manager.href === null || SESSION_HREF.some((re) => re.test(value.staging.release_manager.href)))))
|
|
211
216
|
)) ||
|
|
212
217
|
// BOT-3212: the agent's active waits; null or absent means unknown (no badge).
|
|
213
218
|
(value.waits != null &&
|
|
@@ -296,7 +301,7 @@ function demoSnapshot(now) {
|
|
|
296
301
|
total: 11,
|
|
297
302
|
percent: 45,
|
|
298
303
|
},
|
|
299
|
-
staging: { configured: true, red: true, since: new Date(now - 12 * 60000).toISOString() },
|
|
304
|
+
staging: { configured: true, red: true, since: new Date(now - 12 * 60000).toISOString(), release_manager: { name: "Fanie Sanchez", href: null } },
|
|
300
305
|
waits: {
|
|
301
306
|
count: 2,
|
|
302
307
|
oldest_at: new Date(now - 14 * 60000).toISOString(),
|
|
@@ -833,12 +838,15 @@ function glyphPx(ch) {
|
|
|
833
838
|
if (/[A-Z]/.test(ch)) return 8.1;
|
|
834
839
|
if (/[0-9]/.test(ch)) return 7.1;
|
|
835
840
|
if (/[a-z]/.test(ch)) return 6.5;
|
|
836
|
-
if (ch.codePointAt(0) > 0x2000) return
|
|
841
|
+
if (ch.codePointAt(0) > 0x2000) return 18; // ⏳ ▲ and other symbols
|
|
837
842
|
return 7.1;
|
|
838
843
|
}
|
|
839
844
|
function textPx(text, bold) {
|
|
845
|
+
// BOT-3230 follow-up: ~6% over the 13px system font, since Desktop's own
|
|
846
|
+
// font and zoom draw wider ("Some the SVG buttons are a bit too small for the
|
|
847
|
+
// text", Jono, 2026-11-15); the <text> is then held to this width anyway.
|
|
840
848
|
const w = [...String(text)].reduce((n, ch) => n + glyphPx(ch), 0);
|
|
841
|
-
return Math.ceil(w * (bold ? 1.
|
|
849
|
+
return Math.ceil(w * (bold ? 1.12 : 1.06));
|
|
842
850
|
}
|
|
843
851
|
function xml(text) {
|
|
844
852
|
return String(text).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -857,8 +865,10 @@ function pillSource({ text, icon, fill, bold }, slot) {
|
|
|
857
865
|
body += String(icon).replace(/^<svg /, `<svg x="${x}" y="${(PILL.h - PILL.icon) / 2}" `);
|
|
858
866
|
x += PILL.icon + (text ? PILL.gap : 0);
|
|
859
867
|
}
|
|
868
|
+
// The words are held to the width the pill was drawn for (textLength), so
|
|
869
|
+
// whatever font or zoom draws them, they end inside the rounded end.
|
|
860
870
|
if (text)
|
|
861
|
-
body += `<text x="${x}" y="15" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif" font-size="${PILL.font}"${bold ? ' font-weight="600"' : ""} fill="#ffffff">${xml(text)}</text>`;
|
|
871
|
+
body += `<text x="${x}" y="15" textLength="${textPx(text, bold)}" lengthAdjust="spacingAndGlyphs" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif" font-size="${PILL.font}"${bold ? ' font-weight="600"' : ""} fill="#ffffff">${xml(text)}</text>`;
|
|
862
872
|
return { width: outer, source: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${outer} ${PILL.h}" width="${outer}" height="${PILL.h}">${body}</svg>` };
|
|
863
873
|
}
|
|
864
874
|
function pillSvg(el, pill, slot) {
|
|
@@ -971,18 +981,34 @@ function waitBadges(el, key, w, now) {
|
|
|
971
981
|
if (w.count > out.length) out.push(dim(el, "+" + (w.count - out.length) + " more"));
|
|
972
982
|
return out;
|
|
973
983
|
}
|
|
974
|
-
|
|
975
|
-
|
|
984
|
+
// The context alarm's red pill (above 30%), or nothing.
|
|
985
|
+
function contextBadge(el, key) {
|
|
976
986
|
const alarm = contextAlarm(context);
|
|
977
|
-
if (alarm)
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
987
|
+
if (!alarm) return [];
|
|
988
|
+
return [
|
|
989
|
+
pills() && typeof el.Svg === "function"
|
|
990
|
+
? el.Box({ key: key + "-ctx", flexDirection: "row", flexShrink: 0, children: [pillSvg(el, { text: alarm, fill: RED, bold: true })] })
|
|
991
|
+
: el.Box({ key: key + "-ctx", flexDirection: "row", flexShrink: 0, backgroundColor: "error", paddingX: 1, children: [el.Text({ color: "#ffffff", bold: true, children: [alarm] })] }),
|
|
992
|
+
];
|
|
993
|
+
}
|
|
994
|
+
// BOT-3245: statuses and waits are separate, titled rows on the tree's grid
|
|
995
|
+
// (Jono, 2026-11-15: "Staging green is a wait. Staging red is a status."). The
|
|
996
|
+
// title fills the id column; the badges start in the status-badge column and
|
|
997
|
+
// wrap there, never under the title. No badges, no row.
|
|
998
|
+
const TITLES = { status: "STATUS", waits: "WAITS" };
|
|
999
|
+
const TITLE_CELLS = Math.max(...Object.values(TITLES).map((t) => t.length));
|
|
1000
|
+
function headerRow(el, key, title, idsCells, badges) {
|
|
1001
|
+
if (!badges.length) return null;
|
|
1002
|
+
return el.Box({
|
|
1003
|
+
key,
|
|
1004
|
+
flexDirection: "row",
|
|
1005
|
+
alignItems: "flex-start",
|
|
1006
|
+
columnGap: 1,
|
|
1007
|
+
children: [
|
|
1008
|
+
el.Box({ key: key + "-title", flexDirection: "row", width: idsCells, flexShrink: 0, children: [dim(el, title)] }),
|
|
1009
|
+
el.Box({ key: key + "-badges", flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 1, rowGap: 0, flexGrow: 1, flexShrink: 1, minWidth: 0, children: badges }),
|
|
1010
|
+
],
|
|
1011
|
+
});
|
|
986
1012
|
}
|
|
987
1013
|
async function readContext($) {
|
|
988
1014
|
try {
|
|
@@ -1007,7 +1033,38 @@ function shortAge(fromIso, now) {
|
|
|
1007
1033
|
const hours = Math.floor(mins / 60);
|
|
1008
1034
|
return hours < 48 ? hours + "h" : Math.floor(hours / 24) + "d";
|
|
1009
1035
|
}
|
|
1010
|
-
|
|
1036
|
+
// BOT-3241: a release manager's session, as BB's web links it (agentSessionHref):
|
|
1037
|
+
// a Claude Desktop local_<uuid> or a Codex thread uuid, nothing else.
|
|
1038
|
+
const SESSION_HREF = [
|
|
1039
|
+
/^claude:\/\/claude\.ai\/epitaxy\/local_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
1040
|
+
/^codex:\/\/threads\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
1041
|
+
];
|
|
1042
|
+
// "Release manager: <name>". The terminal opens any link itself; Desktop draws a
|
|
1043
|
+
// non-https Link as plain text, so there the name is a Button that opens the
|
|
1044
|
+
// session with macOS `open`.
|
|
1045
|
+
function releaseManager(el, $, rm) {
|
|
1046
|
+
if (rm === undefined) return [];
|
|
1047
|
+
if (rm === null) return [dim(el, "No release manager yet")];
|
|
1048
|
+
const label = dim(el, "Release manager:");
|
|
1049
|
+
if (!rm.href || !SESSION_HREF.some((re) => re.test(rm.href))) return [label, el.Text({ children: [rm.name] })];
|
|
1050
|
+
if (surface === "terminal") return [label, el.Link({ href: rm.href, label: rm.name })];
|
|
1051
|
+
return [
|
|
1052
|
+
label,
|
|
1053
|
+
el.Button({
|
|
1054
|
+
key: "release-manager",
|
|
1055
|
+
label: rm.name,
|
|
1056
|
+
onPress: async () => {
|
|
1057
|
+
try {
|
|
1058
|
+
const r = await $.process.run(["open", rm.href], { timeoutMs: 10000 });
|
|
1059
|
+
if (r?.exitCode !== 0) $.ui.toast("Couldn't open " + rm.name + "'s session");
|
|
1060
|
+
} catch {
|
|
1061
|
+
$.ui.toast("Couldn't open " + rm.name + "'s session");
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
}),
|
|
1065
|
+
];
|
|
1066
|
+
}
|
|
1067
|
+
function stagingBanner(el, $, key, since, rm) {
|
|
1011
1068
|
const text = "▲ Staging red" + (since ? " " + shortAge(since, currentTime) : "");
|
|
1012
1069
|
return el.Box({
|
|
1013
1070
|
key,
|
|
@@ -1026,6 +1083,7 @@ function stagingBanner(el, key, since) {
|
|
|
1026
1083
|
paddingX: 1,
|
|
1027
1084
|
children: [el.Text({ color: "#ffffff", bold: true, children: [text] })],
|
|
1028
1085
|
}),
|
|
1086
|
+
...releaseManager(el, $, rm),
|
|
1029
1087
|
el.Link({ href: LINKS.staging, label: "Open staging ↗" }),
|
|
1030
1088
|
],
|
|
1031
1089
|
});
|
|
@@ -1050,7 +1108,7 @@ function bandLines(el, $, inPane) {
|
|
|
1050
1108
|
columnGap: 1,
|
|
1051
1109
|
children: [...tag, el.Text({ color: loading ? undefined : "warning", children: ["BB · " + text] }), details].filter(Boolean),
|
|
1052
1110
|
}),
|
|
1053
|
-
|
|
1111
|
+
headerRow(el, k("line-status"), TITLES.status, TITLE_CELLS, contextBadge(el, k("line-context"))),
|
|
1054
1112
|
].filter(Boolean);
|
|
1055
1113
|
}
|
|
1056
1114
|
const s = snapshot;
|
|
@@ -1152,7 +1210,8 @@ function bandLines(el, $, inPane) {
|
|
|
1152
1210
|
if (details) right.push(details);
|
|
1153
1211
|
const svgPills = pills() && typeof el.Svg === "function";
|
|
1154
1212
|
const widths = {
|
|
1155
|
-
|
|
1213
|
+
// BOT-3245: at least as wide as the STATUS / WAITS titles that share the column.
|
|
1214
|
+
ids: Math.max(TITLE_CELLS, ...specs.map((x) => idsWidth(x.ids, x.prefix))),
|
|
1156
1215
|
status: Math.max(0, ...specs.map(statusWidth)),
|
|
1157
1216
|
statusPx: svgPills ? Math.max(0, ...specs.filter((x) => x.iconSource).map((x) => pillWidth(statusPill(x)))) : 0,
|
|
1158
1217
|
};
|
|
@@ -1162,11 +1221,15 @@ function bandLines(el, $, inPane) {
|
|
|
1162
1221
|
? [el.Box({ key: k("line-notes-only"), flexDirection: "row", columnGap: 1, children: right })]
|
|
1163
1222
|
: [];
|
|
1164
1223
|
if (noteLine) lines.push(noteLine);
|
|
1165
|
-
// BOT-
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1224
|
+
// BOT-3245: STATUS (staging red, then the context alarm), then WAITS, then the tree.
|
|
1225
|
+
const statuses = [
|
|
1226
|
+
...(s.staging?.red ? [stagingBanner(el, $, k("line-staging"), s.staging.since, s.staging.release_manager)] : []),
|
|
1227
|
+
...contextBadge(el, k("line-context")),
|
|
1228
|
+
];
|
|
1229
|
+
const waitsRow = headerRow(el, k("line-waits"), TITLES.waits, widths.ids, waitBadges(el, k("line-context"), s.waits, currentTime));
|
|
1230
|
+
const statusRow = headerRow(el, k("line-status"), TITLES.status, widths.ids, statuses);
|
|
1231
|
+
if (waitsRow) lines.unshift(waitsRow);
|
|
1232
|
+
if (statusRow) lines.unshift(statusRow);
|
|
1170
1233
|
return lines;
|
|
1171
1234
|
}
|
|
1172
1235
|
export function register(on) {
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.74.1",
|
|
3
|
+
"source_commit": "7cb15f9935d7c01406092b1c3cf0b4f50abc1f52",
|
|
4
|
+
"source_sha256": "31fd48d79f311d670a1f22f65f68977ed1f3f969d8c7d7eb9c73c8be5ab77ade",
|
|
5
5
|
"target": "darwin-arm64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "f86727472530e17b25b08d0ec34c9efd93a5614fecc21750d7bad9a8a7f0a544"
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.74.1",
|
|
3
|
+
"source_commit": "7cb15f9935d7c01406092b1c3cf0b4f50abc1f52",
|
|
4
|
+
"source_sha256": "31fd48d79f311d670a1f22f65f68977ed1f3f969d8c7d7eb9c73c8be5ab77ade",
|
|
5
5
|
"target": "linux-x64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "20d3be1129756f8f1c38abd9ae3c3f09a110b8efc71ecf4bcd09367c4014e8ae"
|
|
7
7
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
|
-
"release_version": "1.
|
|
4
|
-
"source_commit": "
|
|
5
|
-
"source_sha256": "
|
|
3
|
+
"release_version": "1.74.1",
|
|
4
|
+
"source_commit": "7cb15f9935d7c01406092b1c3cf0b4f50abc1f52",
|
|
5
|
+
"source_sha256": "31fd48d79f311d670a1f22f65f68977ed1f3f969d8c7d7eb9c73c8be5ab77ade",
|
|
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": "
|
|
11
|
+
"sha256": "f86727472530e17b25b08d0ec34c9efd93a5614fecc21750d7bad9a8a7f0a544",
|
|
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": "
|
|
18
|
+
"sha256": "20d3be1129756f8f1c38abd9ae3c3f09a110b8efc71ecf4bcd09367c4014e8ae",
|
|
19
19
|
"mode": "0755"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/package.json
CHANGED
package/src/commands.mjs
CHANGED
|
@@ -348,6 +348,8 @@ ${bold("EVIDENCE")} (${cyan("bb help evidence")})
|
|
|
348
348
|
Prepare or send a BotBuddy issue report
|
|
349
349
|
release-notes submit <note.json>
|
|
350
350
|
Submit one release note for your tenant (stored as draft)
|
|
351
|
+
release-notes grants list|add|remove
|
|
352
|
+
Owners grant members the release-note submit or manage scope
|
|
351
353
|
status-band install Install the bb-status band into Claude Code (bb setup does it)
|
|
352
354
|
status-band read|relay The band's own reads and live wake (run by the mod)
|
|
353
355
|
evidence require <file> Record an exact-head evidence disposition → botbuddy/ready
|
package/src/release-notes.mjs
CHANGED
|
@@ -7,6 +7,9 @@ import { readFile } from "node:fs/promises";
|
|
|
7
7
|
import { CALL_EXIT, callToolJson, resolveCallAuth } from "./api.mjs";
|
|
8
8
|
|
|
9
9
|
export const RELEASE_NOTES_USAGE = `Usage: bb release-notes submit <note.json> [--json]
|
|
10
|
+
bb release-notes grants list [--tenant <slug>] [--json]
|
|
11
|
+
bb release-notes grants add <email> <submit|manage> [--tenant <slug>] [--json]
|
|
12
|
+
bb release-notes grants remove <email> <submit|manage> [--tenant <slug>] [--json]
|
|
10
13
|
|
|
11
14
|
Submits one release note for your tenant. The file is a schema-1 payload:
|
|
12
15
|
|
|
@@ -30,6 +33,16 @@ An unchanged resubmit (a retry) adds none. A refusal names its code
|
|
|
30
33
|
(schema_invalid, type_unknown, markup_refused, link_refused,
|
|
31
34
|
entitlement_missing) and stores nothing.
|
|
32
35
|
|
|
36
|
+
Scopes. Every member and agent key of the tenant reads. Agent keys submit
|
|
37
|
+
unless their scope list is read-only. Tenant owners manage (and submit)
|
|
38
|
+
implicitly; a member submits or manages only when an owner grants it:
|
|
39
|
+
grants add names one member of your tenant and one scope (submit, or manage,
|
|
40
|
+
which includes submit); grants remove revokes it; grants list shows owners,
|
|
41
|
+
the effective grants and the newest changes. Grants use your own sign-in
|
|
42
|
+
(bb login), never the agent session. Refusals: scope_missing (you are not an
|
|
43
|
+
owner), member_not_in_tenant, owner_scope_is_implicit, scope_unknown,
|
|
44
|
+
entitlement_missing.
|
|
45
|
+
|
|
33
46
|
Exit codes: 0 stored · 1 refused · 2 usage · 3 authentication · 5 BotBuddy unreachable.`;
|
|
34
47
|
|
|
35
48
|
const TOOL = "submit_release_note";
|
|
@@ -45,6 +58,7 @@ export async function cmdReleaseNotes(args, {
|
|
|
45
58
|
(args.length === 0 ? errorLog : log)(RELEASE_NOTES_USAGE);
|
|
46
59
|
return args.length === 0 ? 2 : CALL_EXIT.OK;
|
|
47
60
|
}
|
|
61
|
+
if (args[0] === "grants") return cmdGrants(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
48
62
|
const json = args.includes("--json");
|
|
49
63
|
const rest = args.filter((a) => a !== "--json");
|
|
50
64
|
if (rest[0] !== "submit" || rest.length !== 2 || !rest[1] || rest[1].startsWith("-")) {
|
|
@@ -100,3 +114,95 @@ export async function cmdReleaseNotes(args, {
|
|
|
100
114
|
errorLog("✗ BotBuddy did not confirm the submit. Retry the same command; an unchanged resubmit adds no revision.");
|
|
101
115
|
return CALL_EXIT.ERROR;
|
|
102
116
|
}
|
|
117
|
+
|
|
118
|
+
// ── BOT-3160: bb release-notes grants list|add|remove ─────────────────
|
|
119
|
+
|
|
120
|
+
const GRANT_TOOLS = { add: "grant_release_note_scope", remove: "revoke_release_note_scope", list: "list_release_note_scope_grants" };
|
|
121
|
+
|
|
122
|
+
function printRefusalOrFailure(result, json, log, errorLog, nothing) {
|
|
123
|
+
const data = result?.data;
|
|
124
|
+
if (result?.ok && data?.ok === false && typeof data.error === "string") {
|
|
125
|
+
const refusal = { ok: false, error: data.error, ...(data.field ? { field: data.field } : {}), message: data.message ?? null };
|
|
126
|
+
if (json) log(JSON.stringify(refusal));
|
|
127
|
+
errorLog(`✗ ${refusal.error}${refusal.field ? ` (${refusal.field})` : ""}: ${refusal.message ?? nothing}`);
|
|
128
|
+
return CALL_EXIT.ERROR;
|
|
129
|
+
}
|
|
130
|
+
if (result?.auth) {
|
|
131
|
+
if (json) log(JSON.stringify({ ok: false, error: "authentication_failed" }));
|
|
132
|
+
errorLog(`✗ BotBuddy could not authenticate this command. Sign in with bb login, then retry. ${nothing}`);
|
|
133
|
+
return CALL_EXIT.AUTH;
|
|
134
|
+
}
|
|
135
|
+
if (!result?.ok && result?.status == null) {
|
|
136
|
+
if (json) log(JSON.stringify({ ok: false, error: "transport_unavailable" }));
|
|
137
|
+
errorLog(`✗ BotBuddy is unreachable. Retry the same command. ${nothing}`);
|
|
138
|
+
return CALL_EXIT.TRANSPORT;
|
|
139
|
+
}
|
|
140
|
+
if (json) log(JSON.stringify({ ok: false, error: "receipt_unavailable" }));
|
|
141
|
+
errorLog(`✗ BotBuddy did not confirm the command. Retry it; repeating a grant or revoke changes nothing twice.`);
|
|
142
|
+
return CALL_EXIT.ERROR;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async function cmdGrants(argv, { resolveAuth, call, log, errorLog }) {
|
|
146
|
+
const json = argv.includes("--json");
|
|
147
|
+
let tenant = null;
|
|
148
|
+
const rest = [];
|
|
149
|
+
for (let i = 0; i < argv.length; i++) {
|
|
150
|
+
const a = argv[i];
|
|
151
|
+
if (a === "--json") continue;
|
|
152
|
+
if (a === "--tenant") {
|
|
153
|
+
const v = argv[i + 1];
|
|
154
|
+
if (!v || v.startsWith("-")) { errorLog(RELEASE_NOTES_USAGE); return 2; }
|
|
155
|
+
tenant = v;
|
|
156
|
+
i++;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
rest.push(a);
|
|
160
|
+
}
|
|
161
|
+
const [sub, email, scope, ...extra] = rest;
|
|
162
|
+
const tool = GRANT_TOOLS[sub];
|
|
163
|
+
const isChange = sub === "add" || sub === "remove";
|
|
164
|
+
if (!tool || extra.length > 0 || (sub === "list" && email !== undefined) || (isChange && (!email || !scope || email.startsWith("-") || scope.startsWith("-")))) {
|
|
165
|
+
errorLog(RELEASE_NOTES_USAGE);
|
|
166
|
+
return 2;
|
|
167
|
+
}
|
|
168
|
+
const args = isChange ? { member_email: email, scope } : {};
|
|
169
|
+
|
|
170
|
+
let result;
|
|
171
|
+
try {
|
|
172
|
+
const resolved = await resolveAuth({ toolName: tool, preferSession: false });
|
|
173
|
+
result = resolved?.error || !resolved?.auth
|
|
174
|
+
? { ok: false, auth: true }
|
|
175
|
+
: await call(tool, args, { auth: resolved.auth, tenant, signal: AbortSignal.timeout(30_000) });
|
|
176
|
+
} catch {
|
|
177
|
+
result = { ok: false, status: null };
|
|
178
|
+
}
|
|
179
|
+
const data = result?.data;
|
|
180
|
+
if (!(result?.ok && data?.ok === true)) return printRefusalOrFailure(result, json, log, errorLog, isChange ? "Nothing was changed." : "");
|
|
181
|
+
|
|
182
|
+
if (json) {
|
|
183
|
+
log(JSON.stringify(data));
|
|
184
|
+
return CALL_EXIT.OK;
|
|
185
|
+
}
|
|
186
|
+
if (isChange) {
|
|
187
|
+
const where = `in tenant ${data.tenant}`;
|
|
188
|
+
if (sub === "add") log(data.changed ? `Granted ${data.scope} to ${data.member_email} ${where}.` : `${data.member_email} already holds ${data.scope} ${where}; nothing changed.`);
|
|
189
|
+
else log(data.changed ? `Revoked ${data.scope} from ${data.member_email} ${where}.` : `${data.member_email} does not hold ${data.scope} ${where}; nothing changed.`);
|
|
190
|
+
return CALL_EXIT.OK;
|
|
191
|
+
}
|
|
192
|
+
const owners = Array.isArray(data.owners) ? data.owners : [];
|
|
193
|
+
const effective = Array.isArray(data.effective) ? data.effective : [];
|
|
194
|
+
const rows = Array.isArray(data.rows) ? data.rows : [];
|
|
195
|
+
log(`Release-note scopes in tenant ${data.tenant}`);
|
|
196
|
+
log(`Owners (manage implicitly): ${owners.length ? owners.join(", ") : "none"}`);
|
|
197
|
+
if (effective.length === 0) log("Grants: none");
|
|
198
|
+
else {
|
|
199
|
+
log("Grants:");
|
|
200
|
+
for (const g of effective) log(` ${g.member_email} ${g.scope}`);
|
|
201
|
+
}
|
|
202
|
+
if (rows.length === 0) log("Recent changes: none");
|
|
203
|
+
else {
|
|
204
|
+
log("Recent changes:");
|
|
205
|
+
for (const r of rows) log(` ${r.created_at} ${r.action} ${r.scope} ${r.member_email ?? r.member_user_id} by ${r.granted_by_email ?? r.granted_by}`);
|
|
206
|
+
}
|
|
207
|
+
return CALL_EXIT.OK;
|
|
208
|
+
}
|
package/src/status-band-read.mjs
CHANGED
|
@@ -51,7 +51,26 @@ function stagingOf(own) {
|
|
|
51
51
|
const st = own?.staging;
|
|
52
52
|
if (!st || typeof st !== "object" || typeof st.configured !== "boolean") return null;
|
|
53
53
|
const since = typeof st.open_since === "string" && Number.isFinite(Date.parse(st.open_since)) ? new Date(st.open_since).toISOString() : null;
|
|
54
|
-
|
|
54
|
+
const out = { configured: st.configured, red: st.configured && since !== null, since: st.configured ? since : null };
|
|
55
|
+
// BOT-3241: a red staging's elected release manager, linked only to a verified
|
|
56
|
+
// Claude Desktop session or Codex thread. null = none elected; no key = BB did
|
|
57
|
+
// not say (an older server, a failed read or an unsafe name): the band shows nothing.
|
|
58
|
+
if (out.red && "release_manager" in st) {
|
|
59
|
+
const rm = st.release_manager;
|
|
60
|
+
if (rm === null) out.release_manager = null;
|
|
61
|
+
else if (rm && typeof rm === "object") {
|
|
62
|
+
const name = safeText(rm.name, 80);
|
|
63
|
+
if (name) out.release_manager = { name, href: sessionHref(rm.session_href) };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
const SESSION_HREF = [
|
|
69
|
+
/^claude:\/\/claude\.ai\/epitaxy\/local_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
70
|
+
/^codex:\/\/threads\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
71
|
+
];
|
|
72
|
+
function sessionHref(v) {
|
|
73
|
+
return typeof v === "string" && SESSION_HREF.some((re) => re.test(v)) ? v : null;
|
|
55
74
|
}
|
|
56
75
|
// BOT-3212 AC-1: the session agent's active bb waits, for the band's badge; null
|
|
57
76
|
// when BB did not say (no badge rather than a false "none").
|