spur-board 0.131.0 → 0.133.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,4 +1,4 @@
1
- import { _ as renderJsonError, at as errorContextSchema, c as tokenRequestStatusSchema, ct as successEnvelopeSchema, o as tokenRequestResultSchema, ot as errorEnvelopeSchema, rt as ERRORS } from "./chunk-CY_rWPWy.mjs";
1
+ import { _ as renderJsonError, at as ERRORS, c as tokenRequestStatusSchema, ct as errorEnvelopeSchema, o as tokenRequestResultSchema, st as errorContextSchema, ut as successEnvelopeSchema } from "./chunk-CcqlB4rN.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
@@ -119,6 +119,11 @@ const CHECKS_GATE_COLUMNS = [
119
119
  "product-review",
120
120
  "external-review"
121
121
  ];
122
+ /**
123
+ * What `projects[].columns[].approvalRule` on External Review lets a task leave on: any external
124
+ * approval, or that and the repository's own GitHub review rule for the PR head.
125
+ */
126
+ const APPROVAL_RULES = ["any-approval", "github-rules"];
122
127
  /** Where a column's effective orchestrator comes from: its own column entry or top-level `spurProjects`. */
123
128
  const COLUMN_BINDING_SOURCES = ["project", "board-wide"];
124
129
  /**
@@ -221,6 +226,7 @@ const GATE_CONDITIONS = [
221
226
  "submit_on_head",
222
227
  "review_on_head",
223
228
  "approved",
229
+ "review_rule_satisfied",
224
230
  "merged"
225
231
  ];
226
232
  /**
@@ -456,10 +462,19 @@ const columnConfig = z.strictObject({
456
462
  courseCheck: z.int().min(0).default(DEFAULT_COURSE_CHECK).describe("How many returns to Dev from this column, counted as for cycleLimit, before the board holds the task and asks courseCheckTo (by default the curator, or the operator when the project has no curator) to check its course. The answer resets the count and reaches the worker as a task comment. 0 turns the check off; cycleLimit is checked first."),
457
463
  courseCheckTo: nonEmpty.optional().describe("Who answers this column's course check: operator, the curator's name, or the name of a column orchestrator listed in this project's spurProjects; a board-wide orchestrator is refused. Without it, the curator, or the operator when the project has no curator. When the addressee has no live session the question moves to the operator; a conductor that is rung and does not answer keeps it, and the operator gets an item."),
458
464
  requireResolvedThreads: z.boolean().optional().describe("true: a task leaves this column, and every column right of it, only when its PR has no unresolved review thread; an unresolved one sends it back to Dev, and the worker's Dev turn lists each thread. Outdated threads count; a thread counts until someone resolves it, whoever wrote it. Defaults to true on ready-to-merge and false elsewhere; allowed on dev through ready-to-merge."),
465
+ approvalRule: z.enum(APPROVAL_RULES).optional().describe("What lets a task leave External Review. any-approval, the default: an approval by someone other than operatorGithubLogin and no changes requested by one. github-rules: that, and GitHub's review rule for the PR's base branch, from branch protection and rulesets, met on the PR's head: no changes requested (GitHub's review decision counts only once the merge state is computed), a required check completed, or, when none is required, every check except skipped ones green and at least one (no checks at all also counts); and the merge not blocked. A required check, one GitHub marks required or a context the rule lists, pending or without a run GitHub marks required holds the head on CI unless the merge state is clean, unstable or has hooks. Only on the external-review column; a disabled one ignores it."),
459
466
  quietTurnAfterMs: z.int().min(1).optional().describe("How long the orchestrator session holding a turn of this column may sit quiet at its prompt before the board reminds it, then raises a stuck-turn anomaly, in milliseconds. Defaults to health.idleInDevAfterMs. Named orchestrator only: allowed on an enabled column whose orchestrator is a Spur project, set here or filled board-wide; a worker or operator turn left in the column keeps health.idleInDevAfterMs."),
460
467
  noRecipientAfterMs: z.int().min(1).optional().describe("How long an untaken turn of this column may wait with no live session to ring before the board raises one operator item for the project and column, in milliseconds. The time runs from the later of the turn ring's creation and the moment the last session that could take it stopped being a recipient: the first of its end, leaving Spur's list or reaching a finished state (stopped, killed, errored or completed), so later changes in the same gap do not move it. Sessions that could take it are those of the column's Spur project and the task's linked orchestrator. Defaults to 600000 (10 minutes). Named orchestrator only: allowed on an enabled column whose orchestrator is a Spur project, set here or filled board-wide.")
461
468
  });
462
469
  const TURN_TIMING_KEYS = ["quietTurnAfterMs", "noRecipientAfterMs"];
470
+ /**
471
+ * The approval rule of a project's External Review: github-rules only when its enabled
472
+ * external-review column sets it, else any-approval.
473
+ */
474
+ function approvalRuleOf(project) {
475
+ const column = project.columns.find((entry) => entry.id === "external-review");
476
+ return column?.enabled === true && column.approvalRule === "github-rules" ? "github-rules" : "any-approval";
477
+ }
463
478
  /** Columns a task never leaves through the Dev gate, so they cannot require resolved threads. */
