@vercel/board 0.33.0 → 0.35.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 (59) hide show
  1. package/dist/{access-N3XmkKXg.mjs → access-BsP0hvcC.mjs} +169 -12
  2. package/dist/access.d.mts +3 -3
  3. package/dist/access.mjs +5 -5
  4. package/dist/{actors-ihyN47OV.mjs → actors-DFOpTw89.mjs} +2 -2
  5. package/dist/{auth-D6z3rMNj.d.mts → auth-C21V0EK1.d.mts} +128 -9
  6. package/dist/auth-CrjXLgOb.mjs +599 -0
  7. package/dist/{backend-CWpyR1A7.d.mts → backend-D21q8mdm.d.mts} +30 -7
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-DJpFUaFv.d.mts → chat-provider-DmZCmBkb.d.mts} +2 -2
  11. package/dist/cli-commands.d.mts +1 -1
  12. package/dist/cli-commands.mjs +1 -1
  13. package/dist/cli-embedded.d.mts +2 -2
  14. package/dist/cli-embedded.mjs +1 -1
  15. package/dist/cli.mjs +5 -5
  16. package/dist/{commands-BOBQHVqM.d.mts → commands-BorACIFS.d.mts} +168 -1
  17. package/dist/{commands-CHoMl06v.mjs → commands-CENWob9m.mjs} +281 -11
  18. package/dist/{conformance-qKmGLTAT.mjs → conformance-CKrwglzA.mjs} +491 -105
  19. package/dist/conformance.d.mts +20 -2
  20. package/dist/conformance.mjs +1 -1
  21. package/dist/{engine-JxgZiikU.mjs → engine-wN7quvbU.mjs} +2 -2
  22. package/dist/{errors-Pk0XV1hK.mjs → errors-rYDxZEuN.mjs} +116 -7
  23. package/dist/exports-BxljH73E.d.mts +4 -0
  24. package/dist/{exports-gHDHlg0i.mjs → exports-GIRJm2Ja.mjs} +136 -26
  25. package/dist/{index-CXvvYNYj.d.mts → index-LREsSZb2.d.mts} +2 -2
  26. package/dist/index.d.mts +6 -6
  27. package/dist/index.mjs +4 -4
  28. package/dist/index.node.d.mts +6 -6
  29. package/dist/index.node.mjs +3 -3
  30. package/dist/inspect/app.js +32 -32
  31. package/dist/{local-BbLjA5vI.mjs → local-yKwdgukb.mjs} +1981 -1574
  32. package/dist/{main-CQpCZJFw.mjs → main-DjokcEAL.mjs} +440 -50
  33. package/dist/{middleware-BU7rVi9F.mjs → middleware-BxgizazV.mjs} +1 -1
  34. package/dist/provider-DEOfc4Ls.d.mts +1049 -0
  35. package/dist/{provider-BlzUvcM9.d.mts → routes-BpKdMvgX.d.mts} +2461 -2480
  36. package/dist/{serve-D8_W4UN6.mjs → serve-CJ8hauK2.mjs} +4 -4
  37. package/dist/{server-BiIUXWbU.mjs → server-CtaTtyhw.mjs} +7 -7
  38. package/dist/{serving-D7rcUtSC.mjs → serving-6_bhBNAW.mjs} +1 -1
  39. package/dist/sync-chat-sdk.d.mts +2 -2
  40. package/dist/sync-github.d.mts +2 -2
  41. package/dist/sync-linear.d.mts +3 -2
  42. package/dist/sync-slack.d.mts +3 -3
  43. package/dist/sync.d.mts +2 -2
  44. package/dist/{targets-CknPGGVi.mjs → targets-n2i2ZOWI.mjs} +104 -12
  45. package/dist/{tokens-DPKjl3jf.mjs → tokens-Dn4cPZIr.mjs} +2 -2
  46. package/docs/01-board/01-mounting.md +12 -5
  47. package/docs/01-board/03-identity.md +14 -13
  48. package/docs/01-board/07-schedules.md +1 -1
  49. package/docs/01-board/09-access.md +170 -58
  50. package/docs/03-guides/03-ci.md +19 -17
  51. package/docs/03-guides/05-agent-factory.md +5 -6
  52. package/docs/04-reference/01-cli.md +99 -22
  53. package/docs/04-reference/02-board.md +42 -11
  54. package/docs/04-reference/03-http.md +21 -14
  55. package/docs/04-reference/05-conformance.md +31 -5
  56. package/package.json +1 -1
  57. package/dist/auth-r-_PeZyw.mjs +0 -277
  58. package/dist/exports-BuKjVq2t.d.mts +0 -4
  59. package/dist/folds-DjFTiqIM.d.mts +0 -552
