@botbuddy/cli 1.79.1 → 1.80.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/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/release-notes.mjs +136 -2
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.80.0",
|
|
3
|
+
"source_commit": "40ae6662590d709ca177465336070212099da96e",
|
|
4
|
+
"source_sha256": "fa319e00266beb29eacade57591904178ab264252d42f8204002d453a77040b1",
|
|
5
5
|
"target": "darwin-arm64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "71f9fad2e1a3d47199bf30499fa44468eda18503d5d35cca4b5fc636490b481f"
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.80.0",
|
|
3
|
+
"source_commit": "40ae6662590d709ca177465336070212099da96e",
|
|
4
|
+
"source_sha256": "fa319e00266beb29eacade57591904178ab264252d42f8204002d453a77040b1",
|
|
5
5
|
"target": "linux-x64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "9a6eae8b85b2dae57ae7b77143cb78cc642d32fa43b91322ac7401d7afadf39b"
|
|
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.80.0",
|
|
4
|
+
"source_commit": "40ae6662590d709ca177465336070212099da96e",
|
|
5
|
+
"source_sha256": "fa319e00266beb29eacade57591904178ab264252d42f8204002d453a77040b1",
|
|
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": "71f9fad2e1a3d47199bf30499fa44468eda18503d5d35cca4b5fc636490b481f",
|
|
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": "9a6eae8b85b2dae57ae7b77143cb78cc642d32fa43b91322ac7401d7afadf39b",
|
|
19
19
|
"mode": "0755"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/package.json
CHANGED
package/src/release-notes.mjs
CHANGED
|
@@ -8,6 +8,8 @@ import { CALL_EXIT, callToolJson, resolveCallAuth } from "./api.mjs";
|
|
|
8
8
|
import { cmdReleaseNotesKeys, cmdReleaseNotesOrigins, RELEASE_NOTES_KEYS_USAGE } from "./release-notes-keys.mjs";
|
|
9
9
|
|
|
10
10
|
export const RELEASE_NOTES_USAGE = `Usage: bb release-notes submit <note.json> [--json]
|
|
11
|
+
bb release-notes list [--tag <group>=<value>]... [--type <type>] [--state <state>] [--cursor <cursor>] [--json]
|
|
12
|
+
bb release-notes get <source_key> [--json]
|
|
11
13
|
bb release-notes grants list [--tenant <slug>] [--json]
|
|
12
14
|
bb release-notes grants add <email> <submit|manage> [--tenant <slug>] [--json]
|
|
13
15
|
bb release-notes grants remove <email> <submit|manage> [--tenant <slug>] [--json]
|
|
@@ -39,6 +41,15 @@ An unchanged resubmit (a retry) adds none. A refusal names its code
|
|
|
39
41
|
(schema_invalid, type_unknown, markup_refused, link_refused,
|
|
40
42
|
entitlement_missing) and stores nothing.
|
|
41
43
|
|
|
44
|
+
Reading. list shows your tenant's notes, newest change first, 50 a page:
|
|
45
|
+
source key, type, state, revision count, internal title and tags. Filters
|
|
46
|
+
combine with AND; repeating --tag for one group matches any of its values;
|
|
47
|
+
--state withdrawn is the only way to list withdrawn notes. When there is more,
|
|
48
|
+
list prints the --cursor for the next page. get prints one note by its exact
|
|
49
|
+
source key: both voices, links and tags; read it before you resubmit, because
|
|
50
|
+
submit replaces the text. --json returns each body as { format, source, ast }.
|
|
51
|
+
Refusals: not_found, tag_group_unknown, tag_value_unknown, type_unknown.
|
|
52
|
+
|
|
42
53
|
Scopes. Every member and agent key of the tenant reads. Agent keys submit
|
|
43
54
|
unless their scope list is read-only. Tenant owners manage (and submit)
|
|
44
55
|
implicitly; a member submits or manages only when an owner grants it:
|
|
@@ -59,7 +70,7 @@ own sign-in. A value is retired, never deleted: notes that carry it keep it.
|
|
|
59
70
|
--internal-only marks a group that is never shown externally (one-way).
|
|
60
71
|
view --show shows the tag and its filter, --tag-only the tag, --hide neither.
|
|
61
72
|
|
|
62
|
-
Exit codes: 0 stored · 1 refused · 2 usage · 3 authentication · 5 BotBuddy unreachable.
|
|
73
|
+
Exit codes: 0 stored or read · 1 refused or not found · 2 usage · 3 authentication · 5 BotBuddy unreachable.
|
|
63
74
|
|
|
64
75
|
Viewer keys and origins (tenant owners, BOT-3158):
|
|
65
76
|
${RELEASE_NOTES_KEYS_USAGE.split("\n").slice(1, 5).join("\n")}`;
|
|
@@ -79,6 +90,9 @@ export async function cmdReleaseNotes(args, {
|
|
|
79
90
|
}
|
|
80
91
|
if (args[0] === "grants") return cmdGrants(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
81
92
|
if (args[0] === "tags") return cmdTags(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
93
|
+
// BOT-3166: list and read the tenant's notes.
|
|
94
|
+
if (args[0] === "list") return cmdList(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
95
|
+
if (args[0] === "get") return cmdGet(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
82
96
|
// BOT-3158: viewer keys and allowed origins.
|
|
83
97
|
if (args[0] === "keys") return await cmdReleaseNotesKeys(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
84
98
|
if (args[0] === "origins") return await cmdReleaseNotesOrigins(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
@@ -147,7 +161,7 @@ function printRefusalOrFailure(result, json, log, errorLog, nothing) {
|
|
|
147
161
|
if (result?.ok && data?.ok === false && typeof data.error === "string") {
|
|
148
162
|
const refusal = { ok: false, error: data.error, ...(data.field ? { field: data.field } : {}), message: data.message ?? null };
|
|
149
163
|
if (json) log(JSON.stringify(refusal));
|
|
150
|
-
errorLog(`✗ ${refusal.error}${refusal.field ? ` (${refusal.field})` : ""}: ${refusal.message ?? nothing}`);
|
|
164
|
+
errorLog(termClean(`✗ ${refusal.error}${refusal.field ? ` (${refusal.field})` : ""}: ${refusal.message ?? nothing}`));
|
|
151
165
|
return CALL_EXIT.ERROR;
|
|
152
166
|
}
|
|
153
167
|
if (result?.auth) {
|
|
@@ -358,3 +372,123 @@ async function cmdTags(argv, { resolveAuth, call, log, errorLog }) {
|
|
|
358
372
|
}
|
|
359
373
|
return CALL_EXIT.OK;
|
|
360
374
|
}
|
|
375
|
+
|
|
376
|
+
// ── BOT-3166: bb release-notes list | get ──────────────────────────────
|
|
377
|
+
|
|
378
|
+
function readUsage(errorLog) {
|
|
379
|
+
errorLog(RELEASE_NOTES_USAGE);
|
|
380
|
+
return 2;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** list arguments → tool arguments, or null for a usage error. */
|
|
384
|
+
export function parseListArgs(argv) {
|
|
385
|
+
const out = {};
|
|
386
|
+
let json = false;
|
|
387
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
388
|
+
const a = argv[i];
|
|
389
|
+
if (a === "--json") { json = true; continue; }
|
|
390
|
+
if (!["--tag", "--type", "--state", "--cursor"].includes(a)) return null;
|
|
391
|
+
const v = argv[i + 1];
|
|
392
|
+
if (v === undefined || v === "" || v.startsWith("--")) return null;
|
|
393
|
+
i += 1;
|
|
394
|
+
if (a === "--tag") {
|
|
395
|
+
const at = v.indexOf("=");
|
|
396
|
+
const group = at > 0 ? v.slice(0, at).trim() : "";
|
|
397
|
+
const value = at > 0 ? v.slice(at + 1).trim() : "";
|
|
398
|
+
if (!group || !value) return null;
|
|
399
|
+
out.tags ??= {};
|
|
400
|
+
// Own properties only: a group named constructor is an ordinary key.
|
|
401
|
+
if (!Object.prototype.hasOwnProperty.call(out.tags, group)) out.tags[group] = [];
|
|
402
|
+
out.tags[group].push(value);
|
|
403
|
+
} else {
|
|
404
|
+
const key = a.slice(2);
|
|
405
|
+
if (out[key] !== undefined) return null;
|
|
406
|
+
out[key] = v;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return { args: out, json };
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
async function callRead(tool, args, { resolveAuth, call }) {
|
|
413
|
+
try {
|
|
414
|
+
const resolved = await resolveAuth({ toolName: tool, preferSession: true });
|
|
415
|
+
return resolved?.error || !resolved?.auth
|
|
416
|
+
? { ok: false, auth: true }
|
|
417
|
+
: await call(tool, args, { auth: resolved.auth, signal: AbortSignal.timeout(30_000) });
|
|
418
|
+
} catch {
|
|
419
|
+
return { ok: false, status: null };
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const tagLine = (tags) => (Array.isArray(tags) && tags.length ? tags.map((t) => `${t.label}: ${t.value}`).join(" · ") : "");
|
|
424
|
+
const revisionsWord = (n) => `${n} revision${n === 1 ? "" : "s"}`;
|
|
425
|
+
|
|
426
|
+
// Codex P1 on #1724: note text, titles, keys, tags and links come from other
|
|
427
|
+
// agents. Text output prints control characters (C0 except newline, DEL, C1)
|
|
428
|
+
// and bidi overrides as visible escapes, so a note cannot clear or rewrite the
|
|
429
|
+
// reader's terminal; --json prints the stored values unchanged.
|
|
430
|
+
const CONTROL = /[\u0000-\u0009\u000b-\u001f\u007f-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
431
|
+
export function termClean(value) {
|
|
432
|
+
return String(value).replace(CONTROL, (c) => {
|
|
433
|
+
const n = c.charCodeAt(0);
|
|
434
|
+
return n <= 0xff ? `\\x${n.toString(16).padStart(2, "0")}` : `\\u${n.toString(16).padStart(4, "0")}`;
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
async function cmdList(argv, deps) {
|
|
439
|
+
const { errorLog } = deps;
|
|
440
|
+
const log = (line) => deps.log(termClean(line));
|
|
441
|
+
const parsed = parseListArgs(argv);
|
|
442
|
+
if (!parsed) return readUsage(errorLog);
|
|
443
|
+
const result = await callRead("list_release_notes", parsed.args, deps);
|
|
444
|
+
const data = result?.data;
|
|
445
|
+
if (!(result?.ok && data?.ok === true && Array.isArray(data.items))) return printRefusalOrFailure(result, parsed.json, deps.log, errorLog, "");
|
|
446
|
+
if (parsed.json) {
|
|
447
|
+
deps.log(JSON.stringify(data));
|
|
448
|
+
return CALL_EXIT.OK;
|
|
449
|
+
}
|
|
450
|
+
if (data.items.length === 0) {
|
|
451
|
+
log(parsed.args.cursor || Object.keys(parsed.args).length === 0 ? "No release notes yet." : "No release notes match these filters.");
|
|
452
|
+
return CALL_EXIT.OK;
|
|
453
|
+
}
|
|
454
|
+
for (const n of data.items) {
|
|
455
|
+
log(`${n.source_key} · ${n.type} · ${n.state} · ${revisionsWord(n.revisions)} · ${n.title}`);
|
|
456
|
+
const tags = tagLine(n.tags);
|
|
457
|
+
if (tags) log(` ${tags}`);
|
|
458
|
+
}
|
|
459
|
+
if (data.next_cursor) log(`More: bb release-notes list --cursor ${data.next_cursor}${argv.length ? " (repeat your filters)" : ""}`);
|
|
460
|
+
return CALL_EXIT.OK;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
async function cmdGet(argv, deps) {
|
|
464
|
+
const { log, errorLog } = deps;
|
|
465
|
+
const json = argv.includes("--json");
|
|
466
|
+
const rest = argv.filter((a) => a !== "--json");
|
|
467
|
+
if (rest.length !== 1 || rest[0] === "") return readUsage(errorLog);
|
|
468
|
+
const args = { source_key: rest[0], ...(json ? {} : { render: "text" }) };
|
|
469
|
+
const result = await callRead("get_release_note", args, deps);
|
|
470
|
+
const data = result?.data;
|
|
471
|
+
const n = data?.note;
|
|
472
|
+
if (!(result?.ok && data?.ok === true && n && typeof n === "object")) return printRefusalOrFailure(result, json, log, errorLog, "");
|
|
473
|
+
if (json) {
|
|
474
|
+
const { text: _text, ...rest2 } = data;
|
|
475
|
+
log(JSON.stringify(rest2));
|
|
476
|
+
return CALL_EXIT.OK;
|
|
477
|
+
}
|
|
478
|
+
const text = data.text ?? {};
|
|
479
|
+
const links = (list) => (Array.isArray(list) ? list.map((l) => ` - ${l.name} · ${l.url}`) : []);
|
|
480
|
+
const lines = [`${n.source_key} · ${n.type} · ${n.state} · ${revisionsWord(n.revisions)}`];
|
|
481
|
+
const tags = tagLine(n.tags);
|
|
482
|
+
if (tags) lines.push(`Tags: ${tags}`);
|
|
483
|
+
lines.push("", `Internal: ${n.internal?.title ?? ""}`, text.internal ?? "");
|
|
484
|
+
if (Array.isArray(n.internal_links) && n.internal_links.length) lines.push("", "Internal links:", ...links(n.internal_links));
|
|
485
|
+
lines.push("");
|
|
486
|
+
if (n.external) {
|
|
487
|
+
lines.push(`External: ${n.external.title}`, text.external ?? "");
|
|
488
|
+
if (Array.isArray(n.external_links) && n.external_links.length) lines.push("", "External links:", ...links(n.external_links));
|
|
489
|
+
} else {
|
|
490
|
+
lines.push("External: none");
|
|
491
|
+
}
|
|
492
|
+
log(termClean(lines.join("\n")));
|
|
493
|
+
return CALL_EXIT.OK;
|
|
494
|
+
}
|