464
479
  const NO_THREAD_GATE = /* @__PURE__ */ new Set([...TODO_GROUP_COLUMN_IDS, "done"]);
465
480
  /**
@@ -482,6 +497,11 @@ function checkBoard(items, ctx) {
482
497
  });
483
498
  }
484
499
  items.forEach((item, i) => {
500
+ if (item.approvalRule !== void 0 && item.id !== "external-review") ctx.addIssue({
501
+ code: "custom",
502
+ path: [i, "approvalRule"],
503
+ message: `Column ${JSON.stringify(item.id)} cannot set approvalRule: approvalRule is allowed only on the external-review column`
504
+ });
485
505
  if (item.requireResolvedThreads === true && NO_THREAD_GATE.has(item.id)) ctx.addIssue({
486
506
  code: "custom",
487
507
  path: [i, "requireResolvedThreads"],
@@ -1801,6 +1821,28 @@ const prFactsSchema = z.strictObject({
1801
1821
  feedback: z.array(feedbackSchema).optional().describe("Comments and submitted reviews on the pull request, oldest first, without their text."),
1802
1822
  feedbackComplete: z.boolean().optional().describe("Whether feedback holds every comment back to the last one handed over, or to the start of the pull request; missing reads as incomplete.")
1803
1823
  }).describe("Facts about one pull request.");
1824
+ /** GitHub's review verdict on a pull request, as its review rule reads it. */
1825
+ const REVIEW_DECISIONS = [
1826
+ "approved",
1827
+ "changes_requested",
1828
+ "review_required"
1829
+ ];
1830
+ /** One base branch's review rule, merged over its branch protection and rulesets. */
1831
+ const reviewRuleSchema = z.strictObject({
1832
+ sources: z.array(z.enum(["branch-protection", "ruleset"])).describe("Where the rule was read: branch protection, rulesets, both or neither."),
1833
+ approvals: z.int().min(0).nullable().describe("The largest required approval count of any source; null when none sets one."),
1834
+ codeOwners: z.boolean().describe("Whether any source requires a code owner review."),
1835
+ conversationResolution: z.boolean().describe("Whether any source requires every review conversation resolved."),
1836
+ requiredChecks: z.array(z.string().min(1)).describe("Check names any source requires, once each.")
1837
+ }).describe("The base branch's review rule.");
1838
+ /**
1839
+ * What a full read of a pull request says about the review rule of its base branch. It travels
1840
+ * beside the PR facts, never inside them, and only for a project that follows the rule.
1841
+ */
1842
+ const prReviewRuleSchema = z.strictObject({
1843
+ reviewDecision: z.enum(REVIEW_DECISIONS).nullable().describe("GitHub's review verdict on the head; null when GitHub gives none or a new one."),
1844
+ rule: reviewRuleSchema.nullable().describe("Null when the token could not read the rule; the head then has no decision from the read.")
1845
+ }).describe("The pull request's review verdict and its base branch's review rule.");
1804
1846
  /**
1805
1847
  * Whether a comment or review came from outside: not by `agentLogin` in any letter case and not
1806
1848
  * by a bot. A deleted account counts as external.
@@ -1917,7 +1959,8 @@ const batchItemSchema = z.discriminatedUnion("kind", [
1917
1959
  z.strictObject({
1918
1960
  kind: z.literal("pr").describe("Pull request facts."),
1919
1961
  facts: prFactsSchema,
1920
- continuation: z.strictObject({ resume: sourceCursorSchema.nullable().describe("Opaque position to read further back from; null at the start of the PR.") }).nullable().optional().describe("Comment history core holds for the next poll (A10): omitted says nothing, null drops it, an object holds facts.feedback with resume.")
1962
+ continuation: z.strictObject({ resume: sourceCursorSchema.nullable().describe("Opaque position to read further back from; null at the start of the PR.") }).nullable().optional().describe("Comment history core holds for the next poll (A10): omitted says nothing, null drops it, an object holds facts.feedback with resume."),
1963
+ reviewRule: prReviewRuleSchema.optional().describe("GitHub's review verdict and the base branch's review rule from this full read, sent only for a project whose External Review sets approvalRule github-rules; omitted says nothing new.")
1921
1964
  }),
1922
1965
  z.strictObject({
1923
1966
  kind: z.literal("ticket").describe("Ticket facts."),
@@ -2150,6 +2193,10 @@ const GATE_REASONS = [
2150
2193
  "no_submit_on_head",
2151
2194
  "no_review_on_head",
2152
2195
  "not_approved",
2196
+ "changes_requested",
2197
+ "review_rule_blocked",
2198
+ "merge_state_unknown",
2199
+ "review_rule_unreadable",
2153
2200
  "not_merged"
2154
2201
  ];
2155
2202
  /** Why the dispatcher moved a task. */