@@ -1,6 +1,6 @@
1
- import { d as Attachment, f as Author, m as Access, o as ExternalEvent, p as Labels, t as Actor } from "./folds-DjFTiqIM.mjs";
2
- import { d as Pinned, l as Known, m as StoredGrant, o as Granted, t as Authenticate } from "./auth-D6z3rMNj.mjs";
3
- import { $ as EditBody, $t as SyncImportBody, At as RegisterBody, Ft as ScheduleBody, G as AckBody, Gt as SourceRead, Ht as SourceJoin, J as BoardEventView, Jt as SyncCopiesQuery, Kt as SourceReadQuery, L as ProfileOption, M as BoardClient, Mt as RegistrationView, Ot as ReactBody, P as ErrorOrigin, Q as Discovery, Qt as SyncFindView, Rt as ScheduleView, St as MessagesQuery, Tt as PostBody, Ut as SourceJoinBody, X as CreateChannelBody, Y as ChannelView, Yt as SyncCopiesView, Z as DeleteBody, Zt as SyncFindQuery, _t as MatchView, bt as MessageView, cn as ThreadsQuery, ct as InboxEntry, dt as InboxPushBody, et as EventsPage, fn as TokenView, ft as InboxQuery, gn as UploadTicket, gt as LinkedQuery, hn as UploadStartBody, in as SyncedView, it as GrantBody, lt as InboxItem, mt as LabelBody, on as ThreadView, ot as GrantView, p as SyncProvider, pn as TypingBody, rn as SyncThreadView, sn as ThreadsPage, st as InboxAckBody, tn as SyncReceiptBody, tt as EventsQuery, un as TokenBody, ut as InboxNextQuery, vt as MatchesQuery, xt as MessagesPage, yt as Me, zt as SchedulesQuery } from "./provider-BlzUvcM9.mjs";
1
+ import { A as LinkedQuery, C as InboxItem, Ct as ThreadsPage, E as InboxQuery, Et as TokenBody, F as MessagesPage, I as MessagesQuery, It as Access, J as RegistrationView, K as RegisterBody, Kt as Level, M as MatchesQuery, N as Me, Nt as UploadStartBody, O as LabelBody, Ot as TokenView, P as MessageView, Pt as UploadTicket, Qt as Actor, S as InboxEntry, St as ThreadView, T as InboxPushBody, W as ReactBody, Z as ScheduleBody, _ as GrantBody, _t as SyncReceiptBody, at as SourceJoinBody, b as GrantView, bt as SyncedView, c as DeleteBody, ct as SourceReadQuery, d as EventsPage, dt as SyncCopiesView, en as Attachment, et as ScheduleView, f as EventsQuery, h as Explanation, ht as SyncImportBody, i as BoardEventView, in as ExternalEvent, it as SourceJoin, j as MatchView, jt as UpdateGrantBody, kt as TypingBody, l as Discovery, m as ExplainQuery, mt as SyncFindView, nn as Labels, o as ChannelView, pt as SyncFindQuery, qt as Permission, s as CreateChannelBody, st as SourceRead, t as AckBody, tn as Author, tt as SchedulesQuery, u as EditBody, ut as SyncCopiesQuery, w as InboxNextQuery, wt as ThreadsQuery, x as InboxAckBody, yt as SyncThreadView, z as PostBody } from "./routes-BpKdMvgX.mjs";
2
+ import { d as Pinned, l as Known, m as StoredGrant, o as Granted, t as Authenticate } from "./auth-C21V0EK1.mjs";
3
+ import { L as ProfileOption, M as BoardClient, P as ErrorOrigin, p as SyncProvider } from "./provider-DEOfc4Ls.mjs";
4
4
  import { z } from "zod";
