spur-board 0.67.0 → 0.69.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,5 +1,5 @@
1
- import { ct as configSchema, d as buildCatalogSnapshot, lt as plainHttpAllowed, p as OPERATIONS } from "./chunk-D4cCKVAP.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-DawDZw1u.mjs";
1
+ import { d as buildCatalogSnapshot, dt as configSchema, p as OPERATIONS, pt as plainHttpAllowed } from "./chunk-a_l5UPaU.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-eiqYso44.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";
@@ -55,6 +55,23 @@ const COLUMNS = [
55
55
  const COLUMN_IDS = COLUMNS.map((column) => column.id);
56
56
  /** Columns every project board has, enabled. */
57
57
  const REQUIRED_COLUMN_IDS = COLUMNS.filter((column) => column.required).map((column) => column.id);
58
+ /** Where a column's effective orchestrator comes from: its own column entry or top-level `spurProjects`. */
59
+ const COLUMN_BINDING_SOURCES = ["project", "board-wide"];
60
+ /**
61
+ * Where a project's effective operator comes from: its own `spurProjects`, top-level
62
+ * `spurProjects`, or, while no board-wide operator exists, another board project's list.
63
+ */
64
+ const OPERATOR_BINDING_SOURCES = [
65
+ "project",
66
+ "board-wide",
67
+ "other-project"
68
+ ];
69
+ /** Where the default Slack addressee comes from: `slack.defaultAddressee`, the board-wide operator or a project's operator. */
70
+ const ADDRESSEE_SOURCES = [
71
+ "config",
72
+ "board-wide",
73
+ "project"
74
+ ];
58
75
  /** Whether a task is on the board, outside the tracker filter, or archived. */
59
76
  const MEMBERSHIPS = [
60
77
  "active",
@@ -128,6 +145,7 @@ const GATE_CONDITIONS = [
128
145
  "no_conflict",
129
146
  "external_comments_handled",
130
147
  "comment_history_read",
148
+ "threads_resolved",
131
149
  "submit_on_head",
132
150
  "review_on_head",
133
151
  "approved",
@@ -302,15 +320,27 @@ const spurProject = z.strictObject({
302
320
  });
303
321
  const DEFAULT_CYCLE_LIMIT = 10;
304
322
  const DEFAULT_COURSE_CHECK = 3;
323
+ /** A built-in column id; an unknown string names the built-in columns. */
324
+ const columnId = z.enum(COLUMN_IDS, { error: (issue) => typeof issue.input === "string" ? `Unknown column ${JSON.stringify(issue.input)}: custom columns arrive with custom matchers and are not supported yet. Built-in columns: ${COLUMN_IDS.join(", ")}` : void 0 });
305
325
  const columnConfig = z.strictObject({
306
- id: z.enum(COLUMN_IDS, { error: (issue) => typeof issue.input === "string" ? `Unknown column ${JSON.stringify(issue.input)}: custom columns arrive with custom matchers and are not supported yet. Built-in columns: ${COLUMN_IDS.join(", ")}` : void 0 }).describe("The built-in column this entry configures."),
326
+ id: columnId.describe("The built-in column this entry configures."),
307
327
  enabled: z.boolean().default(true).describe("false skips the column: tasks move past it and its exit condition is not checked. todo, dev and done cannot be disabled."),
308
- orchestrator: nonEmpty.default("none").describe("Who takes the column's turns. none: the task's live worker session, else the operator. operator: the operator, who also gets the questions asked in the column. Otherwise the name of a spurProjects entry with role orchestrator or curator whose sessions orchestrate the column and get the questions others ask in it."),
309
- cycleLimit: z.int().min(1).default(DEFAULT_CYCLE_LIMIT).describe("How many times a task may return to Dev from this column before the board stops it for the operator. Returns by the column executor and for external comments count, a changes-requested review included (it is an external comment, not a separate return); a conflict, red CI and a draft do not."),
328
+ orchestrator: nonEmpty.default("none").describe("Who takes the column's turns. none: the task's live worker session, else the operator. operator: the operator, who also gets the questions asked in the column. Otherwise the name of a spurProjects entry with role orchestrator or curator whose sessions orchestrate the column and get the questions others ask in it. A column left at none, and enabled, takes the top-level spurProjects orchestrator that lists it."),
329
+ cycleLimit: z.int().min(1).default(DEFAULT_CYCLE_LIMIT).describe("How many times a task may return to Dev from this column before the board stops it for the operator. Returns by the column executor, for external comments and for unresolved review threads count, a changes-requested review included (it is an external comment, not a separate return); a conflict, red CI and a draft do not."),
310
330
  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."),
311
- courseCheckTo: nonEmpty.optional().describe("Who answers this column's course check: operator, the curator's name, or the name of a column orchestrator. 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.")
331
+ 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."),
332
+ 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.")
312
333
  });
313
- /** The board rules: required columns present and enabled, built-ins in canonical order. */
334
+ /** Columns a task never leaves through the Dev gate, so they cannot require resolved threads. */
335
+ const NO_THREAD_GATE = /* @__PURE__ */ new Set([
336
+ "todo",
337
+ "ready-for-dev",
338
+ "done"
339
+ ]);
340
+ /**
341
+ * The board rules: required columns present and enabled, resolved threads required only from Dev
342
+ * to Ready to Merge, built-ins in canonical order.
343
+ */
314
344
  function checkBoard(items, ctx) {
315
345
  rejectDuplicates(items, "id", "column", ctx);
316
346
  for (const required of REQUIRED_COLUMN_IDS) {
@@ -326,6 +356,13 @@ function checkBoard(items, ctx) {
326
356
  message: `Required column ${JSON.stringify(required)} cannot be disabled`
327
357
  });
328
358
  }
359
+ items.forEach((item, i) => {
360
+ if (item.requireResolvedThreads === true && NO_THREAD_GATE.has(item.id)) ctx.addIssue({
361
+ code: "custom",
362
+ path: [i, "requireResolvedThreads"],
363
+ message: `Column ${JSON.stringify(item.id)} cannot require resolved threads: set it on a column from dev to ready-to-merge`
364
+ });
365
+ });
329
366
  let previous = -1;
330
367
  items.forEach((item, i) => {
331
368
  const position = COLUMN_IDS.indexOf(item.id);
@@ -371,7 +408,7 @@ const projectSchema = z.strictObject({
371
408
  });
372
409
  curator ??= item.name;
373
410
  });
374
- }).default([]).describe("Spur projects whose sessions work on this board project, each with a role; at most one curator. Board commands from a session whose Spur project is in no spurProjects list are refused."),
411
+ }).default([]).describe("Spur projects whose sessions work on this board project, each with a role; at most one curator. An operator listed here replaces the top-level spurProjects operator for this project. Board commands from a session whose Spur project is in no spurProjects list, here or top-level, are refused."),
375
412
  columns: z.array(columnConfig).superRefine(checkBoard).default(() => COLUMN_IDS.map((id) => ({
376
413
  id,
377
414
  enabled: true,
@@ -494,13 +531,79 @@ function rejectSharedShortNames(items, ctx) {
494
531
  });
495
532
  });
496
533
  }
