@vercel/board 0.24.0 → 0.25.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/{a2-BxfKZFvJ.mjs → a2-CQ3WcqMv.mjs} +6 -6
- package/dist/access.mjs +3 -3
- package/dist/{actors-rPnEQLZu.mjs → actors-CDDhhFNY.mjs} +2 -2
- package/dist/{auth-5nLsx9qB.mjs → auth-BwWH3Twu.mjs} +1 -1
- package/dist/{backend-D0GDYiFr.d.mts → backend-DmXjVnil.d.mts} +6 -2
- package/dist/backend-a2.d.mts +2 -2
- package/dist/backend-a2.mjs +1 -1
- package/dist/{backend-http-rfiG-AKP.mjs → backend-http-BJ7AdK0c.mjs} +6 -6
- package/dist/{backend-http-Dvq2p__1.d.mts → backend-http-BsP0Xq9e.d.mts} +2 -2
- package/dist/{backend-http-tGUo0e8j.mjs → backend-http-Cs-UKpYp.mjs} +2 -2
- package/dist/backend-http.d.mts +1 -1
- package/dist/backend-http.mjs +1 -1
- package/dist/backend-http.node.d.mts +1 -1
- package/dist/backend-http.node.mjs +1 -1
- package/dist/{backend-vercel-C3zuxmcD.mjs → backend-vercel-B0Q0K0O5.mjs} +3 -3
- package/dist/{backend-vercel-01QKDobk.d.mts → backend-vercel-CED673bx.d.mts} +2 -2
- package/dist/{backend-vercel-DM5PyMc2.mjs → backend-vercel-CG2SYa03.mjs} +3 -3
- package/dist/backend-vercel.d.mts +1 -1
- package/dist/backend-vercel.mjs +1 -1
- package/dist/backend-vercel.node.d.mts +1 -1
- package/dist/backend-vercel.node.mjs +1 -1
- package/dist/{chat-provider-D0k3y8zY.d.mts → chat-provider-6eYkL2ef.d.mts} +1 -1
- package/dist/cli-embedded.d.mts +55 -4
- package/dist/cli-embedded.mjs +38 -18
- package/dist/cli.mjs +4 -4
- package/dist/{client-ClznIBMg.mjs → client-BY-BCggB.mjs} +13 -7
- package/dist/{conformance-DQ9qVzWP.mjs → conformance-BZ53bxrG.mjs} +1 -1
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-kHfSOXnQ.mjs → engine-SeaJ_CIY.mjs} +2 -2
- package/dist/{errors-CQ-fwxM3.mjs → errors-Bven0k29.mjs} +7 -3
- package/dist/{exports-Bw81oDDl.mjs → exports-ByvYtxFT.mjs} +6 -6
- package/dist/exports-CPrIkpz3.d.mts +4 -0
- package/dist/{index-B_hWanKF.d.mts → index-k2LfZxl-.d.mts} +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/{index.default-B6oPlvEa.mjs → index.default-DmfhBZZi.mjs} +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.node.d.mts +3 -3
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +1 -1
- package/dist/{main-CzWvRy91.mjs → main-BNkywL2P.mjs} +706 -141
- package/dist/{middleware-DUjyQP_a.mjs → middleware-B0J7QBq7.mjs} +1 -1
- package/dist/{node-CirFYqw0.mjs → node-C51_xzCb.mjs} +23 -23
- package/dist/{provider-D11Dfda0.d.mts → provider-C_sj4-GL.d.mts} +10 -1
- package/dist/{serve-DHyA-6FR.mjs → serve-DYQ64Q5R.mjs} +6 -5
- package/dist/{server-Cp2oIQOj.mjs → server-BgK1sgj7.mjs} +4 -4
- package/dist/{serving-B307gppu.mjs → serving-rXQcEgTO.mjs} +1 -1
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-kapso.d.mts +2 -2
- package/dist/sync-linear.d.mts +2 -2
- package/dist/sync-slack.d.mts +2 -2
- package/dist/sync.chat.d.mts +1 -1
- package/dist/sync.d.mts +1 -1
- package/dist/{tokens-DUXaXwOj.mjs → tokens-U-XRlEfq.mjs} +2 -2
- package/dist/{watchers-hash-C_1jGA53.mjs → watchers-hash-C4CJg7K1.mjs} +2 -2
- package/docs/01-board/03-identity.md +16 -7
- package/docs/01-board/04-messages.md +2 -2
- package/docs/01-board/05-reading.md +16 -8
- package/docs/01-board/07-schedules.md +2 -2
- package/docs/01-board/09-access.md +5 -4
- package/docs/03-guides/01-coding-agents.md +4 -2
- package/docs/03-guides/03-ci.md +2 -2
- package/docs/04-reference/01-cli.md +78 -19
- package/docs/04-reference/02-board.md +2 -1
- package/docs/04-reference/03-http.md +4 -0
- package/package.json +1 -1
- package/dist/exports-87_yESpp.d.mts +0 -4
|
@@ -35,7 +35,25 @@ import { createApp } from '@vercel/board/cli'
|
|
|
35
35
|
const code = await createApp({ appName: 'vercel board' }).run(process.argv.slice(3))
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
`run` answers the exit code, and never exits the process itself.
|
|
38
|
+
`run` answers the exit code, and never exits the process itself. A failure is
|
|
39
|
+
data too, for the CLI that runs board to show as it shows its own:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createApp, failureLines } from '@vercel/board/cli'
|
|
43
|
+
|
|
44
|
+
const code = await createApp({
|
|
45
|
+
appName: 'vercel board',
|
|
46
|
+
// { class, reason, message, details, next: [{ instruction, argv }], data, … }
|
|
47
|
+
onError: (failure, { json }) => console.error(json ? JSON.stringify(failure) : failureLines(failure).join('\n')),
|
|
48
|
+
// { reason, message }: a write that went through, with something to say. With --json, it's in the result.
|
|
49
|
+
onWarning: (warning) => console.error(warning.message),
|
|
50
|
+
}).run(process.argv.slice(3))
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`class` fixes the exit code: `usage` and `missing_input` answer 2,
|
|
54
|
+
`timeout` 124, `canceled` 130, and the rest 1. Without `onError`, board
|
|
55
|
+
prints its own on stderr: `error: ` and the lines, or with `--json`, its
|
|
56
|
+
[JSON document](#errors).
|
|
39
57
|
|
|
40
58
|
The commands are data too, in `@vercel/board/cli/commands`, which imports
|
|
41
59
|
nothing: each command's name, description, arguments, options, examples, and
|
|
@@ -141,10 +159,11 @@ hyphens. Avatars are `https` URLs (`http` only on localhost).
|
|
|
141
159
|
- **What's written can't drive your terminal.** A message's control
|
|
142
160
|
characters, ESC among them, print as their pictures (`␛`), and `--json`
|
|
143
161
|
prints them as the board has them.
|
|
144
|
-
- **On a terminal, output is for people.** `--json` prints
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
162
|
+
- **On a terminal, output is for people.** `--json` prints one JSON document
|
|
163
|
+
instead, with what's in it as the [HTTP API](./03-http.md#routes) sends it,
|
|
164
|
+
indented at a terminal. `tail` prints one object per line, as they come. See
|
|
165
|
+
[JSON output](#json-output).
|
|
166
|
+
- **Writes print the new message's ID** on stdout (`{ message, outcome }` with
|
|
148
167
|
`--json`), so a script can chain them: `id=$(vb post ops "…")`. A number
|
|
149
168
|
prints as it is (`812`); any other ID prints with its `#` (`#msg_…`), since
|
|
150
169
|
it could also be a channel's name.
|
|
@@ -152,10 +171,13 @@ hyphens. Avatars are `https` URLs (`http` only on localhost).
|
|
|
152
171
|
it as `'#812'`, since in a shell an unquoted `#` starts a comment.
|
|
153
172
|
- **Text can come from stdin.** Pass `-` as the text. It may be left out when
|
|
154
173
|
the message has `--attach` files.
|
|
155
|
-
- **Errors
|
|
174
|
+
- **Errors go to stderr**: `error:` and what failed, then how to fix it, the
|
|
175
|
+
command to run indented under it. With `--json`, one JSON document instead.
|
|
176
|
+
See [Errors](#errors).
|
|
156
177
|
- **A mention that matches no one** stays plain text, and the write warns on
|
|
157
178
|
stderr:
|
|
158
|
-
`warning: @bob matches no one on the board, so it stays plain text and notifies no one
|
|
179
|
+
`warning: @bob matches no one on the board, so it stays plain text and notifies no one.`
|
|
180
|
+
With `--json`, the warning is in the result's `warnings`.
|
|
159
181
|
|
|
160
182
|
```text
|
|
161
183
|
$ vb read 812
|
|
@@ -170,29 +192,66 @@ $ vb read 812
|
|
|
170
192
|
|
|
171
193
|
### JSON output
|
|
172
194
|
|
|
173
|
-
| Command |
|
|
195
|
+
| Command | Document |
|
|
174
196
|
| --- | --- |
|
|
175
|
-
| `read <channel>`, `read [filters]` | thread
|
|
176
|
-
| `read <id>`, `read <link>` | message
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
| `post`, `reply` |
|
|
180
|
-
|
|
181
|
-
`
|
|
197
|
+
| `read <channel>`, `read [filters]` | `{ threads, cursor }`: each thread `{ message, replies, last }`, its root, its reply count, and its latest reply or `null`. `cursor` is where `tail` and `wait` read on from |
|
|
198
|
+
| `read <id>`, `read <link>` | `{ message, replies, cursor, schedules }`: the root and its replies, each `{ id, channel, text, re, labels, reactions, by, author, createdAt, … }` |
|
|
199
|
+
| `channels`, `actors`, `schedules`, `inbox`, `sources` | `{ channels }`, `{ actors }`, `{ schedules }`, `{ events }`, `{ sources }` |
|
|
200
|
+
| `sync <id>` | `{ targets }`: each `{ target, key, thread, message, url, undelivered }`, the message's copy there and the platform's link to it |
|
|
201
|
+
| `post`, `reply` | `{ message, outcome: "posted" }` |
|
|
202
|
+
| `edit`, `delete`, `react`, `label` | `{ message: { id }, outcome }`, `outcome` being `edited`, `deleted`, `reacted` or `unreacted`, or `labeled` |
|
|
203
|
+
| `schedule` | `{ schedule, outcome: "scheduled" }`; `schedule cancel`'s outcome is `canceled`, or `unchanged` when it already wasn't pending |
|
|
204
|
+
| `wait` | `{ event }`: `{ cursor, type, createdAt, payload, message, actor }` |
|
|
205
|
+
| `tail` | one event per line, as they come |
|
|
206
|
+
| `whoami` | `{ actor, name, handle, profile, session, expiresAt, can, board, source }` |
|
|
207
|
+
|
|
208
|
+
A write's warnings are in its document, as
|
|
209
|
+
`"warnings": [{ "reason": "unknown_mention", "message": "…" }]`.
|
|
182
210
|
|
|
183
211
|
```bash
|
|
184
|
-
vb read prs --label state=open --json | jq -r '"#\(.message.id) \(.replies) \(.message.text)"'
|
|
185
|
-
vb read 1204 --json | jq -r '.text' # every message in one thread
|
|
212
|
+
vb read prs --label state=open --json | jq -r '.threads[] | "#\(.message.id) \(.replies) \(.message.text)"'
|
|
213
|
+
vb read 1204 --json | jq -r '.message.text, .replies[].text' # every message in one thread
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Errors
|
|
217
|
+
|
|
218
|
+
An error says what failed and why, then each way out, likeliest first:
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
$ vb raed dev
|
|
222
|
+
error: Unknown command raed for vb. Did you mean read?
|
|
223
|
+
|
|
224
|
+
See all commands:
|
|
225
|
+
vb --help
|
|
186
226
|
```
|
|
187
227
|
|
|
228
|
+
With `--json`, stdout stays empty and stderr gets one line, the Vercel CLI's
|
|
229
|
+
error document:
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
{"status":"error","reason":"unknown_command","message":"Unknown command raed for vb. Did you mean read?","next":[{"command":"vb --help","argv":["vb","--help"],"when":"See all commands"}]}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
- **`reason` is what a program branches on:** `missing_scope`,
|
|
236
|
+
`login_required`, `permission_denied`, `deployment_protected`,
|
|
237
|
+
`board_not_found`, `message_not_found`, `channel_not_found`,
|
|
238
|
+
`unknown_command`, `unknown_option`, `invalid_arguments`, `timeout`, and
|
|
239
|
+
the board's own codes, such as `already_synced` or `no_scheduler`.
|
|
240
|
+
- **`next` is what to run**, each `{ command, argv, when }`, and `hint` what
|
|
241
|
+
to do when it isn't a command. `status` is `action_required` when the
|
|
242
|
+
command lacked something before it did anything: a team, say.
|
|
243
|
+
- **`data.error` is the board's own error**, `{ code, message, status }`, when
|
|
244
|
+
it answered with one.
|
|
245
|
+
|
|
188
246
|
## Exit codes
|
|
189
247
|
|
|
190
248
|
| Code | Meaning |
|
|
191
249
|
| --- | --- |
|
|
192
250
|
| 0 | success |
|
|
193
|
-
| 1 |
|
|
194
|
-
| 2 |
|
|
251
|
+
| 1 | it failed: `error: Couldn't find message #9999.` |
|
|
252
|
+
| 2 | misuse: an unknown command or option, a missing or malformed argument, or no board to use |
|
|
195
253
|
| 124 | `wait` timed out (the GNU `timeout` convention), or `identity link` saw no link in time |
|
|
254
|
+
| 130 | Ctrl-C stopped `tail` or `wait` |
|
|
196
255
|
|
|
197
256
|
## Setup
|
|
198
257
|
|
|
@@ -516,7 +516,8 @@ which only the handle reaches. A handle on `http()` finds the board it uses in
|
|
|
516
516
|
## Errors
|
|
517
517
|
|
|
518
518
|
A failed request throws a `BoardError` with the board's `code`, its
|
|
519
|
-
`message`,
|
|
519
|
+
`message`, the HTTP `status`, and, when the handle or the board knows what
|
|
520
|
+
fixes it, a `hint` (`Run vercel login.`).
|
|
520
521
|
|
|
521
522
|
```ts
|
|
522
523
|
// anywhere in Node:
|
|
@@ -436,6 +436,10 @@ Every failure is JSON with a matching status:
|
|
|
436
436
|
{ "error": { "code": "message_not_found", "message": "message not found: #9999" } }
|
|
437
437
|
```
|
|
438
438
|
|
|
439
|
+
When the board knows what fixes it, the error carries a `hint` too, as a board
|
|
440
|
+
on `http()` does when its own handle can't reach the board it uses:
|
|
441
|
+
`"hint": "Set VERCEL_AUTOMATION_BYPASS_SECRET (Project → Settings → …)."`.
|
|
442
|
+
|
|
439
443
|
| Status | Code | When |
|
|
440
444
|
| --- | --- | --- |
|
|
441
445
|
| 400 | `invalid_request` | the body or query doesn't validate; the message names the field |
|
package/package.json
CHANGED