5
5
  //#region src/api/protocol.d.ts
6
6
  type Input<S extends z.ZodType> = NonNullable<z.output<S>>;
@@ -118,21 +118,32 @@ type Protocol = {
118
118
  canceled: boolean;
119
119
  };
120
120
  };
121
- /** The board's grants: needs `manage` in every channel. 501 `no_grants` where the board keeps none. */
121
+ /** The board's grants: needs `manage` at `*`, or a team owner. 501 `no_grants` where the board keeps none. */
122
122
  grants: {
123
123
  input: Nothing;
124
124
  output: {
125
125
  grants: GrantView[];
126
126
  };
127
127
  };
128
- /** Sets a grant, or the `can` of the one with its issuer and claims: `created` is false for that. */
128
+ /** A new grant, always: the same principals again are another. Needs `manage` at each pattern its `can` names. */
129
129
  createGrant: {
130
130
  input: Input<typeof GrantBody>;
131
131
  output: {
132
132
  grant: GrantView;
133
- created: boolean;
134
133
  };
135
134
  };
135
+ /** Adds and removes principals, or replaces its `can`: needs what `checkGrantChange` says, for the grant as it was and as it'd be. 404 `grant_not_found`. */
136
+ updateGrant: {
137
+ input: Id & Input<typeof UpdateGrantBody>;
138
+ output: {
139
+ grant: GrantView;
140
+ };
141
+ };
142
+ /** Which grant decides `channel` for the caller, or with `manage` at `*` (or a team owner), the principal it names. */
143
+ explain: {
144
+ input: Input<typeof ExplainQuery>;
145
+ output: Explanation;
146
+ };
136
147
  /** `revoked` is false when it was already gone. */
