@vercel/board 0.51.1 → 0.52.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.
@@ -1,7 +1,7 @@
1
1
  import { i as ATTACHMENT_BYTES_MAX, r as parseProfileHeader, t as InvalidProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
- import { t as Failed, u as who } from "./main-Dq6yQxNB.mjs";
4
- import { n as relative, r as shell, t as CSP } from "./shell-CmZylG0M.mjs";
3
+ import { t as Failed, u as who } from "./main-DfJNxck4.mjs";
4
+ import { n as relative, r as shell, t as CSP } from "./shell-qrJL3Z_R.mjs";
5
5
  import { t as page } from "./page-7KWSGxyC.mjs";
6
6
  import { randomBytes, timingSafeEqual } from "node:crypto";
7
7
  import { createServer } from "node:http";
@@ -0,0 +1,2 @@
1
+ import { n as inspect } from "./inspect-BJR-BsUv.mjs";
2
+ export { inspect };
package/dist/inspect.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as ATTACHMENT_BYTES_MAX, r as parseProfileHeader, t as InvalidProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
- import { n as relative, r as shell, t as CSP } from "./shell-CmZylG0M.mjs";
3
+ import { n as relative, r as shell, t as CSP } from "./shell-qrJL3Z_R.mjs";
4
4
  import { t as page } from "./page-7KWSGxyC.mjs";
5
5
  //#region src/inspect/handler.ts
6
6
  /**
@@ -6,9 +6,9 @@ import { a as duplicateId, c as notFound, f as BoardError, i as batchTooLarge, l
6
6
  import { a as waitUntil, c as platformProfile, d as userIdOf, h as isKeyIdOf, l as shownName, m as derivedId, n as MIDDLEWARE_ACTOR, o as actorParts, s as importedHandle, t as DroppedError } from "./middleware-iVTNf5Su.mjs";
7
7
  import { a as SCHEMA_DESCRIPTION_MAX, c as canonical, d as parseSchemaId, f as schemaId, i as BUILT_IN_SCHEMAS, l as checkDefinition, n as blocksIn, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX, u as isBuiltInName } from "./blocks-CVoBC7ur.mjs";
8
8
  import { a as replaceMentions, i as mentionTerms, n as isEmail, r as mentionTerm, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
9
- import { t as VERSION } from "./version-BltS6V9X.mjs";
9
+ import { t as VERSION } from "./version-NfsFHDfg.mjs";
10
10
  import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-DdojoPZm.mjs";
11
- import { _ as SYNC, a as runMatch, g as uploadName, h as carried, i as canonicalWatchers, l as METHODS, n as SYNC_ACTOR, o as compileWatcher, r as syncTarget, s as hasCriteria, t as batchPlan } from "./task-batch-Da6Q_7AK.mjs";
11
+ import { _ as SYNC, a as runMatch, g as uploadName, h as carried, i as canonicalWatchers, l as METHODS, n as SYNC_ACTOR, o as compileWatcher, r as syncTarget, s as hasCriteria, t as batchPlan } from "./task-batch-6UHphYfl.mjs";
12
12
  import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
13
13
  import { E as wroteAs, T as workflowPath, b as removes, c as checkCan, g as joined, h as issuerName, l as checkGrant, n as GITHUB_ISSUER, p as grantIssuers, s as authenticates, u as checkPrincipal } from "./auth-zPqFJocD.mjs";
14
14
  import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-CDkNgWUL.mjs";
@@ -6,12 +6,12 @@ import { f as BoardError } from "./errors-DbCKqGXp.mjs";
6
6
  import { l as shownName } from "./middleware-iVTNf5Su.mjs";
7
7
  import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
8
8
  import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
9
- import { t as VERSION } from "./version-BltS6V9X.mjs";
9
+ import { t as VERSION } from "./version-NfsFHDfg.mjs";
10
10
  import { r as PERMISSIONS } from "./access-DdojoPZm.mjs";
11
- import { c as withMentions } from "./task-batch-Da6Q_7AK.mjs";
12
- import { a as isBoardName, c as isApiMessageId, n as createTasksInChunks, t as TasksInChunksError } from "./exports-BFeX9HNn.mjs";
11
+ import { c as withMentions } from "./task-batch-6UHphYfl.mjs";
12
+ import { a as isBoardName, c as isApiMessageId, n as createTasksInChunks, t as TasksInChunksError } from "./exports-DI-MtN01.mjs";
13
13
  import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-B_gbi2sU.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-DbYDp2Lr.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--BLSj6fd.mjs";
15
15
  import { n as everyChannel, t as conformance } from "./conformance-DW4-9Dwf.mjs";
16
16
  import { n as displayText, t as byVercelBot } from "./bots-CqPYxkqK.mjs";
17
17
  import { spawn } from "node:child_process";
@@ -1,9 +1,9 @@
1
1
  import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DbCKqGXp.mjs";
2
- import { i as hostCheckedBy } from "./exports-BFeX9HNn.mjs";
2
+ import { i as hostCheckedBy } from "./exports-DI-MtN01.mjs";
3
3
  import { i as LOGINS, r as LOGIN } from "./auth-zPqFJocD.mjs";
4
- import { h as localTokenFile, t as board } from "./server-DbYDp2Lr.mjs";
4
+ import { h as localTokenFile, t as board } from "./server--BLSj6fd.mjs";
5
5
  import { t as oidcTokens } from "./tokens-C-T0B1uF.mjs";
6
- import { t as local } from "./local-DTzfnJAf.mjs";
6
+ import { t as local } from "./local-B376y9u3.mjs";
7
7
  import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
8
8
  import { userInfo } from "node:os";
9
9
  import { dirname, join, resolve } from "node:path";
@@ -3,8 +3,8 @@ import "./schemas-CUSTEFIy.mjs";
3
3
  import { $ as routes } from "./routes-C85Sbhtm.mjs";
4
4
  import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DbCKqGXp.mjs";
5
5
  import { g as keyId, p as DERIVED_ID } from "./middleware-iVTNf5Su.mjs";
6
- import { l as METHODS, o as compileWatcher } from "./task-batch-Da6Q_7AK.mjs";
7
- import { d as tailWatchers, f as deployedOnVercel, l as PROTOCOL_ROUTES, r as createBoard, s as createVercel, u as withoutToken } from "./exports-BFeX9HNn.mjs";
6
+ import { l as METHODS, o as compileWatcher } from "./task-batch-6UHphYfl.mjs";
7
+ import { d as tailWatchers, f as deployedOnVercel, l as PROTOCOL_ROUTES, r as createBoard, s as createVercel, u as withoutToken } from "./exports-DI-MtN01.mjs";
8
8
  import { execFile } from "node:child_process";
9
9
  import { createHash } from "node:crypto";
10
10
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -1,4 +1,4 @@
1
- import { t as VERSION } from "./version-BltS6V9X.mjs";
1
+ import { t as VERSION } from "./version-NfsFHDfg.mjs";
2
2
  //#region src/inspect/style.ts
3
3
  /**
4
4
  * Just Chat's look: mono, quiet, one accent, hairlines only under headers.
@@ -502,6 +502,11 @@ button.file:hover { background: var(--shade-hover); color: var(--bright); }
502
502
  .task-now .need + .need { margin-left: 8px; }
503
503
  .task-where { color: var(--faint); font-size: 12px; white-space: nowrap; }
504
504
  .task-row .time { text-align: right; }
505
+ .task-places { display: grid; padding: 0 12px; }
506
+ .task-place { display: flex; align-items: center; gap: 12px; padding: 5px 8px; color: var(--dim); }
507
+ .task-place:hover { background: var(--shade); color: var(--bright); }
508
+ .task-place .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
509
+ .task-place .count { color: var(--faint); font-size: 12px; white-space: nowrap; }
505
510
  @media (max-width: 700px) {
506
511
  .task-row { grid-template-columns: 88px minmax(0, 1fr) 30px; row-gap: 0; }
507
512
  .task-where { display: none; }
@@ -438,6 +438,46 @@ export declare const GitHubEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
438
438
  }, z.core.$loose>>;
439
439
  }, z.core.$loose>;
440
440
  }, z.core.$loose>;
441
+ }, z.core.$strip> | z.ZodObject<{
442
+ channel: z.ZodString;
443
+ thread: z.ZodString;
444
+ subthread: z.ZodNullable<z.ZodString>;
445
+ kind: z.ZodLiteral<"lifecycle">;
446
+ title: z.ZodString;
447
+ url: z.ZodNullable<z.ZodString>;
448
+ body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
449
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
450
+ unset: z.ZodArray<z.ZodString>;
451
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
452
+ reply: z.ZodNullable<z.ZodString>;
453
+ createRoot: z.ZodBoolean;
454
+ retitled: z.ZodOptional<z.ZodBoolean>;
455
+ author: z.ZodObject<{
456
+ id: z.ZodString;
457
+ handle: z.ZodString;
458
+ name: z.ZodString;
459
+ avatar: z.ZodNullable<z.ZodString>;
460
+ isBot: z.ZodBoolean;
461
+ }, z.core.$strip>;
462
+ id: z.ZodString;
463
+ key: z.ZodString;
464
+ platform: z.ZodLiteral<"github">;
465
+ type: z.ZodLiteral<"ci.failed" | "ci.passed">;
466
+ subject: z.ZodObject<{
467
+ repo: z.ZodString;
468
+ number: z.ZodNumber;
469
+ type: z.ZodLiteral<"pull_request">;
470
+ }, z.core.$strip>;
471
+ raw: z.ZodObject<{
472
+ action: z.ZodOptional<z.ZodString>;
473
+ workflow_run: z.ZodObject<{
474
+ name: z.ZodString;
475
+ path: z.ZodString;
476
+ conclusion: z.ZodString;
477
+ head_sha: z.ZodString;
478
+ html_url: z.ZodOptional<z.ZodString>;
479
+ }, z.core.$loose>;
480
+ }, z.core.$loose>;
441
481
  }, z.core.$strip>)[]], "type">;
442
482
  export type GitHubEvent = z.infer<typeof GitHubEvent>;
443
483
  export type GitHubRepo = SyncUnit<GitHubEvent> | {
@@ -1,6 +1,6 @@
1
1
  import { _ as withRoutes, i as eventSchema, m as into, r as envelope } from "./events-mWKc1uvZ.mjs";
2
2
  import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-Br2RXgLV.mjs";
3
- import { n as tagOf } from "./tags-CxDCF_tt.mjs";
3
+ import { n as tagOf, t as slug } from "./tags-CxDCF_tt.mjs";
4
4
  import { z } from "zod";
5
5
  import { connectGitHubAdapter } from "@vercel/connect/chat";
6
6
  import { createGitHubAdapter } from "@chat-adapter/github";
@@ -103,7 +103,8 @@ function lifecycle(name, body) {
103
103
  type: "pr.synchronized",
104
104
  labels: head,
105
105
  reply: null,
106
- createRoot: false
106
+ createRoot: false,
107
+ owns: [ciPrefix(body.repository.id, pr.number)]
107
108
  }
108
109
  };
109
110
  case "ready_for_review": return {
@@ -268,6 +269,56 @@ function lifecycle(name, body) {
268
269
  }
269
270
  return null;
270
271
  }
272
+ /**
273
+ * A PR's CI labels, `ci.<repo ID>-<number>.`: a board thread can join several PRs, even in other
274
+ * repos, and each PR's results and pushes touch only its own. Two numbers keep it short and
275
+ * unambiguous, where a repo's name can be long and hold the separators.
276
+ */
277
+ const ciPrefix = (repo, number) => `ci.${repo}-${number}.`;
278
+ /** Conclusions that mean a workflow failed. `cancelled` usually means a newer push superseded it. */
279
+ const FAILED = [
280
+ "failure",
281
+ "timed_out",
282
+ "startup_failure"
283
+ ];
284
+ /** Who CI results are posted as: GitHub Actions' bot, so they don't read as the person who pushed. */
285
+ const ACTIONS = {
286
+ login: "github-actions[bot]",
287
+ id: 41898282,
288
+ type: "Bot"
289
+ };
290
+ /**
291
+ * Maps a completed `workflow_run` to a lifecycle event on each PR it ran for, at the commit the PR
292
+ * is at: a failure replies and sets `ci.<repo ID>-<number>.<workflow file>=<conclusion>`, a pass unsets it. A fork's PRs
293
+ * aren't in `pull_requests`, so their runs reach no thread.
294
+ */
295
+ function workflowRun(body) {
296
+ if (body.action !== "completed") return [];
297
+ const run = body.workflow_run;
298
+ const { full_name: repo, id } = body.repository ?? {};
299
+ if (!run?.name || !run.path || !run.head_sha || !run.conclusion || !repo || typeof id !== "number") return [];
300
+ const file = run.path.slice(run.path.lastIndexOf("/") + 1).replace(/\.ya?ml$/, "");
301
+ if (!slug(file)) return [];
302
+ const failed = FAILED.includes(run.conclusion);
303
+ if (!failed && run.conclusion !== "success") return [];
304
+ return (run.pull_requests ?? []).filter((pr) => pr.head?.sha === run.head_sha).map((pr) => {
305
+ const key = `${ciPrefix(id, pr.number)}${slug(file)}`.slice(0, 64);
306
+ const verdict = run.conclusion === "failure" ? "failed" : run.conclusion.replace("_", " ");
307
+ return {
308
+ number: pr.number,
309
+ user: ACTIONS,
310
+ lifecycle: {
311
+ type: failed ? "ci.failed" : "ci.passed",
312
+ title: `PR #${pr.number}`,
313
+ url: `https://github.com/${repo}/pull/${pr.number}`,
314
+ labels: failed ? { [key]: run.conclusion } : {},
315
+ unset: failed ? [] : [key],
316
+ reply: failed ? `${run.name} ${verdict} on ${repo.slice(repo.indexOf("/") + 1)}#${pr.number} at ${run.head_sha.slice(0, 7)}${run.html_url ? `: ${run.html_url}` : ""}` : null,
317
+ createRoot: false
318
+ }
319
+ };
320
+ });
321
+ }
271
322
  const GitHubSubject = z.object({
272
323
  type: z.enum(["pull_request", "issue"]),
273
324
  repo: z.string(),
@@ -303,6 +354,7 @@ const prTypes = [
303
354
  "review.submitted",
304
355
  "review.dismissed"
305
356
  ];
357
+ const ciTypes = ["ci.failed", "ci.passed"];
306
358
  const issueTypes = [
307
359
  "issue.opened",
308
360
  "issue.edited",
@@ -328,13 +380,28 @@ const issueLifecycle = (type) => lifecycleEvent.extend({
328
380
  subject: GitHubSubject.extend({ type: z.literal("issue") }),
329
381
  raw: GitHubPayload.extend({ issue: NativeItem })
330
382
  });
383
+ const ciLifecycle = (type) => lifecycleEvent.extend({
384
+ type: z.literal(type),
385
+ subject: GitHubSubject.extend({ type: z.literal("pull_request") }),
386
+ raw: z.looseObject({
387
+ action: z.string().optional(),
388
+ workflow_run: z.looseObject({
389
+ name: z.string(),
390
+ path: z.string(),
391
+ conclusion: z.string(),
392
+ head_sha: z.string(),
393
+ html_url: z.string().optional()
394
+ })
395
+ })
396
+ });
331
397
  const GitHubEvent = z.discriminatedUnion("type", [
332
398
  messageEvent.extend(githubFields),
333
399
  editedEvent.extend(githubFields),
334
400
  deletedEvent.extend(githubFields),
335
401
  reactionEvent.extend(githubFields),
336
402
  ...prTypes.map(prLifecycle),
337
- ...issueTypes.map(issueLifecycle)
403
+ ...issueTypes.map(issueLifecycle),
404
+ ...ciTypes.map(ciLifecycle)
338
405
  ]);
339
406
  /**
340
407
  * Syncs GitHub with the board: `app` is a Vercel Connect connector
@@ -513,7 +580,8 @@ var GitHubProvider = class extends ChatSyncProvider {
513
580
  if (![
514
581
  "pull_request",
515
582
  "pull_request_review",
516
- "issues"
583
+ "issues",
584
+ "workflow_run"
517
585
  ].includes(name)) return [];
518
586
  let parsed;
519
587
  try {
@@ -521,6 +589,21 @@ var GitHubProvider = class extends ChatSyncProvider {
521
589
  } catch {
522
590
  return [];
523
591
  }
592
+ const repo = parsed.repository.full_name;
593
+ if (name === "workflow_run") {
594
+ const delivery = headers.get("x-github-delivery") ?? `${name}:${parsed.workflow_run?.id}`;
595
+ return workflowRun(parsed).map((found) => ({
596
+ event: {
597
+ kind: "lifecycle",
598
+ channel: `${key}:${repo}:pulls`,
599
+ thread: `${key}:${repo}:${found.number}`,
600
+ author: author(found.user),
601
+ ...found.lifecycle
602
+ },
603
+ raw: parsed,
604
+ dedupe: `lifecycle:${delivery}:${found.number}`
605
+ }));
606
+ }
524
607
  const found = lifecycle(name, parsed);
525
608
  if (!found) return [];
526
609
  const item = parsed.pull_request ?? parsed.issue;
@@ -529,9 +612,8 @@ var GitHubProvider = class extends ChatSyncProvider {
529
612
  ...tagsOf(item),
530
613
  ...found.lifecycle.labels
531
614
  },
532
- owns: ownedBy(item)
615
+ owns: [...ownedBy(item), ...found.lifecycle.owns ?? []]
533
616
  });
534
- const repo = parsed.repository.full_name;
535
617
  const thread = name === "issues" ? `${key}:${repo}:issue:${found.number}` : `${key}:${repo}:${found.number}`;
536
618
  const delivery = headers.get("x-github-delivery") ?? `${name}:${found.lifecycle.type}:${found.number}`;
537
619
  return [{
@@ -4,7 +4,7 @@ import { l as isThreadTarget } from "./external-DkWafjn-.mjs";
4
4
  import { $ as routes, b as Filters } from "./routes-C85Sbhtm.mjs";
5
5
  import { r as badRequest, t as HttpError } from "./errors-DbCKqGXp.mjs";
6
6
  import { i as afterRetry } from "./middleware-iVTNf5Su.mjs";
7
- import { t as VERSION } from "./version-BltS6V9X.mjs";
7
+ import { t as VERSION } from "./version-NfsFHDfg.mjs";
8
8
  import { t as own } from "./own-OwgPWdmh.mjs";
9
9
  import { o as options } from "./commands-B_gbi2sU.mjs";
10
10
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const VERSION = "0.51.1";
3
+ const VERSION = "0.52.0";
4
4
  //#endregion
5
5
  export { VERSION as t };
@@ -103,8 +103,10 @@ issue. Resolving review conversations isn't synced.
103
103
  | `pr.edited`, `issue.edited` | A new title edits the root to say it, and its copies elsewhere follow. A new description changes nothing |
104
104
  | `pr.ready`, `pr.draft` | Sets `state` to `open` or `draft` |
105
105
  | `pr.reopened` | A reply ("reopened by julian") and `state=open`, or `state=draft` for a draft |
106
- | `pr.synchronized` | New commits: sets `head` to the PR's latest commit, with no reply |
106
+ | `pr.synchronized` | New commits: sets `head` to the PR's latest commit and unsets the PR's `ci.<repo ID>-<number>.*`, with no reply |
107
107
  | `pr.closed` | A reply ("merged by julian" or "closed by julian") and `state=merged` or `state=closed` |
108
+ | `ci.failed` | A GitHub Actions workflow failed, timed out, or didn't start on the PR's latest commit: a reply from `github-actions[bot]` ("check failed on www#123 at a1b2c3d: <run link>") and `ci.<repo ID>-<number>.<workflow file>=<conclusion>` |
109
+ | `ci.passed` | That workflow passed on the PR's latest commit: unsets `ci.<repo ID>-<number>.<workflow file>`, with no reply |
108
110
  | `review.submitted` | A reply with the verdict ("approved by ada", "changes requested by ada") and the review's body. Approvals and change requests set `review` |
109
111
  | `review.dismissed` | Unsets `review` |
110
112
  | `issue.opened` | A root labeled `issue=owner/repo#45` and `state=open` |
@@ -124,7 +126,7 @@ without polling it:
124
126
 
125
127
  | Root | Labels |
126
128
  | --- | --- |
127
- | PR | `state=draft\|open\|merged\|closed`, `review=approved\|changes_requested`, `head=<sha>` (the commit the PR is at) |
129
+ | PR | `state=draft\|open\|merged\|closed`, `review=approved\|changes_requested`, `head=<sha>` (the commit the PR is at), `ci.<repo ID>-<number>.<workflow file>=failure\|timed_out\|startup_failure` per workflow failing on it |
128
130
  | Issue | `state=open\|closed` |
129
131
  | Both | `tag.<label>=<name>` per GitHub label, `assignee.<login>=<login>` per assignee |
130
132
 
@@ -184,9 +186,10 @@ lookup.
184
186
  ## Setup
185
187
 
186
188
  1. Create a GitHub App, through Vercel Connect or by hand.
187
- 2. Give it **Issues** and **Pull requests** read and write permissions.
189
+ 2. Give it **Issues** and **Pull requests** read and write permissions, and
190
+ **Actions** read for CI results.
188
191
  3. Subscribe it to **Pull requests**, **Pull request reviews**, **Pull request
189
- review comments**, **Issues**, and **Issue comments**.
192
+ review comments**, **Issues**, **Issue comments**, and **Workflow runs**.
190
193
  4. Point its webhook at `https://<host>/api/board/webhooks/github`: Connect's
191
194
  trigger path, or the App's webhook URL with a secret.
192
195
  5. Install it on the repos you map.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/board",
3
- "version": "0.51.1",
3
+ "version": "0.52.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": "Apache-2.0",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- import { n as inspect } from "./inspect-fOA9UNPD.mjs";
2
- export { inspect };