@vercel/board 0.48.1 → 0.50.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/dist/{access-C06pIr0M.mjs → access-BbgmsAFF.mjs} +29 -17
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +5 -5
- package/dist/{actors-Dkyg-oo0.mjs → actors-CX2D22hL.mjs} +4 -3
- package/dist/{auth-B9-wXQ-x.mjs → auth-DJDTfgAL.mjs} +2 -2
- package/dist/{auth-li3lKwJG.d.mts → auth-Z9-Khvvw.d.mts} +1 -1
- package/dist/{backend-UBP6HimX.d.mts → backend-CcaaS9Xl.d.mts} +31 -8
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-iN0DFsSE.d.mts → chat-provider-DQ1GHm4o.d.mts} +2 -2
- package/dist/{chat-provider-kNWd6MQC.mjs → chat-provider-HJ7y_ipp.mjs} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +8 -2
- package/dist/cli-embedded.mjs +10 -4
- package/dist/cli.mjs +6 -6
- package/dist/client-C2T4eaXd.d.mts +544 -0
- package/dist/{commands-CJsOA-hf.d.mts → commands-Cm4sODIu.d.mts} +12 -8
- package/dist/{commands-Dk6_cHLS.mjs → commands-nN8WpvCe.mjs} +75 -58
- package/dist/{conformance-CDP8y2Zm.mjs → conformance-Cr-umDl0.mjs} +102 -20
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-BQ0hJw2w.mjs → engine-DJZ8Xy_g.mjs} +10 -7
- package/dist/{errors-QhkdzI-o.mjs → errors-DYF4hhIc.mjs} +53 -174
- package/dist/{events-B-qyxNsJ.mjs → events-BdOCmnZh.mjs} +3 -3
- package/dist/{exports-BzSG0_wL.mjs → exports-CuD-Mxkw.mjs} +389 -118
- package/dist/{exports-inhbjAWi.d.mts → exports-lmr6UHHc.d.mts} +4 -4
- package/dist/{external-BuVTXT1R.mjs → external-D2jq_DEQ.mjs} +1 -1
- package/dist/{index-B0Fnhvk7.d.mts → index-_KxJu15n.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +7 -7
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +39 -39
- package/dist/inspect/engine.js +3 -3
- package/dist/inspect-CZeoSm7E.mjs +272 -0
- package/dist/inspect-UCcPViyA.mjs +2 -0
- package/dist/inspect.d.mts +17 -0
- package/dist/inspect.mjs +196 -0
- package/dist/{local-BdKxz-Dn.mjs → local-BVSFSSYf.mjs} +165 -61
- package/dist/{main-BgiViRZ8.mjs → main-B016auoG.mjs} +227 -49
- package/dist/{memory-CMm-Fk_A.mjs → memory-C2lzMV_t.mjs} +2 -2
- package/dist/{middleware-CT6vMNUc.mjs → middleware-DUKIITFZ.mjs} +3 -3
- package/dist/{page-D-OzDOAX.mjs → page-7KWSGxyC.mjs} +12 -2
- package/dist/page-CN77B014.mjs +2 -0
- package/dist/profile-header-Cj0Cb1cf.mjs +163 -0
- package/dist/{provider-DC3WHUXo.d.mts → provider-Dwb_9mnu.d.mts} +3 -529
- package/dist/{routes-CjA6Mp4D.d.mts → routes-B6SEA9yw.d.mts} +130 -4
- package/dist/{routes-ABXf3CKq.mjs → routes-BE0y6wCk.mjs} +40 -14
- package/dist/{schemas-7VFdomFB.mjs → schemas-CUSTEFIy.mjs} +11 -3
- package/dist/{serve-C2Jbr7pR.mjs → serve-B10e7QaY.mjs} +5 -5
- package/dist/{server-EOQC5Gtq.mjs → server-ViWNvg5q.mjs} +61 -29
- package/dist/{serving-BNdiReQT.mjs → serving-SbqeWqlA.mjs} +1 -1
- package/dist/{inspect-n9brh-TT.mjs → shell-DmpmgOPC.mjs} +25 -274
- package/dist/{sql-IEbO5vXs.mjs → sql-iABdyCiz.mjs} +18 -5
- package/dist/{sqlite-CVG8XKHm.mjs → sqlite-28EMrmk7.mjs} +2 -2
- package/dist/{sqlite-db-BJjPQYx4.mjs → sqlite-db-Ckd-ceNe.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 +3 -3
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +3 -3
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +11 -7
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{tags-BpFo6q0_.mjs → tags-D0qra0Qy.mjs} +1 -1
- package/dist/{task-batch-D4p9N8lN.mjs → task-batch-9lVDG3d-.mjs} +10 -11
- package/dist/{tokens-BCp4EWTQ.mjs → tokens-C-iK0Cku.mjs} +2 -2
- package/dist/version-C70RLVEK.mjs +5 -0
- package/docs/01-board/01-mounting.md +8 -0
- package/docs/01-board/03-identity.md +3 -2
- package/docs/01-board/04-messages.md +6 -2
- package/docs/01-board/05-reading.md +17 -2
- package/docs/01-board/09-access.md +40 -6
- package/docs/01-board/11-tasks.md +3 -3
- package/docs/02-sync/01-overview.md +2 -1
- package/docs/03-guides/02-inspector.md +31 -0
- package/docs/03-guides/06-sandboxed-agents.md +22 -21
- package/docs/04-reference/01-cli.md +91 -33
- package/docs/04-reference/02-board.md +20 -7
- package/docs/04-reference/03-http.md +9 -6
- package/docs/04-reference/05-conformance.md +7 -0
- package/package.json +5 -1
- package/dist/inspect-BB-XUPuz.mjs +0 -2
- package/dist/page-Dr9Aqlej.mjs +0 -2
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-
|
|
1
|
+
import { a as DIRECT_UPLOAD_BYTES_MAX, c as fileSize } from "./profile-header-Cj0Cb1cf.mjs";
|
|
2
|
+
import { m as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-CUSTEFIy.mjs";
|
|
3
|
+
import "./routes-BE0y6wCk.mjs";
|
|
3
4
|
import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
4
|
-
import {
|
|
5
|
+
import { f as BoardError } from "./errors-DYF4hhIc.mjs";
|
|
6
|
+
import { l as shownName } from "./middleware-DUKIITFZ.mjs";
|
|
5
7
|
import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
|
|
6
8
|
import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { r as PERMISSIONS } from "./access-
|
|
9
|
-
import {
|
|
10
|
-
import { i as
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
9
|
+
import { t as VERSION } from "./version-C70RLVEK.mjs";
|
|
10
|
+
import { r as PERMISSIONS } from "./access-BbgmsAFF.mjs";
|
|
11
|
+
import { c as withMentions } from "./task-batch-9lVDG3d-.mjs";
|
|
12
|
+
import { i as isBoardName, n as createTasksInChunks, s as isApiMessageId, t as TasksInChunksError } from "./exports-CuD-Mxkw.mjs";
|
|
13
|
+
import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-nN8WpvCe.mjs";
|
|
14
|
+
import { _ as vercelProjectFile, a as vercel, c as boardUrl, d as environmentProfile, f as handFetch, i as handTeam, l as configDir, m as handToken, n as credentialSource, o as http, p as handLogin, r as credentialed, t as board, u as connect } from "./server-ViWNvg5q.mjs";
|
|
15
|
+
import { t as conformance } from "./conformance-Cr-umDl0.mjs";
|
|
13
16
|
import { n as displayText, t as byVercelBot } from "./bots-CqPYxkqK.mjs";
|
|
14
17
|
import { spawn } from "node:child_process";
|
|
15
18
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -144,6 +147,8 @@ function inputOf(started) {
|
|
|
144
147
|
default: return { kind: started.kind };
|
|
145
148
|
}
|
|
146
149
|
}
|
|
150
|
+
/** Each pattern `--can` flags name, as typed: what a grant made with them reaches. */
|
|
151
|
+
const patternsIn = (values) => [...new Set(values.flatMap((value) => value.split(";")).map((entry) => entry.slice(0, Math.max(entry.indexOf("="), 0)).trim()).filter(Boolean))];
|
|
147
152
|
const WORDS = [
|
|
148
153
|
...PERMISSIONS,
|
|
149
154
|
"all",
|
|
@@ -282,6 +287,8 @@ const terminalText = (text) => text.replace(/\r\n/g, "\n").replace(/[\u0000-\u00
|
|
|
282
287
|
const code = char.charCodeAt(0);
|
|
283
288
|
return code < 32 ? String.fromCharCode(9216 + code) : code === 127 ? "␡" : "�";
|
|
284
289
|
});
|
|
290
|
+
/** As `terminalText`, for what shows within one line: tab and newline show as their pictures too. */
|
|
291
|
+
const lineText = (text) => terminalText(text).replace(/[\t\n]/g, (char) => String.fromCharCode(9216 + char.charCodeAt(0)));
|
|
285
292
|
/** Who you are, as your messages show you: `claude via julian` with a profile, your name otherwise. */
|
|
286
293
|
const who = (me) => shownName(me);
|
|
287
294
|
/**
|
|
@@ -302,7 +309,7 @@ function ago(iso, now = Date.now()) {
|
|
|
302
309
|
const indent = (text, prefix) => text.split("\n").map((line) => `${prefix}${line}`).join("\n");
|
|
303
310
|
function labels(message) {
|
|
304
311
|
const entries = Object.entries(message.labels);
|
|
305
|
-
return entries.length ? ` [${entries.map(([k, v]) => `${k}=${v}`).join(" ")}]` : "";
|
|
312
|
+
return entries.length ? ` [${entries.map(([k, v]) => `${k}=${lineText(v)}`).join(" ")}]` : "";
|
|
306
313
|
}
|
|
307
314
|
function reactions(message, names) {
|
|
308
315
|
const groups = Object.entries(message.reactions);
|
|
@@ -418,7 +425,7 @@ function taskNote(message, task, room) {
|
|
|
418
425
|
if (task.state === "completed" && task.result) return noteLine(task.result, room);
|
|
419
426
|
if ((task.state === "failed" || task.state === "canceled") && task.reason) return noteLine(task.reason, room);
|
|
420
427
|
if (task.state === "blocked" && task.blocked) return noteLine(task.blocked.reason, room);
|
|
421
|
-
return [Object.entries(message.labels).filter(([key]) => !key.startsWith("board.")).map(([key, value]) => `${key}=${value}`).join(" "), task.state === "waiting" && task.needs.length ? `needs ${task.needs.map((id) => `#${id}`).join(" ")}` : ""].filter(Boolean).join(" ");
|
|
428
|
+
return [Object.entries(message.labels).filter(([key]) => !key.startsWith("board.")).map(([key, value]) => `${key}=${lineText(value)}`).join(" "), task.state === "waiting" && task.needs.length ? `needs ${task.needs.map((id) => `#${id}`).join(" ")}` : ""].filter(Boolean).join(" ");
|
|
422
429
|
}
|
|
423
430
|
/** The widest a task's state is (`completed`), and how wide its first line's column is at least and at most. */
|
|
424
431
|
const STATE_WIDTH = 9;
|
|
@@ -1386,6 +1393,8 @@ let typed = [];
|
|
|
1386
1393
|
let warnings = [];
|
|
1387
1394
|
/** The board this run reached by its URL, for a failure to name. */
|
|
1388
1395
|
let reached = null;
|
|
1396
|
+
/** Where the credential this run sent came from, as `whoami` says it, for a refusal to say which to replace. */
|
|
1397
|
+
let sent = () => null;
|
|
1389
1398
|
/** How long the message text this run sends is, for a backend's refusal of it to say what to do instead. */
|
|
1390
1399
|
let sentLength = 0;
|
|
1391
1400
|
/** The help `words` ask for: a command's page when they name one (`read`, `sources read`), or else every command. */
|
|
@@ -1442,8 +1451,51 @@ function parse(argv) {
|
|
|
1442
1451
|
if (foreign) throw foreignOption(foreign.name, word);
|
|
1443
1452
|
if (canonical(positionals[0]) !== word) throw misplaced(args, word);
|
|
1444
1453
|
}
|
|
1454
|
+
/**
|
|
1455
|
+
* An option that has another name now, `--file`: passing the old one says so, as a command that's
|
|
1456
|
+
* gone does. Where the old one has no `--file` to become (one task's text, a schema written
|
|
1457
|
+
* inline), it says where that goes instead.
|
|
1458
|
+
*/
|
|
1459
|
+
function renamedOption(name, word, argv) {
|
|
1460
|
+
const creates = word !== void 0 && argv[argv.indexOf(word) + 1] === "create";
|
|
1461
|
+
if (name === "text-file" && word === "tasks" && creates) return usage("--text-file is gone from tasks create.", {
|
|
1462
|
+
reason: "unknown_option",
|
|
1463
|
+
next: [{ instruction: "Pass the text, or - to read it from stdin: --file there is a plan of several" }]
|
|
1464
|
+
});
|
|
1465
|
+
if (name === "schema" && word === "schemas" && creates) {
|
|
1466
|
+
const at = argv.findIndex((arg) => arg === "--schema" || arg.startsWith("--schema="));
|
|
1467
|
+
const joined = argv[at]?.startsWith("--schema=") ?? false;
|
|
1468
|
+
const given = joined ? argv[at].slice(9) : argv[at + 1];
|
|
1469
|
+
if (at === -1 || given === void 0) return usage("--schema is --file now, or --data for JSON written inline.", { reason: "unknown_option" });
|
|
1470
|
+
const [option, value] = given === "-" ? ["--file", "-"] : given.startsWith("@") ? ["--file", given.slice(1)] : ["--data", given];
|
|
1471
|
+
const again = [
|
|
1472
|
+
...argv.slice(0, at),
|
|
1473
|
+
option,
|
|
1474
|
+
value,
|
|
1475
|
+
...argv.slice(at + (joined ? 1 : 2))
|
|
1476
|
+
];
|
|
1477
|
+
return usage(`--schema is ${option} now.`, {
|
|
1478
|
+
reason: "unknown_option",
|
|
1479
|
+
next: [{
|
|
1480
|
+
instruction: `Run it with ${option}`,
|
|
1481
|
+
argv: [...cli(), ...again]
|
|
1482
|
+
}]
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
if (!(name === "text-file" && word !== void 0 && TEXT.has(word) || name === "tasks-file" && word === "tasks" && creates)) return void 0;
|
|
1486
|
+
const again = argv.map((arg) => arg === `--${name}` ? "--file" : arg.startsWith(`--${name}=`) ? `--file=${arg.slice(name.length + 3)}` : arg);
|
|
1487
|
+
return usage(`--${name} is --file now.`, {
|
|
1488
|
+
reason: "unknown_option",
|
|
1489
|
+
next: [{
|
|
1490
|
+
instruction: "Run it with --file",
|
|
1491
|
+
argv: [...cli(), ...again]
|
|
1492
|
+
}]
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1445
1495
|
/** An option `word` doesn't take: what to do instead, where there's something better to say than that. */
|
|
1446
1496
|
function foreignOption(name, word) {
|
|
1497
|
+
const renamed = renamedOption(name, word, typed);
|
|
1498
|
+
if (renamed) return renamed;
|
|
1447
1499
|
if (name === "text" && TEXT.has(word)) return usage(`--text is a filter for read, tail, and wait. ${word} takes its text as an argument, in quotes.`);
|
|
1448
1500
|
if (name === "sync" && word === "schedule") return usage("Can't use --sync with schedule. A schedule posts where you point it.");
|
|
1449
1501
|
if (name === "attach" && word === "edit") return usage("edit can't attach files: reply with the file instead.", {
|
|
@@ -1487,6 +1539,8 @@ function parseFailure(error, argv, word) {
|
|
|
1487
1539
|
const dash = argv.indexOf("--");
|
|
1488
1540
|
const options = dash === -1 ? argv : argv.slice(0, dash);
|
|
1489
1541
|
const spaced = token === void 0 ? void 0 : options.find((arg) => /\s/.test(arg) && (token.startsWith("--") ? arg === token : arg.startsWith(token)));
|
|
1542
|
+
const renamed = !spaced && option.startsWith("--") ? renamedOption(option.slice(2), word, argv) : void 0;
|
|
1543
|
+
if (renamed) return renamed;
|
|
1490
1544
|
const guess = !spaced && option.startsWith("--") ? closest(option.slice(2), optionsOf(word)) : void 0;
|
|
1491
1545
|
const next = [{
|
|
1492
1546
|
instruction: "See all options",
|
|
@@ -1615,13 +1669,14 @@ function oneText(command, target, extra) {
|
|
|
1615
1669
|
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.`);
|
|
1616
1670
|
}
|
|
1617
1671
|
/**
|
|
1618
|
-
* A message's text: the argument, stdin for `-`, or the file `--
|
|
1619
|
-
* `optional` when the message can go without, as one with `--attach` files can.
|
|
1672
|
+
* A message's text: the argument, stdin for `-`, or the file `--file` names (`-` for stdin).
|
|
1673
|
+
* `optional` when the message can go without, as one with `--attach` files can. `missing` is
|
|
1674
|
+
* what's said when there's none: a task's `--file` holds a plan, so it says so itself.
|
|
1620
1675
|
*/
|
|
1621
|
-
async function text(value, { optional = false } = {}) {
|
|
1622
|
-
const file = flags
|
|
1676
|
+
async function text(value, { optional = false, missing = "Missing the message's text: pass it, - to read it from stdin, or --file <path>." } = {}) {
|
|
1677
|
+
const file = flags.file;
|
|
1623
1678
|
if (file !== void 0) {
|
|
1624
|
-
if (value !== void 0) throw usage("Can't use --
|
|
1679
|
+
if (value !== void 0) throw usage("Can't use --file with text: a message has no title, so its whole text comes from one or the other.");
|
|
1625
1680
|
if (file === "-") return (await io.stdin()).replace(/\n$/, "");
|
|
1626
1681
|
const data = await io.readFile(file).catch((error) => {
|
|
1627
1682
|
if (!(error instanceof Failed) || error.failure.reason !== "payload_too_large") throw error;
|
|
@@ -1639,7 +1694,7 @@ async function text(value, { optional = false } = {}) {
|
|
|
1639
1694
|
}
|
|
1640
1695
|
if (value === void 0) {
|
|
1641
1696
|
if (optional) return "";
|
|
1642
|
-
throw usage(
|
|
1697
|
+
throw usage(missing, { reason: "missing_arguments" });
|
|
1643
1698
|
}
|
|
1644
1699
|
if (value !== "-") return value;
|
|
1645
1700
|
return (await io.stdin()).replace(/\n$/, "");
|
|
@@ -1719,6 +1774,85 @@ function grantFlags(read) {
|
|
|
1719
1774
|
throw error;
|
|
1720
1775
|
}
|
|
1721
1776
|
}
|
|
1777
|
+
/** `--lock-me-out`, as a grant write takes it: go ahead with a change this caller couldn't take back. */
|
|
1778
|
+
const lockMeOut = () => flags["lock-me-out"] ? { lockMeOut: true } : {};
|
|
1779
|
+
/** Whoever runs this, as the flags that name them in a grant, once a lockout has asked: null when no flag does. */
|
|
1780
|
+
let self = null;
|
|
1781
|
+
/** The flags that name a caller in a grant: a person, a project's deployment where it runs, an app, or a repository's runs. */
|
|
1782
|
+
function selfFlags({ principal, handle }) {
|
|
1783
|
+
const [source, kind, ...rest] = principal.split(":");
|
|
1784
|
+
if ((source === "vercel" || source === "local") && kind === "user" && rest.length > 0) return ["--user", rest.join(":")];
|
|
1785
|
+
if (source === "vercel" && kind === "project" && rest.length === 2) return [
|
|
1786
|
+
"--project",
|
|
1787
|
+
rest[0],
|
|
1788
|
+
"--environment",
|
|
1789
|
+
rest[1]
|
|
1790
|
+
];
|
|
1791
|
+
if (source === "vercel" && kind === "app" && rest.length > 0) return ["--app", rest.join(":")];
|
|
1792
|
+
if (source === "github" && kind === "repo" && /^[^/\s]+\/[^/\s]+$/.test(handle)) return ["--github", handle];
|
|
1793
|
+
return null;
|
|
1794
|
+
}
|
|
1795
|
+
/** A grant write's refusal, on its way out: a lockout's way out names whoever runs this, which is a read away. */
|
|
1796
|
+
async function namingSelf(error) {
|
|
1797
|
+
if (error?.code === "grant_lockout") self = await client().me().then(selfFlags, () => null);
|
|
1798
|
+
throw error;
|
|
1799
|
+
}
|
|
1800
|
+
/** The options that say which board this run acts on, as it was given them: a command suggested for the same board carries them. */
|
|
1801
|
+
const onSameBoard = () => [
|
|
1802
|
+
...flags.url !== void 0 ? ["--url", flags.url] : [],
|
|
1803
|
+
...flags.scope !== void 0 || flags.team !== void 0 ? ["--scope", flags.scope ?? flags.team] : [],
|
|
1804
|
+
...flags.name !== void 0 ? ["--name", flags.name] : []
|
|
1805
|
+
];
|
|
1806
|
+
/**
|
|
1807
|
+
* The ways out of a grant change the board refused as a lockout. A new grant: first, the grant
|
|
1808
|
+
* that keeps manage, for whoever runs this, at each pattern it names, after which this one is no
|
|
1809
|
+
* lockout. Any of them: the same command, told to go ahead.
|
|
1810
|
+
*/
|
|
1811
|
+
function lockoutRecoveries() {
|
|
1812
|
+
const [verb] = current.args;
|
|
1813
|
+
const anyway = {
|
|
1814
|
+
instruction: verb === "create" ? "Make it anyway" : verb === "revoke" ? "Revoke it anyway" : "Update it anyway",
|
|
1815
|
+
argv: rerun("--lock-me-out")
|
|
1816
|
+
};
|
|
1817
|
+
if (verb !== "create") return [{ instruction: "Keep manage there first, with another grant that names you" }, anyway];
|
|
1818
|
+
if (flags.file !== void 0) return [{ instruction: "Keep manage there yourself: add a grant to the file that names you, with all there" }, anyway];
|
|
1819
|
+
const all = patternsIn(flags.can ?? []).map((pattern) => `${pattern}=all`).join(";");
|
|
1820
|
+
return [self ? {
|
|
1821
|
+
instruction: "Keep manage there yourself first",
|
|
1822
|
+
argv: [
|
|
1823
|
+
...cli(),
|
|
1824
|
+
"grants",
|
|
1825
|
+
"create",
|
|
1826
|
+
...self,
|
|
1827
|
+
"--can",
|
|
1828
|
+
all,
|
|
1829
|
+
...onSameBoard()
|
|
1830
|
+
]
|
|
1831
|
+
} : { instruction: `Keep manage there yourself first, with a grant that names you: --can '${all}'` }, anyway];
|
|
1832
|
+
}
|
|
1833
|
+
/** The grants a `--file` holds: a JSON array, from the file or from stdin for `-`, each as `createGrants` takes one. The board checks what's in them. */
|
|
1834
|
+
async function grantsFrom(path) {
|
|
1835
|
+
const where = path === "-" ? "stdin" : path;
|
|
1836
|
+
let source;
|
|
1837
|
+
if (path === "-") source = await io.stdin();
|
|
1838
|
+
else {
|
|
1839
|
+
const data = await io.readFile(path);
|
|
1840
|
+
if (!data) throw usage(`Can't read ${path}. There's no such file.`, {
|
|
1841
|
+
reason: "file_not_found",
|
|
1842
|
+
next: []
|
|
1843
|
+
});
|
|
1844
|
+
source = new TextDecoder().decode(data);
|
|
1845
|
+
}
|
|
1846
|
+
let parsed;
|
|
1847
|
+
try {
|
|
1848
|
+
parsed = JSON.parse(source);
|
|
1849
|
+
} catch {
|
|
1850
|
+
throw usage(`${where} isn't JSON.`);
|
|
1851
|
+
}
|
|
1852
|
+
if (!Array.isArray(parsed) || parsed.length === 0 || parsed.some((grant) => typeof grant !== "object" || grant === null || Array.isArray(grant))) throw usage(`${where} holds no grants. It's a JSON array of them: [{"principals": [{"kind": "everyone"}], "can": {"ci/": ["read"]}}].`);
|
|
1853
|
+
if (parsed.length > 16) throw usage(`${where} holds ${parsed.length} grants, and one write makes 16 at most.`);
|
|
1854
|
+
return parsed;
|
|
1855
|
+
}
|
|
1722
1856
|
/** Refuses the principal flags `verb` doesn't take: plain ones on update, `--add-` and `--remove-` ones elsewhere. */
|
|
1723
1857
|
function onlyPrincipalFlags(verb) {
|
|
1724
1858
|
for (const { name } of ordered) {
|
|
@@ -1774,7 +1908,7 @@ function configuredUrl() {
|
|
|
1774
1908
|
}
|
|
1775
1909
|
/**
|
|
1776
1910
|
* What a message says: its text, or with `--schema`, a block of that schema and nothing else, whose
|
|
1777
|
-
* JSON the text is, from wherever text comes (the argument, stdin, `--
|
|
1911
|
+
* JSON the text is, from wherever text comes (the argument, stdin, `--file`).
|
|
1778
1912
|
*/
|
|
1779
1913
|
async function content(value, options = {}) {
|
|
1780
1914
|
const said = await given(value, options);
|
|
@@ -1795,14 +1929,15 @@ async function given(value, options) {
|
|
|
1795
1929
|
if (typeof data !== "object" || data === null || Array.isArray(data)) throw usage(`With --schema, the text is a JSON object, like {"id":"sbx-123"}.`);
|
|
1796
1930
|
return block(schema, data);
|
|
1797
1931
|
}
|
|
1798
|
-
/** A schema's JSON Schema
|
|
1932
|
+
/** A schema's JSON Schema: from the file `--file` names, or stdin for `-`, or written inline as `--data`. */
|
|
1799
1933
|
async function definition() {
|
|
1800
|
-
const
|
|
1801
|
-
if (
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1934
|
+
const { file, data: inline } = flags;
|
|
1935
|
+
if (file !== void 0 && inline !== void 0) throw usage("--file and --data both give the JSON Schema: pass one.");
|
|
1936
|
+
if (file === void 0 && inline === void 0) throw usage("Missing its JSON Schema: --file <path>, - for stdin, or --data <json>.", { reason: "missing_arguments" });
|
|
1937
|
+
let source;
|
|
1938
|
+
if (inline !== void 0) source = inline;
|
|
1939
|
+
else if (file === "-") source = await io.stdin();
|
|
1940
|
+
else {
|
|
1806
1941
|
const data = await io.readFile(file);
|
|
1807
1942
|
if (!data) throw usage(`Can't read ${file}. There's no such file.`, {
|
|
1808
1943
|
reason: "file_not_found",
|
|
@@ -1814,7 +1949,8 @@ async function definition() {
|
|
|
1814
1949
|
try {
|
|
1815
1950
|
parsed = JSON.parse(source);
|
|
1816
1951
|
} catch {
|
|
1817
|
-
|
|
1952
|
+
if (inline === void 0) throw usage(`${file === "-" ? "stdin" : file} isn't JSON.`);
|
|
1953
|
+
throw usage(`--data takes the JSON itself, and ${inline.length > 40 ? `${inline.slice(0, 40)}…` : inline} isn't JSON.`, { next: [{ instruction: "A file, or - for stdin, goes in --file" }] });
|
|
1818
1954
|
}
|
|
1819
1955
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw usage("A schema is a JSON object: {\"type\":\"object\", …}.");
|
|
1820
1956
|
return parsed;
|
|
@@ -1851,13 +1987,13 @@ function doing() {
|
|
|
1851
1987
|
if (a === void 0 || !TASK_VERBS.has(a)) return a === void 0 ? "list tasks" : `list tasks in ${a}`;
|
|
1852
1988
|
const one = b === void 0 ? "a task" : `task ${ref(b)}`;
|
|
1853
1989
|
if (a === "claim" || a === "run") return flags.ready ? `claim a task in ${b ?? "a channel"}` : `claim ${one}`;
|
|
1854
|
-
if (a === "create" && flags
|
|
1990
|
+
if (a === "create" && flags.file !== void 0) return `create tasks in ${b ?? "a channel"}`;
|
|
1855
1991
|
if (a === "create") return b !== void 0 && isMessageRef(b) ? `make ${ref(b)} a task` : `create a task in ${b ?? "a channel"}`;
|
|
1856
1992
|
if (a === "renew") return `renew the claim on ${one}`;
|
|
1857
1993
|
if (a === "needs") return `change what ${one} needs`;
|
|
1858
1994
|
return `${a} ${one}`;
|
|
1859
1995
|
}
|
|
1860
|
-
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";
|
|
1996
|
+
case "grants": return a === "create" ? flags.file !== void 0 ? "create the grants" : "create the grant" : a === "update" ? `update grant ${b}` : a === "explain" ? `explain ${b ?? "the channel"}` : a === "revoke" ? `revoke grant ${b}` : "list grants";
|
|
1861
1997
|
case "schemas": return a === "create" ? `register schema ${b ?? ""}`.trimEnd() : a === "inspect" ? `read schema ${b ?? ""}`.trimEnd() : "list schemas";
|
|
1862
1998
|
case "sources": return b === void 0 ? "list sources" : `${b} ${c ?? "it"} on ${a}`;
|
|
1863
1999
|
case "download": return `download ${a ?? "the attachment"}`;
|
|
@@ -1906,18 +2042,20 @@ function missing() {
|
|
|
1906
2042
|
function failureOf(error) {
|
|
1907
2043
|
if (error instanceof Failed) return error.failure;
|
|
1908
2044
|
const message = error instanceof Error ? error.message : String(error);
|
|
1909
|
-
const { code, status, hint, origin } = error;
|
|
2045
|
+
const { code, status, hint, origin, retryAfter } = error;
|
|
1910
2046
|
if (typeof code !== "string" || typeof status !== "number") return {
|
|
1911
2047
|
class: "unknown",
|
|
1912
2048
|
reason: "unexpected_error",
|
|
1913
2049
|
message: `Failed to ${doing()}.`,
|
|
1914
2050
|
details: [message]
|
|
1915
2051
|
};
|
|
2052
|
+
const wait = typeof retryAfter === "number" && Number.isInteger(retryAfter) && retryAfter >= 0 ? retryAfter : void 0;
|
|
1916
2053
|
const said = { error: {
|
|
1917
2054
|
code,
|
|
1918
2055
|
message,
|
|
1919
2056
|
status,
|
|
1920
|
-
...typeof hint === "string" ? { hint } : {}
|
|
2057
|
+
...typeof hint === "string" ? { hint } : {},
|
|
2058
|
+
...wait !== void 0 ? { retryAfter: wait } : {}
|
|
1921
2059
|
} };
|
|
1922
2060
|
if (origin === "handle") {
|
|
1923
2061
|
const fix = typeof hint === "string" ? [{ instruction: hint }] : [];
|
|
@@ -2023,7 +2161,7 @@ function failureOf(error) {
|
|
|
2023
2161
|
details: []
|
|
2024
2162
|
};
|
|
2025
2163
|
if (status === 400) return theirs("usage", specific("invalid_arguments"), `Can't ${doing()}.`);
|
|
2026
|
-
if (status === 401) return theirs("auth", "login_required", "The board didn't accept your credentials.", process.env.BOARD_TOKEN && (reached && !vercelBoard(reached) || credentialSource() === "BOARD_TOKEN") ? [{ instruction: "Pass a token it accepts in BOARD_TOKEN, or unset it" }] : [{
|
|
2164
|
+
if (status === 401) return theirs("auth", "login_required", "The board didn't accept your credentials.", sent() === "the token you passed" ? [{ instruction: "Pass a token it accepts" }] : process.env.BOARD_TOKEN && (reached && !vercelBoard(reached) || credentialSource() === "BOARD_TOKEN") ? [{ instruction: "Pass a token it accepts in BOARD_TOKEN, or unset it" }] : [{
|
|
2027
2165
|
instruction: "Log in again",
|
|
2028
2166
|
argv: ["vercel", "login"]
|
|
2029
2167
|
}]);
|
|
@@ -2036,6 +2174,7 @@ function failureOf(error) {
|
|
|
2036
2174
|
} : theirs("not_found", specific("not_found"), `Can't ${doing()}.`);
|
|
2037
2175
|
}
|
|
2038
2176
|
if (status === 409) {
|
|
2177
|
+
if (code === "grant_lockout" && current.command === "grants") return theirs("conflict", code, `Can't ${doing()}: it would lock you out.`, lockoutRecoveries());
|
|
2039
2178
|
const { args } = current;
|
|
2040
2179
|
const newer = code === "newer_message" && flags.after !== void 0 && args[0] !== void 0;
|
|
2041
2180
|
const labeled = code === "label_conflict" && (flags.if !== void 0 || flags["if-unset"] !== void 0) && args[0] !== void 0;
|
|
@@ -2076,11 +2215,14 @@ function failureOf(error) {
|
|
|
2076
2215
|
}] : []);
|
|
2077
2216
|
}
|
|
2078
2217
|
if (status === 413) return theirs("limit", "payload_too_large", `Can't ${doing()}. It's too large for the board.`);
|
|
2079
|
-
if (status ===
|
|
2218
|
+
if (status === 501 && code === "no_direct_uploads") return theirs("limit", "payload_too_large", `Can't ${doing()}. The file is too large for this board.`, [{ instruction: "Compress it, or split it into smaller files" }]);
|
|
2219
|
+
if (status === 429) return theirs("rate_limit", "rate_limited", `Can't ${doing()}. Too many requests to the board.`, [{ instruction: wait !== void 0 ? `Wait ${waitFor(wait)}, then run it again` : "Wait a minute, then run it again" }]);
|
|
2080
2220
|
if (status === 501) return theirs("platform", specific("not_supported"), `Can't ${doing()}. This board doesn't support it.`);
|
|
2081
2221
|
if (code === "unreachable") return theirs("network", "network_error", "Couldn't reach the board.");
|
|
2082
2222
|
return theirs("platform", "api_error", `Failed to ${doing()}.`);
|
|
2083
2223
|
}
|
|
2224
|
+
/** `42s`, `2m`: a wait the way people say it. */
|
|
2225
|
+
const waitFor = (seconds) => seconds < 120 ? `${Math.max(1, seconds)}s` : `${Math.ceil(seconds / 60)}m`;
|
|
2084
2226
|
/** How this run ends with `failure`: shown on stderr, or by the app, and its exit code. */
|
|
2085
2227
|
function report(failure, json) {
|
|
2086
2228
|
if (app.onError) app.onError(failure, { json });
|
|
@@ -2138,6 +2280,7 @@ function connection(url = flags.url, options = {}) {
|
|
|
2138
2280
|
ensure: flags.ensure === true
|
|
2139
2281
|
} : {}
|
|
2140
2282
|
});
|
|
2283
|
+
sent = credentialSource;
|
|
2141
2284
|
return {
|
|
2142
2285
|
url: null,
|
|
2143
2286
|
transport: { source: credentialSource },
|
|
@@ -2152,6 +2295,7 @@ function connection(url = flags.url, options = {}) {
|
|
|
2152
2295
|
...onVercel,
|
|
2153
2296
|
...sending(options.token, options.can, options.headers)
|
|
2154
2297
|
}) });
|
|
2298
|
+
sent = credentialSource;
|
|
2155
2299
|
return {
|
|
2156
2300
|
url: at,
|
|
2157
2301
|
transport: { source: credentialSource },
|
|
@@ -2167,6 +2311,7 @@ function connection(url = flags.url, options = {}) {
|
|
|
2167
2311
|
...Object.keys(extra).length > 0 ? { fetch: withHeaders(extra) } : {}
|
|
2168
2312
|
});
|
|
2169
2313
|
const board$2 = board({ backend: http(at, { fetch: transport.fetch }) });
|
|
2314
|
+
sent = transport.source;
|
|
2170
2315
|
return {
|
|
2171
2316
|
url: at,
|
|
2172
2317
|
transport,
|
|
@@ -2455,15 +2600,22 @@ async function run(command, args) {
|
|
|
2455
2600
|
if (!narrowed) for (const schedule of thread.schedules ?? []) out(formatSchedule(schedule, { pad: " " }));
|
|
2456
2601
|
return 0;
|
|
2457
2602
|
}
|
|
2603
|
+
const limit = flags.limit ? Number(flags.limit) : 50;
|
|
2604
|
+
const peek = !flags.json && Number.isInteger(limit) && limit >= 1 && limit < 500;
|
|
2458
2605
|
const query = {
|
|
2459
2606
|
...filters(target),
|
|
2460
|
-
...
|
|
2607
|
+
...peek ? { limit: limit + 1 } : flags.limit ? { limit } : {}
|
|
2461
2608
|
};
|
|
2462
2609
|
const old = outdated("This board can't list threads.");
|
|
2463
|
-
const
|
|
2610
|
+
const listed = await board.threads(query).catch((error) => {
|
|
2464
2611
|
throw error instanceof BoardError && error.status === 404 && /^no route: /.test(error.message) ? old : error;
|
|
2465
2612
|
});
|
|
2466
|
-
if (!Array.isArray(
|
|
2613
|
+
if (!Array.isArray(listed.threads)) throw old;
|
|
2614
|
+
const more = listed.threads.length > limit || !peek && listed.threads.length === limit;
|
|
2615
|
+
const page = listed.threads.length > limit ? {
|
|
2616
|
+
...listed,
|
|
2617
|
+
threads: flags.after !== void 0 ? listed.threads.slice(0, limit) : listed.threads.slice(-limit)
|
|
2618
|
+
} : listed;
|
|
2467
2619
|
if (!page.threads.length && target) {
|
|
2468
2620
|
const channels = (await board.channels()).map((c) => c.path);
|
|
2469
2621
|
if (!channels.some((path) => path === target || path.startsWith(target.replace(/\/?$/, "/")))) {
|
|
@@ -2493,6 +2645,20 @@ async function run(command, args) {
|
|
|
2493
2645
|
handles
|
|
2494
2646
|
}));
|
|
2495
2647
|
}
|
|
2648
|
+
const latest = page.threads.at(-1);
|
|
2649
|
+
if (more && flags.after !== void 0 && latest) {
|
|
2650
|
+
if (![
|
|
2651
|
+
"re",
|
|
2652
|
+
"by",
|
|
2653
|
+
"mentions",
|
|
2654
|
+
"from",
|
|
2655
|
+
"text"
|
|
2656
|
+
].some((key) => key in query)) out(`\nmore since then: ${commandLine(rerunWithout(["--after"], "--after", (latest.last ?? latest.message).id))}`);
|
|
2657
|
+
else if (limit < 500) out(`\nmore since then: ${commandLine(rerunWithout(["--limit", "-n"], "--limit", String(Math.min(500, limit * 2))))}`);
|
|
2658
|
+
else out(`\n(more not shown: 500 is the most a read lists, so narrow it with --label, --by, or --text)`);
|
|
2659
|
+
return 0;
|
|
2660
|
+
}
|
|
2661
|
+
if (more) out(limit < 500 ? `\n(older not shown: ${commandLine(rerunWithout(["--limit", "-n"], "--limit", String(Math.min(500, limit * 2))))})` : `\n(older not shown: 500 is the most a read lists, so narrow it with --label, --by, or --text)`);
|
|
2496
2662
|
out(`\nnew since then: ${commandLine(rerunWithout(["--after"], "--after", String(page.cursor)))}`);
|
|
2497
2663
|
return 0;
|
|
2498
2664
|
}
|
|
@@ -2604,13 +2770,23 @@ async function run(command, args) {
|
|
|
2604
2770
|
if (rest.length > 0) throw usage(`grants create takes no arguments: ${rest[0]} is one too many.`);
|
|
2605
2771
|
onlyPrincipalFlags("create");
|
|
2606
2772
|
const principals = grantFlags(() => principalsIn(ordered, [""])).map(({ principal }) => principal);
|
|
2773
|
+
if (flags.file !== void 0) {
|
|
2774
|
+
if (principals.length > 0 || flags.can !== void 0) throw usage("--file holds the grants: each one in it names its own principals and can, so it goes without theirs.");
|
|
2775
|
+
const { grants } = await client().createGrants(await grantsFrom(flags.file), lockMeOut()).catch(namingSelf);
|
|
2776
|
+
if (flags.json) result({
|
|
2777
|
+
grants,
|
|
2778
|
+
outcome: "created"
|
|
2779
|
+
});
|
|
2780
|
+
else for (const grant of grants) out(`created ${grantRow(grant)}`);
|
|
2781
|
+
return 0;
|
|
2782
|
+
}
|
|
2607
2783
|
if (principals.length === 0) throw usage("A grant names whom it lets in: --user, --project, --github, --oidc, --all-users, --all-projects, or --everyone.", { reason: "missing_arguments" });
|
|
2608
2784
|
const can = grantFlags(() => grantCanOf(flags.can ?? []));
|
|
2609
2785
|
if (Object.keys(can).length === 0) throw usage("A grant says what it lets them do: --can pattern=permissions, like --can 'ci/=read,post'.", { reason: "missing_arguments" });
|
|
2610
2786
|
const { grant } = await client().createGrant({
|
|
2611
2787
|
principals,
|
|
2612
2788
|
can
|
|
2613
|
-
});
|
|
2789
|
+
}, lockMeOut()).catch(namingSelf);
|
|
2614
2790
|
if (flags.json) result({
|
|
2615
2791
|
grant,
|
|
2616
2792
|
outcome: "created"
|
|
@@ -2648,7 +2824,7 @@ async function run(command, args) {
|
|
|
2648
2824
|
...add.length > 0 ? { add } : {},
|
|
2649
2825
|
...remove.length > 0 ? { remove } : {},
|
|
2650
2826
|
...can !== void 0 ? { can } : {}
|
|
2651
|
-
});
|
|
2827
|
+
}, lockMeOut());
|
|
2652
2828
|
if (flags.json) result({
|
|
2653
2829
|
grant,
|
|
2654
2830
|
outcome: "updated"
|
|
@@ -2669,7 +2845,7 @@ async function run(command, args) {
|
|
|
2669
2845
|
}
|
|
2670
2846
|
if (verb === "revoke") {
|
|
2671
2847
|
const id = grantId(rest[0]);
|
|
2672
|
-
const { revoked } = await client().revokeGrant(id);
|
|
2848
|
+
const { revoked } = await client().revokeGrant(id, lockMeOut());
|
|
2673
2849
|
if (flags.json) result({
|
|
2674
2850
|
grant: id,
|
|
2675
2851
|
outcome: revoked ? "revoked" : "unchanged"
|
|
@@ -3029,15 +3205,14 @@ function seconds(flag) {
|
|
|
3029
3205
|
return total;
|
|
3030
3206
|
}
|
|
3031
3207
|
/**
|
|
3032
|
-
* `tasks create <channel> --
|
|
3208
|
+
* `tasks create <channel> --file <path>`: the tasks a JSON file holds, as `tasks.createMany`
|
|
3033
3209
|
* takes them, made in as many writes as the board needs. It prints each as the list shows one.
|
|
3034
3210
|
* The whole plan goes under one key, `--idempotency-key`'s or this run's own, so one that stops
|
|
3035
3211
|
* midway says what was made and is finished by the same command.
|
|
3036
3212
|
*/
|
|
3037
3213
|
async function createPlan(target, text, path) {
|
|
3038
|
-
if (isMessageRef(target)) throw usage(`--
|
|
3214
|
+
if (isMessageRef(target)) throw usage(`--file holds a plan, which starts threads in a channel, and ${ref(target)} is a thread.`);
|
|
3039
3215
|
const own = text !== void 0 ? "text" : [
|
|
3040
|
-
"text-file",
|
|
3041
3216
|
"label",
|
|
3042
3217
|
"needs",
|
|
3043
3218
|
"for",
|
|
@@ -3045,7 +3220,7 @@ async function createPlan(target, text, path) {
|
|
|
3045
3220
|
"lease",
|
|
3046
3221
|
"no-sync"
|
|
3047
3222
|
].find((name) => flags[name] !== void 0 && flags[name] !== false);
|
|
3048
|
-
if (own !== void 0) throw usage(`${own === "text" ? "Text" : `--${own}`} is one task's: with --
|
|
3223
|
+
if (own !== void 0) throw usage(`${own === "text" ? "Text" : `--${own}`} is one task's: with --file, each task in the file has its own.`);
|
|
3049
3224
|
const board = client();
|
|
3050
3225
|
const tasks = await planFrom(path, board);
|
|
3051
3226
|
sentLength = Math.max(0, ...tasks.map((task) => typeof task.text === "string" ? task.text.length : 0));
|
|
@@ -3085,7 +3260,7 @@ async function createPlan(target, text, path) {
|
|
|
3085
3260
|
}))));
|
|
3086
3261
|
return 0;
|
|
3087
3262
|
}
|
|
3088
|
-
/** What a task of a `--
|
|
3263
|
+
/** What a task of a plan's `--file` takes, as `tasks.createMany` does. */
|
|
3089
3264
|
const PLAN_KEYS = [
|
|
3090
3265
|
"key",
|
|
3091
3266
|
"text",
|
|
@@ -3141,7 +3316,7 @@ function checkPlan(plan, where) {
|
|
|
3141
3316
|
}
|
|
3142
3317
|
}
|
|
3143
3318
|
}
|
|
3144
|
-
/** The tasks a `--
|
|
3319
|
+
/** The tasks a plan's `--file` holds: a JSON array, from the file or from stdin for `-`. An ID may be written `#812`, and `for` as a profile's name. */
|
|
3145
3320
|
async function planFrom(path, board) {
|
|
3146
3321
|
const where = path === "-" ? "stdin" : path;
|
|
3147
3322
|
let source;
|
|
@@ -3158,7 +3333,7 @@ async function planFrom(path, board) {
|
|
|
3158
3333
|
try {
|
|
3159
3334
|
parsed = JSON.parse(source);
|
|
3160
3335
|
} catch {
|
|
3161
|
-
throw usage(`${where} isn't JSON.`, { next: [planHelp()] });
|
|
3336
|
+
throw usage(`${where} isn't JSON: --file on tasks create is a plan of tasks.`, { next: [{ instruction: "For one task's text, pass it, or - to read it from stdin" }, planHelp()] });
|
|
3162
3337
|
}
|
|
3163
3338
|
const shape = "A plan is a JSON array of tasks: [{\"key\": \"fix\", \"text\": \"…\"}, {\"text\": \"…\", \"needs\": [{\"key\": \"fix\"}]}].";
|
|
3164
3339
|
if (!Array.isArray(parsed) || parsed.length === 0 || parsed.some((task) => typeof task !== "object" || task === null || Array.isArray(task))) throw usage(`${where} holds no tasks. ${shape}`, { next: [planHelp()] });
|
|
@@ -3385,7 +3560,7 @@ async function tasks(args) {
|
|
|
3385
3560
|
const [target, body, extra] = rest;
|
|
3386
3561
|
if (!target) throw usage("Missing a channel to start a task in, or a thread's ID to make one of.", { reason: "missing_arguments" });
|
|
3387
3562
|
if (extra !== void 0) throw usage(`tasks create takes a channel and quoted text: ${extra} is one too many.`);
|
|
3388
|
-
if (flags
|
|
3563
|
+
if (flags.file !== void 0) return createPlan(target, body, flags.file);
|
|
3389
3564
|
const lease = seconds("lease");
|
|
3390
3565
|
if (lease !== void 0 && !claimFlag()) throw usage("--lease is how long a claim holds the task: pass --claim too.");
|
|
3391
3566
|
const { board, claims } = tasksOn();
|
|
@@ -3398,7 +3573,6 @@ async function tasks(args) {
|
|
|
3398
3573
|
let made;
|
|
3399
3574
|
if (isMessageRef(target)) {
|
|
3400
3575
|
const own = body !== void 0 ? "text" : [
|
|
3401
|
-
"text-file",
|
|
3402
3576
|
"label",
|
|
3403
3577
|
"no-sync",
|
|
3404
3578
|
"idempotency-key"
|
|
@@ -3414,7 +3588,7 @@ async function tasks(args) {
|
|
|
3414
3588
|
}] });
|
|
3415
3589
|
made = await board.tasks.create({ re: messageId(target) }, about);
|
|
3416
3590
|
} else {
|
|
3417
|
-
const said = await text(body);
|
|
3591
|
+
const said = await text(body, { missing: "Missing the task's text: pass it, or - to read it from stdin. --file takes a plan of several." });
|
|
3418
3592
|
sentLength = said.length;
|
|
3419
3593
|
made = await board.tasks.create(target, {
|
|
3420
3594
|
text: said,
|
|
@@ -3728,7 +3902,7 @@ function taskFailure(code, status) {
|
|
|
3728
3902
|
}]
|
|
3729
3903
|
};
|
|
3730
3904
|
case "invalid_needs":
|
|
3731
|
-
if (flags
|
|
3905
|
+
if (flags.file !== void 0) return {
|
|
3732
3906
|
class: "usage",
|
|
3733
3907
|
message: `Can't ${doing()}. A task's needs are tasks you can read, or keys of the plan's own.`,
|
|
3734
3908
|
next: [{
|
|
@@ -4117,12 +4291,14 @@ const context = () => ({
|
|
|
4117
4291
|
*/
|
|
4118
4292
|
async function main(argv, options) {
|
|
4119
4293
|
handLogin(options.login ?? null);
|
|
4294
|
+
handToken(options.token ?? null);
|
|
4120
4295
|
handTeam(options.team ?? null);
|
|
4121
4296
|
handFetch(options.fetch ?? null);
|
|
4122
4297
|
try {
|
|
4123
4298
|
return await runOnce(argv, options);
|
|
4124
4299
|
} finally {
|
|
4125
4300
|
handLogin(null);
|
|
4301
|
+
handToken(null);
|
|
4126
4302
|
handTeam(null);
|
|
4127
4303
|
handFetch(null);
|
|
4128
4304
|
}
|
|
@@ -4134,7 +4310,9 @@ async function runOnce(argv, options) {
|
|
|
4134
4310
|
positionals = [];
|
|
4135
4311
|
warnings = [];
|
|
4136
4312
|
reached = null;
|
|
4313
|
+
sent = () => null;
|
|
4137
4314
|
sentLength = 0;
|
|
4315
|
+
self = null;
|
|
4138
4316
|
try {
|
|
4139
4317
|
parse(argv);
|
|
4140
4318
|
if (flags.version) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as sqlTables } from "./sql-
|
|
1
|
+
import { r as sqlTables } from "./sql-iABdyCiz.mjs";
|
|
2
2
|
import { t as memory$1 } from "./store-memory-CKQVEzXN.mjs";
|
|
3
|
-
import { t as sqliteDb } from "./sqlite-db-
|
|
3
|
+
import { t as sqliteDb } from "./sqlite-db-Ckd-ceNe.mjs";
|
|
4
4
|
//#region src/store/memory.ts
|
|
5
5
|
/**
|
|
6
6
|
* A board that lives in memory, for tests: its log in A2's memory store, its
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { _ as NewLabels, m as MESSAGE_TEXT_MAX } from "./schemas-CUSTEFIy.mjs";
|
|
2
|
+
import { t as HttpError } from "./errors-DYF4hhIc.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/client/ids.ts
|
|
5
5
|
const hex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
@@ -130,7 +130,7 @@ var DroppedError = class extends HttpError {
|
|
|
130
130
|
};
|
|
131
131
|
const Patch = z.object({
|
|
132
132
|
text: z.string().max(MESSAGE_TEXT_MAX).optional(),
|
|
133
|
-
labels:
|
|
133
|
+
labels: NewLabels.optional()
|
|
134
134
|
}).strict();
|
|
135
135
|
const MIDDLEWARE_ACTOR = "board:middleware";
|
|
136
136
|
/**
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
//#region src/inspect/page.ts
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Next to the CLI in `dist`, or in `dist` when running from source. A bundler that copies files a
|
|
5
|
+
* module names this way (Next.js's Turbopack) copies the first, which is in the package, and
|
|
6
|
+
* fails on a name it can't find: so the second, which is only in a checkout, is put together at run time.
|
|
7
|
+
*/
|
|
8
|
+
const FILES = [new URL("./inspect/app.js", import.meta.url), new URL([
|
|
9
|
+
"..",
|
|
10
|
+
"..",
|
|
11
|
+
"dist",
|
|
12
|
+
"inspect",
|
|
13
|
+
"app.js"
|
|
14
|
+
].join("/"), import.meta.url)];
|
|
5
15
|
/** The page's script where board is installed, or null when there's none beside it. */
|
|
6
16
|
async function page() {
|
|
7
17
|
for (const file of FILES) {
|