497
- /** The board config file. Every object rejects unknown keys; no key holds a secret. */
498
- const configSchema = z.strictObject({
534
+ /** A Spur project bound for every board project at once, in top-level `spurProjects`. */
535
+ const boardWideEntry = z.strictObject({
536
+ name: spurProject.shape.name.describe("The name of the project in Spur. It must not also be listed under any projects[].spurProjects, and none and operator are reserved."),
537
+ role: z.enum(["orchestrator", "operator"]).describe("orchestrator: sessions execute the listed columns in every board project that enables the column and leaves its orchestrator at none. operator: sessions act as the operator of every board project that lists no operator of its own; while one exists, a project's own operator acts only in its project. At most one operator."),
538
+ columns: z.array(columnId.describe("A built-in column this orchestrator executes.")).optional().describe("Required for role orchestrator, not allowed for operator. The columns it executes board-wide. A project column whose orchestrator is set to anything but none keeps it, and a disabled column is never filled; it must fill at least one column in some board project."),
539
+ shortName: spurProject.shape.shortName.describe("The name the operator types as @<shortName> at the start of a new message in the orchestrators channel to start a conversation with this Spur project's live session. Unique across the board, top-level and projects[].spurProjects alike."),
540
+ displayName: spurProject.shape.displayName.describe("The name Slack messages this Spur project's sessions write are posted under. Defaults to the Spur project name."),
541
+ icon: spurProject.shape.icon.describe("The emoji shortcode, such as :owl:, shown on those messages instead of the role icon.")
542
+ });
543
+ /** Checks within top-level `spurProjects`: R1 names, R2 reserved names, R3 shared columns, R6 operators, R8 columns. */
544
+ function checkBoardWide(items, ctx) {
545
+ rejectDuplicates(items, "name", "spur project name", ctx);
546
+ const bound = /* @__PURE__ */ new Map();
547
+ let operator;
548
+ items.forEach((item, i) => {
549
+ if (item.name === "none" || item.name === "operator") ctx.addIssue({
550
+ code: "custom",
551
+ path: [i, "name"],
552
+ message: `Spur project name ${JSON.stringify(item.name)} is reserved for columns[].orchestrator`
553
+ });
554
+ if (item.role === "operator") {
555
+ if (operator !== void 0) ctx.addIssue({
556
+ code: "custom",
557
+ path: [i, "role"],
558
+ message: `Second board-wide operator ${JSON.stringify(item.name)}: ${JSON.stringify(operator)} is already the board-wide operator`
559
+ });
560
+ operator ??= item.name;
561
+ if (item.columns !== void 0) ctx.addIssue({
562
+ code: "custom",
563
+ path: [i, "columns"],
564
+ message: `Board-wide operator ${JSON.stringify(item.name)} takes no columns: remove columns, or bind the column to operator in projects[].columns`
565
+ });
566
+ return;
567
+ }
568
+ if (item.columns === void 0 || item.columns.length === 0) {
569
+ ctx.addIssue({
570
+ code: "custom",
571
+ path: [i, "columns"],
572
+ message: `Board-wide orchestrator ${JSON.stringify(item.name)} needs columns: list the columns it executes`
573
+ });
574
+ return;
575
+ }
576
+ item.columns.forEach((column, j) => {
577
+ if (item.columns?.indexOf(column) !== j) {
578
+ ctx.addIssue({
579
+ code: "custom",
580
+ path: [i, "columns"],
581
+ message: `Duplicate column: ${JSON.stringify(column)}`
582
+ });
583
+ return;
584
+ }
585
+ const other = bound.get(column);
586
+ if (other === void 0) bound.set(column, item.name);
587
+ else ctx.addIssue({
588
+ code: "custom",
589
+ path: [
590
+ i,
591
+ "columns",
592
+ j
593
+ ],
594
+ message: `Column ${JSON.stringify(column)} is bound board-wide by ${JSON.stringify(other)} and ${JSON.stringify(item.name)}: bind it once`
595
+ });
596
+ });
597
+ });
598
+ }
599
+ /** The board config file before the checks across its sections. */
600
+ const configObject = z.strictObject({
499
601
  projects: z.array(projectSchema).min(1).superRefine((items, ctx) => {
500
602
  rejectDuplicates(items, "id", "project id", ctx);
501
603
  rejectSharedSpurProjects(items, ctx);
502
604
  rejectSharedShortNames(items, ctx);
503
- }).describe("Board projects, at least one. Each reads tasks from one tracker and PRs from its repos. A Spur project can be listed under only one board project."),
605
+ }).describe("Board projects, at least one. Each reads tasks from one tracker and PRs from its repos. A Spur project can be listed under only one board project; one that serves several goes in top-level spurProjects."),
606
+ spurProjects: z.array(boardWideEntry).superRefine(checkBoardWide).default([]).describe("Spur projects bound board-wide, each with role orchestrator or operator. A project-level binding wins for its own project. A Spur project here serves every board project it binds, and one of its sessions acts on the turns, inbox, questions and doorbells of each of them and no other."),
504
607
  operator: z.strictObject({ slack: nonEmpty.describe("Slack user ID of the operator, such as U0123456789. Slack commands, button presses and messages from anyone else are denied. A feed line the operator resolves names this user.") }),
505
608
  slack: z.strictObject({
506
609
  appName: z.string().trim().min(1).default(DEFAULT_SLACK_APP_NAME).describe("Slack app and bot display name that board slack manifest writes when --app-name is not given."),
@@ -510,7 +613,7 @@ const configSchema = z.strictObject({
510
613
  orchestrators: nonEmpty.optional().describe("Slack channel ID, such as C0123456789, where the board opens a thread for each block addressed to the operator by someone else. Once either channel is set, the daemon does not start without the other channel and SLACK_BOT_TOKEN, and without SLACK_APP_TOKEN it reads nothing from Slack."),
511
614
  feed: nonEmpty.optional().describe("Slack channel ID where the board posts a line for each curator answer, each newly installed version, each revoked operator token, each `/board tokens` list and each operator item, with the buttons the operator presses. Operator items about failed Slack posts, transport health, undelivered answers and ended workers, and those shown as operator blocks, get no feed line. A line whose item clears before it is first sent, such as an expired token request, is dropped. Set it together with orchestrators.")
512
615
  }).prefault({}),
513
- defaultAddressee: z.string().optional().describe("The shortName of the Spur project that gets a new orchestrators-channel message which does not start with a known @<shortName>. Without it, such a message gets one reply listing the valid prefixes. Ignored when no shortName is configured.")
616
+ defaultAddressee: z.string().optional().describe("The shortName, top-level or under projects[].spurProjects, of the Spur project that gets a new orchestrators-channel message which does not start with a known @<shortName>. Without it, such a message goes to the top-level spurProjects operator; without one, when any shortName is set, to the operator of the first board project that lists one; otherwise it gets one reply listing the valid prefixes, or is skipped when no shortName is configured.")
514
617
  }).prefault({}),
515
618
  thresholds: z.strictObject({
516
619
  staleMultiplier: z.number().min(1).default(3).describe("A source with no complete poll for this many of its poll intervals turns blind stale. board status marks that source, and an operator item whose fact is older than that, as stale."),
@@ -560,15 +663,193 @@ const configSchema = z.strictObject({
560
663
  maxEpisodeMs: durationMs(3e5, "Longest a host-load episode lasts before error flags resume")
561
664
  }).prefault({})
562
665
  }).prefault({})
563
- }).superRefine((config, ctx) => {
666
+ });
667
+ /** The project's copy of a top-level entry: its role and Slack identity, without `columns`. */
668
+ function boardWideCopy(entry) {
669
+ return {
670
+ name: entry.name,
671
+ role: entry.role,
672
+ ...entry.shortName === void 0 ? {} : { shortName: entry.shortName },
673
+ ...entry.displayName === void 0 ? {} : { displayName: entry.displayName },
674
+ ...entry.icon === void 0 ? {} : { icon: entry.icon }
675
+ };
676
+ }
677
+ /** Whether a board-wide orchestrator takes this column: listed, enabled and left at none. */
678
+ function fills(entry, column) {
679
+ return column.enabled && column.orchestrator === "none" && entry.columns?.includes(column.id) === true;
680
+ }
681
+ /**
682
+ * One board project with the top-level entries applied: an orchestrator fills each listed
683
+ * enabled column left at none, an operator joins a project without its own. Each entry that
684
+ * binds the project is appended to its `spurProjects`.
685
+ */
686
+ function expandProject(project, entries) {
687
+ const ownOperator = project.spurProjects.some((spur) => spur.role === "operator");
688
+ let columns = project.columns;
689
+ const added = [];
690
+ for (const entry of entries) {
691
+ if (entry.role === "operator") {
692
+ if (!ownOperator) added.push(boardWideCopy(entry));
693
+ continue;
694
+ }
695
+ if (!columns.some((column) => fills(entry, column))) continue;
696
+ columns = columns.map((column) => fills(entry, column) ? {
697
+ ...column,
698
+ orchestrator: entry.name
699
+ } : column);
700
+ added.push(boardWideCopy(entry));
701
+ }
702
+ if (added.length === 0) return project;
703
+ return {
704
+ ...project,
705
+ columns,
706
+ spurProjects: [...project.spurProjects, ...added]
707
+ };
708
+ }
709
+ function expandBoardWide(config) {
710
+ if (config.spurProjects.length === 0) return config;
711
+ return {
712
+ ...config,
713
+ projects: config.projects.map((project) => expandProject(project, config.spurProjects))
714
+ };
715
+ }
716
+ /** Checks between top-level `spurProjects` and the board projects: R4, R5, R7 and R9. */
717
+ function checkBoardWideAgainstProjects(config, ctx) {
718
+ const entries = config.spurProjects;
719
+ if (entries.length === 0) return;
720
+ const byName = new Map(entries.map((entry) => [entry.name, entry]));
721
+ config.projects.forEach((project, i) => {
722
+ project.spurProjects.forEach((spur, j) => {
723
+ if (!byName.has(spur.name)) return;
724
+ ctx.addIssue({
725
+ code: "custom",
726
+ path: [
727
+ "projects",
728
+ i,
729
+ "spurProjects",
730
+ j,
731
+ "name"
732
+ ],
733
+ message: `Spur project ${JSON.stringify(spur.name)} is bound board-wide in spurProjects and listed under projects[${project.id}].spurProjects as ${spur.role}: remove one; a board-wide Spur project serves every board project it binds`
734
+ });
735
+ });
736
+ });
737
+ const projectShortNames = new Set(config.projects.flatMap((project) => project.spurProjects.map((spur) => spur.shortName)));
738
+ const shortNames = /* @__PURE__ */ new Set();
739
+ entries.forEach((entry, i) => {
740
+ const name = JSON.stringify(entry.name);
741
+ if (entry.role === "orchestrator") {
742
+ if (!config.projects.some((project) => project.columns.some((c) => fills(entry, c)))) ctx.addIssue({
743
+ code: "custom",
744
+ path: [
745
+ "spurProjects",
746
+ i,
747
+ "columns"
748
+ ],
749
+ message: `Board-wide orchestrator ${name} executes no column: in every board project each listed column is missing, disabled or bound to another orchestrator`
750
+ });
751
+ } else if (config.projects.every((project) => project.spurProjects.some((spur) => spur.role === "operator"))) ctx.addIssue({
752
+ code: "custom",
753
+ path: [
754
+ "spurProjects",
755
+ i,
756
+ "name"
757
+ ],
758
+ message: `Board-wide operator ${name} serves no board project: every board project lists its own operator`
759
+ });
760
+ const { shortName } = entry;
761
+ if (shortName === void 0) return;
762
+ if (shortNames.has(shortName) || projectShortNames.has(shortName)) ctx.addIssue({
763
+ code: "custom",
764
+ path: [
765
+ "spurProjects",
766
+ i,
767
+ "shortName"
768
+ ],
769
+ message: `Duplicate short name: ${JSON.stringify(shortName)}`
770
+ });
771
+ shortNames.add(shortName);
772
+ });
773
+ }
774
+ /**
775
+ * The board config file. Every object rejects unknown keys; no key holds a secret. The parsed
776
+ * value has top-level `spurProjects` applied to every board project's columns and
777
+ * `spurProjects` (`expandBoardWide`), so readers of `projects[]` see the effective bindings.
778
+ */
779
+ const configSchema = configObject.superRefine(checkBoardWideAgainstProjects).superRefine((config, ctx) => {
564
780
  const addressee = config.slack.defaultAddressee;
565
781
  if (addressee === void 0) return;
566
- if (!config.projects.some((project) => project.spurProjects.some(({ shortName }) => shortName === addressee))) ctx.addIssue({
782
+ if (!(config.spurProjects.some(({ shortName }) => shortName === addressee) || config.projects.some((project) => project.spurProjects.some(({ shortName }) => shortName === addressee)))) ctx.addIssue({
567
783
  code: "custom",
568
784
  path: ["slack", "defaultAddressee"],
569
- message: `Unknown short name ${JSON.stringify(addressee)}: set it as projects[].spurProjects[].shortName first`
785
+ message: `Unknown short name ${JSON.stringify(addressee)}: set it as spurProjects[].shortName or projects[].spurProjects[].shortName first`
570
786
  });
571
- });
787
+ }).overwrite(expandBoardWide);
788
+ /** The top-level `spurProjects` entry named `name`: a Spur project bound board-wide. */
789
+ function boardWideSpurProject(config, name) {
790
+ return config.spurProjects.find((entry) => entry.name === name);
791
+ }
792
+ /**
793
+ * `slack.defaultAddressee`; else the board-wide operator; else, once any shortName is set, the
794
+ * operator of the first board project that lists one; else null.
795
+ */
796
+ function defaultAddressee(config) {
797
+ const projectSpurs = config.projects.flatMap((project) => project.spurProjects);
798
+ const named = config.slack.defaultAddressee;
799
+ if (named !== void 0) {
800
+ const spur = [...config.spurProjects, ...projectSpurs].find(({ shortName }) => shortName === named);
801
+ if (spur !== void 0) return {
802
+ spurProject: spur.name,
803
+ source: "config"
804
+ };
805
+ }
806
+ const boardWide = config.spurProjects.find((entry) => entry.role === "operator");
807
+ if (boardWide !== void 0) return {
808
+ spurProject: boardWide.name,
809
+ source: "board-wide"
810
+ };
811
+ if (![...config.spurProjects, ...projectSpurs].some(({ shortName }) => shortName !== void 0)) return null;
812
+ const operator = projectSpurs.find((spur) => spur.role === "operator");
813
+ return operator === void 0 ? null : {
814
+ spurProject: operator.name,
815
+ source: "project"
816
+ };
817
+ }
818
+ /**
819
+ * The effective column orchestrators and operators of `projects`, in config order, and the
820
+ * default Slack addressee. Columns that are disabled or left at none have no row. While no
821
+ * board-wide operator exists, each project also lists the other projects' operators, since those
822
+ * act on every board project then (`isOperator`).
823
+ */
824
+ function configBindings(config, projects) {
825
+ const source = (name) => boardWideSpurProject(config, name) === void 0 ? "project" : "board-wide";
826
+ const operatorsOf = (project) => project.spurProjects.filter((spur) => spur.role === "operator");
827
+ const boardWideOperator = config.spurProjects.some((entry) => entry.role === "operator");
828
+ const served = config.projects.filter((project) => projects.has(project.id));
829
+ return {
830
+ columns: served.flatMap((project) => project.columns.filter((column) => column.enabled && column.orchestrator !== "none").map((column) => ({
831
+ project: project.id,
832
+ column: column.id,
833
+ orchestrator: column.orchestrator,
834
+ source: source(column.orchestrator)
835
+ }))),
836
+ operators: served.flatMap((project) => {
837
+ const own = operatorsOf(project).map((spur) => ({
838
+ project: project.id,
839
+ operator: spur.name,
840
+ source: source(spur.name)
841
+ }));
842
+ if (boardWideOperator) return own;
843
+ const others = config.projects.filter((other) => other.id !== project.id).flatMap(operatorsOf).map((spur) => ({
844
+ project: project.id,
845
+ operator: spur.name,
846
+ source: "other-project"
847
+ }));
848
+ return [...own, ...others];
849
+ }),
850
+ defaultAddressee: defaultAddressee(config)
851
+ };
852
+ }
572
853
  /** Recognized names in the private secrets.env file; values never belong in config.yaml. */