137
148
  revokeGrant: {
138
149
  input: Id;
@@ -404,6 +415,14 @@ declare class DroppedError extends HttpError {
404
415
  }
405
416
  //#endregion
406
417
  //#region src/server/policy.d.ts
418
+ /** What decides a channel for a principal: the winning pattern and level, the grants there or the rule, and what they give. */
419
+ type Decided = {
420
+ pattern: string | null;
421
+ over: string[];
422
+ level: Level | null;
423
+ grants: StoredGrant[];
424
+ permissions: Permission[];
425
+ };
407
426
  /** Who may use a board, and what they may do: `board()`'s options for it. */
408
427
  type PolicyOptions = {
409
428
  /**
@@ -693,8 +712,12 @@ type BoardBinding = {
693
712
  /**
694
713
  * What a principal the backend stored may do now, under board()'s defaults and the board's grants:
695
714
  * a schedule's creator at each send, a registrant at each event and pull. Null once it may do nothing.
715
+ * With `grants`, under those instead of the board's grants as they are: a grant write's own
716
+ * snapshot, so what it checks is what it appends to.
696
717
  */
697
- accessNow(principal: Known): Promise<Access | null>;
718
+ accessNow(principal: Known, grants?: readonly StoredGrant[]): Promise<Access | null>;
719
+ /** Which grants, or which rule, decide `channel` for a principal under board()'s `access`, and what they give: what `explain` answers. */
720
+ explain(principal: Known, channel: string): Promise<Decided>;
698
721
  /** The board's own Vercel project and team, as board() knows them: what discovery names, for clients to mint tokens with. */
699
722
  project(): Promise<{
700
723
  id: string | null;
@@ -1,4 +1,4 @@
1
- import { t as Backend } from "./backend-CWpyR1A7.mjs";
1
+ import { t as Backend } from "./backend-D21q8mdm.mjs";
2
2
  //#region src/server/local.d.ts
3
3
  type LocalOptions = {
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { t as local } from "./local-BbLjA5vI.mjs";
1
+ import { t as local } from "./local-yKwdgukb.mjs";
2
2
  export { local };
@@ -1,5 +1,5 @@
1
- import { a as ExternalAuthor, c as ExternalLink, s as ExternalFile, t as Actor } from "./folds-DjFTiqIM.mjs";
2
- import { Gt as SourceRead, Ht as SourceJoin, T as ProviderEvent, a as ProviderOptions, c as ReceivedEvent, d as ResolvedTarget, g as SyncFn, i as ProviderFile, k as SyncRoot, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, t as FetchedLink } from "./provider-BlzUvcM9.mjs";
1
+ import { Qt as Actor, an as ExternalFile, it as SourceJoin, on as ExternalLink, rn as ExternalAuthor, st as SourceRead } from "./routes-BpKdMvgX.mjs";
2
+ import { T as ProviderEvent, a as ProviderOptions, c as ReceivedEvent, d as ResolvedTarget, g as SyncFn, i as ProviderFile, k as SyncRoot, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, t as FetchedLink } from "./provider-DEOfc4Ls.mjs";
3
3
  import { Adapter, Author, FileUpload, Message, ReactionEvent, StateAdapter } from "chat";
4
4
  //#region src/sync/chat-provider.d.ts
5
5
  type ChatInput = {
@@ -1,2 +1,2 @@
1
- import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-BOBQHVqM.mjs";
1
+ import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-BorACIFS.mjs";
2
2
  export { CliArgument, CliCommand, CliExample, CliOption, OptionName, commands, filters, globalOptions, groups, option, options, usage };
@@ -1,2 +1,2 @@
1
- import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-CHoMl06v.mjs";
1
+ import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-CENWob9m.mjs";
2
2
  export { commands, filters, globalOptions, groups, option, options, usage };
@@ -1,5 +1,5 @@
1
- import { d as Board } from "./backend-CWpyR1A7.mjs";
2
- import "./index-CXvvYNYj.mjs";
1
+ import { d as Board } from "./backend-D21q8mdm.mjs";
2
+ import "./index-LREsSZb2.mjs";
3
3
  //#region src/cli/failure.d.ts
4
4
  /**
5
5
  * What kind of failure it is, which fixes the exit code: 2 for `usage` and `missing_input`, 130
@@ -1,4 +1,4 @@
1
- import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-CQpCZJFw.mjs";
1
+ import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-DjokcEAL.mjs";
2
2
  //#region src/cli/embedded.ts
3
3
  /**
4
4
  * Board's CLI as `appName` names it in help, usage, and errors (`vercel board`). With no board
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { p as ATTACHMENT_BYTES_MAX } from "./errors-Pk0XV1hK.mjs";
2
+ import { p as ATTACHMENT_BYTES_MAX } from "./errors-rYDxZEuN.mjs";
3
3
  import "./schemas-BG205xds.mjs";
4
- import { a as option } from "./commands-CHoMl06v.mjs";
5
- import { d as projectDir } from "./server-BiIUXWbU.mjs";
6
- import { r as main, u as who } from "./main-CQpCZJFw.mjs";
4
+ import { a as option } from "./commands-CENWob9m.mjs";
5
+ import { d as projectDir } from "./server-CtaTtyhw.mjs";
6
+ import { r as main, u as who } from "./main-DjokcEAL.mjs";
7
7
  import { randomBytes, timingSafeEqual } from "node:crypto";
8
8
  import { appendFile, readFile } from "node:fs/promises";
9
9
  import { join } from "node:path";
@@ -661,7 +661,7 @@ const local = {
661
661
  if (args.length > 0) throw usage("serve takes no arguments: pass its port with --port, and its directory with --dir.");
662
662
  const port = portFlag();
663
663
  const root = projectDir();
664
- const { localHandle, serveLocal } = await import("./serve-D8_W4UN6.mjs");
664
+ const { localHandle, serveLocal } = await import("./serve-CJ8hauK2.mjs");
665
665
  const handle = flags.handle ?? process.env.BOARD_HANDLE;
666
666
  const local = await serveLocal({
667
667
  dir: flags.dir ?? join(root, ".board"),
@@ -255,14 +255,181 @@ declare const options: {
255
255
  };
256
256
  readonly can: {
257
257
  readonly type: 'string';
258
+ readonly multiple: true;
258
259
  readonly value: 'scope';
259
260
  readonly description: 'what it may do (default: *=read,post,react,label)';
260
261
  };
262
+ readonly user: {
263
+ readonly type: 'string';
264
+ readonly multiple: true;
265
+ readonly value: 'email';
266
+ readonly description: 'a person on the team';
267
+ };
268
+ readonly project: {
269
+ readonly type: 'string';
270
+ readonly multiple: true;
271
+ readonly value: 'name|id';
272
+ readonly description: "a project's deployments";
273
+ };
274
+ readonly github: {
275
+ readonly type: 'string';
276
+ readonly multiple: true;
277
+ readonly value: 'owner/repo';
278
+ readonly description: "GitHub Actions' runs in a repository";
279
+ };
280
+ readonly oidc: {
281
+ readonly type: 'string';
282
+ readonly multiple: true;
283
+ readonly value: 'issuer';
284
+ readonly description: "an issuer's tokens, by its URL";
285
+ };
286
+ readonly 'all-users': {
287
+ readonly type: 'boolean';
288
+ readonly description: 'every person on the team';
289
+ };
290
+ readonly 'all-projects': {
291
+ readonly type: 'boolean';
292
+ readonly description: "every project's deployments on the team";
293
+ };
294
+ readonly app: {
295
+ readonly type: 'string';
296
+ readonly multiple: true;
297
+ readonly value: 'slug|id';
298
+ readonly description: 'an app installed on the team';
299
+ };
300
+ readonly 'all-apps': {
301
+ readonly type: 'boolean';
302
+ readonly description: 'every app installed on the team';
303
+ };
304
+ readonly everyone: {
305
+ readonly type: 'boolean';
306
+ readonly description: 'everyone let in some other way, and no one new';
307
+ };
308
+ readonly environment: {
309
+ readonly type: 'string';
310
+ readonly multiple: true;
311
+ readonly value: 'envs';
312
+ readonly description: 'where its --project runs';
313
+ };
314
+ readonly workflow: {
315
+ readonly type: 'string';
316
+ readonly multiple: true;
317
+ readonly value: 'file';
318
+ readonly description: "its --github's workflow, e.g. ci.yml";
319
+ };
320
+ readonly branch: {
321
+ readonly type: 'string';
322
+ readonly multiple: true;
323
+ readonly value: 'branch';
324
+ readonly description: "its --github's branch";
325
+ };
326
+ readonly event: {
327
+ readonly type: 'string';
328
+ readonly multiple: true;
329
+ readonly value: 'event';
330
+ readonly description: "its --github's event, e.g. push";
331
+ };
261
332
  readonly claim: {
262
333
  readonly type: 'string';
263
334
  readonly multiple: true;
264
335
  readonly value: 'k=v';
265
- readonly description: 'a claim its tokens carry; the same name again is any of them';
336
+ readonly description: "a claim its --oidc's tokens carry";
337
+ };
338
+ readonly 'add-user': {
339
+ readonly type: 'string';
340
+ readonly multiple: true;
341
+ readonly value: 'email';
342
+ readonly description: 'add a person';
343
+ };
344
+ readonly 'add-project': {
345
+ readonly type: 'string';
346
+ readonly multiple: true;
347
+ readonly value: 'name|id';
348
+ readonly description: "add a project's deployments";
349
+ };
350
+ readonly 'add-github': {
351
+ readonly type: 'string';
352
+ readonly multiple: true;
353
+ readonly value: 'owner/repo';
354
+ readonly description: "add a repository's runs";
355
+ };
356
+ readonly 'add-oidc': {
357
+ readonly type: 'string';
358
+ readonly multiple: true;
359
+ readonly value: 'issuer';
360
+ readonly description: "add an issuer's tokens";
361
+ };
362
+ readonly 'add-all-users': {
363
+ readonly type: 'boolean';
364
+ readonly description: 'add every person on the team';
365
+ };
366
+ readonly 'add-all-projects': {
367
+ readonly type: 'boolean';
368
+ readonly description: 'add every project on the team';
369
+ };
370
+ readonly 'add-app': {
371
+ readonly type: 'string';
372
+ readonly multiple: true;
373
+ readonly value: 'slug|id';
374
+ readonly description: 'add an app';
375
+ };
376
+ readonly 'add-all-apps': {
377
+ readonly type: 'boolean';
378
+ readonly description: 'add every app on the team';
379
+ };
380
+ readonly 'add-everyone': {
381
+ readonly type: 'boolean';
382
+ readonly description: 'add everyone something else lets in';
383
+ };
384
+ readonly 'remove-user': {
385
+ readonly type: 'string';
386
+ readonly multiple: true;
387
+ readonly value: 'email';
388
+ readonly description: 'remove a person';
389
+ };
390
+ readonly 'remove-project': {
391
+ readonly type: 'string';
392
+ readonly multiple: true;
393
+ readonly value: 'name|id';
394
+ readonly description: 'remove a project, whatever its environments';
395
+ };
396
+ readonly 'remove-github': {
397
+ readonly type: 'string';
398
+ readonly multiple: true;
399
+ readonly value: 'owner/repo';
400
+ readonly description: "remove a repository's runs";
401
+ };
402
+ readonly 'remove-oidc': {
403
+ readonly type: 'string';
404
+ readonly multiple: true;
405
+ readonly value: 'issuer';
406
+ readonly description: "remove an issuer's tokens";
407
+ };
408
+ readonly 'remove-all-users': {
409
+ readonly type: 'boolean';
410
+ readonly description: 'remove every person on the team';
411
+ };
412
+ readonly 'remove-all-projects': {
413
+ readonly type: 'boolean';
414
+ readonly description: 'remove every project on the team';
415
+ };
416
+ readonly 'remove-app': {
417
+ readonly type: 'string';
418
+ readonly multiple: true;
419
+ readonly value: 'slug|id';
420
+ readonly description: 'remove an app';
421
+ };
422
+ readonly 'remove-all-apps': {
423
+ readonly type: 'boolean';
424
+ readonly description: 'remove every app on the team';
425
+ };
426
+ readonly 'remove-everyone': {
427
+ readonly type: 'boolean';
428
+ readonly description: 'remove everyone';
429
+ };
430
+ readonly private: {
431
+ readonly type: 'boolean';
432
+ readonly description: 'closed to everyone but you, in the same write';
266
433
  };
267
434
  readonly profile: {
268
435
  readonly type: 'string';
@@ -207,14 +207,181 @@ const options = {
207
207
  },
208
208
  can: {
209
209
  type: "string",
210
+ multiple: true,
210
211
  value: "scope",
211
212
  description: "what it may do (default: *=read,post,react,label)"
212
213
  },
214
+ user: {
215
+ type: "string",
216
+ multiple: true,
217
+ value: "email",
218
+ description: "a person on the team"
219
+ },
220
+ project: {
221
+ type: "string",
222
+ multiple: true,
223
+ value: "name|id",
224
+ description: "a project's deployments"
225
+ },
226
+ github: {
227
+ type: "string",
228
+ multiple: true,
229
+ value: "owner/repo",
230
+ description: "GitHub Actions' runs in a repository"
231
+ },
232
+ oidc: {
233
+ type: "string",
234
+ multiple: true,
235
+ value: "issuer",
236
+ description: "an issuer's tokens, by its URL"
237
+ },
238
+ "all-users": {
239
+ type: "boolean",
240
+ description: "every person on the team"
241
+ },
242
+ "all-projects": {
243
+ type: "boolean",
244
+ description: "every project's deployments on the team"
245
+ },
246
+ app: {
247
+ type: "string",
248
+ multiple: true,
249
+ value: "slug|id",
250
+ description: "an app installed on the team"
251
+ },
252
+ "all-apps": {
253
+ type: "boolean",
254
+ description: "every app installed on the team"
255
+ },
256
+ everyone: {
257
+ type: "boolean",
258
+ description: "everyone let in some other way, and no one new"
259
+ },
260
+ environment: {
261
+ type: "string",
262
+ multiple: true,
263
+ value: "envs",
264
+ description: "where its --project runs"
265
+ },
266
+ workflow: {
267
+ type: "string",
268
+ multiple: true,
269
+ value: "file",
270
+ description: "its --github's workflow, e.g. ci.yml"
271
+ },
272
+ branch: {
273
+ type: "string",
274
+ multiple: true,
275
+ value: "branch",
276
+ description: "its --github's branch"
277
+ },
278
+ event: {
279
+ type: "string",
280
+ multiple: true,
281
+ value: "event",
282
+ description: "its --github's event, e.g. push"
283
+ },
213
284
  claim: {
214
285
  type: "string",
215
286
  multiple: true,
216
287
  value: "k=v",
217
- description: "a claim its tokens carry; the same name again is any of them"
288
+ description: "a claim its --oidc's tokens carry"
289
+ },
290
+ "add-user": {
291
+ type: "string",
292
+ multiple: true,
293
+ value: "email",
294
+ description: "add a person"
295
+ },
296
+ "add-project": {
297
+ type: "string",
298
+ multiple: true,
299
+ value: "name|id",
300
+ description: "add a project's deployments"
301
+ },
302
+ "add-github": {
303
+ type: "string",
304
+ multiple: true,
305
+ value: "owner/repo",
306
+ description: "add a repository's runs"
307
+ },
308
+ "add-oidc": {
309
+ type: "string",
310
+ multiple: true,
311
+ value: "issuer",
312
+ description: "add an issuer's tokens"
313
+ },
314
+ "add-all-users": {
315
+ type: "boolean",
316
+ description: "add every person on the team"
317
+ },
318
+ "add-all-projects": {
319
+ type: "boolean",
320
+ description: "add every project on the team"
321
+ },
322
+ "add-app": {
323
+ type: "string",
324
+ multiple: true,
325
+ value: "slug|id",
326
+ description: "add an app"
327
+ },
328
+ "add-all-apps": {
329
+ type: "boolean",
330
+ description: "add every app on the team"
331
+ },
332
+ "add-everyone": {
333
+ type: "boolean",
334
+ description: "add everyone something else lets in"
335
+ },
336
+ "remove-user": {
337
+ type: "string",
338
+ multiple: true,
339
+ value: "email",
340
+ description: "remove a person"
341
+ },
342
+ "remove-project": {
343
+ type: "string",
344
+ multiple: true,
345
+ value: "name|id",
346
+ description: "remove a project, whatever its environments"
347
+ },
348
+ "remove-github": {
349
+ type: "string",
350
+ multiple: true,
351
+ value: "owner/repo",
352
+ description: "remove a repository's runs"
353
+ },
354
+ "remove-oidc": {
355
+ type: "string",
356
+ multiple: true,
357
+ value: "issuer",
358
+ description: "remove an issuer's tokens"
359
+ },
360
+ "remove-all-users": {
361
+ type: "boolean",
362
+ description: "remove every person on the team"
363
+ },
364
+ "remove-all-projects": {
365
+ type: "boolean",
366
+ description: "remove every project on the team"
367
+ },
368
+ "remove-app": {
369
+ type: "string",
370
+ multiple: true,
371
+ value: "slug|id",
372
+ description: "remove an app"
373
+ },
374
+ "remove-all-apps": {
375
+ type: "boolean",
376
+ description: "remove every app on the team"
377
+ },
378
+ "remove-everyone": {
379
+ type: "boolean",
380
+ description: "remove everyone"
381
+ },
382
+ private: {
383
+ type: "boolean",
384
+ description: "closed to everyone but you, in the same write"
218
385
  },
219
386
  profile: {
220
387
  type: "string",
@@ -381,7 +548,7 @@ const commands = [
381
548
  {
382
549
  group: "the board",
383
550
  name: "grants",
384
- description: "who the board lets in beside its code's rules: tokens from an OIDC issuer with these claims",
551
+ description: "who may do what where, grant by grant",
385
552
  arguments: [],
386
553
  options: [],
387
554
  runsWithoutSubcommand: true,
@@ -403,19 +570,119 @@ const commands = [
403
570
  },
404
571
  {
405
572
  name: "create",
406
- description: "let them in, or change what they may do",
573
+ description: "let principals do what --can says, where it says",
574
+ arguments: [],
575
+ options: [
576
+ ...[
577
+ "user",
578
+ "project",
579
+ "github",
580
+ "oidc",
581
+ "app",
582
+ "all-users",
583
+ "all-projects",
584
+ "all-apps",
585
+ "everyone"
586
+ ].map((name) => option(name)),
587
+ option("environment", "where its --project runs (default: production)"),
588
+ ...[
589
+ "workflow",
590
+ "branch",
591
+ "event",
592
+ "claim"
593
+ ].map((name) => option(name)),
594
+ option("can", "what they may do, repeated: perms, all, or none", "pattern=perms")
595
+ ],
596
+ examples: [
597
+ {
598
+ name: "close security/ to everyone",
599
+ value: "grants create --everyone --can 'security/=none'"
600
+ },
601
+ {
602
+ name: "and let two people in",
603
+ value: "grants create --user alice@acme.com --user bob@acme.com --can 'security/=all'"
604
+ },
605
+ {
606
+ name: "a project's production and previews",
607
+ value: "grants create --project sec --environment production,preview --can 'security/=read,post'"
608
+ },
609
+ {
610
+ name: "two repositories' workflows",
611
+ value: "grants create --github acme/web --workflow ci.yml --branch main --github acme/api --workflow deploy.yml --can 'ci/=post'"
612
+ },
613
+ {
614
+ name: "another issuer's tokens",
615
+ value: "grants create --oidc https://gitlab.com --claim project_id=42 --can 'ci/=post'"
616
+ }
617
+ ]
618
+ },
619
+ {
620
+ name: "update",
621
+ description: "add or remove principals, or replace its --can",
407
622
  arguments: [{
408
- name: "issuer",
623
+ name: "grant",
624
+ required: true,
625
+ description: "its ID, as grants shows it (g3)"
626
+ }],
627
+ options: [...[
628
+ "add-user",
629
+ "add-project",
630
+ "add-github",
631
+ "add-oidc",
632
+ "add-app",
633
+ "add-all-users",
634
+ "add-all-projects",
635
+ "add-all-apps",
636
+ "add-everyone",
637
+ "remove-user",
638
+ "remove-project",
639
+ "remove-github",
640
+ "remove-oidc",
641
+ "remove-app",
642
+ "remove-all-users",
643
+ "remove-all-projects",
644
+ "remove-all-apps",
645
+ "remove-everyone",
646
+ "environment",
647
+ "workflow",
648
+ "branch",
649
+ "event",
650
+ "claim"
651
+ ].map((name) => option(name)), option("can", "replaces what it lets them do", "pattern=perms")],
652
+ examples: [{
653
+ name: "let another person in",
654
+ value: "grants update g4 --add-user carol@acme.com"
655
+ }, {
656
+ name: "drop a project, and narrow it",
657
+ value: "grants update g5 --remove-project sec --can 'security/=read'"
658
+ }]
659
+ },
660
+ {
661
+ name: "explain",
662
+ description: "which grant decides a channel, for you or anyone",
663
+ arguments: [{
664
+ name: "channel",
409
665
  required: true,
410
- description: "vercel, github, or an https URL"
666
+ description: "a channel, such as security/incidents"
411
667
  }],
412
- options: [option("claim"), option("can")],
668
+ options: [...[
669
+ "user",
670
+ "project",
671
+ "github",
672
+ "oidc",
673
+ "app",
674
+ "environment",
675
+ "workflow",
676
+ "branch",
677
+ "event",
678
+ "claim"
679
+ ].map((name) => option(name))],
413
680
  examples: [{
414
- name: "let a workflow post in ci/",
415
- value: "grants create github --claim repository=acme/web --can ci/=read,post"
681
+ name: "what you may do in a channel",
682
+ value: "grants explain security/incidents"
416
683
  }, {
417
- name: "let a project's production post feedback",
418
- value: "grants create vercel --claim project_id=prj_123 --claim environment=production --can feedback/=post"
684
+ name: "what someone else may",
685
+ value: "grants explain --user bob@acme.com security/incidents"
419
686
  }]
420
687
  },
421
688
  {
@@ -463,10 +730,13 @@ const commands = [
463
730
  required: true,
464
731
  description: "its path, such as dev/alerts"
465
732
  }],
466
- options: [],
733
+ options: [option("private")],
467
734
  examples: [{
468
735
  name: "make a channel for alerts",
469
736
  value: "channels create dev/alerts"
737
+ }, {
738
+ name: "one only you can see, until you grant others",
739
+ value: "channels create security --private"
470
740
  }]
471
741
  }]
472
742
  },