spur-board 0.170.1 → 0.170.3

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.
@@ -1561,7 +1561,7 @@ const ERRORS = {
1561
1561
  status: null,
1562
1562
  exit: EXIT_CODES.config,
1563
1563
  message: "No caller identity was found: this is not a Spur session and no .spur-board/token was found walking up from the current folder.",
1564
- hint: "Run the command in a Spur session of a project listed in config.yaml, or run `board token create --name <name> --into <folder>` and ask the operator to approve the request in Slack.",
1564
+ hint: "Run the command in a Spur session of a project listed in config.yaml, or send that session the request with `spur send <session id> \"<request>\"`. With Slack (slack.channels set in config.yaml), you can instead run `board token create --name <name> --into <folder>` and ask the operator to approve the request in Slack.",
1565
1565
  recovery: noRetry("Get a caller identity as the fix says, then run the command again.")
1566
1566
  }),
1567
1567
  service_start_failed: spec("service_start_failed", {
@@ -1,5 +1,5 @@
1
- import { Mt as plainHttpAllowed, g as OPERATIONS, kt as configSchema, m as buildCatalogSnapshot } from "./chunk-BebxFmW0.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-BbohDnMm.mjs";
1
+ import { It as slackConfigured, Mt as plainHttpAllowed, g as OPERATIONS, kt as configSchema, m as buildCatalogSnapshot } from "./chunk-CljtkzXu.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-d2uszLEI.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { homedir } from "node:os";
@@ -27,16 +27,31 @@ function dataDirectory(env, home, cwd = process.cwd()) {
27
27
  const xdg = env["XDG_DATA_HOME"];
28
28
  return join(xdg && isAbsolute(xdg) ? xdg : join(home, ".local", "share"), "spur-board");
29
29
  }
30
- /** The http.port in config.yaml, or undefined when the file is missing or invalid. */
31
- function readConfiguredPort(env, home) {
30
+ /** The parsed config.yaml, or undefined when the file is missing, unreadable or invalid. */
31
+ function readBoardConfig(env, home) {
32
32
  try {
33
33
  const parsed = YAML.parseDocument(readFileSync(configFile(env, home), "utf8"));
34
34
  if (parsed.errors.length === 0) {
35
35
  const config = configSchema.safeParse(parsed.toJS());
36
- if (config.success) return config.data.http.port;
36
+ if (config.success) return config.data;
37
37
  }
38
38
  } catch {}
39
39
  }
40
+ /** The http.port in config.yaml, or undefined when the file is missing or invalid. */
41
+ function readConfiguredPort(env, home) {
42
+ return readBoardConfig(env, home)?.http.port;
43
+ }
44
+ /**
45
+ * Whether config.yaml turns Slack on, or undefined when the file is missing or invalid, or when
46
+ * BOARD_DAEMON_URL selects the daemon.
47
+ */
48
+ function boardSlackState(env, home) {
49
+ if (env["BOARD_DAEMON_URL"]) return void 0;
50
+ const config = readBoardConfig(env, home);
51
+ return config && slackConfigured(config);
52
+ }
53
+ const SLACK_IDENTITY_HINT = "Run the command in a Spur session of a project listed in config.yaml, or run `board token create --name <name> --into <folder>` and ask the operator to approve the request in Slack.";
54
+ const SPUR_IDENTITY_HINT = "Run the command in a Spur session of a project listed in config.yaml, such as one whose spurProjects role is operator, or send that session the request with `spur send <session id> \"<request>\"`.";
40
55
  function resolveDaemonAddress(env = process.env, home = homedir(), configuredPort) {
41
56
  const rawAddress = env["BOARD_DAEMON_URL"];
42
57
  if (rawAddress === void 0) {
@@ -126,7 +141,8 @@ function loadClientConfig(env = process.env, paths = {
126
141
  const token = session ? void 0 : env["BOARD_TOKEN"] === void 0 ? findTokenFile(paths.cwd, paths.home) : env["BOARD_TOKEN"];
127
142
  if (!session && !token) {
128
143
  if (env["BOARD_TOKEN"] === "") throw new CliError("config", { environmentVariable: "BOARD_TOKEN" });
129
- throw new CliError("identity_missing");
144
+ const slack = boardSlackState(env, paths.home);
145
+ throw new CliError("identity_missing", void 0, void 0, slack === void 0 ? void 0 : slack ? SLACK_IDENTITY_HINT : SPUR_IDENTITY_HINT);
130
146
  }
131
147
  return {
132
148
  address,
@@ -261,4 +277,4 @@ function fileVerdictCache(path, cliVersion) {
261
277
  return verdict;
262
278
  } };
263
279
  }
264
- export { memoryVerdictCache as a, loadClientConfig as c, resolveDaemonAddress as d, tokenInFolder as f, fileVerdictCache as i, loadEnrollmentConfig as l, cliPackageVersion as n, configFile as o, compareCatalogs as r, dataDirectory as s, checkCatalog as t, readConfiguredPort as u };
280
+ export { memoryVerdictCache as a, dataDirectory as c, readConfiguredPort as d, resolveDaemonAddress as f, fileVerdictCache as i, loadClientConfig as l, cliPackageVersion as n, boardSlackState as o, tokenInFolder as p, compareCatalogs as r, configFile as s, checkCatalog as t, loadEnrollmentConfig as u };
@@ -1,4 +1,4 @@
1
- import { d as tokenRequestStatusSchema, gt as errorEnvelopeSchema, ht as errorContextSchema, l as tokenRequestResultSchema, pt as ERRORS, vt as successEnvelopeSchema, x as renderJsonError } from "./chunk-BebxFmW0.mjs";
1
+ import { d as tokenRequestStatusSchema, gt as errorEnvelopeSchema, ht as errorContextSchema, l as tokenRequestResultSchema, pt as ERRORS, vt as successEnvelopeSchema, x as renderJsonError } from "./chunk-CljtkzXu.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { Ct as DEFAULT_STAND_PORT_RANGE, Ft as resolveWebOrigin, It as slackConfigured, Pt as requiredSecretKeys, Ut as SLACK_BOT_SCOPES, c as requestHashOf, ct as actorIdSchema, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, kt as configSchema, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, pt as ERRORS, r as SLACK_PARTLY_FIX, vt as successEnvelopeSchema } from "./chunk-BebxFmW0.mjs";
1
+ import { Ct as DEFAULT_STAND_PORT_RANGE, Ft as resolveWebOrigin, It as slackConfigured, Pt as requiredSecretKeys, Ut as SLACK_BOT_SCOPES, c as requestHashOf, ct as actorIdSchema, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, kt as configSchema, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, pt as ERRORS, r as SLACK_PARTLY_FIX, vt as successEnvelopeSchema } from "./chunk-CljtkzXu.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
3
- import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-BbohDnMm.mjs";
4
- import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-DEHqpoRe.mjs";
3
+ import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-d2uszLEI.mjs";
4
+ import { a as memoryVerdictCache, c as dataDirectory, d as readConfiguredPort, f as resolveDaemonAddress, i as fileVerdictCache, l as loadClientConfig, n as cliPackageVersion, o as boardSlackState, p as tokenInFolder, s as configFile, t as checkCatalog, u as loadEnrollmentConfig } from "./chunk-DbBNabCm.mjs";
5
5
  import { createHash, randomBytes, randomUUID } from "node:crypto";
6
6
  import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
7
7
  import { homedir, hostname, tmpdir, userInfo } from "node:os";
@@ -2379,18 +2379,22 @@ function shellValue(value) {
2379
2379
  return /^[A-Za-z0-9_./#:@-]+$/.test(text) ? text : JSON.stringify(text);
2380
2380
  }
2381
2381
  /** The identity an operation in the selected input mode needs, when only one kind of caller can run it. */
2382
- function identityHint(op, mode) {
2382
+ function identityHint(op, mode, slack) {
2383
2383
  const flag = op.cli.modes?.find((item) => item.mode === mode)?.flag;
2384
2384
  const command = `\`board ${op.cli.command}${flag ? ` ${flag}` : ""}\``;
2385
- if (!roleCanUseOperation(op, "worker", mode) && !roleCanUseOperation(op, "orchestrator", mode)) return `${command} needs operator identity: run it in a Spur session of a project whose spurProjects role is operator, or run \`board token create --name <name> --into <folder>\` and ask the operator to approve the request in Slack.`;
2385
+ if (!roleCanUseOperation(op, "worker", mode) && !roleCanUseOperation(op, "orchestrator", mode)) {
2386
+ if (slack === false) return `${command} needs operator identity: run it in a Spur session of a project whose spurProjects role is operator, or send that session the request with \`spur send <session id> "<request>"\`.`;
2387
+ return `${command} needs operator identity: run it in a Spur session of a project whose spurProjects role is operator, or run \`board token create --name <name> --into <folder>\` and ask the operator to approve the request in Slack.`;
2388
+ }
2386
2389
  if (!roleCanUseOperation(op, "operator", mode)) return `${command} needs an agent identity: run it in a Spur session of a project listed in config.yaml.`;
2387
2390
  }
2388
2391
  function loadOperationConfig(op, input, env) {
2389
2392
  try {
2390
2393
  return loadClientConfig(env);
2391
2394
  } catch (error) {
2392
- const hint = identityHint(op, typeof input === "object" && input !== null && "mode" in input && typeof input.mode === "string" ? input.mode : void 0);
2393
- if (error instanceof CliError && error.code === "identity_missing" && hint) throw new CliError(error.code, error.context, error.requestId, hint);
2395
+ if (!(error instanceof CliError) || error.code !== "identity_missing") throw error;
2396
+ const hint = identityHint(op, typeof input === "object" && input !== null && "mode" in input && typeof input.mode === "string" ? input.mode : void 0, boardSlackState(env, homedir()));
2397
+ if (hint) throw new CliError(error.code, error.context, error.requestId, hint);
2394
2398
  throw error;
2395
2399
  }
2396
2400
  }
package/dist/client.mjs CHANGED
@@ -1 +1 @@
1
- export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-BbohDnMm.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-d2uszLEI.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as prApprovalPairSchema, A as skillReloadFilesSchema, At as defaultAddressee, B as entityRefSchema, Bt as COLUMN_IDS, C as SPACE_IDS, D as messageRefSchema, Dt as columnTurnTimings, E as interactionRefSchema, Et as boardWideSpurProject, F as AdapterError, Ft as resolveWebOrigin, G as trackerSourceId, Gt as TODO_GROUP_COLUMN_IDS, H as prSourceId, Ht as ITEM_KINDS, I as MIRROR_FAILURES, It as slackConfigured, J as REVIEW_STATES, K as PR_STATES, Kt as VIAS, L as MIRROR_FAILURE_CODES, Lt as BLOCK_TYPES, M as EVENT_KINDS, Mt as plainHttpAllowed, N as GATE_REASONS, Nt as readyMirrorOf, O as userIdSchema, Ot as configBindings, P as eventPayloadSchemas, Pt as requiredSecretKeys, Q as parseRingMarker, R as batchSchema, Rt as COLUMNS, St as DEFAULT_SLACK_COMMAND, T as inboundEventSchema, Tt as approvalRuleOf, U as sessionTransitionSchema, Ut as SLACK_BOT_SCOPES, V as mirrorSourceId, Vt as DISPATCHER_MODES, W as sourceCursorSchema, Wt as TASK_HOLDS, X as SESSION_STATUSES, Y as SESSION_HEALTH_STATES, Z as isExternalAuthor, _ as defaultBranchViewSchema, _t as ok, a as doctorReportSchema, at as ticketFactsSchema, b as renderHttpProblem, bt as DEFAULT_LINK, c as requestHashOf, ct as actorIdSchema, d as tokenRequestStatusSchema, dt as parseActorId, et as prFactsSchema, f as BOARD_TICK_MS, ft as parseRef$1, g as OPERATIONS, h as roleCanUseOperation, i as SPUR_MIN_VERSION, it as sessionFactsSchema, j as sortSkillFiles, jt as externalQuietAfterMs, kt as configSchema, l as tokenRequestResultSchema, lt as encodeActorId, m as buildCatalogSnapshot, mt as err, n as SLACK_OFF_FIX, nt as prReviewRuleSchema, ot as JIRA_PROJECT_KEY, pt as ERRORS, q as REVIEW_DECISIONS, qt as isTodoGroupColumn, r as SLACK_PARTLY_FIX, rt as ringMarker, s as TOKEN_REQUEST_LIMITS, st as REF_NUMBER, t as assertNever, tt as prRefSchema, u as tokenRequestSchema, ut as errorCodeOf, v as inboxNoSessionSchema, vt as successEnvelopeSchema, w as conversationRefSchema, wt as RESERVED_PROJECT, y as turnHandedSchema, z as defaultBranchFactSchema, zt as COLUMN_GROUPS } from "./chunk-BebxFmW0.mjs";
1
+ import { $ as prApprovalPairSchema, A as skillReloadFilesSchema, At as defaultAddressee, B as entityRefSchema, Bt as COLUMN_IDS, C as SPACE_IDS, D as messageRefSchema, Dt as columnTurnTimings, E as interactionRefSchema, Et as boardWideSpurProject, F as AdapterError, Ft as resolveWebOrigin, G as trackerSourceId, Gt as TODO_GROUP_COLUMN_IDS, H as prSourceId, Ht as ITEM_KINDS, I as MIRROR_FAILURES, It as slackConfigured, J as REVIEW_STATES, K as PR_STATES, Kt as VIAS, L as MIRROR_FAILURE_CODES, Lt as BLOCK_TYPES, M as EVENT_KINDS, Mt as plainHttpAllowed, N as GATE_REASONS, Nt as readyMirrorOf, O as userIdSchema, Ot as configBindings, P as eventPayloadSchemas, Pt as requiredSecretKeys, Q as parseRingMarker, R as batchSchema, Rt as COLUMNS, St as DEFAULT_SLACK_COMMAND, T as inboundEventSchema, Tt as approvalRuleOf, U as sessionTransitionSchema, Ut as SLACK_BOT_SCOPES, V as mirrorSourceId, Vt as DISPATCHER_MODES, W as sourceCursorSchema, Wt as TASK_HOLDS, X as SESSION_STATUSES, Y as SESSION_HEALTH_STATES, Z as isExternalAuthor, _ as defaultBranchViewSchema, _t as ok, a as doctorReportSchema, at as ticketFactsSchema, b as renderHttpProblem, bt as DEFAULT_LINK, c as requestHashOf, ct as actorIdSchema, d as tokenRequestStatusSchema, dt as parseActorId, et as prFactsSchema, f as BOARD_TICK_MS, ft as parseRef$1, g as OPERATIONS, h as roleCanUseOperation, i as SPUR_MIN_VERSION, it as sessionFactsSchema, j as sortSkillFiles, jt as externalQuietAfterMs, kt as configSchema, l as tokenRequestResultSchema, lt as encodeActorId, m as buildCatalogSnapshot, mt as err, n as SLACK_OFF_FIX, nt as prReviewRuleSchema, ot as JIRA_PROJECT_KEY, pt as ERRORS, q as REVIEW_DECISIONS, qt as isTodoGroupColumn, r as SLACK_PARTLY_FIX, rt as ringMarker, s as TOKEN_REQUEST_LIMITS, st as REF_NUMBER, t as assertNever, tt as prRefSchema, u as tokenRequestSchema, ut as errorCodeOf, v as inboxNoSessionSchema, vt as successEnvelopeSchema, w as conversationRefSchema, wt as RESERVED_PROJECT, y as turnHandedSchema, z as defaultBranchFactSchema, zt as COLUMN_GROUPS } from "./chunk-CljtkzXu.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -28144,6 +28144,9 @@ function deniedReference(error) {
28144
28144
  function deniedBranchRule(error) {
28145
28145
  return (error.type === "FORBIDDEN" || error.type === "NOT_FOUND") && error.path?.[2] === "baseRef";
28146
28146
  }
28147
+ function deniedSuites(error) {
28148
+ return (error.type === "FORBIDDEN" || error.type === "NOT_FOUND") && error.path?.[2] === "statusCheckRollup" && error.path[3] === "commit";
28149
+ }
28147
28150
  const graphEnvelopeWire = z.object({
28148
28151
  errors: z.array(graphErrorWire).optional(),
28149
28152
  data: z.unknown()
@@ -28177,9 +28180,9 @@ const BRANCH_RULE_FIELDS = "refUpdateRule { pattern requiredApprovingReviewCount
28177
28180
  const prFields = (number, closing = false, reviewRule = false) => `id number url title updatedAt mergedAt closedAt state isDraft mergeable mergeStateStatus
28178
28181
  author { login } headRefName headRefOid${reviewRule ? `\n reviewDecision baseRef { ${BRANCH_RULE_FIELDS} }` : ""}
28179
28182
  statusCheckRollup { contexts(first: 100) { nodes {
28180
- ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt workflowRun { workflow { id } } app { id } } isRequired(pullRequestNumber: ${String(number)}) }
28183
+ ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt id workflowRun { event runNumber runAttempt workflow { id } } app { id } } isRequired(pullRequestNumber: ${String(number)}) }
28181
28184
  ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: ${String(number)}) }
28182
- } pageInfo { hasNextPage endCursor } } }
28185
+ } pageInfo { hasNextPage endCursor } } commit { checkSuites(first: 100) { nodes { id status createdAt workflowRun { event runNumber runAttempt workflow { id } } } pageInfo { hasNextPage } } } }
28183
28186
  reviews(first: 100) { nodes { ${REVIEW_FIELDS} } pageInfo { hasNextPage endCursor } }
28184
28187
  comments(last: 100) { ${COMMENT_FIELDS} }
28185
28188
  reviewThreads(first: 100) { nodes { ${THREAD_FIELDS} } pageInfo { hasNextPage endCursor } }
@@ -28207,7 +28210,7 @@ function detailQuery(numbers, closing = false, reviewRule = false) {
28207
28210
  function pageQuery(connection, bootstrap = false) {
28208
28211
  if (connection === "comments") return `query PrPage($owner: String!, $repo: String!, $number: Int!, $before: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { comments(last: 100, before: $before) { ${COMMENT_FIELDS} } } } }`;
28209
28212
  if (connection === "pullRequests") return `query DiscoveryPage($owner: String!, $repo: String!, $after: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, after: $after, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} } } }`;
28210
- return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt workflowRun { workflow { id } } app { id } } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ? THREAD_FIELDS : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
28213
+ return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt id workflowRun { event runNumber runAttempt workflow { id } } app { id } } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ? THREAD_FIELDS : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
28211
28214
  }
28212
28215
  const TREE_FIELDS = "tree { entries { name type mode oid } }";
28213
28216
  function commitsQuery() {
@@ -28313,6 +28316,12 @@ var GithubClient = class {
28313
28316
  }
28314
28317
  };
28315
28318
  // ../adapters/src/github/checks.ts
28319
+ const workflowRunWire = z.object({
28320
+ event: z.string().nullish(),
28321
+ runNumber: z.number().int().nullish(),
28322
+ runAttempt: z.number().int().nullish(),
28323
+ workflow: z.object({ id: z.string().min(1) })
28324
+ });
28316
28325
  const checkRunWire = z.object({
28317
28326
  __typename: z.literal("CheckRun"),
28318
28327
  name: z.string(),
@@ -28322,7 +28331,8 @@ const checkRunWire = z.object({
28322
28331
  completedAt: z.string().nullable(),
28323
28332
  checkSuite: z.object({
28324
28333
  createdAt: z.string(),
28325
- workflowRun: z.object({ workflow: z.object({ id: z.string().min(1) }) }).nullish(),
28334
+ id: z.string().nullish(),
28335
+ workflowRun: workflowRunWire.nullish(),
28326
28336
  app: z.object({ id: z.string().min(1) }).nullish()
28327
28337
  }).nullish(),
28328
28338
  isRequired: z.boolean().nullish()
@@ -28388,6 +28398,78 @@ function latestContexts(nodes) {
28388
28398
  }
28389
28399
  return [...latest.entries()].sort(([a, x], [b, y]) => contextName(x).localeCompare(contextName(y)) || a.localeCompare(b)).map(([, node]) => node);
28390
28400
  }
28401
+ /**
28402
+ * The head commit's check suites, read in the PR detail query. Actions creates a suite for each
28403
+ * workflow run when the run starts, before its jobs create check runs. A denied suite arrives as
28404
+ * a null node; a denied list or commit, or a list without nodes, arrives as null.
28405
+ */
28406
+ const suiteListWire = z.object({ checkSuites: z.object({
28407
+ nodes: z.array(z.object({
28408
+ id: z.string().nullish(),
28409
+ status: z.string(),
28410
+ createdAt: z.string(),
28411
+ workflowRun: workflowRunWire.nullable()
28412
+ }).nullable()).nullable(),
28413
+ pageInfo: z.object({ hasNextPage: z.boolean() })
28414
+ }).nullable() }).nullish();
28415
+ /**
28416
+ * What decides a required check run that reads skipped, as `latestContexts` keeps it. Of the
28417
+ * head's suites of its workflow and trigger event, from the suite list and the check runs and
28418
+ * joined by node id, only the newest decides, by creation time, then the workflow run's number
28419
+ * and attempt: its run of the same check (see `checkKey`) counts, finished or not; without one
28420
+ * the check is `pending` until that suite completes, then the skip stands. Older suites never
28421
+ * decide, and a run of another event, such as a manual dispatch, is not one of them. A missing,
28422
+ * denied or truncated suite list, a null suite in it, a missing event, a time that does not
28423
+ * parse, or a newest place the run number and attempt cannot break, decides nothing.
28424
+ */
28425
+ function skipDecision(node, nodes, commit) {
28426
+ if (node.__typename !== "CheckRun" || node.isRequired !== true) return void 0;
28427
+ if (checkState(node) !== "skipped") return void 0;
28428
+ const run = node.checkSuite?.workflowRun;
28429
+ const event = run?.event;
28430
+ const list = commit?.checkSuites;
28431
+ if (!run || !event || !list?.nodes || list.pageInfo.hasNextPage) return void 0;
28432
+ if (list.nodes.some((suite) => suite === null)) return void 0;
28433
+ const ofRun = (wire) => wire?.workflow.id === run.workflow.id && wire.event === event;
28434
+ const suites = [];
28435
+ const byId = /* @__PURE__ */ new Map();
28436
+ const add = (createdAt, id, wire, status) => {
28437
+ const known = id == null ? void 0 : byId.get(id);
28438
+ if (known !== void 0) {
28439
+ known.status ??= status;
28440
+ known.number ??= wire.runNumber ?? null;
28441
+ known.attempt ??= wire.runAttempt ?? null;
28442
+ return;
28443
+ }
28444
+ const suite = {
28445
+ at: Date.parse(createdAt),
28446
+ id: id ?? null,
28447
+ number: wire.runNumber ?? null,
28448
+ attempt: wire.runAttempt ?? null,
28449
+ status
28450
+ };
28451
+ suites.push(suite);
28452
+ if (suite.id !== null) byId.set(suite.id, suite);
28453
+ };
28454
+ for (const suite of list.nodes) if (suite !== null && ofRun(suite.workflowRun)) add(suite.createdAt, suite.id, suite.workflowRun, suite.status);
28455
+ for (const other of nodes) if (other.__typename === "CheckRun" && other.checkSuite && ofRun(other.checkSuite.workflowRun)) add(other.checkSuite.createdAt, other.checkSuite.id, other.checkSuite.workflowRun);
28456
+ if (suites.some((suite) => Number.isNaN(suite.at))) return void 0;
28457
+ const order = (a, b) => (a.number ?? 0) - (b.number ?? 0) || (a.attempt ?? 0) - (b.attempt ?? 0);
28458
+ suites.sort((a, b) => a.at - b.at || order(a, b));
28459
+ const newest = suites.at(-1);
28460
+ if (newest === void 0) return void 0;
28461
+ const tied = suites.filter((suite) => suite.at === newest.at);
28462
+ if (tied.length > 1) {
28463
+ if (tied.some((suite) => suite.number === null || suite.attempt === null)) return void 0;
28464
+ const next = tied.at(-2);
28465
+ if (next !== void 0 && order(next, newest) === 0) return void 0;
28466
+ }
28467
+ const key = checkKey(node);
28468
+ const [decider] = latestContexts(nodes.filter((other) => other.__typename === "CheckRun" && newest.id !== null && other.checkSuite?.id === newest.id && checkKey(other) === key));
28469
+ if (decider !== void 0) return decider;
28470
+ if (newest.status === void 0 || newest.status === "COMPLETED") return void 0;
28471
+ return "pending";
28472
+ }
28391
28473
  // ../adapters/src/github/discovery.ts
28392
28474
  const timestamp$1 = z.string().min(1).refine((value) => !Number.isNaN(Date.parse(value)));
28393
28475
  const discoveryNodeWire = z.object({
@@ -28693,7 +28775,10 @@ const prWire = z.object({
28693
28775
  author: actor,
28694
28776
  headRefName: z.string(),
28695
28777
  headRefOid: z.string(),
28696
- statusCheckRollup: z.object({ contexts: nodes(contextWire) }).nullish(),
28778
+ statusCheckRollup: z.object({
28779
+ contexts: nodes(contextWire),
28780
+ commit: suiteListWire
28781
+ }).nullish(),
28697
28782
  reviews: nodes(reviewWire),
28698
28783
  comments: nodes(commentWire),
28699
28784
  reviewThreads: nodes(threadWire),
@@ -28752,12 +28837,22 @@ function closingRefs(wire) {
28752
28837
  number: node.number
28753
28838
  }] : []);
28754
28839
  }
28755
- function latestChecks(nodes) {
28840
+ function latestChecks(nodes, commit) {
28841
+ const visible = (node) => ({
28842
+ state: checkState(node),
28843
+ completedAt: node.__typename === "StatusContext" ? null : node.completedAt
28844
+ });
28845
+ const shown = (node) => {
28846
+ const decided = skipDecision(node, nodes, commit);
28847
+ return decided === "pending" ? {
28848
+ state: "pending",
28849
+ completedAt: null
28850
+ } : visible(decided ?? node);
28851
+ };
28756
28852
  const values = latestContexts(nodes).map((node) => ({
28757
28853
  check: {
28758
28854
  name: contextName(node),
28759
- state: checkState(node),
28760
- completedAt: node.__typename === "StatusContext" ? null : node.completedAt
28855
+ ...shown(node)
28761
28856
  },
28762
28857
  required: node.isRequired === true
28763
28858
  }));
@@ -28928,7 +29023,7 @@ function reviewThread(node) {
28928
29023
  */
28929
29024
  function normalizePr(repo, value, rule, feedbackComplete, held = []) {
28930
29025
  const wire = parseWire(prWire, value, "Malformed GitHub PR response");
28931
- const checks = latestChecks(wire.statusCheckRollup?.contexts.nodes ?? []);
29026
+ const checks = latestChecks(wire.statusCheckRollup?.contexts.nodes ?? [], wire.statusCheckRollup?.commit);
28932
29027
  const state = wire.state === "MERGED" ? "merged" : wire.state === "CLOSED" ? "closed" : "open";
28933
29028
  const mergeable = wire.mergeable === "MERGEABLE" ? "mergeable" : wire.mergeable === "CONFLICTING" ? "conflicting" : "unknown";
28934
29029
  const rawMerge = wire.mergeStateStatus.toLowerCase();
@@ -29080,7 +29175,7 @@ const prPagingWire = z.looseObject({
29080
29175
  comments: backPagingWire,
29081
29176
  reviewThreads: pagingWire,
29082
29177
  reviewRequests: pagingWire,
29083
- statusCheckRollup: z.object({ contexts: pagingWire }).nullish(),
29178
+ statusCheckRollup: z.looseObject({ contexts: pagingWire }).nullish(),
29084
29179
  closingIssuesReferences: pagingWire.nullish()
29085
29180
  });
29086
29181
  const aliasWire = z.object({ pullRequest: prPagingWire.nullish() }).nullish();
@@ -29378,7 +29473,8 @@ function malformed(acc, error, ref) {
29378
29473
  }
29379
29474
  async function processPr(scope, acc, number, alias, data, scopedErrors, ref) {
29380
29475
  const ruleDenied = scopedErrors.some(deniedBranchRule);
29381
- const errors = withoutDeniedReferences(scopedErrors).filter((entry) => !deniedBranchRule(entry));
29476
+ const suitesDenied = scopedErrors.some(deniedSuites);
29477
+ const errors = withoutDeniedReferences(scopedErrors).filter((entry) => !deniedBranchRule(entry) && !deniedSuites(entry));
29382
29478
  requireCheckAccess(errors);
29383
29479
  const error = errors[0];
29384
29480
  if (error !== void 0) {
@@ -29421,12 +29517,17 @@ async function processPr(scope, acc, number, alias, data, scopedErrors, ref) {
29421
29517
  return;
29422
29518
  }
29423
29519
  const feedback = await readFeedback(scope, number, full.pr.comments, entryFor(scope.feedbackCursors, scope.repo, number), entryFor(scope.continuations, scope.repo, number), report);
29520
+ const rollup = full.pr.statusCheckRollup;
29424
29521
  const pr = {
29425
29522
  ...full.pr,
29426
29523
  comments: {
29427
29524
  ...full.pr.comments,
29428
29525
  nodes: feedback.nodes
29429
- }
29526
+ },
29527
+ ...suitesDenied && rollup ? { statusCheckRollup: {
29528
+ ...rollup,
29529
+ commit: null
29530
+ } } : {}
29430
29531
  };
29431
29532
  const facts = content(() => normalizePr(ref?.repo ?? scope.repo, pr, scope.keys, feedback.complete, feedback.held));
29432
29533
  if (facts instanceof AdapterError) {
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { S as renderMcpError, g as OPERATIONS, pt as ERRORS } from "./chunk-BebxFmW0.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-BbohDnMm.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DEHqpoRe.mjs";
1
+ import { S as renderMcpError, g as OPERATIONS, pt as ERRORS } from "./chunk-CljtkzXu.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-d2uszLEI.mjs";
3
+ import { a as memoryVerdictCache, l as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DbBNabCm.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";