573
854
  const SECRET_ENV_KEYS = [
574
855
  {
@@ -1214,7 +1495,12 @@ const prFactsSchema = z.strictObject({
1214
1495
  commitSha: commitShaSchema.describe("Commit the review was given on."),
1215
1496
  submittedAt: at$2.describe("When the review was submitted.")
1216
1497
  })).describe("The latest review of each reviewer, with the commit it was given on."),
1217
- reviewThreads: z.array(z.strictObject({ resolved: z.boolean().describe("Whether the review thread is resolved.") })).describe("Review threads on the pull request."),
1498
+ reviewThreads: z.array(z.strictObject({
1499
+ resolved: z.boolean().describe("Whether the review thread is resolved."),
1500
+ id: z.string().min(1).optional().describe("Node ID of the review thread; missing in facts stored by an earlier version."),
1501
+ url: webUrl.optional().describe("Web URL of the thread's first comment; missing in facts stored by an earlier version."),
1502
+ outdated: z.boolean().optional().describe("Whether the thread is on a diff line the head no longer has; missing in facts stored by an earlier version.")
1503
+ })).describe("Review threads on the pull request."),
1218
1504
  reviewRequests: z.array(z.strictObject({
1219
1505
  kind: z.enum(REVIEWER_KINDS).optional().describe("Kind of reviewer asked to review."),
1220
1506
  id: z.string().min(1).optional().describe("Login of the user or bot, or the slug of the team."),
@@ -1557,6 +1843,7 @@ const GATE_REASONS = [
1557
1843
  "mergeable_unknown",
1558
1844
  "external_comments",
1559
1845
  "comment_history_incomplete",
1846
+ "unresolved_threads",
1560
1847
  "no_submit_on_head",
1561
1848
  "no_review_on_head",
1562
1849
  "not_approved",
@@ -2159,7 +2446,12 @@ const turnViewSchema = z.strictObject({
2159
2446
  taken: z.strictObject({
2160
2447
  by: actorIdSchema,
2161
2448
  at: z.iso.datetime().describe("When the turn was taken, ISO 8601 UTC.")
2162
- }).nullable().describe("Who took the turn and when; null until it is taken.")
2449
+ }).nullable().describe("Who took the turn and when; null until it is taken."),
2450
+ threads: z.array(z.strictObject({
2451
+ id: z.string().min(1).describe("Node ID of the review thread."),
2452
+ url: z.url({ protocol: /^https?$/ }).describe("Web URL of the thread's first comment."),
2453
+ outdated: z.boolean().describe("Whether the thread is on a diff line the head no longer has.")
2454
+ }).describe("One unresolved review thread.")).min(1).optional().describe("The unresolved review threads on the task's open pull request, read live, in a Dev turn of a project requiring resolved threads; absent when none, or when the pull request is closed, merged or missing. Fix or answer each thread, then resolve it.")
2163
2455
  }).describe("A turn: the executor of a column is asked to act on a task.");
2164
2456
  /** A turn as `task.get` shows it: who executes it, whether it was taken, and how it closed. */
2165
2457
  const taskTurnSchema = turnViewSchema.pick({
@@ -2210,7 +2502,7 @@ const taskWhySchema = z.strictObject({
2210
2502
  gates: z.array(z.strictObject({
2211
2503
  column: z.enum(COLUMN_IDS).describe("Board column."),
2212
2504
  enabled: z.boolean().describe("Whether the column is enabled in the project."),
2213
- ok: z.boolean().describe("Whether the column's own exit conditions pass."),
2505
+ ok: z.boolean().describe("Whether the column's own exit conditions pass. Dev's threads_resolved counts once any enabled column requires resolved threads, while the gates left of that column ignore it."),
2214
2506
  blockedIn: z.enum(COLUMN_IDS).nullable().describe("Leftmost enabled column at or left of this one whose exit conditions fail; null when the cumulative gate passes."),
2215
2507
  conditions: z.array(gateConditionSchema).describe("The column's exit conditions, empty for a column without any.")
2216
2508
  }).describe("The gate of one column.")).describe("The gate of every column, To Do to Done; empty when the pull request facts are missing."),
@@ -2475,7 +2767,8 @@ const failed = (condition, reason) => ({
2475
2767
  });
2476
2768
  /**
2477
2769
  * The gates of a task in Review on a project with To Do, Dev, Review and Done enabled: Dev passes,
2478
- * Review waits for its review on head.
2770
+ * Review waits for its review on head. Ready to Merge is disabled, so no column requires resolved
2771
+ * threads and Dev's `threads_resolved` is met.
2479
2772
  */
2480
2773
  const reviewGates = [
2481
2774
  {
@@ -2504,6 +2797,7 @@ const reviewGates = [
2504
2797
  met("no_conflict"),
2505
2798
  met("external_comments_handled"),
2506
2799
  met("comment_history_read"),
2800
+ met("threads_resolved"),
2507
2801
  met("submit_on_head")
2508
2802
  ]
2509
2803
  },
@@ -2550,6 +2844,24 @@ const reviewGates = [
2550
2844
  conditions: []
2551
2845
  }
2552
2846
  ];
2847
+ /** The effective column orchestrators and operators of the requested projects (`configBindings`). */
2848
+ const statusBindingsSchema = z.strictObject({
2849
+ columns: z.array(z.strictObject({
2850
+ project: z.string().min(1).describe("Board project."),
2851
+ column: z.enum(COLUMN_IDS).describe("Enabled column with an orchestrator."),
2852
+ orchestrator: z.string().min(1).describe("Spur project, or operator, that takes the column turns."),
2853
+ source: z.enum(COLUMN_BINDING_SOURCES).describe("project: set in projects[].columns; board-wide: filled from top-level spurProjects.")
2854
+ }).describe("One column binding.")).describe("Column orchestrators of each requested project; columns left at none are absent."),
2855
+ operators: z.array(z.strictObject({
2856
+ project: z.string().min(1).describe("Board project."),
2857
+ operator: z.string().min(1).describe("Spur project acting as operator there."),
2858
+ source: z.enum(OPERATOR_BINDING_SOURCES).describe("project: its own spurProjects; board-wide: top-level spurProjects; other-project: another project's operator, without a board-wide one.")
2859
+ }).describe("One operator binding.")).describe("Operator Spur projects of each requested project."),
2860
+ defaultAddressee: z.strictObject({
2861
+ spurProject: z.string().min(1).describe("Spur project the message goes to."),
2862
+ source: z.enum(ADDRESSEE_SOURCES).describe("config: slack.defaultAddressee; board-wide: the board-wide operator; project: the operator of the first board project, in config order, that lists one.")
2863
+ }).nullable().describe("Who an orchestrators-channel message without a known @shortName goes to; null when it is left unhandled or answered with the prefixes.")
2864
+ }).describe("Effective column orchestrators, operators and default Slack addressee.");
2553
2865
  const taskOutput = z.strictObject({ task: taskViewSchema });
2554
2866
  const blockOutput = z.strictObject({ block: blockViewSchema });
2555
2867
  const itemOutput = z.strictObject({ item: itemViewSchema });
@@ -2596,7 +2908,8 @@ const OPERATIONS = [
2596
2908
  unlinkedPrs: z.array(statusUnlinkedPrSchema).describe("Observed pull requests without a task link; merged or closed ones with no change for over 7 days are left out."),
2597
2909
  unlinkedSessions: z.array(statusUnlinkedSessionSchema).describe("Observed sessions without a task link; ones ended, or gone from Spur's session list, for over 7 days are left out."),
2598
2910
  hiddenUnlinkedPrs: z.int().min(0).describe("Unlinked pull requests not listed: merged or closed, with no change for over 7 days. Counted within the requested projects; detail does not list them."),
2599
- hiddenUnlinkedSessions: z.int().min(0).describe("Unlinked sessions not listed: ended, or gone from Spur's session list, for over 7 days. Counted within the requested projects; detail does not list them.")
2911
+ hiddenUnlinkedSessions: z.int().min(0).describe("Unlinked sessions not listed: ended, or gone from Spur's session list, for over 7 days. Counted within the requested projects; detail does not list them."),
2912
+ bindings: statusBindingsSchema
2600
2913
  }),
2601
2914
  grants: operatorOrProjectAgent,
2602
2915
  errors: ["not_found"],
@@ -2632,7 +2945,24 @@ const OPERATIONS = [
2632
2945
  unlinkedPrs: [],
2633
2946
  unlinkedSessions: [],
2634
2947
  hiddenUnlinkedPrs: 0,
2635
- hiddenUnlinkedSessions: 0
2948
+ hiddenUnlinkedSessions: 0,
2949
+ bindings: {
2950
+ columns: [{
2951
+ project: "web",
2952
+ column: "review",
2953
+ orchestrator: "web-review",
2954
+ source: "project"
2955
+ }],
2956
+ operators: [{
2957
+ project: "web",
2958
+ operator: "hq",
2959
+ source: "board-wide"
2960
+ }],
2961
+ defaultAddressee: {
2962
+ spurProject: "hq",
2963
+ source: "board-wide"
2964
+ }
2965
+ }
2636
2966
  }
2637
2967
  }, {
2638
2968
  summary: "Show the board with full facts and links",
@@ -2662,7 +2992,12 @@ const OPERATIONS = [
2662
2992
  unlinkedPrs: [],
2663
2993
  unlinkedSessions: [],
2664
2994
  hiddenUnlinkedPrs: 0,
2665
- hiddenUnlinkedSessions: 0
2995
+ hiddenUnlinkedSessions: 0,
2996
+ bindings: {
2997
+ columns: [],
2998
+ operators: [],
2999
+ defaultAddressee: null
3000
+ }
2666
3001
  }
2667
3002
  }]
2668
3003
  }),
@@ -4067,4 +4402,4 @@ function assertNever(value) {
4067
4402
  throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
4068
4403
  }
4069
4404
  //#endregion
4070
- export { errorContextSchema as $, sessionTransitionSchema as A, prRefSchema as B, userIdSchema as C, batchSchema as D, AdapterError as E, SESSION_HEALTH_STATES as F, REF_NUMBER as G, sessionFactsSchema as H, SESSION_STATUSES as I, errorCodeOf as J, actorIdSchema as K, isExternalAuthor as L, trackerSourceId as M, PR_STATES as N, entityRefSchema as O, REVIEW_STATES as P, err as Q, parseRingMarker as R, messageRefSchema as S, eventPayloadSchemas as T, ticketFactsSchema as U, ringMarker as V, JIRA_PROJECT_KEY as W, parseRef as X, parseActorId as Y, ERRORS as Z, renderMcpError as _, requestHashOf as a, DEFAULT_SLACK_APP_NAME as at, inboundEventSchema as b, tokenRequestStatusSchema as c, configSchema as ct, buildCatalogSnapshot as d, COLUMN_IDS as dt, errorEnvelopeSchema as et, roleCanUseOperation as f, DISPATCHER_MODES as ft, renderJsonError as g, renderHttpProblem as h, TOKEN_REQUEST_LIMITS as i, DEFAULT_LINK as it, sourceCursorSchema as j, prSourceId as k, BOARD_TICK_MS as l, plainHttpAllowed as lt, turnHandedSchema as m, TASK_HOLDS as mt, doctorReportSchema as n, successEnvelopeSchema as nt, tokenRequestResultSchema as o, DEFAULT_SLACK_COMMAND as ot, OPERATIONS as p, SLACK_BOT_SCOPES as pt, encodeActorId as q, remoteDoctorReportSchema as r, DEFAULT_HTTP_PORT as rt, tokenRequestSchema as s, RESERVED_PROJECT as st, assertNever as t, ok as tt, SYSTEMD_SERVICE_SETTINGS as u, requiredSecretKeys as ut, SPACE_IDS as v, EVENT_KINDS as w, interactionRefSchema as x, conversationRefSchema as y, prFactsSchema as z };
4405
+ export { err as $, prSourceId as A, prFactsSchema as B, userIdSchema as C, AdapterError as D, eventPayloadSchemas as E, REVIEW_STATES as F, JIRA_PROJECT_KEY as G, ringMarker as H, SESSION_HEALTH_STATES as I, encodeActorId as J, REF_NUMBER as K, SESSION_STATUSES as L, sourceCursorSchema as M, trackerSourceId as N, batchSchema as O, PR_STATES as P, ERRORS as Q, isExternalAuthor as R, messageRefSchema as S, GATE_REASONS as T, sessionFactsSchema as U, prRefSchema as V, ticketFactsSchema as W, parseActorId as X, errorCodeOf as Y, parseRef as Z, renderMcpError as _, SLACK_BOT_SCOPES as _t, requestHashOf as a, DEFAULT_LINK as at, inboundEventSchema as b, tokenRequestStatusSchema as c, RESERVED_PROJECT as ct, buildCatalogSnapshot as d, configSchema as dt, errorContextSchema as et, roleCanUseOperation as f, defaultAddressee as ft, renderJsonError as g, DISPATCHER_MODES as gt, renderHttpProblem as h, COLUMN_IDS as ht, TOKEN_REQUEST_LIMITS as i, DEFAULT_HTTP_PORT as it, sessionTransitionSchema as j, entityRefSchema as k, BOARD_TICK_MS as l, boardWideSpurProject as lt, turnHandedSchema as m, requiredSecretKeys as mt, doctorReportSchema as n, ok as nt, tokenRequestResultSchema as o, DEFAULT_SLACK_APP_NAME as ot, OPERATIONS as p, plainHttpAllowed as pt, actorIdSchema as q, remoteDoctorReportSchema as r, successEnvelopeSchema as rt, tokenRequestSchema as s, DEFAULT_SLACK_COMMAND as st, assertNever as t, errorEnvelopeSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, configBindings as ut, SPACE_IDS as v, TASK_HOLDS as vt, EVENT_KINDS as w, interactionRefSchema as x, conversationRefSchema as y, parseRingMarker as z };
@@ -1,4 +1,4 @@
1
- import { $ as errorContextSchema, Z as ERRORS, c as tokenRequestStatusSchema, et as errorEnvelopeSchema, g as renderJsonError, nt as successEnvelopeSchema, o as tokenRequestResultSchema } from "./chunk-D4cCKVAP.mjs";
1
+ import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-a_l5UPaU.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 { K as actorIdSchema, Z as ERRORS, a as requestHashOf, ct as configSchema, f as roleCanUseOperation, nt as successEnvelopeSchema, p as OPERATIONS, pt as SLACK_BOT_SCOPES, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as requiredSecretKeys } from "./chunk-D4cCKVAP.mjs";
1
+ import { Q as ERRORS, _t as SLACK_BOT_SCOPES, a as requestHashOf, dt as configSchema, f as roleCanUseOperation, mt as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-a_l5UPaU.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-DAMwWWmT.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-DawDZw1u.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-BywmJyLe.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-eiqYso44.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-CxD6ZAl9.mjs";
5
5
  import { createHash, randomBytes, randomUUID } from "node:crypto";
6
6
  import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
7
7
  import { homedir, hostname, userInfo } from "node:os";
@@ -568,7 +568,7 @@ async function runDoctor(options = {}) {
568
568
  }
569
569
  }
570
570
  const unknown = [...states].filter(([, state]) => state === "unknown").map(([name]) => name);
571
- checks.push(configured.size === 0 ? result("skills.codex_visibility", true, codexVisibilityFix) : projectPaths === null ? warning("skills.codex_visibility", "Start Spur or correct adapters.spur.baseUrl in config.yaml, then rerun board doctor to check the Codex skill install.") : [...states.values()].includes("broken") ? result("skills.codex_visibility", false, codexVisibilityFix) : missing.length > 0 || unknown.length > 0 ? warning("skills.codex_visibility", [...missing.length > 0 ? [`Correct spurProjects in config.yaml or register these projects in Spur${listing(safeIds(missing))}.`] : [], ...unknown.length > 0 ? [`Check that projects.<id>.symlinks in each project's spur.yaml lists .agents/skills/spur-board${listing(safeIds(unknown))}.`] : []].join(" ")) : result("skills.codex_visibility", true, codexVisibilityFix));
571
+ checks.push(configured.size === 0 ? result("skills.codex_visibility", true, codexVisibilityFix) : projectPaths === null ? warning("skills.codex_visibility", "Start Spur or correct adapters.spur.baseUrl in config.yaml, then rerun board doctor to check the Codex skill install.") : [...states.values()].includes("broken") ? result("skills.codex_visibility", false, codexVisibilityFix) : missing.length > 0 || unknown.length > 0 ? warning("skills.codex_visibility", [...missing.length > 0 ? [`Correct spurProjects or projects[].spurProjects in config.yaml or register these projects in Spur${listing(safeIds(missing))}.`] : [], ...unknown.length > 0 ? [`Check that projects.<id>.symlinks in each project's spur.yaml lists .agents/skills/spur-board${listing(safeIds(unknown))}.`] : []].join(" ")) : result("skills.codex_visibility", true, codexVisibilityFix));
572
572
  const oldSessions = codexSessions.filter((session) => session.project !== void 0 && states.get(session.project) === "ok" && !(session.cwd !== void 0 && ports.exists(join(session.cwd, ".agents", "skills", "spur-board", "SKILL.md")) || session.codexHome !== void 0 && ports.exists(join(session.codexHome, "skills", "spur-board", "SKILL.md"))));
573
573
  checks.push(oldSessions.length > 0 ? warning("sessions.codex_skill", `Start new Spur sessions to replace Codex sessions created before the skill link${listing(safeIds([...new Set(oldSessions.map((session) => session.id))]))}; Spur links .agents/skills/spur-board only into new worktrees.`) : result("sessions.codex_skill", true, "Start new Spur sessions."));
574
574
  const version = ports.productVersion();
package/dist/client.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-DawDZw1u.mjs";
1
+ import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-eiqYso44.mjs";
2
2
  export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };