@vercel/board 0.33.0 → 0.34.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-CdBcYPQH.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-MrIEr9LI.mjs} +2 -2
  5. package/dist/auth-DjoJygbG.mjs +599 -0
  6. package/dist/{auth-D6z3rMNj.d.mts → auth-aaoKt5DK.d.mts} +128 -9
  7. package/dist/backend-local.d.mts +1 -1
  8. package/dist/backend-local.mjs +1 -1
  9. package/dist/{backend-CWpyR1A7.d.mts → backend-u1sVvybh.d.mts} +30 -7
  10. package/dist/{chat-provider-DJpFUaFv.d.mts → chat-provider-De0iDnUB.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-CHoMl06v.mjs → commands-B8oZEByR.mjs} +25 -51
  17. package/dist/{commands-BOBQHVqM.d.mts → commands-BkVMdXP1.d.mts} +0 -6
  18. package/dist/{conformance-qKmGLTAT.mjs → conformance-gqYBkXFS.mjs} +76 -83
  19. package/dist/conformance.d.mts +1 -1
  20. package/dist/conformance.mjs +1 -1
  21. package/dist/{engine-JxgZiikU.mjs → engine-rtOVWsiF.mjs} +2 -2
  22. package/dist/{errors-Pk0XV1hK.mjs → errors-D8ifv16L.mjs} +19 -4
  23. package/dist/{exports-gHDHlg0i.mjs → exports-Bx2dGpzr.mjs} +55 -10
  24. package/dist/exports-uwRl5qIj.d.mts +4 -0
  25. package/dist/{index-CXvvYNYj.d.mts → index-D6mK0Ial.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 +31 -31
  31. package/dist/{local-BbLjA5vI.mjs → local-CPz22MQ8.mjs} +1981 -1574
  32. package/dist/{main-CQpCZJFw.mjs → main-DScDKwQN.mjs} +45 -38
  33. package/dist/{middleware-BU7rVi9F.mjs → middleware-BjYpk4yq.mjs} +1 -1
  34. package/dist/provider-hB8QNrwm.d.mts +1031 -0
  35. package/dist/{provider-BlzUvcM9.d.mts → routes-De4W6lEs.d.mts} +2439 -2469
  36. package/dist/{serve-D8_W4UN6.mjs → serve-B1noQRkn.mjs} +4 -4
  37. package/dist/{server-BiIUXWbU.mjs → server-Ov6GBJ8j.mjs} +7 -7
  38. package/dist/{serving-D7rcUtSC.mjs → serving-2s7lqSBS.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-aMdbp84G.mjs} +98 -10
  45. package/dist/{tokens-DPKjl3jf.mjs → tokens-LHLrnV_P.mjs} +2 -2
  46. package/docs/01-board/01-mounting.md +5 -3
  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 +140 -59
  50. package/docs/03-guides/03-ci.md +15 -15
  51. package/docs/03-guides/05-agent-factory.md +5 -6
  52. package/docs/04-reference/01-cli.md +9 -16
  53. package/docs/04-reference/02-board.md +19 -8
  54. package/docs/04-reference/03-http.md +20 -13
  55. package/docs/04-reference/05-conformance.md +1 -1
  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,12 +1,12 @@
1
- import { _ as fileSize, m as DIRECT_UPLOAD_BYTES_MAX, u as BoardError } from "./errors-Pk0XV1hK.mjs";
1
+ import { _ as fileSize, m as DIRECT_UPLOAD_BYTES_MAX, u as BoardError } from "./errors-D8ifv16L.mjs";
2
2
  import { d as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-BG205xds.mjs";
3
- import { h as VERSION, s as withMentions } from "./targets-CknPGGVi.mjs";
3
+ import { h as VERSION, s as withMentions } from "./targets-aMdbp84G.mjs";
4
4
  import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
5
- import { o as parseScope } from "./access-N3XmkKXg.mjs";
6
- import { i as isApiMessageId, n as isBoardName } from "./exports-gHDHlg0i.mjs";
7
- import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-CHoMl06v.mjs";
8
- import { a as http, c as handFetch, f as vercelProjectFile, i as vercel, l as handLogin, n as credentialSource, o as boardUrl, r as handTeam, s as connect, t as board } from "./server-BiIUXWbU.mjs";
9
- import { t as conformance } from "./conformance-qKmGLTAT.mjs";
5
+ import { u as parseScope } from "./access-CdBcYPQH.mjs";
6
+ import { i as isApiMessageId, n as isBoardName } from "./exports-Bx2dGpzr.mjs";
7
+ import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-B8oZEByR.mjs";
8
+ import { a as http, c as handFetch, f as vercelProjectFile, i as vercel, l as handLogin, n as credentialSource, o as boardUrl, r as handTeam, s as connect, t as board } from "./server-Ov6GBJ8j.mjs";
9
+ import { t as conformance } from "./conformance-gqYBkXFS.mjs";
10
10
  import { t as displayText } from "./bots-CGkO76qH.mjs";
11
11
  import { spawn } from "node:child_process";
12
12
  import { readFile, stat, writeFile } from "node:fs/promises";
@@ -170,13 +170,46 @@ const table = (rows) => {
170
170
  const widths = rows[0].map((_, column) => Math.max(...rows.map((row) => row[column].length)));
171
171
  return rows.map((row) => row.map((cell, column) => column === row.length - 1 ? cell : cell.padEnd(widths[column])).join(" ").trimEnd()).join("\n");
172
172
  };
173
- /** Each grant on a row: its ID, its issuer, the claims it matches, and what it lets do. */
173
+ /** A workflow as people name it: `ci.yml` for `.github/workflows/ci.yml`. */
174
+ const workflowName = (workflow) => workflow.replace(/^\.github\/workflows\/(?=[^/]+$)/, "");
175
+ /** A principal as the flags that name it: `--user ada@acme.com`, `--project web --environment production,preview`. */
176
+ function principalFlags(principal) {
177
+ switch (principal.kind) {
178
+ case "user": return `--user ${principal.email ?? principal.userId}`;
179
+ case "project": return `--project ${principal.name ?? principal.projectId} --environment ${principal.environments.join(",")}`;
180
+ case "github": return [
181
+ `--github ${principal.repository}`,
182
+ ...principal.workflow !== void 0 ? [`--workflow ${workflowName(principal.workflow)}`] : [],
183
+ ...principal.branch !== void 0 ? [`--branch ${principal.branch}`] : [],
184
+ ...principal.event !== void 0 ? [`--event ${principal.event}`] : []
185
+ ].join(" ");
186
+ case "oidc": return [`--oidc ${principal.issuer}`, ...Object.entries(principal.claims).flatMap(([name, value]) => [value].flat().map((one) => `--claim ${name}=${one}`))].join(" ");
187
+ case "all-projects": return `--all-projects --environment ${principal.environments.join(",")}`;
188
+ case "app": return `--app ${principal.name ?? principal.clientId}`;
189
+ default: return `--${principal.kind}`;
190
+ }
191
+ }
192
+ /**
193
+ * What a grant lets do, as `--can` writes it, `security/=none ci/=read,post`, or in words for
194
+ * `*` alone: `read post react label`, or `everything your role allows` for all of it where team
195
+ * roles cap it.
196
+ */
197
+ function grantCan(can, capped) {
198
+ const patterns = Object.keys(can);
199
+ const words = (grant) => grant === "all" ? "all" : grant.length === 0 ? "none" : grant.join(",");
200
+ if (patterns.length === 1 && patterns[0] === "*") {
201
+ const all = can["*"];
202
+ if (all === "all" || all.includes("manage")) return capped ? "everything your role allows" : "everything";
203
+ return all.length === 0 ? "nothing" : all.join(" ");
204
+ }
205
+ return patterns.map((pattern) => `${pattern}=${words(can[pattern])}`).join(" ");
206
+ }
207
+ /** Each grant on a row: its ID, who it names (as the flags that would), and what it lets them do. */
174
208
  function formatGrants(grants) {
175
209
  return table(grants.map((grant) => [
176
210
  grant.id,
177
- grant.issuer,
178
- Object.entries(grant.claims).map(([name, value]) => `${name}=${typeof value === "string" ? value : value.join("|")}`).join(" "),
179
- formatCan(grant.can)
211
+ grant.principals.map(principalFlags).join(" "),
212
+ grantCan(grant.can, grant.capped)
180
213
  ]));
181
214
  }
182
215
  /** Each token on a row: its ID, its name, what it may do, and when it expires. */
@@ -999,16 +1032,6 @@ function canFlag(value) {
999
1032
  throw usage(`${error.message.replace(/x-board-scope/g, "--can")}.`);
1000
1033
  }
1001
1034
  }
1002
- /** `--claim k=v`, each again: the same name twice is any of its values. */
1003
- function claimPairs(values) {
1004
- const claims = {};
1005
- for (const value of values ?? []) {
1006
- const at = value.indexOf("=");
1007
- if (at <= 0 || at === value.length - 1) throw usage(`Claims look like name=value, and ${value} isn't one.`);
1008
- (claims[value.slice(0, at)] ??= []).push(value.slice(at + 1));
1009
- }
1010
- return Object.fromEntries(Object.entries(claims).map(([name, list]) => [name, list.length === 1 ? list[0] : list]));
1011
- }
1012
1035
  /** A time flag: anything `Date` reads, as ISO. */
1013
1036
  function instant(flag, value) {
1014
1037
  const time = new Date(value);
@@ -1746,23 +1769,7 @@ async function run(command, args) {
1746
1769
  else out(revoked ? `revoked ${id}` : `${id} is already gone`);
1747
1770
  return 0;
1748
1771
  }
1749
- if (verb !== "create") throw usage(`Unknown command ${verb} for ${named()} grants.`, { reason: "unknown_command" });
1750
- const [issuer, extra] = rest;
1751
- if (!issuer) throw usage("Missing the issuer to grant: vercel, github, or an https URL.", { reason: "missing_arguments" });
1752
- if (extra !== void 0) throw usage(`grants create takes one issuer, and its claims as --claim name=value: ${extra} is one too many.`);
1753
- const claims = claimPairs(flags.claim);
1754
- if (Object.keys(claims).length === 0) throw usage(`Missing the claims ${issuer}'s tokens must carry: pass --claim name=value.`, { reason: "missing_arguments" });
1755
- const { grant, created } = await client().createGrant({
1756
- issuer,
1757
- claims,
1758
- ...flags.can !== void 0 ? { can: canFlag(flags.can) } : {}
1759
- });
1760
- if (flags.json) result({
1761
- grant,
1762
- outcome: created ? "granted" : "updated"
1763
- });
1764
- else out(`${created ? "granted" : "updated"} ${grant.id}`);
1765
- return 0;
1772
+ throw usage(`Unknown command ${verb} for ${named()} grants.`, { reason: "unknown_command" });
1766
1773
  }
1767
1774
  case "tokens": {
1768
1775
  const [verb, ...rest] = args;
@@ -1,4 +1,4 @@
1
- import { t as HttpError } from "./errors-Pk0XV1hK.mjs";
1
+ import { t as HttpError } from "./errors-D8ifv16L.mjs";
2
2
  import { d as MESSAGE_TEXT_MAX, u as Labels } from "./schemas-BG205xds.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/client/ids.ts