@botbuddy/cli 1.79.1 → 1.81.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 +4 -0
- 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 +200 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.81.0
|
|
4
|
+
|
|
5
|
+
- `bb release-notes submit <note.json> --pack <pack.json>` adds the pack file to the note unchanged as its internal `bbrn-pack-1` pack (BOT-3260) and prints the customers BotBuddy derived from Linear, or `unavailable (<reason>)`; `--json` includes them as `customers`. An unreadable pack file, a note that already has a `pack`, or `--pack` with no file is a usage error and sends nothing. The help lists the pack fields and `pack_field_missing`; each field's good and bad example is in `docs/release-notes/pack-fields.md`.
|
|
6
|
+
|
|
3
7
|
## 1.79.0
|
|
4
8
|
|
|
5
9
|
- The bb-status band's STATUS line warns while the session's project has tickets with none of the Must, Unsure or Could labels (BOT-3263): an amber `⚠ 26 project tickets not categorised` with a ↗ to the project drawer filtered to them (`&progress=uncategorised`). The count is BB's `progress_uncategorised`; against an older MCP that does not send it there is no warning. The project row's badge is unchanged. bb-status plugin 1.6.0.
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.81.0",
|
|
3
|
+
"source_commit": "3e272e88f4b4c4e668a69bb804bd262570b96a4a",
|
|
4
|
+
"source_sha256": "e82a3837cf2ed15fce1e360819e1c41a70f328e455e1a80a8ade9ae19077df64",
|
|
5
5
|
"target": "darwin-arm64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "4c4a922b177fb8ccc37d3b822e1fa828719189fa7c2719f6c6b3d41645e26ae0"
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.81.0",
|
|
3
|
+
"source_commit": "3e272e88f4b4c4e668a69bb804bd262570b96a4a",
|
|
4
|
+
"source_sha256": "e82a3837cf2ed15fce1e360819e1c41a70f328e455e1a80a8ade9ae19077df64",
|
|
5
5
|
"target": "linux-x64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "806739b52d332caa0da7bccecbd4fc46cd65ffdb43021324cd7f3dd46a7e4c40"
|
|
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.81.0",
|
|
4
|
+
"source_commit": "3e272e88f4b4c4e668a69bb804bd262570b96a4a",
|
|
5
|
+
"source_sha256": "e82a3837cf2ed15fce1e360819e1c41a70f328e455e1a80a8ade9ae19077df64",
|
|
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": "4c4a922b177fb8ccc37d3b822e1fa828719189fa7c2719f6c6b3d41645e26ae0",
|
|
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": "806739b52d332caa0da7bccecbd4fc46cd65ffdb43021324cd7f3dd46a7e4c40",
|
|
19
19
|
"mode": "0755"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/package.json
CHANGED
package/src/release-notes.mjs
CHANGED
|
@@ -7,7 +7,9 @@ import { readFile } from "node:fs/promises";
|
|
|
7
7
|
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
|
-
export const RELEASE_NOTES_USAGE = `Usage: bb release-notes submit <note.json> [--json]
|
|
10
|
+
export const RELEASE_NOTES_USAGE = `Usage: bb release-notes submit <note.json> [--pack <pack.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]
|
|
@@ -34,10 +36,37 @@ No HTML and no links inside a body. A link url is https://… or an app path
|
|
|
34
36
|
starting with one /. Write the text yourself: BotBuddy stores exactly what you
|
|
35
37
|
submit.
|
|
36
38
|
|
|
39
|
+
Pack (bbrn-pack-1, internal only, BOT-3260). --pack adds the file as the
|
|
40
|
+
note's "pack": the fields a release pack and testing tour are built from.
|
|
41
|
+
|
|
42
|
+
{ "schema": "bbrn-pack-1", "category": "Feature",
|
|
43
|
+
"audience": ["Release manager"],
|
|
44
|
+
"before": "…", "after": "…", "benefit": "…", "ui": "none",
|
|
45
|
+
"tour": { "find_it": "/release-notes", "try": "…", "look_for": "…",
|
|
46
|
+
"watch": "…", "role": ["Release manager"] } }
|
|
47
|
+
|
|
48
|
+
category is Feature, Bug fix or Chore. A Feature or Bug fix needs before,
|
|
49
|
+
after, benefit, ui (bbrn-md-1, or "none" when there is no UI) and the tour's
|
|
50
|
+
find_it (an app path or https URL), try and look_for; a Chore needs only
|
|
51
|
+
category and after. A missing field is refused with pack_field_missing naming
|
|
52
|
+
it. audience and tour.role are values of your tenant's persona tag group.
|
|
53
|
+
Never write customers: BotBuddy derives them from the linked Linear tickets'
|
|
54
|
+
customer needs and the receipt prints them (or why they are unavailable).
|
|
55
|
+
Each field, with a good and a bad example: docs/release-notes/pack-fields.md.
|
|
56
|
+
|
|
37
57
|
Submitting the same source_key again updates the note and adds a revision.
|
|
38
58
|
An unchanged resubmit (a retry) adds none. A refusal names its code
|
|
39
59
|
(schema_invalid, type_unknown, markup_refused, link_refused,
|
|
40
|
-
entitlement_missing) and stores nothing.
|
|
60
|
+
entitlement_missing, pack_field_missing) and stores nothing.
|
|
61
|
+
|
|
62
|
+
Reading. list shows your tenant's notes, newest change first, 50 a page:
|
|
63
|
+
source key, type, state, revision count, internal title and tags. Filters
|
|
64
|
+
combine with AND; repeating --tag for one group matches any of its values;
|
|
65
|
+
--state withdrawn is the only way to list withdrawn notes. When there is more,
|
|
66
|
+
list prints the --cursor for the next page. get prints one note by its exact
|
|
67
|
+
source key: both voices, links and tags; read it before you resubmit, because
|
|
68
|
+
submit replaces the text. --json returns each body as { format, source, ast }.
|
|
69
|
+
Refusals: not_found, tag_group_unknown, tag_value_unknown, type_unknown.
|
|
41
70
|
|
|
42
71
|
Scopes. Every member and agent key of the tenant reads. Agent keys submit
|
|
43
72
|
unless their scope list is read-only. Tenant owners manage (and submit)
|
|
@@ -50,7 +79,8 @@ owner), member_not_in_tenant, owner_scope_is_implicit, scope_unknown,
|
|
|
50
79
|
entitlement_missing.
|
|
51
80
|
|
|
52
81
|
Tags. Each tenant manages its own tag groups (Component and Module to start,
|
|
53
|
-
plus any it adds
|
|
82
|
+
then Persona and Customer, plus any it adds). Customer is internal only and
|
|
83
|
+
filled from Linear: never submit it. tags lists each group's values, retired
|
|
54
84
|
values and what the internal and external views show; read it before you
|
|
55
85
|
submit. A note may carry only listed values: tag_group_unknown,
|
|
56
86
|
tag_value_unknown (the message lists the allowed values) and tag_count_invalid
|
|
@@ -59,7 +89,7 @@ own sign-in. A value is retired, never deleted: notes that carry it keep it.
|
|
|
59
89
|
--internal-only marks a group that is never shown externally (one-way).
|
|
60
90
|
view --show shows the tag and its filter, --tag-only the tag, --hide neither.
|
|
61
91
|
|
|
62
|
-
Exit codes: 0 stored · 1 refused · 2 usage · 3 authentication · 5 BotBuddy unreachable.
|
|
92
|
+
Exit codes: 0 stored or read · 1 refused or not found · 2 usage · 3 authentication · 5 BotBuddy unreachable.
|
|
63
93
|
|
|
64
94
|
Viewer keys and origins (tenant owners, BOT-3158):
|
|
65
95
|
${RELEASE_NOTES_KEYS_USAGE.split("\n").slice(1, 5).join("\n")}`;
|
|
@@ -79,11 +109,25 @@ export async function cmdReleaseNotes(args, {
|
|
|
79
109
|
}
|
|
80
110
|
if (args[0] === "grants") return cmdGrants(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
81
111
|
if (args[0] === "tags") return cmdTags(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
112
|
+
// BOT-3166: list and read the tenant's notes.
|
|
113
|
+
if (args[0] === "list") return cmdList(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
114
|
+
if (args[0] === "get") return cmdGet(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
82
115
|
// BOT-3158: viewer keys and allowed origins.
|
|
83
116
|
if (args[0] === "keys") return await cmdReleaseNotesKeys(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
84
117
|
if (args[0] === "origins") return await cmdReleaseNotesOrigins(args.slice(1), { resolveAuth, call, log, errorLog });
|
|
85
118
|
const json = args.includes("--json");
|
|
86
|
-
|
|
119
|
+
let rest = args.filter((a) => a !== "--json");
|
|
120
|
+
// BOT-3260: --pack <pack.json>, anywhere after submit.
|
|
121
|
+
let packFile = null;
|
|
122
|
+
const at = rest.indexOf("--pack");
|
|
123
|
+
if (at !== -1) {
|
|
124
|
+
packFile = rest[at + 1];
|
|
125
|
+
if (!packFile || packFile.startsWith("-")) {
|
|
126
|
+
errorLog(RELEASE_NOTES_USAGE);
|
|
127
|
+
return 2;
|
|
128
|
+
}
|
|
129
|
+
rest = [...rest.slice(0, at), ...rest.slice(at + 2)];
|
|
130
|
+
}
|
|
87
131
|
if (rest[0] !== "submit" || rest.length !== 2 || !rest[1] || rest[1].startsWith("-")) {
|
|
88
132
|
errorLog(RELEASE_NOTES_USAGE);
|
|
89
133
|
return 2;
|
|
@@ -96,6 +140,21 @@ export async function cmdReleaseNotes(args, {
|
|
|
96
140
|
errorLog(`Could not read ${file} as JSON; nothing was submitted.`);
|
|
97
141
|
return 2;
|
|
98
142
|
}
|
|
143
|
+
if (packFile) {
|
|
144
|
+
let pack;
|
|
145
|
+
try {
|
|
146
|
+
pack = JSON.parse(await read(packFile, "utf8"));
|
|
147
|
+
} catch {
|
|
148
|
+
errorLog(`Could not read ${packFile} as JSON; nothing was submitted.`);
|
|
149
|
+
return 2;
|
|
150
|
+
}
|
|
151
|
+
if (note && typeof note === "object" && !Array.isArray(note) && "pack" in note) {
|
|
152
|
+
errorLog(`${file} already has a pack; pass it in the note or with --pack, not both. Nothing was submitted.`);
|
|
153
|
+
return 2;
|
|
154
|
+
}
|
|
155
|
+
// Sent unchanged: the server is the only validator.
|
|
156
|
+
note = { ...note, pack };
|
|
157
|
+
}
|
|
99
158
|
|
|
100
159
|
let result;
|
|
101
160
|
try {
|
|
@@ -109,11 +168,15 @@ export async function cmdReleaseNotes(args, {
|
|
|
109
168
|
|
|
110
169
|
const data = result?.data;
|
|
111
170
|
if (result?.ok && data?.ok === true && typeof data.source_key === "string" && Number.isInteger(data.revision)) {
|
|
112
|
-
const receipt = {
|
|
171
|
+
const receipt = {
|
|
172
|
+
ok: true, source_key: data.source_key, state: data.state, revision: data.revision, created: data.created === true, changed: data.changed === true, tenant: data.tenant ?? null,
|
|
173
|
+
...(data.customers && typeof data.customers === "object" ? { customers: data.customers } : {}),
|
|
174
|
+
};
|
|
113
175
|
if (json) log(JSON.stringify(receipt));
|
|
114
176
|
else {
|
|
115
177
|
const what = receipt.created ? "stored" : receipt.changed ? "updated" : "unchanged (no new revision)";
|
|
116
178
|
log(`Release note ${receipt.source_key} ${what}: state ${receipt.state}, revision ${receipt.revision}${receipt.tenant ? `, tenant ${receipt.tenant}` : ""}.`);
|
|
179
|
+
if (receipt.customers) log(describeCustomers(receipt.customers));
|
|
117
180
|
}
|
|
118
181
|
return CALL_EXIT.OK;
|
|
119
182
|
}
|
|
@@ -138,6 +201,16 @@ export async function cmdReleaseNotes(args, {
|
|
|
138
201
|
return CALL_EXIT.ERROR;
|
|
139
202
|
}
|
|
140
203
|
|
|
204
|
+
/** BOT-3260: the receipt's derived customers in one line. "none" only when Linear said so. */
|
|
205
|
+
export function describeCustomers(c) {
|
|
206
|
+
const tickets = Array.isArray(c.tickets) && c.tickets.length ? c.tickets.join(", ") : "no linked ticket";
|
|
207
|
+
if (c.status === "resolved") {
|
|
208
|
+
const names = Array.isArray(c.customers) ? c.customers.map((x) => x?.name).filter(Boolean) : [];
|
|
209
|
+
return names.length ? `Customers (from Linear): ${names.join(", ")}.` : `Customers (from Linear): none on ${tickets}.`;
|
|
210
|
+
}
|
|
211
|
+
return `Customers: unavailable (${c.reason ?? "unknown"}) for ${tickets}.`;
|
|
212
|
+
}
|
|
213
|
+
|
|
141
214
|
// ── BOT-3160: bb release-notes grants list|add|remove ─────────────────
|
|
142
215
|
|
|
143
216
|
const GRANT_TOOLS = { add: "grant_release_note_scope", remove: "revoke_release_note_scope", list: "list_release_note_scope_grants" };
|
|
@@ -147,7 +220,7 @@ function printRefusalOrFailure(result, json, log, errorLog, nothing) {
|
|
|
147
220
|
if (result?.ok && data?.ok === false && typeof data.error === "string") {
|
|
148
221
|
const refusal = { ok: false, error: data.error, ...(data.field ? { field: data.field } : {}), message: data.message ?? null };
|
|
149
222
|
if (json) log(JSON.stringify(refusal));
|
|
150
|
-
errorLog(`✗ ${refusal.error}${refusal.field ? ` (${refusal.field})` : ""}: ${refusal.message ?? nothing}`);
|
|
223
|
+
errorLog(termClean(`✗ ${refusal.error}${refusal.field ? ` (${refusal.field})` : ""}: ${refusal.message ?? nothing}`));
|
|
151
224
|
return CALL_EXIT.ERROR;
|
|
152
225
|
}
|
|
153
226
|
if (result?.auth) {
|
|
@@ -358,3 +431,123 @@ async function cmdTags(argv, { resolveAuth, call, log, errorLog }) {
|
|
|
358
431
|
}
|
|
359
432
|
return CALL_EXIT.OK;
|
|
360
433
|
}
|
|
434
|
+
|
|
435
|
+
// ── BOT-3166: bb release-notes list | get ──────────────────────────────
|
|
436
|
+
|
|
437
|
+
function readUsage(errorLog) {
|
|
438
|
+
errorLog(RELEASE_NOTES_USAGE);
|
|
439
|
+
return 2;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** list arguments → tool arguments, or null for a usage error. */
|
|
443
|
+
export function parseListArgs(argv) {
|
|
444
|
+
const out = {};
|
|
445
|
+
let json = false;
|
|
446
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
447
|
+
const a = argv[i];
|
|
448
|
+
if (a === "--json") { json = true; continue; }
|
|
449
|
+
if (!["--tag", "--type", "--state", "--cursor"].includes(a)) return null;
|
|
450
|
+
const v = argv[i + 1];
|
|
451
|
+
if (v === undefined || v === "" || v.startsWith("--")) return null;
|
|
452
|
+
i += 1;
|
|
453
|
+
if (a === "--tag") {
|
|
454
|
+
const at = v.indexOf("=");
|
|
455
|
+
const group = at > 0 ? v.slice(0, at).trim() : "";
|
|
456
|
+
const value = at > 0 ? v.slice(at + 1).trim() : "";
|
|
457
|
+
if (!group || !value) return null;
|
|
458
|
+
out.tags ??= {};
|
|
459
|
+
// Own properties only: a group named constructor is an ordinary key.
|
|
460
|
+
if (!Object.prototype.hasOwnProperty.call(out.tags, group)) out.tags[group] = [];
|
|
461
|
+
out.tags[group].push(value);
|
|
462
|
+
} else {
|
|
463
|
+
const key = a.slice(2);
|
|
464
|
+
if (out[key] !== undefined) return null;
|
|
465
|
+
out[key] = v;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return { args: out, json };
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
async function callRead(tool, args, { resolveAuth, call }) {
|
|
472
|
+
try {
|
|
473
|
+
const resolved = await resolveAuth({ toolName: tool, preferSession: true });
|
|
474
|
+
return resolved?.error || !resolved?.auth
|
|
475
|
+
? { ok: false, auth: true }
|
|
476
|
+
: await call(tool, args, { auth: resolved.auth, signal: AbortSignal.timeout(30_000) });
|
|
477
|
+
} catch {
|
|
478
|
+
return { ok: false, status: null };
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const tagLine = (tags) => (Array.isArray(tags) && tags.length ? tags.map((t) => `${t.label}: ${t.value}`).join(" · ") : "");
|
|
483
|
+
const revisionsWord = (n) => `${n} revision${n === 1 ? "" : "s"}`;
|
|
484
|
+
|
|
485
|
+
// Codex P1 on #1724: note text, titles, keys, tags and links come from other
|
|
486
|
+
// agents. Text output prints control characters (C0 except newline, DEL, C1)
|
|
487
|
+
// and bidi overrides as visible escapes, so a note cannot clear or rewrite the
|
|
488
|
+
// reader's terminal; --json prints the stored values unchanged.
|
|
489
|
+
const CONTROL = /[\u0000-\u0009\u000b-\u001f\u007f-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
490
|
+
export function termClean(value) {
|
|
491
|
+
return String(value).replace(CONTROL, (c) => {
|
|
492
|
+
const n = c.charCodeAt(0);
|
|
493
|
+
return n <= 0xff ? `\\x${n.toString(16).padStart(2, "0")}` : `\\u${n.toString(16).padStart(4, "0")}`;
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
async function cmdList(argv, deps) {
|
|
498
|
+
const { errorLog } = deps;
|
|
499
|
+
const log = (line) => deps.log(termClean(line));
|
|
500
|
+
const parsed = parseListArgs(argv);
|
|
501
|
+
if (!parsed) return readUsage(errorLog);
|
|
502
|
+
const result = await callRead("list_release_notes", parsed.args, deps);
|
|
503
|
+
const data = result?.data;
|
|
504
|
+
if (!(result?.ok && data?.ok === true && Array.isArray(data.items))) return printRefusalOrFailure(result, parsed.json, deps.log, errorLog, "");
|
|
505
|
+
if (parsed.json) {
|
|
506
|
+
deps.log(JSON.stringify(data));
|
|
507
|
+
return CALL_EXIT.OK;
|
|
508
|
+
}
|
|
509
|
+
if (data.items.length === 0) {
|
|
510
|
+
log(parsed.args.cursor || Object.keys(parsed.args).length === 0 ? "No release notes yet." : "No release notes match these filters.");
|
|
511
|
+
return CALL_EXIT.OK;
|
|
512
|
+
}
|
|
513
|
+
for (const n of data.items) {
|
|
514
|
+
log(`${n.source_key} · ${n.type} · ${n.state} · ${revisionsWord(n.revisions)} · ${n.title}`);
|
|
515
|
+
const tags = tagLine(n.tags);
|
|
516
|
+
if (tags) log(` ${tags}`);
|
|
517
|
+
}
|
|
518
|
+
if (data.next_cursor) log(`More: bb release-notes list --cursor ${data.next_cursor}${argv.length ? " (repeat your filters)" : ""}`);
|
|
519
|
+
return CALL_EXIT.OK;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
async function cmdGet(argv, deps) {
|
|
523
|
+
const { log, errorLog } = deps;
|
|
524
|
+
const json = argv.includes("--json");
|
|
525
|
+
const rest = argv.filter((a) => a !== "--json");
|
|
526
|
+
if (rest.length !== 1 || rest[0] === "") return readUsage(errorLog);
|
|
527
|
+
const args = { source_key: rest[0], ...(json ? {} : { render: "text" }) };
|
|
528
|
+
const result = await callRead("get_release_note", args, deps);
|
|
529
|
+
const data = result?.data;
|
|
530
|
+
const n = data?.note;
|
|
531
|
+
if (!(result?.ok && data?.ok === true && n && typeof n === "object")) return printRefusalOrFailure(result, json, log, errorLog, "");
|
|
532
|
+
if (json) {
|
|
533
|
+
const { text: _text, ...rest2 } = data;
|
|
534
|
+
log(JSON.stringify(rest2));
|
|
535
|
+
return CALL_EXIT.OK;
|
|
536
|
+
}
|
|
537
|
+
const text = data.text ?? {};
|
|
538
|
+
const links = (list) => (Array.isArray(list) ? list.map((l) => ` - ${l.name} · ${l.url}`) : []);
|
|
539
|
+
const lines = [`${n.source_key} · ${n.type} · ${n.state} · ${revisionsWord(n.revisions)}`];
|
|
540
|
+
const tags = tagLine(n.tags);
|
|
541
|
+
if (tags) lines.push(`Tags: ${tags}`);
|
|
542
|
+
lines.push("", `Internal: ${n.internal?.title ?? ""}`, text.internal ?? "");
|
|
543
|
+
if (Array.isArray(n.internal_links) && n.internal_links.length) lines.push("", "Internal links:", ...links(n.internal_links));
|
|
544
|
+
lines.push("");
|
|
545
|
+
if (n.external) {
|
|
546
|
+
lines.push(`External: ${n.external.title}`, text.external ?? "");
|
|
547
|
+
if (Array.isArray(n.external_links) && n.external_links.length) lines.push("", "External links:", ...links(n.external_links));
|
|
548
|
+
} else {
|
|
549
|
+
lines.push("External: none");
|
|
550
|
+
}
|
|
551
|
+
log(termClean(lines.join("\n")));
|
|
552
|
+
return CALL_EXIT.OK;
|
|
553
|
+
}
|