@vercel/board 0.40.0 → 0.41.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/README.md +1 -1
- package/dist/{access-Bl_k_Hpa.mjs → access-C5HaO42b.mjs} +2 -2
- package/dist/access.d.mts +6 -6
- package/dist/access.mjs +5 -5
- package/dist/{actors-yBRWTpt5.mjs → actors-nrOf7Y7z.mjs} +59 -40
- package/dist/{auth-DtmZzlHm.d.mts → auth-Bn8J_1F2.d.mts} +12 -30
- package/dist/{auth-C8URZHLx.mjs → auth-DAlYi6TN.mjs} +9 -19
- package/dist/{backend-BW5NbBsp.d.mts → backend-CYsTLxtP.d.mts} +116 -46
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-1WKsLEnM.mjs → chat-provider-CPZg2MQb.mjs} +2 -2
- package/dist/{chat-provider-Bbb9JguG.d.mts → chat-provider-Cgkh9xJw.d.mts} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +3 -3
- package/dist/cli-embedded.mjs +4 -4
- package/dist/cli.mjs +8 -13
- package/dist/{commands-BJLocuXj.d.mts → commands-CrEVjASe.d.mts} +8 -30
- package/dist/{commands-D6VWegVY.mjs → commands-QRD0U9AQ.mjs} +30 -101
- package/dist/{conformance-BWhZ0k8T.mjs → conformance-ClxEEZ9C.mjs} +139 -109
- package/dist/conformance.d.mts +9 -8
- package/dist/conformance.mjs +1 -1
- package/dist/digest-Dna1CGa_.mjs +4 -0
- package/dist/{engine-Djif8XVk.mjs → engine-8BcNeckB.mjs} +11 -12
- package/dist/{errors-CNRJqUuL.mjs → errors-DcQf5WeM.mjs} +109 -30
- package/dist/{events-C6HwB046.mjs → events-BT8y_81j.mjs} +2 -2
- package/dist/{exports-C2OWIbLU.mjs → exports-B6udRV_E.mjs} +363 -161
- package/dist/exports-C8zsIL1A.d.mts +4 -0
- package/dist/{external-CHDxWIVf.mjs → external-DymyhUzl.mjs} +1 -1
- package/dist/{index-Cuxbz_E0.d.mts → index-fcpEFCTR.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +6 -5
- package/dist/index.node.d.mts +6 -6
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +31 -31
- package/dist/inspect/engine.js +2 -2
- package/dist/inspect-BsF3mYMY.mjs +2 -0
- package/dist/{inspect-cGcP8ZO9.mjs → inspect-DPRoC_Gg.mjs} +6 -6
- package/dist/{local-CsleYuyM.mjs → local-B9y4p6N7.mjs} +113 -358
- package/dist/{main-D97xuqWZ.mjs → main-S0A-c_kP.mjs} +392 -139
- package/dist/{memory-BvVoglGv.mjs → memory-DhduVbUu.mjs} +2 -2
- package/dist/{mentions-CT2bN5eP.mjs → mentions-DfZGp3B-.mjs} +1 -1
- package/dist/{middleware-BF9vnPPS.mjs → middleware-DHdrxmoc.mjs} +2 -2
- package/dist/{origin-DLCmrwmE.mjs → origin-B3m2lnZC.mjs} +7 -36
- package/dist/{page-6BTCZWGY.mjs → page-2jjHZmIW.mjs} +2 -2
- package/dist/page-CAUe4GmQ.mjs +2 -0
- package/dist/{provider-YqkF1E2k.d.mts → provider-dY54GFNz.d.mts} +1 -25
- package/dist/{routes-CAjd5ARa.d.mts → routes-By9lmvUD.d.mts} +1 -63
- package/dist/{schemas-AZkxk06N.mjs → schemas-DAzSsgWk.mjs} +8 -3
- package/dist/{serve-Cs-e0Jke.mjs → serve-B15I2Ibf.mjs} +5 -5
- package/dist/{server-CIfMdIt3.mjs → server-DgpRZ4Nu.mjs} +74 -127
- package/dist/{serving-B4l0nLng.mjs → serving-CALKWs9K.mjs} +1 -1
- package/dist/{sql-Bv-RQu8n.mjs → sql-P9g-rLIF.mjs} +3 -3
- package/dist/{sqlite-D4mkYihG.mjs → sqlite-B3rCcIof.mjs} +2 -2
- package/dist/{sqlite-db-BraLvHtf.mjs → sqlite-db-D0Fyju-4.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +2 -2
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +4 -4
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{tokens-CrrXAVGz.mjs → tokens-D7_ZIWpX.mjs} +4 -4
- package/docs/01-board/01-mounting.md +12 -17
- package/docs/01-board/03-identity.md +45 -39
- package/docs/01-board/04-messages.md +3 -1
- package/docs/01-board/05-reading.md +8 -2
- package/docs/01-board/06-watchers.md +15 -10
- package/docs/01-board/07-schedules.md +6 -2
- package/docs/01-board/09-access.md +56 -111
- package/docs/02-sync/01-overview.md +5 -2
- package/docs/02-sync/03-slack.md +12 -12
- package/docs/03-guides/01-coding-agents.md +18 -22
- package/docs/03-guides/02-inspector.md +4 -5
- package/docs/03-guides/03-ci.md +7 -26
- package/docs/03-guides/04-triage.md +2 -2
- package/docs/03-guides/05-agent-factory.md +7 -9
- package/docs/03-guides/06-sandboxed-agents.md +149 -0
- package/docs/04-reference/01-cli.md +52 -87
- package/docs/04-reference/02-board.md +35 -36
- package/docs/04-reference/03-http.md +32 -53
- package/docs/04-reference/05-conformance.md +37 -18
- package/docs/index.md +4 -4
- package/package.json +1 -1
- package/dist/digest-D32GV_mX.mjs +0 -4
- package/dist/exports-FyRBIAMs.d.mts +0 -4
- package/dist/inspect-CLy6FrOZ.mjs +0 -2
- package/dist/page-BnY8FhPn.mjs +0 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-
|
|
1
|
+
import { g as DIRECT_UPLOAD_BYTES_MAX, u as BoardError, y as fileSize } from "./errors-DcQf5WeM.mjs";
|
|
2
|
+
import { f as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-DAzSsgWk.mjs";
|
|
3
3
|
import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
|
|
4
|
-
import { h as VERSION, s as withMentions } from "./origin-
|
|
4
|
+
import { h as VERSION, s as withMentions } from "./origin-B3m2lnZC.mjs";
|
|
5
5
|
import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
6
|
-
import { l as shownName } from "./middleware-
|
|
7
|
-
import { r as PERMISSIONS
|
|
8
|
-
import { i as isApiMessageId, n as isBoardName } from "./exports-
|
|
9
|
-
import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-
|
|
10
|
-
import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-
|
|
11
|
-
import { t as conformance } from "./conformance-
|
|
6
|
+
import { l as shownName } from "./middleware-DHdrxmoc.mjs";
|
|
7
|
+
import { r as PERMISSIONS } from "./access-C5HaO42b.mjs";
|
|
8
|
+
import { i as isApiMessageId, n as isBoardName } from "./exports-B6udRV_E.mjs";
|
|
9
|
+
import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-QRD0U9AQ.mjs";
|
|
10
|
+
import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-DgpRZ4Nu.mjs";
|
|
11
|
+
import { t as conformance } from "./conformance-ClxEEZ9C.mjs";
|
|
12
12
|
import { t as displayText } from "./bots-CGkO76qH.mjs";
|
|
13
13
|
import { spawn } from "node:child_process";
|
|
14
14
|
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
@@ -427,14 +427,6 @@ function formatAccess(access) {
|
|
|
427
427
|
return `${pattern.padEnd(width)} ${permissions.includes("manage") ? "all" : permissions.length === 0 ? "nothing" : permissions.join(" ")}`;
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
|
-
/** What a grant or token may do, as `--can` takes it: `dev/=read,post;ci/=read`, or `all`. */
|
|
431
|
-
function formatCan(can) {
|
|
432
|
-
const patterns = Object.keys(can);
|
|
433
|
-
if (patterns.length === 1 && patterns[0] === "*" && can["*"].includes("manage")) return "all";
|
|
434
|
-
if (patterns.length === 0) return "nothing";
|
|
435
|
-
const permissions = (list) => list.includes("manage") ? "all" : list.length === 0 ? "none" : list.join(",");
|
|
436
|
-
return patterns.map((pattern) => `${pattern}=${permissions(can[pattern])}`).join(";");
|
|
437
|
-
}
|
|
438
430
|
/** Rows of cells, each column padded to its widest, two spaces apart. */
|
|
439
431
|
const table = (rows) => {
|
|
440
432
|
const widths = rows[0].map((_, column) => Math.max(...rows.map((row) => row[column].length)));
|
|
@@ -485,15 +477,6 @@ function formatGrants(grants) {
|
|
|
485
477
|
}
|
|
486
478
|
/** One grant as its row: `g3 --everyone security/=none`. */
|
|
487
479
|
const grantRow = (grant) => grantCells(grant).join(" ");
|
|
488
|
-
/** Each token on a row: its ID, its name, what it may do, and when it expires. */
|
|
489
|
-
function formatTokens(tokens, now = Date.now()) {
|
|
490
|
-
return table(tokens.map((token) => [
|
|
491
|
-
token.id,
|
|
492
|
-
token.name,
|
|
493
|
-
formatCan(token.can),
|
|
494
|
-
`expires ${until(token.expiresAt, now)}${token.profile !== null ? ` · as ${token.profile}` : ""}${token.parent !== null ? ` · minted with ${token.parent}` : ""}`
|
|
495
|
-
]));
|
|
496
|
-
}
|
|
497
480
|
/** `90m` → `1h30m`, `1d`: milliseconds as a duration flag would say them. */
|
|
498
481
|
function span(ms) {
|
|
499
482
|
const parts = [];
|
|
@@ -810,7 +793,7 @@ const flag = (option) => `${option.short ? `-${option.short}, ` : ""}--${option.
|
|
|
810
793
|
const shown = (list) => list.filter((option) => !option.hidden);
|
|
811
794
|
/** A command's rows in the list: itself, when it runs alone and no subcommand is what it runs, and each of its subcommands. */
|
|
812
795
|
function listed(command) {
|
|
813
|
-
return [...!command.subcommands || command.runsWithoutSubcommand && !command.subcommands.some((sub) => sub.default) ? [[usage$1([command])
|
|
796
|
+
return [...!command.subcommands || command.runsWithoutSubcommand && !command.subcommands.some((sub) => sub.default) ? [[`${usage$1([command])}${command.brief ? ` ${command.brief}` : ""}`, command.description]] : [], ...(command.subcommands ?? []).filter((sub) => !sub.hidden).map((sub) => [usage$1([command, sub]), sub.description])];
|
|
814
797
|
}
|
|
815
798
|
/** Every command, by group, then what the app adds (`serve`, `inspect`), and the options they share. */
|
|
816
799
|
function rootHelp(app, version) {
|
|
@@ -824,7 +807,7 @@ function rootHelp(app, version) {
|
|
|
824
807
|
const pad = padOf(listedSections.flat());
|
|
825
808
|
for (const section of listedSections) lines.push("", ...rows(section, pad));
|
|
826
809
|
const everywhere = shown(globalOptions).filter((option) => option.name !== "help" && option.name !== "version");
|
|
827
|
-
lines.push("", ...labeled("filters:", shown(filters$1).map(flag).join(" "), " "), ...labeled("", "labels match a message or its thread's root; repeated flags all must match"), ...labeled("global:", everywhere.map(flag).join(" "), " "), ...labeled("json:", "one object
|
|
810
|
+
lines.push("", ...labeled("filters:", shown(filters$1).map(flag).join(" "), " "), ...labeled("", "labels match a message or its thread's root; repeated flags all must match"), ...labeled("global:", everywhere.map(flag).join(" "), " "), ...labeled("json:", "one object: { threads, cursor } for read <channel>, { message, replies, cursor } for read <id> (message is the thread root)"), ...labeled("text:", "pass \"-\" to read it from stdin; it may be left out when you --attach"), ...labeled("env:", "BOARD_URL BOARD_NAME BOARD_TOKEN BOARD_PROFILE BOARD_AVATAR", " "), "", `a command's own help: ${app.name} <command> --help`);
|
|
828
811
|
return lines.join("\n");
|
|
829
812
|
}
|
|
830
813
|
/** One command's page: its usage, what it does, and its arguments, subcommands, options, and examples. */
|
|
@@ -1261,23 +1244,45 @@ function ifRevision() {
|
|
|
1261
1244
|
if (!/^[1-9]\d{0,15}$/.test(given)) throw usage(`--if-revision takes the message's revision, a number, and ${given} isn't one.`);
|
|
1262
1245
|
return { revision: Number(given) };
|
|
1263
1246
|
}
|
|
1264
|
-
function labelPairs(values, wrong = "Labels look like key=value, and {value} isn't one.") {
|
|
1247
|
+
function labelPairs(values, wrong = "Labels look like key=value, and {value} isn't one.", empty = "{value} has no value: a label needs one.") {
|
|
1265
1248
|
const pairs = {};
|
|
1266
1249
|
for (const value of values ?? []) {
|
|
1267
1250
|
const at = value.indexOf("=");
|
|
1268
1251
|
if (at <= 0) throw usage(wrong.replace("{value}", value));
|
|
1252
|
+
if (at === value.length - 1 && empty !== null) throw usage(empty.replace("{value}", value).replace("{key}", value.slice(0, at)));
|
|
1269
1253
|
pairs[value.slice(0, at)] = value.slice(at + 1);
|
|
1270
1254
|
}
|
|
1271
1255
|
return pairs;
|
|
1272
1256
|
}
|
|
1273
1257
|
/**
|
|
1258
|
+
* A post or reply takes one text. What follows it was meant to be part of the message, or a label,
|
|
1259
|
+
* and would be dropped without a word: say so, and how each is written.
|
|
1260
|
+
*/
|
|
1261
|
+
function oneText(command, target, extra) {
|
|
1262
|
+
if (flags.text !== void 0) throw usage(`--text is a filter for read, tail, and wait. ${command} takes its text as an argument, in quotes.`);
|
|
1263
|
+
const [first] = extra;
|
|
1264
|
+
if (first === void 0) return;
|
|
1265
|
+
if (/^[\w.-]+=/.test(first)) throw usage(`${first} looks like a label, and ${command} takes labels with --label.`, { next: [{
|
|
1266
|
+
instruction: "Label it as you post it",
|
|
1267
|
+
argv: [
|
|
1268
|
+
...cli(),
|
|
1269
|
+
command,
|
|
1270
|
+
target,
|
|
1271
|
+
"<TEXT>",
|
|
1272
|
+
"--label",
|
|
1273
|
+
first
|
|
1274
|
+
]
|
|
1275
|
+
}] });
|
|
1276
|
+
throw usage(first === "-" ? `${command} takes one text, and - (stdin) is a second. For a long message, pass - alone as the text: it has no title.` : `${command} takes one text, and ${first.length > 40 ? `${first.slice(0, 40)}…` : first} is one too many. Quote the whole message as one argument: it has no title.`);
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1274
1279
|
* A message's text: the argument, stdin for `-`, or the file `--text-file` names (`-` for stdin).
|
|
1275
1280
|
* `optional` when the message can go without, as one with `--attach` files can.
|
|
1276
1281
|
*/
|
|
1277
1282
|
async function text(value, { optional = false } = {}) {
|
|
1278
1283
|
const file = flags["text-file"];
|
|
1279
1284
|
if (file !== void 0) {
|
|
1280
|
-
if (value !== void 0) throw usage("Can't use --text-file with text:
|
|
1285
|
+
if (value !== void 0) throw usage("Can't use --text-file with text: a message has no title, so its whole text comes from one or the other.");
|
|
1281
1286
|
if (file === "-") return (await io.stdin()).replace(/\n$/, "");
|
|
1282
1287
|
const data = await io.readFile(file).catch((error) => {
|
|
1283
1288
|
if (!(error instanceof Failed) || error.failure.reason !== "payload_too_large") throw error;
|
|
@@ -1305,6 +1310,18 @@ async function attachments(board) {
|
|
|
1305
1310
|
const files = [];
|
|
1306
1311
|
for (const path of flags.attach ?? []) {
|
|
1307
1312
|
const data = await io.readFile(path);
|
|
1313
|
+
if (!data && path === "-") throw usage("Can't attach -: stdin is for the message's text. Pass - as the text to read it from stdin.", {
|
|
1314
|
+
reason: "file_not_found",
|
|
1315
|
+
next: [{
|
|
1316
|
+
instruction: "Post text from stdin",
|
|
1317
|
+
argv: [
|
|
1318
|
+
...cli(),
|
|
1319
|
+
current.command ?? "post",
|
|
1320
|
+
"<channel|id>",
|
|
1321
|
+
"-"
|
|
1322
|
+
]
|
|
1323
|
+
}]
|
|
1324
|
+
});
|
|
1308
1325
|
if (!data) throw usage(`Can't attach ${path}. There's no such file.`, {
|
|
1309
1326
|
reason: "file_not_found",
|
|
1310
1327
|
next: []
|
|
@@ -1322,38 +1339,23 @@ async function attachments(board) {
|
|
|
1322
1339
|
}));
|
|
1323
1340
|
return uploaded;
|
|
1324
1341
|
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Whether `value` is a schedule's own ID and not a message's: `s12` on a local board, `sch_…` on
|
|
1344
|
+
* Vercel's. A message's is a number or `msg_…`, so neither is ever one.
|
|
1345
|
+
*/
|
|
1346
|
+
const isScheduleId = (value) => /^(?:s\d+|sch_\S+)$/i.test(value);
|
|
1325
1347
|
/** A schedule's ID as the board gave it: `s12`, or `sch_…` on Vercel's board. */
|
|
1326
1348
|
function scheduleId(value) {
|
|
1327
1349
|
if (value === void 0) throw usage("Missing the schedule ID, like s12.", { reason: "missing_arguments" });
|
|
1328
1350
|
if (!/^[^\s/]+$/.test(value)) throw usage(`${value} isn't a schedule ID like s12.`);
|
|
1329
1351
|
return value;
|
|
1330
1352
|
}
|
|
1331
|
-
/** A grant's
|
|
1332
|
-
function
|
|
1333
|
-
|
|
1334
|
-
if (value
|
|
1335
|
-
if (!/^[^\s/]+$/.test(value)) throw usage(`${value} isn't a ${what} ID like ${like}.`);
|
|
1353
|
+
/** A grant's ID as the board gave it: `g3`, or another board's own. */
|
|
1354
|
+
function grantId(value) {
|
|
1355
|
+
if (value === void 0) throw usage("Missing the grant ID, like g3.", { reason: "missing_arguments" });
|
|
1356
|
+
if (!/^[^\s/]+$/.test(value)) throw usage(`${value} isn't a grant ID like g3.`);
|
|
1336
1357
|
return value;
|
|
1337
1358
|
}
|
|
1338
|
-
/**
|
|
1339
|
-
* A token's `--can`, as `x-board-can` writes it (`dev/=read,post;ci/=read`), repeated or
|
|
1340
|
-
* `;`-joined, with `none` for no permissions, as `all` is every one: `*=all;security/=none` closes a
|
|
1341
|
-
* subtree. `security/=` means the same. The board takes an empty list, so `none` never leaves the CLI.
|
|
1342
|
-
*/
|
|
1343
|
-
function canFlag(values) {
|
|
1344
|
-
const scope = values.flatMap((value) => value.split(";")).map((entry) => {
|
|
1345
|
-
const at = entry.indexOf("=");
|
|
1346
|
-
if (at === -1) return entry;
|
|
1347
|
-
const permissions = entry.slice(at + 1).split(",").map((permission) => permission.trim());
|
|
1348
|
-
if (permissions.includes("none") && permissions.length > 1) throw usage(`--can: none is no permissions, so it goes alone: ${entry.slice(0, at).trim()}=none.`);
|
|
1349
|
-
return permissions[0] === "none" ? entry.slice(0, at + 1) : entry;
|
|
1350
|
-
}).join(";");
|
|
1351
|
-
try {
|
|
1352
|
-
return parseCan(scope, "--can");
|
|
1353
|
-
} catch (error) {
|
|
1354
|
-
throw usage(`${error.message.replace(/, or all$/, ", all, or none")}.`);
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
1359
|
/** What a grant's flags say, or the misuse in them. */
|
|
1358
1360
|
function grantFlags(read) {
|
|
1359
1361
|
try {
|
|
@@ -1487,7 +1489,6 @@ function doing() {
|
|
|
1487
1489
|
case "schedules":
|
|
1488
1490
|
case "actors": return `list ${command}`;
|
|
1489
1491
|
case "grants": return a === "create" ? "create the grant" : a === "update" ? `update grant ${b}` : a === "explain" ? `explain ${b ?? "the channel"}` : a === "revoke" ? `revoke grant ${b}` : "list grants";
|
|
1490
|
-
case "tokens": return a === "create" ? `mint token ${b ?? ""}`.trimEnd() : a === "revoke" ? `revoke token ${b}` : "list tokens";
|
|
1491
1492
|
case "schemas": return a === "create" ? `register schema ${b ?? ""}`.trimEnd() : a === "inspect" ? `read schema ${b ?? ""}`.trimEnd() : "list schemas";
|
|
1492
1493
|
case "sources": return b === void 0 ? "list sources" : `${b} ${c ?? "it"} on ${a}`;
|
|
1493
1494
|
case "download": return `download ${a ?? "the attachment"}`;
|
|
@@ -1522,7 +1523,7 @@ function missing() {
|
|
|
1522
1523
|
"schedule"
|
|
1523
1524
|
].includes(command) && isMessageRef(a)) return `message ${ref(a)}`;
|
|
1524
1525
|
if (command === "schedule" && a === "cancel" && b !== void 0) return `schedule ${b}`;
|
|
1525
|
-
if (
|
|
1526
|
+
if (command === "grants" && (a === "revoke" || a === "update") && b !== void 0) return `grant ${b}`;
|
|
1526
1527
|
if (command === "schemas" && a === "inspect" && b !== void 0) return `schema ${b}`;
|
|
1527
1528
|
if (command === "download") return `attachment ${a}`;
|
|
1528
1529
|
}
|
|
@@ -1581,19 +1582,12 @@ function failureOf(error) {
|
|
|
1581
1582
|
case "board_not_granted": return own("permission", "board_not_granted");
|
|
1582
1583
|
case "watchers_need_project": return own("permission", "watchers_need_project");
|
|
1583
1584
|
case "unsupported_principal": return own(status === 403 ? "permission" : "usage", "unsupported_principal");
|
|
1584
|
-
case "board_token_scope": return own("permission", "board_token_scope");
|
|
1585
1585
|
case "invalid_board_name": return own("usage", "invalid_arguments", [helpRecovery()]);
|
|
1586
1586
|
case "too_many_redirects": return own("network", "network_error");
|
|
1587
1587
|
case "invalid_duration": return own("usage", "invalid_arguments", [helpRecovery()]);
|
|
1588
1588
|
case "wrong_audience":
|
|
1589
1589
|
case "redirected": return own("usage", "wrong_url");
|
|
1590
|
-
case "
|
|
1591
|
-
instruction: "Write as one of them",
|
|
1592
|
-
argv: rerun("--as", "<PROFILE>")
|
|
1593
|
-
}, {
|
|
1594
|
-
instruction: "Or as yourself",
|
|
1595
|
-
argv: rerun("--human")
|
|
1596
|
-
}]);
|
|
1590
|
+
case "renamed_env": return own("usage", "renamed_env");
|
|
1597
1591
|
case "too_large": return {
|
|
1598
1592
|
...own("limit", "payload_too_large"),
|
|
1599
1593
|
message: `Can't ${doing()}. ${sentence(message)}`
|
|
@@ -1651,7 +1645,7 @@ function failureOf(error) {
|
|
|
1651
1645
|
argv: [...cli(), "schemas"]
|
|
1652
1646
|
}]);
|
|
1653
1647
|
if (status === 400) return theirs("usage", specific("invalid_arguments"), `Can't ${doing()}.`);
|
|
1654
|
-
if (status === 401) return theirs("auth", "login_required", "The board didn't accept your credentials.", process.env.BOARD_TOKEN ? [{ instruction: "Pass a token it accepts in BOARD_TOKEN, or unset it" }] : [{
|
|
1648
|
+
if (status === 401) return theirs("auth", "login_required", "The board didn't accept your credentials.", process.env.BOARD_TOKEN && reached && !vercelBoard(reached) ? [{ instruction: "Pass a token it accepts in BOARD_TOKEN, or unset it" }] : [{
|
|
1655
1649
|
instruction: "Log in again",
|
|
1656
1650
|
argv: ["vercel", "login"]
|
|
1657
1651
|
}]);
|
|
@@ -1735,9 +1729,9 @@ function vercelBoard(url) {
|
|
|
1735
1729
|
...team ? { team } : {}
|
|
1736
1730
|
};
|
|
1737
1731
|
}
|
|
1738
|
-
/** Who the handle writes as: `--as`'s profile (with `--avatar`),
|
|
1732
|
+
/** Who the handle writes as: `--as`'s profile (with `--avatar`), or what the environment says (`BOARD_PROFILE`), else yourself. */
|
|
1739
1733
|
function profileFlag() {
|
|
1740
|
-
if (flags.
|
|
1734
|
+
if (flags.avatar !== void 0 && !flags.as) throw usage("--avatar is the avatar of the profile --as names: pass --as too.", { reason: "missing_arguments" });
|
|
1741
1735
|
if (!flags.as) return void 0;
|
|
1742
1736
|
return flags.avatar ? {
|
|
1743
1737
|
name: flags.as,
|
|
@@ -1759,7 +1753,7 @@ function connection(url = flags.url, options = {}) {
|
|
|
1759
1753
|
const board$1 = board({
|
|
1760
1754
|
backend: vercel({
|
|
1761
1755
|
...team !== void 0 ? { team } : {},
|
|
1762
|
-
...sending(options.token, options.can)
|
|
1756
|
+
...sending(options.token, options.can, options.headers)
|
|
1763
1757
|
}),
|
|
1764
1758
|
...name !== void 0 ? {
|
|
1765
1759
|
name,
|
|
@@ -1778,7 +1772,7 @@ function connection(url = flags.url, options = {}) {
|
|
|
1778
1772
|
if (onVercel) {
|
|
1779
1773
|
const board$3 = board({ backend: vercel({
|
|
1780
1774
|
...onVercel,
|
|
1781
|
-
...sending(options.token, options.can)
|
|
1775
|
+
...sending(options.token, options.can, options.headers)
|
|
1782
1776
|
}) });
|
|
1783
1777
|
return {
|
|
1784
1778
|
url: at,
|
|
@@ -1786,11 +1780,13 @@ function connection(url = flags.url, options = {}) {
|
|
|
1786
1780
|
board: profile !== void 0 ? board$3.as(profile) : board$3
|
|
1787
1781
|
};
|
|
1788
1782
|
}
|
|
1789
|
-
const
|
|
1783
|
+
const extra = {
|
|
1784
|
+
...options.headers,
|
|
1785
|
+
...options.can !== void 0 ? { "x-board-can": options.can } : {}
|
|
1786
|
+
};
|
|
1790
1787
|
const transport = connect(at, {
|
|
1791
1788
|
...options.token !== void 0 ? { token: options.token } : {},
|
|
1792
|
-
...
|
|
1793
|
-
...options.can !== void 0 ? { fetch: narrowing(options.can) } : {}
|
|
1789
|
+
...Object.keys(extra).length > 0 ? { fetch: withHeaders(extra) } : {}
|
|
1794
1790
|
});
|
|
1795
1791
|
const board$2 = board({ backend: http(at, { fetch: transport.fetch }) });
|
|
1796
1792
|
return {
|
|
@@ -1830,36 +1826,33 @@ function boardNameFlag(url, team) {
|
|
|
1830
1826
|
if (!isBoardName(given)) throw usage(`${from} ${given} isn't a board's name: one is 1 to 64 characters.`);
|
|
1831
1827
|
return given;
|
|
1832
1828
|
}
|
|
1833
|
-
/** For Vercel's API, `token` in place of your own credentials
|
|
1834
|
-
function sending(token, can) {
|
|
1835
|
-
if (token === void 0 && can === void 0) return {};
|
|
1829
|
+
/** For Vercel's API, `token` in place of your own credentials, `can` narrowing them, and `headers` beside them. */
|
|
1830
|
+
function sending(token, can, extra = {}) {
|
|
1831
|
+
if (token === void 0 && can === void 0 && Object.keys(extra).length === 0) return {};
|
|
1836
1832
|
return { fetch: (input, init = {}) => {
|
|
1837
1833
|
const headers = new Headers(init.headers ?? (input instanceof Request ? input.headers : void 0));
|
|
1838
1834
|
if (token !== void 0) headers.set("authorization", `Bearer ${token}`);
|
|
1839
1835
|
if (can !== void 0) headers.set("x-board-can", can);
|
|
1836
|
+
for (const [name, value] of Object.entries(extra)) headers.set(name, value);
|
|
1840
1837
|
return (token === void 0 ? credentialed() : globalThis.fetch)(input, {
|
|
1841
1838
|
...init,
|
|
1842
1839
|
headers
|
|
1843
1840
|
});
|
|
1844
1841
|
} };
|
|
1845
1842
|
}
|
|
1846
|
-
/** A fetch that
|
|
1847
|
-
function
|
|
1843
|
+
/** A fetch that adds `headers` to each request to a board on HTTP, as a proxy holding its credentials would: `x-board-can`, say. */
|
|
1844
|
+
function withHeaders(headers) {
|
|
1848
1845
|
return (input, init) => {
|
|
1849
1846
|
const request = new Request(input, init);
|
|
1850
|
-
request.headers.set(
|
|
1847
|
+
for (const [name, value] of Object.entries(headers)) request.headers.set(name, value);
|
|
1851
1848
|
return globalThis.fetch(request);
|
|
1852
1849
|
};
|
|
1853
1850
|
}
|
|
1854
1851
|
/** A handle on the board this command talks to: `vb()`'s, as `--as` says, or the one `connection()` finds. */
|
|
1855
1852
|
function client() {
|
|
1856
1853
|
if (!io.board) return connection().board;
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
name: flags.as,
|
|
1860
|
-
avatar: flags.avatar
|
|
1861
|
-
} : flags.as);
|
|
1862
|
-
return io.board;
|
|
1854
|
+
const profile = profileFlag();
|
|
1855
|
+
return profile === void 0 ? io.board : io.board.as(profile);
|
|
1863
1856
|
}
|
|
1864
1857
|
async function readStdin() {
|
|
1865
1858
|
const chunks = [];
|
|
@@ -1944,7 +1937,6 @@ async function run(command, args) {
|
|
|
1944
1937
|
const minutes = Math.max(0, Math.round((Date.parse(me.expiresAt) - Date.now()) / 6e4));
|
|
1945
1938
|
rows.push(["token", `expires in ${Math.floor(minutes / 60)}h ${minutes % 60}m`]);
|
|
1946
1939
|
}
|
|
1947
|
-
if (me.session) rows.push(["session", me.session]);
|
|
1948
1940
|
(me.can === void 0 ? [] : formatAccess(me.can)).forEach((line, index) => rows.push([index === 0 ? "can" : "", line]));
|
|
1949
1941
|
const width = Math.max(...rows.map(([subject]) => subject.length));
|
|
1950
1942
|
for (const [subject, value] of rows) out(`${subject.padEnd(width)} ${value}`);
|
|
@@ -1963,13 +1955,10 @@ async function run(command, args) {
|
|
|
1963
1955
|
argv: rerun("--url", "<URL>")
|
|
1964
1956
|
}]
|
|
1965
1957
|
});
|
|
1966
|
-
const
|
|
1967
|
-
const withToken = io.board ? {} : { withToken: (secret) => connection(tokenUrl, { token: secret }).board };
|
|
1968
|
-
const withCan = io.board ? {} : { withCan: (can) => connection(void 0, { can }).board };
|
|
1958
|
+
const withHeaders = io.board ? {} : { withHeaders: (headers) => connection(void 0, { headers }).board };
|
|
1969
1959
|
const report = await conformance(client(), {
|
|
1970
1960
|
...flags.channel ? { channel: flags.channel } : {},
|
|
1971
|
-
...
|
|
1972
|
-
...withCan
|
|
1961
|
+
...withHeaders
|
|
1973
1962
|
});
|
|
1974
1963
|
if (flags.json) result(report);
|
|
1975
1964
|
else out(formatConformance(report));
|
|
@@ -2059,6 +2048,7 @@ async function run(command, args) {
|
|
|
2059
2048
|
class: "not_found",
|
|
2060
2049
|
reason: "channel_not_found",
|
|
2061
2050
|
message: `Couldn't find channel ${target}.${guess ? ` Did you mean ${guess}?` : ""}`,
|
|
2051
|
+
details: ["A channel appears with its first post: one nobody has posted in yet is not there to read."],
|
|
2062
2052
|
next: [{
|
|
2063
2053
|
instruction: "See its channels",
|
|
2064
2054
|
argv: [...cli(), "channels"]
|
|
@@ -2070,11 +2060,13 @@ async function run(command, args) {
|
|
|
2070
2060
|
const count = `${page.threads.length} ${page.threads.length === 1 ? "thread" : "threads"}`;
|
|
2071
2061
|
out(`${target ?? "all channels"} · ${count} · cursor ${page.cursor}${page.threads.length ? "\n" : ""}`);
|
|
2072
2062
|
if (page.threads.length) out(formatThreadSummaries(page.threads, { channel: !target || target.endsWith("/") }));
|
|
2063
|
+
out(`\nnew since then: ${commandLine(rerunWithout(["--after"], "--after", String(page.cursor)))}`);
|
|
2073
2064
|
return 0;
|
|
2074
2065
|
}
|
|
2075
2066
|
case "post": {
|
|
2076
2067
|
const [target, body] = args;
|
|
2077
2068
|
if (!target) throw usage("Missing the channel or message to post to.", { reason: "missing_arguments" });
|
|
2069
|
+
oneText("post", target, args.slice(2));
|
|
2078
2070
|
const re = isMessageRef(target) ? messageId(target) : void 0;
|
|
2079
2071
|
if (re !== void 0 && flags.sync?.length) throw usage("Can't use --sync on a reply. It syncs whole threads.", { next: [{
|
|
2080
2072
|
instruction: "Sync the thread instead",
|
|
@@ -2108,6 +2100,7 @@ async function run(command, args) {
|
|
|
2108
2100
|
}
|
|
2109
2101
|
case "reply": {
|
|
2110
2102
|
const id = messageId(args[0]);
|
|
2103
|
+
oneText("reply", args[0], args.slice(2));
|
|
2111
2104
|
const board = client();
|
|
2112
2105
|
const said = await content(args[1], { optional: !!flags.attach?.length });
|
|
2113
2106
|
const files = await attachments(board);
|
|
@@ -2188,7 +2181,7 @@ async function run(command, args) {
|
|
|
2188
2181
|
return 0;
|
|
2189
2182
|
}
|
|
2190
2183
|
if (verb === "update") {
|
|
2191
|
-
const id =
|
|
2184
|
+
const id = grantId(rest[0]);
|
|
2192
2185
|
if (rest.length > 1) throw usage(`grants update takes one grant: ${rest[1]} is one too many.`);
|
|
2193
2186
|
onlyPrincipalFlags("update");
|
|
2194
2187
|
const named = grantFlags(() => principalsIn(ordered, ["add-", "remove-"], ({ kind, value }) => {
|
|
@@ -2237,7 +2230,7 @@ async function run(command, args) {
|
|
|
2237
2230
|
return 0;
|
|
2238
2231
|
}
|
|
2239
2232
|
if (verb === "revoke") {
|
|
2240
|
-
const id =
|
|
2233
|
+
const id = grantId(rest[0]);
|
|
2241
2234
|
const { revoked } = await client().revokeGrant(id);
|
|
2242
2235
|
if (flags.json) result({
|
|
2243
2236
|
grant: id,
|
|
@@ -2248,43 +2241,6 @@ async function run(command, args) {
|
|
|
2248
2241
|
}
|
|
2249
2242
|
throw usage(`Unknown command ${verb} for ${named()} grants.`, { reason: "unknown_command" });
|
|
2250
2243
|
}
|
|
2251
|
-
case "tokens": {
|
|
2252
|
-
const [verb, ...rest] = args;
|
|
2253
|
-
if (verb === void 0 || verb === "list") {
|
|
2254
|
-
if (rest.length > 0) throw usage(`tokens list takes no arguments: ${rest[0]} is one too many.`);
|
|
2255
|
-
const list = await client().tokens();
|
|
2256
|
-
if (flags.json) return result({ tokens: list }), 0;
|
|
2257
|
-
out(list.length === 0 ? "no tokens" : formatTokens(list));
|
|
2258
|
-
return 0;
|
|
2259
|
-
}
|
|
2260
|
-
if (verb === "revoke") {
|
|
2261
|
-
const id = trustId("token", rest[0]);
|
|
2262
|
-
const { revoked } = await client().revokeToken(id);
|
|
2263
|
-
if (flags.json) result({
|
|
2264
|
-
token: id,
|
|
2265
|
-
outcome: revoked ? "revoked" : "unchanged"
|
|
2266
|
-
});
|
|
2267
|
-
else out(revoked ? `revoked ${id}` : `${id} isn't a live token of yours`);
|
|
2268
|
-
return 0;
|
|
2269
|
-
}
|
|
2270
|
-
if (verb !== "create") throw usage(`Unknown command ${verb} for ${named()} tokens.`, { reason: "unknown_command" });
|
|
2271
|
-
const [name, extra] = rest;
|
|
2272
|
-
if (!name) throw usage("Missing a name for the token, like feedback-widget.", { reason: "missing_arguments" });
|
|
2273
|
-
if (extra !== void 0) throw usage(`tokens create takes one name: ${extra} is one too many.`);
|
|
2274
|
-
const { token, secret } = await client().createToken({
|
|
2275
|
-
name,
|
|
2276
|
-
...flags.can !== void 0 ? { can: canFlag(flags.can) } : {},
|
|
2277
|
-
...flags.profile !== void 0 ? { profile: flags.profile } : {},
|
|
2278
|
-
...flags.session !== void 0 ? { session: flags.session } : {},
|
|
2279
|
-
...flags.expires !== void 0 ? { expires: flags.expires } : {}
|
|
2280
|
-
});
|
|
2281
|
-
if (flags.json) result({
|
|
2282
|
-
token,
|
|
2283
|
-
secret
|
|
2284
|
-
});
|
|
2285
|
-
else out(secret);
|
|
2286
|
-
return 0;
|
|
2287
|
-
}
|
|
2288
2244
|
case "schemas": {
|
|
2289
2245
|
const [verb, ...rest] = args;
|
|
2290
2246
|
if (verb === void 0 || verb === "list") {
|
|
@@ -2319,6 +2275,24 @@ async function run(command, args) {
|
|
|
2319
2275
|
return 0;
|
|
2320
2276
|
}
|
|
2321
2277
|
case "schedules": {
|
|
2278
|
+
if (args[0] !== void 0 && isScheduleId(args[0])) {
|
|
2279
|
+
const one = (await client().schedules({ all: true })).find((schedule) => schedule.id.toLowerCase() === args[0].toLowerCase());
|
|
2280
|
+
if (!one) throw new Failed({
|
|
2281
|
+
class: "not_found",
|
|
2282
|
+
reason: "schedule_not_found",
|
|
2283
|
+
message: `Couldn't find schedule ${args[0]}.`,
|
|
2284
|
+
next: [{
|
|
2285
|
+
instruction: "See every schedule, done and canceled ones too",
|
|
2286
|
+
argv: [
|
|
2287
|
+
...cli(),
|
|
2288
|
+
"schedules",
|
|
2289
|
+
"--all"
|
|
2290
|
+
]
|
|
2291
|
+
}]
|
|
2292
|
+
});
|
|
2293
|
+
if (flags.json) return result({ schedules: [one] }), 0;
|
|
2294
|
+
return out(formatSchedule(one)), 0;
|
|
2295
|
+
}
|
|
2322
2296
|
const list = await client().schedules({
|
|
2323
2297
|
...args[0] ? { re: messageId(args[0]) } : {},
|
|
2324
2298
|
...flags.by ? { by: flags.by.replace(/^@/, "") } : {},
|
|
@@ -2394,10 +2368,10 @@ async function run(command, args) {
|
|
|
2394
2368
|
}
|
|
2395
2369
|
case "label": {
|
|
2396
2370
|
const id = messageId(args[0]);
|
|
2397
|
-
const set = labelPairs(args.slice(1));
|
|
2371
|
+
const set = labelPairs(args.slice(1), void 0, "{value} has no value. To remove the label, --unset {key}.");
|
|
2398
2372
|
const unset = flags.unset ?? [];
|
|
2399
2373
|
if (Object.keys(set).length === 0 && unset.length === 0) throw usage("Missing the labels: k=v to set one, --unset k to remove one.", { reason: "missing_arguments" });
|
|
2400
|
-
const expected = labelPairs(flags.if, "--if takes key=value, and {value} isn't one. For a label that mustn't be set, --if-unset key.");
|
|
2374
|
+
const expected = labelPairs(flags.if, "--if takes key=value, and {value} isn't one. For a label that mustn't be set, --if-unset key.", null);
|
|
2401
2375
|
for (const key of flags["if-unset"] ?? []) {
|
|
2402
2376
|
if (Object.hasOwn(expected, key)) throw usage(`Can't use --if ${key}=… with --if-unset ${key}.`);
|
|
2403
2377
|
expected[key] = null;
|
|
@@ -2436,6 +2410,14 @@ async function run(command, args) {
|
|
|
2436
2410
|
case "download": {
|
|
2437
2411
|
const id = args[0];
|
|
2438
2412
|
if (!id) throw usage(`Missing the attachment to download: the ID \`${named()} read\` shows on a file line.`, { reason: "missing_arguments" });
|
|
2413
|
+
if (/[./]/.test(id)) throw usage(`${id} is a file's name, and download takes the attachment's ID: the last thing on its file line when you read its thread.`, { next: [{
|
|
2414
|
+
instruction: "Read the thread to see the ID",
|
|
2415
|
+
argv: [
|
|
2416
|
+
...cli(),
|
|
2417
|
+
"read",
|
|
2418
|
+
"<ID>"
|
|
2419
|
+
]
|
|
2420
|
+
}] });
|
|
2439
2421
|
const response = await client().download(id);
|
|
2440
2422
|
const data = new Uint8Array(await response.arrayBuffer());
|
|
2441
2423
|
if (args[1] === "-") return io.write(data), 0;
|
|
@@ -2511,8 +2493,15 @@ async function run(command, args) {
|
|
|
2511
2493
|
case "wait": {
|
|
2512
2494
|
const controller = new AbortController();
|
|
2513
2495
|
const stop = stopOn(controller);
|
|
2514
|
-
const timeout = flags.timeout ?? "30m";
|
|
2515
|
-
const
|
|
2496
|
+
const timeout = /^\d+$/.test(flags.timeout ?? "") ? `${flags.timeout}s` : flags.timeout ?? "30m";
|
|
2497
|
+
const thread = args[0] !== void 0 && isMessageRef(args[0]) && flags.re === void 0 ? args[0] : void 0;
|
|
2498
|
+
const root = thread === void 0 ? void 0 : (await client().thread(messageId(thread))).message.id;
|
|
2499
|
+
const waitsOn = root === void 0 ? filters(args[0]) : {
|
|
2500
|
+
...filters(),
|
|
2501
|
+
re: root,
|
|
2502
|
+
...flags.after === void 0 ? { after: messageId(thread) } : {}
|
|
2503
|
+
};
|
|
2504
|
+
const event = await client().wait(waitsOn, {
|
|
2516
2505
|
timeout,
|
|
2517
2506
|
signal: controller.signal
|
|
2518
2507
|
}).finally(stop.release);
|
|
@@ -2521,21 +2510,37 @@ async function run(command, args) {
|
|
|
2521
2510
|
throw new Failed({
|
|
2522
2511
|
class: "timeout",
|
|
2523
2512
|
reason: "timeout",
|
|
2524
|
-
message: `Nothing matched within ${timeout}
|
|
2513
|
+
message: `Nothing matched within ${timeout}.`,
|
|
2514
|
+
details: [waitsOn.after === void 0 ? "wait sees only what arrives after it starts. For what is already there, read, or pass --after <id>." : `Nothing came after ${waitsOn.after}.`],
|
|
2515
|
+
next: [{
|
|
2516
|
+
instruction: "See what is there now",
|
|
2517
|
+
argv: [
|
|
2518
|
+
...cli(),
|
|
2519
|
+
"read",
|
|
2520
|
+
...thread ?? flags.re ?? args[0] ? [thread ?? flags.re ?? args[0]] : []
|
|
2521
|
+
]
|
|
2522
|
+
}]
|
|
2525
2523
|
});
|
|
2526
2524
|
}
|
|
2527
2525
|
if (flags.json) result({ event });
|
|
2528
|
-
else
|
|
2526
|
+
else {
|
|
2527
|
+
out(formatEvent(event));
|
|
2528
|
+
out(`next: ${commandLine(rerunWithout(["--after"], "--after", String(event.cursor)))}`);
|
|
2529
|
+
}
|
|
2529
2530
|
return 0;
|
|
2530
2531
|
}
|
|
2531
|
-
case "inspect": return (await import("./inspect-
|
|
2532
|
+
case "inspect": return (await import("./inspect-BsF3mYMY.mjs")).inspect(context());
|
|
2532
2533
|
default: {
|
|
2533
2534
|
const own = app.commands[command];
|
|
2534
2535
|
if (own) return own.run(args, context());
|
|
2535
2536
|
const guess = closest(command, [...commands.flatMap((known) => [known.name, ...known.aliases ?? []]), ...Object.keys(app.commands)]);
|
|
2536
|
-
|
|
2537
|
+
const said = Object.hasOwn(OTHER_NAMES, command.toLowerCase()) ? OTHER_NAMES[command.toLowerCase()] : void 0;
|
|
2538
|
+
throw usage(`Unknown command ${command} for ${named()}.${said ? "" : guess ? ` Did you mean ${guess}?` : ""}`, {
|
|
2537
2539
|
reason: "unknown_command",
|
|
2538
|
-
next: [{
|
|
2540
|
+
next: [...said ? [{
|
|
2541
|
+
instruction: said.instruction,
|
|
2542
|
+
argv: [...cli(), ...said.argv]
|
|
2543
|
+
}] : [], {
|
|
2539
2544
|
instruction: "See all commands",
|
|
2540
2545
|
argv: [...cli(), "--help"]
|
|
2541
2546
|
}]
|
|
@@ -2543,6 +2548,254 @@ async function run(command, args) {
|
|
|
2543
2548
|
}
|
|
2544
2549
|
}
|
|
2545
2550
|
}
|
|
2551
|
+
/** Words for a command this CLI names otherwise, and the command they mean. */
|
|
2552
|
+
const OTHER_NAMES = {
|
|
2553
|
+
search: {
|
|
2554
|
+
instruction: "Search is a filter on read",
|
|
2555
|
+
argv: [
|
|
2556
|
+
"read",
|
|
2557
|
+
"<CHANNEL>",
|
|
2558
|
+
"--text",
|
|
2559
|
+
"<PHRASE>"
|
|
2560
|
+
]
|
|
2561
|
+
},
|
|
2562
|
+
find: {
|
|
2563
|
+
instruction: "Search is a filter on read",
|
|
2564
|
+
argv: [
|
|
2565
|
+
"read",
|
|
2566
|
+
"<CHANNEL>",
|
|
2567
|
+
"--text",
|
|
2568
|
+
"<PHRASE>"
|
|
2569
|
+
]
|
|
2570
|
+
},
|
|
2571
|
+
grep: {
|
|
2572
|
+
instruction: "Search is a filter on read",
|
|
2573
|
+
argv: [
|
|
2574
|
+
"read",
|
|
2575
|
+
"<CHANNEL>",
|
|
2576
|
+
"--text",
|
|
2577
|
+
"<PHRASE>"
|
|
2578
|
+
]
|
|
2579
|
+
},
|
|
2580
|
+
list: {
|
|
2581
|
+
instruction: "List a channel's threads with read",
|
|
2582
|
+
argv: ["read", "<CHANNEL>"]
|
|
2583
|
+
},
|
|
2584
|
+
ls: {
|
|
2585
|
+
instruction: "List a channel's threads with read",
|
|
2586
|
+
argv: ["read", "<CHANNEL>"]
|
|
2587
|
+
},
|
|
2588
|
+
threads: {
|
|
2589
|
+
instruction: "List a channel's threads with read",
|
|
2590
|
+
argv: ["read", "<CHANNEL>"]
|
|
2591
|
+
},
|
|
2592
|
+
messages: {
|
|
2593
|
+
instruction: "Read one thread, every message",
|
|
2594
|
+
argv: ["read", "<ID>"]
|
|
2595
|
+
},
|
|
2596
|
+
thread: {
|
|
2597
|
+
instruction: "Read one thread, every message",
|
|
2598
|
+
argv: ["read", "<ID>"]
|
|
2599
|
+
},
|
|
2600
|
+
show: {
|
|
2601
|
+
instruction: "Read one thread, every message",
|
|
2602
|
+
argv: ["read", "<ID>"]
|
|
2603
|
+
},
|
|
2604
|
+
get: {
|
|
2605
|
+
instruction: "Read one thread, every message",
|
|
2606
|
+
argv: ["read", "<ID>"]
|
|
2607
|
+
},
|
|
2608
|
+
view: {
|
|
2609
|
+
instruction: "Read one thread, every message",
|
|
2610
|
+
argv: ["read", "<ID>"]
|
|
2611
|
+
},
|
|
2612
|
+
history: {
|
|
2613
|
+
instruction: "Read one thread, every message",
|
|
2614
|
+
argv: ["read", "<ID>"]
|
|
2615
|
+
},
|
|
2616
|
+
send: {
|
|
2617
|
+
instruction: "Start a thread with post",
|
|
2618
|
+
argv: [
|
|
2619
|
+
"post",
|
|
2620
|
+
"<CHANNEL>",
|
|
2621
|
+
"<TEXT>"
|
|
2622
|
+
]
|
|
2623
|
+
},
|
|
2624
|
+
create: {
|
|
2625
|
+
instruction: "Start a thread with post",
|
|
2626
|
+
argv: [
|
|
2627
|
+
"post",
|
|
2628
|
+
"<CHANNEL>",
|
|
2629
|
+
"<TEXT>"
|
|
2630
|
+
]
|
|
2631
|
+
},
|
|
2632
|
+
comment: {
|
|
2633
|
+
instruction: "Reply in a thread",
|
|
2634
|
+
argv: [
|
|
2635
|
+
"reply",
|
|
2636
|
+
"<ID>",
|
|
2637
|
+
"<TEXT>"
|
|
2638
|
+
]
|
|
2639
|
+
},
|
|
2640
|
+
answer: {
|
|
2641
|
+
instruction: "Reply in a thread",
|
|
2642
|
+
argv: [
|
|
2643
|
+
"reply",
|
|
2644
|
+
"<ID>",
|
|
2645
|
+
"<TEXT>"
|
|
2646
|
+
]
|
|
2647
|
+
},
|
|
2648
|
+
update: {
|
|
2649
|
+
instruction: "Change a message's text with edit",
|
|
2650
|
+
argv: [
|
|
2651
|
+
"edit",
|
|
2652
|
+
"<ID>",
|
|
2653
|
+
"<TEXT>"
|
|
2654
|
+
]
|
|
2655
|
+
},
|
|
2656
|
+
remove: {
|
|
2657
|
+
instruction: "Delete a message",
|
|
2658
|
+
argv: ["delete", "<ID>"]
|
|
2659
|
+
},
|
|
2660
|
+
rm: {
|
|
2661
|
+
instruction: "Delete a message",
|
|
2662
|
+
argv: ["delete", "<ID>"]
|
|
2663
|
+
},
|
|
2664
|
+
cancel: {
|
|
2665
|
+
instruction: "Cancel a schedule",
|
|
2666
|
+
argv: [
|
|
2667
|
+
"schedule",
|
|
2668
|
+
"cancel",
|
|
2669
|
+
"<SCHEDULE>"
|
|
2670
|
+
]
|
|
2671
|
+
},
|
|
2672
|
+
unschedule: {
|
|
2673
|
+
instruction: "Cancel a schedule",
|
|
2674
|
+
argv: [
|
|
2675
|
+
"schedule",
|
|
2676
|
+
"cancel",
|
|
2677
|
+
"<SCHEDULE>"
|
|
2678
|
+
]
|
|
2679
|
+
},
|
|
2680
|
+
remind: {
|
|
2681
|
+
instruction: "Post later with schedule",
|
|
2682
|
+
argv: [
|
|
2683
|
+
"schedule",
|
|
2684
|
+
"<TARGET>",
|
|
2685
|
+
"<TEXT>",
|
|
2686
|
+
"--in",
|
|
2687
|
+
"<DURATION>"
|
|
2688
|
+
]
|
|
2689
|
+
},
|
|
2690
|
+
attach: {
|
|
2691
|
+
instruction: "Attach a file to a post",
|
|
2692
|
+
argv: [
|
|
2693
|
+
"post",
|
|
2694
|
+
"<TARGET>",
|
|
2695
|
+
"<TEXT>",
|
|
2696
|
+
"--attach",
|
|
2697
|
+
"<FILE>"
|
|
2698
|
+
]
|
|
2699
|
+
},
|
|
2700
|
+
upload: {
|
|
2701
|
+
instruction: "Attach a file to a post",
|
|
2702
|
+
argv: [
|
|
2703
|
+
"post",
|
|
2704
|
+
"<TARGET>",
|
|
2705
|
+
"<TEXT>",
|
|
2706
|
+
"--attach",
|
|
2707
|
+
"<FILE>"
|
|
2708
|
+
]
|
|
2709
|
+
},
|
|
2710
|
+
claim: {
|
|
2711
|
+
instruction: "Claim a thread with a label, unless someone has",
|
|
2712
|
+
argv: [
|
|
2713
|
+
"label",
|
|
2714
|
+
"<ID>",
|
|
2715
|
+
"owner=<YOU>",
|
|
2716
|
+
"--if-unset",
|
|
2717
|
+
"owner"
|
|
2718
|
+
]
|
|
2719
|
+
},
|
|
2720
|
+
assign: {
|
|
2721
|
+
instruction: "Claim a thread with a label, unless someone has",
|
|
2722
|
+
argv: [
|
|
2723
|
+
"label",
|
|
2724
|
+
"<ID>",
|
|
2725
|
+
"owner=<YOU>",
|
|
2726
|
+
"--if-unset",
|
|
2727
|
+
"owner"
|
|
2728
|
+
]
|
|
2729
|
+
},
|
|
2730
|
+
tag: {
|
|
2731
|
+
instruction: "Set labels on a message",
|
|
2732
|
+
argv: [
|
|
2733
|
+
"label",
|
|
2734
|
+
"<ID>",
|
|
2735
|
+
"<KEY=VALUE>"
|
|
2736
|
+
]
|
|
2737
|
+
},
|
|
2738
|
+
labels: {
|
|
2739
|
+
instruction: "Set labels on a message",
|
|
2740
|
+
argv: [
|
|
2741
|
+
"label",
|
|
2742
|
+
"<ID>",
|
|
2743
|
+
"<KEY=VALUE>"
|
|
2744
|
+
]
|
|
2745
|
+
},
|
|
2746
|
+
mentions: {
|
|
2747
|
+
instruction: "Mentions are a filter on read and wait",
|
|
2748
|
+
argv: ["read", "--mentions"]
|
|
2749
|
+
},
|
|
2750
|
+
watch: {
|
|
2751
|
+
instruction: "Block for the next match with wait, or follow live with tail",
|
|
2752
|
+
argv: [
|
|
2753
|
+
"wait",
|
|
2754
|
+
"<CHANNEL>",
|
|
2755
|
+
"--after",
|
|
2756
|
+
"<CURSOR>"
|
|
2757
|
+
]
|
|
2758
|
+
},
|
|
2759
|
+
follow: {
|
|
2760
|
+
instruction: "Block for the next match with wait, or follow live with tail",
|
|
2761
|
+
argv: [
|
|
2762
|
+
"wait",
|
|
2763
|
+
"<CHANNEL>",
|
|
2764
|
+
"--after",
|
|
2765
|
+
"<CURSOR>"
|
|
2766
|
+
]
|
|
2767
|
+
},
|
|
2768
|
+
subscribe: {
|
|
2769
|
+
instruction: "Block for the next match with wait, or follow live with tail",
|
|
2770
|
+
argv: [
|
|
2771
|
+
"wait",
|
|
2772
|
+
"<CHANNEL>",
|
|
2773
|
+
"--after",
|
|
2774
|
+
"<CURSOR>"
|
|
2775
|
+
]
|
|
2776
|
+
},
|
|
2777
|
+
listen: {
|
|
2778
|
+
instruction: "Block for the next match with wait, or follow live with tail",
|
|
2779
|
+
argv: [
|
|
2780
|
+
"wait",
|
|
2781
|
+
"<CHANNEL>",
|
|
2782
|
+
"--after",
|
|
2783
|
+
"<CURSOR>"
|
|
2784
|
+
]
|
|
2785
|
+
},
|
|
2786
|
+
users: {
|
|
2787
|
+
instruction: "See who is on the board",
|
|
2788
|
+
argv: ["actors"]
|
|
2789
|
+
},
|
|
2790
|
+
members: {
|
|
2791
|
+
instruction: "See who is on the board",
|
|
2792
|
+
argv: ["actors"]
|
|
2793
|
+
},
|
|
2794
|
+
me: {
|
|
2795
|
+
instruction: "See who you are",
|
|
2796
|
+
argv: ["whoami"]
|
|
2797
|
+
}
|
|
2798
|
+
};
|
|
2546
2799
|
/**
|
|
2547
2800
|
* Aborts `controller` on the run's signal, or Ctrl-C without one. `release` stops listening, and
|
|
2548
2801
|
* `interrupted` says whether Ctrl-C stopped it.
|
|
@@ -2619,7 +2872,7 @@ async function runOnce(argv, options) {
|
|
|
2619
2872
|
args
|
|
2620
2873
|
};
|
|
2621
2874
|
if (io.board) {
|
|
2622
|
-
const given = flags.url ? "url" : flags.name !== void 0 ? "name" : flags.ensure ? "ensure" :
|
|
2875
|
+
const given = flags.url ? "url" : flags.name !== void 0 ? "name" : flags.ensure ? "ensure" : null;
|
|
2623
2876
|
if (given) throw usage(`--${given} doesn't apply in-process: the board handle you pass says which board and who.`, { next: [] });
|
|
2624
2877
|
if (command !== void 0 && MACHINE.has(command)) throw usage(`${command} isn't available in-process: it's about the machine ${named()} runs on.`, {
|
|
2625
2878
|
reason: "not_available",
|