@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.
Files changed (67) hide show
  1. package/dist/{a2-BxfKZFvJ.mjs → a2-CQ3WcqMv.mjs} +6 -6
  2. package/dist/access.mjs +3 -3
  3. package/dist/{actors-rPnEQLZu.mjs → actors-CDDhhFNY.mjs} +2 -2
  4. package/dist/{auth-5nLsx9qB.mjs → auth-BwWH3Twu.mjs} +1 -1
  5. package/dist/{backend-D0GDYiFr.d.mts → backend-DmXjVnil.d.mts} +6 -2
  6. package/dist/backend-a2.d.mts +2 -2
  7. package/dist/backend-a2.mjs +1 -1
  8. package/dist/{backend-http-rfiG-AKP.mjs → backend-http-BJ7AdK0c.mjs} +6 -6
  9. package/dist/{backend-http-Dvq2p__1.d.mts → backend-http-BsP0Xq9e.d.mts} +2 -2
  10. package/dist/{backend-http-tGUo0e8j.mjs → backend-http-Cs-UKpYp.mjs} +2 -2
  11. package/dist/backend-http.d.mts +1 -1
  12. package/dist/backend-http.mjs +1 -1
  13. package/dist/backend-http.node.d.mts +1 -1
  14. package/dist/backend-http.node.mjs +1 -1
  15. package/dist/{backend-vercel-C3zuxmcD.mjs → backend-vercel-B0Q0K0O5.mjs} +3 -3
  16. package/dist/{backend-vercel-01QKDobk.d.mts → backend-vercel-CED673bx.d.mts} +2 -2
  17. package/dist/{backend-vercel-DM5PyMc2.mjs → backend-vercel-CG2SYa03.mjs} +3 -3
  18. package/dist/backend-vercel.d.mts +1 -1
  19. package/dist/backend-vercel.mjs +1 -1
  20. package/dist/backend-vercel.node.d.mts +1 -1
  21. package/dist/backend-vercel.node.mjs +1 -1
  22. package/dist/{chat-provider-D0k3y8zY.d.mts → chat-provider-6eYkL2ef.d.mts} +1 -1
  23. package/dist/cli-embedded.d.mts +55 -4
  24. package/dist/cli-embedded.mjs +38 -18
  25. package/dist/cli.mjs +4 -4
  26. package/dist/{client-ClznIBMg.mjs → client-BY-BCggB.mjs} +13 -7
  27. package/dist/{conformance-DQ9qVzWP.mjs → conformance-BZ53bxrG.mjs} +1 -1
  28. package/dist/conformance.d.mts +1 -1
  29. package/dist/conformance.mjs +1 -1
  30. package/dist/{engine-kHfSOXnQ.mjs → engine-SeaJ_CIY.mjs} +2 -2
  31. package/dist/{errors-CQ-fwxM3.mjs → errors-Bven0k29.mjs} +7 -3
  32. package/dist/{exports-Bw81oDDl.mjs → exports-ByvYtxFT.mjs} +6 -6
  33. package/dist/exports-CPrIkpz3.d.mts +4 -0
  34. package/dist/{index-B_hWanKF.d.mts → index-k2LfZxl-.d.mts} +2 -2
  35. package/dist/index.d.mts +3 -3
  36. package/dist/{index.default-B6oPlvEa.mjs → index.default-DmfhBZZi.mjs} +1 -1
  37. package/dist/index.mjs +6 -6
  38. package/dist/index.node.d.mts +3 -3
  39. package/dist/index.node.mjs +4 -4
  40. package/dist/inspect/app.js +1 -1
  41. package/dist/{main-CzWvRy91.mjs → main-BNkywL2P.mjs} +706 -141
  42. package/dist/{middleware-DUjyQP_a.mjs → middleware-B0J7QBq7.mjs} +1 -1
  43. package/dist/{node-CirFYqw0.mjs → node-C51_xzCb.mjs} +23 -23
  44. package/dist/{provider-D11Dfda0.d.mts → provider-C_sj4-GL.d.mts} +10 -1
  45. package/dist/{serve-DHyA-6FR.mjs → serve-DYQ64Q5R.mjs} +6 -5
  46. package/dist/{server-Cp2oIQOj.mjs → server-BgK1sgj7.mjs} +4 -4
  47. package/dist/{serving-B307gppu.mjs → serving-rXQcEgTO.mjs} +1 -1
  48. package/dist/sync-github.d.mts +2 -2
  49. package/dist/sync-kapso.d.mts +2 -2
  50. package/dist/sync-linear.d.mts +2 -2
  51. package/dist/sync-slack.d.mts +2 -2
  52. package/dist/sync.chat.d.mts +1 -1
  53. package/dist/sync.d.mts +1 -1
  54. package/dist/{tokens-DUXaXwOj.mjs → tokens-U-XRlEfq.mjs} +2 -2
  55. package/dist/{watchers-hash-C_1jGA53.mjs → watchers-hash-C4CJg7K1.mjs} +2 -2
  56. package/docs/01-board/03-identity.md +16 -7
  57. package/docs/01-board/04-messages.md +2 -2
  58. package/docs/01-board/05-reading.md +16 -8
  59. package/docs/01-board/07-schedules.md +2 -2
  60. package/docs/01-board/09-access.md +5 -4
  61. package/docs/03-guides/01-coding-agents.md +4 -2
  62. package/docs/03-guides/03-ci.md +2 -2
  63. package/docs/04-reference/01-cli.md +78 -19
  64. package/docs/04-reference/02-board.md +2 -1
  65. package/docs/04-reference/03-http.md +4 -0
  66. package/package.json +1 -1
  67. 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 JSONL instead: one
145
- object per line, each a message, event, channel, actor, or schedule as the
146
- [HTTP API](./03-http.md#routes) sends it. See [JSON output](#json-output).
147
- - **Writes print the new message's ID** on stdout (the whole message with
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 are one line on stderr**, starting with `error:`.
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 | One line per |
195
+ | Command | Document |
174
196
  | --- | --- |
175
- | `read <channel>`, `read [filters]` | thread: `{ message, replies, last }`, the root, its reply count, and its latest reply or `null` |
176
- | `read <id>`, `read <link>` | message: `{ id, channel, text, re, labels, reactions, by, author, createdAt, … }`, where `re` is the root's ID or `null` for a root |
177
- | `sync <id>` | target: `{ target, key, thread, message, url, undelivered }`, the message's copy there and the platform's link to it |
178
- | `tail`, `wait` | event: `{ cursor, type, createdAt, payload, message, actor }` |
179
- | `post`, `reply` | the new message |
180
-
181
- `read`'s lines carry no header and no cursor, so `jq` reads each as it is:
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 | error, e.g. `error: message not found: #9999` |
194
- | 2 | usage error: an unknown command or flag, a missing argument |
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`, and the HTTP `status`.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/board",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "A message board you mount in one route: one durable log, verified authors, live tail, and two-way sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,4 +0,0 @@
1
- import "./auth-CU56Q2Xh.mjs";
2
- import "./schemas-CWxs3ECJ.mjs";
3
- import "./provider-D11Dfda0.mjs";
4
- import "./backend-D0GDYiFr.mjs";