@@ -2914,10 +2961,10 @@ const taskWhySchema = z.strictObject({
2914
2961
  turn: turnViewSchema.nullable().describe("The open turn of the task; null when none is open."),
2915
2962
  moves: z.array(moveViewSchema).describe("The last 5 column moves, oldest first."),
2916
2963
  waiting: z.array(z.strictObject({
2917
- reason: z.enum(GATE_REASONS).describe("The gate reason that waits on the fact; checks_red only when the project checksGate is not dev."),
2964
+ reason: z.enum(GATE_REASONS).describe("The gate reason that waits on the fact; checks_red only when the project checksGate is not dev, and review_rule_blocked, changes_requested, merge_state_unknown and review_rule_unreadable only when External Review sets approvalRule github-rules."),
2918
2965
  head: commitShaSchema.describe("Head commit of the pull request the fact is about."),
2919
- text: z.string().describe("The fact in one line, e.g. waiting for CI on <sha>. When the project checksGate is not dev, checks_pending reads checks running, exit from <checksGate> waits for green, and checks_red reads checks red.")
2920
- }).describe("One fact the task waits for.")).min(1).optional().describe("Facts the task waits for that GitHub has not settled yet, plus red checks the task returns to Dev on when the project checksGate is not dev; absent when none.")
2966
+ text: z.string().describe("The fact in one line, e.g. waiting for CI on <sha>. When the project checksGate is not dev, checks_pending reads checks running, exit from <checksGate> waits for green, and checks_red reads checks red. Under approvalRule github-rules, review_rule_blocked reads merge blocked by the GitHub review rule, changes_requested reads changes requested, merge_state_unknown reads GitHub has not computed the merge state yet, and review_rule_unreadable reads the GitHub review rule for the base branch could not be read, none with the sha.")
2967
+ }).describe("One fact the task waits for.")).min(1).optional().describe("Facts the task waits for that GitHub has not settled yet, plus red checks the task returns to Dev on when the project checksGate is not dev, and the GitHub review rule waits under approvalRule github-rules; absent when none.")
2921
2968
  }).describe("Why the task is in its column and what the dispatcher waits for.");
2922
2969
  const itemViewSchema = z.strictObject({
2923
2970
  id: itemIdSchema,
@@ -5458,4 +5505,4 @@ const remoteDoctorReportSchema = z.object({
5458
5505
  function assertNever(value) {
5459
5506
  throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
5460
5507
  }
5461
- export { encodeActorId as $, eventPayloadSchemas as A, TODO_GROUP_COLUMN_IDS as At, REVIEW_STATES as B, messageRefSchema as C, COLUMNS as Ct, sortSkillFiles as D, ITEM_KINDS as Dt, skillReloadFilesSchema as E, DISPATCHER_MODES as Et, prSourceId as F, prFactsSchema as G, SESSION_STATUSES as H, sessionTransitionSchema as I, sessionFactsSchema as J, prRefSchema as K, sourceCursorSchema as L, batchSchema as M, isTodoGroupColumn as Mt, defaultBranchFactSchema as N, EVENT_KINDS as O, SLACK_BOT_SCOPES as Ot, entityRefSchema as P, actorIdSchema as Q, trackerSourceId as R, interactionRefSchema as S, resolveWebOrigin as St, skillReloadFileSchema as T, COLUMN_IDS as Tt, isExternalAuthor as U, SESSION_HEALTH_STATES as V, parseRingMarker as W, JIRA_PROJECT_KEY as X, ticketFactsSchema as Y, REF_NUMBER as Z, renderJsonError as _, configBindings as _t, requestHashOf as a, errorContextSchema as at, conversationRefSchema as b, plainHttpAllowed as bt, tokenRequestStatusSchema as c, successEnvelopeSchema as ct, buildCatalogSnapshot as d, DEFAULT_SLACK_APP_NAME as dt, errorCodeOf as et, roleCanUseOperation as f, DEFAULT_SLACK_COMMAND as ft, renderHttpProblem as g, columnTurnTimings as gt, turnHandedSchema as h, boardWideSpurProject as ht, TOKEN_REQUEST_LIMITS as i, err as it, AdapterError as j, VIAS as jt, GATE_REASONS as k, TASK_HOLDS as kt, BOARD_TICK_MS as l, DEFAULT_HTTP_PORT as lt, defaultBranchViewSchema as m, RESERVED_PROJECT as mt, doctorReportSchema as n, parseRef as nt, tokenRequestResultSchema as o, errorEnvelopeSchema as ot, OPERATIONS as p, DEFAULT_STAND_PORT_RANGE as pt, ringMarker as q, remoteDoctorReportSchema as r, ERRORS as rt, tokenRequestSchema as s, ok as st, assertNever as t, parseActorId as tt, SYSTEMD_SERVICE_SETTINGS as u, DEFAULT_LINK as ut, renderMcpError as v, configSchema as vt, userIdSchema as w, COLUMN_GROUPS as wt, inboundEventSchema as x, requiredSecretKeys as xt, SPACE_IDS as y, defaultAddressee as yt, PR_STATES as z };
5508
+ export { REF_NUMBER as $, eventPayloadSchemas as A, ITEM_KINDS as At, REVIEW_DECISIONS as B, messageRefSchema as C, plainHttpAllowed as Ct, sortSkillFiles as D, COLUMN_GROUPS as Dt, skillReloadFilesSchema as E, COLUMNS as Et, prSourceId as F, isTodoGroupColumn as Ft, parseRingMarker as G, SESSION_HEALTH_STATES as H, sessionTransitionSchema as I, prReviewRuleSchema as J, prFactsSchema as K, sourceCursorSchema as L, batchSchema as M, TASK_HOLDS as Mt, defaultBranchFactSchema as N, TODO_GROUP_COLUMN_IDS as Nt, EVENT_KINDS as O, COLUMN_IDS as Ot, entityRefSchema as P, VIAS as Pt, JIRA_PROJECT_KEY as Q, trackerSourceId as R, interactionRefSchema as S, defaultAddressee as St, skillReloadFileSchema as T, resolveWebOrigin as Tt, SESSION_STATUSES as U, REVIEW_STATES as V, isExternalAuthor as W, sessionFactsSchema as X, ringMarker as Y, ticketFactsSchema as Z, renderJsonError as _, approvalRuleOf as _t, requestHashOf as a, ERRORS as at, conversationRefSchema as b, configBindings as bt, tokenRequestStatusSchema as c, errorEnvelopeSchema as ct, buildCatalogSnapshot as d, DEFAULT_HTTP_PORT as dt, actorIdSchema as et, roleCanUseOperation as f, DEFAULT_LINK as ft, renderHttpProblem as g, RESERVED_PROJECT as gt, turnHandedSchema as h, DEFAULT_STAND_PORT_RANGE as ht, TOKEN_REQUEST_LIMITS as i, parseRef as it, AdapterError as j, SLACK_BOT_SCOPES as jt, GATE_REASONS as k, DISPATCHER_MODES as kt, BOARD_TICK_MS as l, ok as lt, defaultBranchViewSchema as m, DEFAULT_SLACK_COMMAND as mt, doctorReportSchema as n, errorCodeOf as nt, tokenRequestResultSchema as o, err as ot, OPERATIONS as p, DEFAULT_SLACK_APP_NAME as pt, prRefSchema as q, remoteDoctorReportSchema as r, parseActorId as rt, tokenRequestSchema as s, errorContextSchema as st, assertNever as t, encodeActorId as tt, SYSTEMD_SERVICE_SETTINGS as u, successEnvelopeSchema as ut, renderMcpError as v, boardWideSpurProject as vt, userIdSchema as w, requiredSecretKeys as wt, inboundEventSchema as x, configSchema as xt, SPACE_IDS as y, columnTurnTimings as yt, PR_STATES as z };
@@ -1,5 +1,5 @@
1
- import { bt as plainHttpAllowed, d as buildCatalogSnapshot, p as OPERATIONS, vt as configSchema } from "./chunk-CY_rWPWy.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-DfehZM2s.mjs";
1
+ import { Ct as plainHttpAllowed, d as buildCatalogSnapshot, p as OPERATIONS, xt as configSchema } from "./chunk-CcqlB4rN.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-BC8T5XHO.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";
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { D as sortSkillFiles, Ot as SLACK_BOT_SCOPES, Q as actorIdSchema, St as resolveWebOrigin, T as skillReloadFileSchema, a as requestHashOf, ct as successEnvelopeSchema, f as roleCanUseOperation, p as OPERATIONS, pt as DEFAULT_STAND_PORT_RANGE, r as remoteDoctorReportSchema, rt as ERRORS, u as SYSTEMD_SERVICE_SETTINGS, vt as configSchema, xt as requiredSecretKeys } from "./chunk-CY_rWPWy.mjs";
1
+ import { D as sortSkillFiles, T as skillReloadFileSchema, Tt as resolveWebOrigin, a as requestHashOf, at as ERRORS, et as actorIdSchema, f as roleCanUseOperation, ht as DEFAULT_STAND_PORT_RANGE, jt as SLACK_BOT_SCOPES, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as successEnvelopeSchema, wt as requiredSecretKeys, xt as configSchema } from "./chunk-CcqlB4rN.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-DfehZM2s.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-BUWlIiQd.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-BC8T5XHO.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-CjHIyoJR.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";
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-DfehZM2s.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-BC8T5XHO.mjs";