spur-board 0.72.0 → 0.73.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.
@@ -204,6 +204,10 @@ const SLACK_BOT_SCOPES = [
204
204
  * range 32768-60999.
205
205
  */
206
206
  const DEFAULT_HTTP_PORT = 4777;
207
+ const DEFAULT_STAND_PORT_RANGE = {
208
+ min: 4780,
209
+ max: 4799
210
+ };
207
211
  const DEFAULT_SLACK_APP_NAME = "spur-board";
208
212
  const DEFAULT_SLACK_COMMAND = "/board";
209
213
  /**
@@ -247,6 +251,19 @@ function plainHttpAllowed(url) {
247
251
  const host = url.hostname;
248
252
  return host === "localhost" || host === "[::1]" || LOOPBACK_IPV4.test(host);
249
253
  }
254
+ /** Check raw syntax before URL normalization can hide a slash, whitespace or backslash. */
255
+ function validOrigin(value, port) {
256
+ const resolved = port === void 0 ? value : value.replaceAll("{port}", String(port));
257
+ if (!/^https?:\/\/[^/\\\s?#@{}]+$/i.test(resolved)) return false;
258
+ try {
259
+ const url = new URL(resolved);
260
+ return url.username === "" && url.password === "" && plainHttpAllowed(url);
261
+ } catch {
262
+ return false;
263
+ }
264
+ }
265
+ const originError = "Expected a bare HTTP/HTTPS origin; HTTP requires loopback, with no path, trailing slash, query, fragment, credentials or invalid placeholders";
266
+ const concreteOrigin = z.string().refine((value) => validOrigin(value), { error: originError });
250
267
  const jiraTracker = z.strictObject({
251
268
  type: z.literal("jira").describe("jira: tasks come from the Jira issues jql returns, read with JIRA_EMAIL and JIRA_API_TOKEN from secrets.env."),
252
269
  baseUrl: z.url({ protocol: /^https?$/ }).refine((value) => {
@@ -640,6 +657,15 @@ const configObject = z.strictObject({
640
657
  });
641
658
  }).prefault({}),
642
659
  http: z.strictObject({ port: z.int().min(0).max(65535).default(DEFAULT_HTTP_PORT).describe("Local HTTP API port (0 assigns a free port). The default 4777 is above 4310-4399, a margin kept for Spur's server port 4310 and the ports from 4311 upward that its MCP port takes, and avoids Spur's ports 5555 and 8730-8799 and the Linux ephemeral range 32768-60999.") }).prefault({}),
660
+ web: z.strictObject({
661
+ port: z.int().min(0).max(65535).optional().describe("Optional web listener port (0 assigns a free port); omitted means off. Set together with publicOrigin. Must differ from http.port, including when both are 0. This config does not start a listener."),
662
+ publicOrigin: z.string().optional().describe("Bare public HTTP/HTTPS origin for the web API; HTTP requires loopback. Set together with port. Every {port} is replaced with the listener port, including in hostnames. No trailing slash. The resolved origin must remain valid and HTTP loopback-only after actual-port substitution; the resolver returns no origin for an invalid actual port or resulting origin."),
663
+ spurUiOrigin: concreteOrigin.optional().describe("Optional concrete bare origin for the Spur UI, independently of the web API. HTTP requires loopback; no placeholders or trailing slash. Omitted means no configured UI origin.")
664
+ }).prefault({}),
665
+ stand: z.strictObject({ portRange: z.strictObject({
666
+ min: z.int().min(1024).max(65535).default(DEFAULT_STAND_PORT_RANGE.min).describe("Inclusive first stand port; defaults to 4780 when a range is supplied."),
667
+ max: z.int().min(1024).max(65535).default(DEFAULT_STAND_PORT_RANGE.max).describe("Inclusive last stand port; defaults to 4799 when a range is supplied.")
668
+ }).optional().describe("Optional stand port range, effectively 4780..4799 when omitted. An explicit range (including {}) must exclude http.port and web.port; an omitted range preserves legacy configs and doctor warns on overlaps. Range allocation and exclusions are deferred to #534; current stand behavior is unchanged.") }).prefault({}),
643
669
  adapters: z.strictObject({
644
670
  spur: spurAdapterSection,
645
671
  github: adapterSection(6e4),
@@ -777,6 +803,39 @@ function checkBoardWideAgainstProjects(config, ctx) {
777
803
  * `spurProjects` (`expandBoardWide`), so readers of `projects[]` see the effective bindings.
778
804
  */
779
805
  const configSchema = configObject.superRefine(checkBoardWideAgainstProjects).superRefine((config, ctx) => {
806
+ const { web } = config;
807
+ if (web.publicOrigin !== void 0 && !validOrigin(web.publicOrigin, web.port)) ctx.addIssue({
808
+ code: "custom",
809
+ path: ["web", "publicOrigin"],
810
+ message: originError
811
+ });
812
+ if (web.port === void 0 !== (web.publicOrigin === void 0)) ctx.addIssue({
813
+ code: "custom",
814
+ path: ["web", web.port === void 0 ? "port" : "publicOrigin"],
815
+ message: "Set web.port and web.publicOrigin together"
816
+ });
817
+ if (web.port !== void 0 && web.port === config.http.port) ctx.addIssue({
818
+ code: "custom",
819
+ path: ["web", "port"],
820
+ message: "Web port must differ from http.port"
821
+ });
822
+ const range = config.stand.portRange;
823
+ if (range !== void 0) {
824
+ if (range.min > range.max) ctx.addIssue({
825
+ code: "custom",
826
+ path: [
827
+ "stand",
828
+ "portRange",
829
+ "max"
830
+ ],
831
+ message: "Range maximum must be at least its minimum"
832
+ });
833
+ for (const [field, port] of [["http", config.http.port], ["web", web.port]]) if (port !== void 0 && port >= range.min && port <= range.max) ctx.addIssue({
834
+ code: "custom",
835
+ path: ["stand", "portRange"],
836
+ message: `Stand port range includes ${field}.port ${String(port)}`
837
+ });
838
+ }
780
839
  const addressee = config.slack.defaultAddressee;
781
840
  if (addressee === void 0) return;
782
841
  if (!(config.spurProjects.some(({ shortName }) => shortName === addressee) || config.projects.some((project) => project.spurProjects.some(({ shortName }) => shortName === addressee)))) ctx.addIssue({
@@ -785,6 +844,18 @@ const configSchema = configObject.superRefine(checkBoardWideAgainstProjects).sup
785
844
  message: `Unknown short name ${JSON.stringify(addressee)}: set it as spurProjects[].shortName or projects[].spurProjects[].shortName first`
786
845
  });
787
846
  }).overwrite(expandBoardWide);
847
+ /**
848
+ * Resolve validated web settings without mutation or I/O. Returns undefined when off, or when
849
+ * the effective port is not an integer in 0..65535 or its substituted origin violates the
850
+ * config origin policy. Invalid overrides never expose a URL parser error or unsafe origin.
851
+ */
852
+ function resolveWebOrigin(web, actualPort) {
853
+ if (web.port === void 0 || web.publicOrigin === void 0) return void 0;
854
+ const port = actualPort ?? web.port;
855
+ if (!Number.isInteger(port) || port < 0 || port > 65535) return void 0;
856
+ if (!validOrigin(web.publicOrigin, port)) return void 0;
857
+ return new URL(web.publicOrigin.replaceAll("{port}", String(port))).origin;
858
+ }
788
859
  /** The top-level `spurProjects` entry named `name`: a Spur project bound board-wide. */
789
860
  function boardWideSpurProject(config, name) {
790
861
  return config.spurProjects.find((entry) => entry.name === name);
@@ -4476,4 +4547,4 @@ function assertNever(value) {
4476
4547
  throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
4477
4548
  }
4478
4549
  //#endregion
4479
- 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 };
4550
+ 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 _, COLUMN_IDS as _t, requestHashOf as a, DEFAULT_LINK as at, inboundEventSchema as b, TASK_HOLDS as bt, tokenRequestStatusSchema as c, DEFAULT_STAND_PORT_RANGE as ct, buildCatalogSnapshot as d, configBindings as dt, errorContextSchema as et, roleCanUseOperation as f, configSchema as ft, renderJsonError as g, resolveWebOrigin as gt, renderHttpProblem as h, requiredSecretKeys as ht, TOKEN_REQUEST_LIMITS as i, DEFAULT_HTTP_PORT as it, sessionTransitionSchema as j, entityRefSchema as k, BOARD_TICK_MS as l, RESERVED_PROJECT as lt, turnHandedSchema as m, plainHttpAllowed as mt, doctorReportSchema as n, ok as nt, tokenRequestResultSchema as o, DEFAULT_SLACK_APP_NAME as ot, OPERATIONS as p, defaultAddressee 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, boardWideSpurProject as ut, SPACE_IDS as v, DISPATCHER_MODES as vt, EVENT_KINDS as w, interactionRefSchema as x, conversationRefSchema as y, SLACK_BOT_SCOPES as yt, parseRingMarker as z };
@@ -1,4 +1,4 @@
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-Di9QGxO1.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-DL9OvxPQ.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
@@ -1,5 +1,5 @@
1
- import { d as buildCatalogSnapshot, dt as configSchema, p as OPERATIONS, pt as plainHttpAllowed } from "./chunk-Di9QGxO1.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-QCOwDTOu.mjs";
1
+ import { d as buildCatalogSnapshot, ft as configSchema, mt as plainHttpAllowed, p as OPERATIONS } from "./chunk-DL9OvxPQ.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-aWb9sMi0.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 { 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-Di9QGxO1.mjs";
1
+ import { Q as ERRORS, a as requestHashOf, ct as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, ht as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS, yt as SLACK_BOT_SCOPES } from "./chunk-DL9OvxPQ.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-QCOwDTOu.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-BRdjSAl1.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-aWb9sMi0.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-mUsK73x3.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";
@@ -513,6 +513,14 @@ async function runDoctor(options = {}) {
513
513
  checks.push(result("config", false, "Create or correct config.yaml using the configuration schema."));
514
514
  return checks;
515
515
  }
516
+ const webOrigin = resolveWebOrigin(config.web);
517
+ checks.push({
518
+ ...result("web", true, ""),
519
+ present: webOrigin === void 0 ? ["off"] : ["on", webOrigin]
520
+ });
521
+ const range = config.stand.portRange ?? DEFAULT_STAND_PORT_RANGE;
522
+ const overlaps = [["http.port", config.http.port], ["web.port", config.web.port]].filter(([, port]) => port !== void 0 && port >= range.min && port <= range.max).map(([field, port]) => `${field} ${String(port)}`);
523
+ checks.push(overlaps.length === 0 ? result("stand.port_range", true, "") : warning("stand.port_range", `Implicit stand port range ${String(range.min)}..${String(range.max)} overlaps ${overlaps.join(", ")}. Set a nonoverlapping stand.portRange. Range allocation and exclusions are deferred to #534; current stand behavior is unchanged.`));
516
524
  if (options.offline) return checks;
517
525
  const unitPath = unitFile(env, home);
518
526
  let unit = null;
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-QCOwDTOu.mjs";
1
+ import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-aWb9sMi0.mjs";
2
2
  export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as SLACK_BOT_SCOPES, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, c as tokenRequestStatusSchema, ct as RESERVED_PROJECT, d as buildCatalogSnapshot, dt as configSchema, f as roleCanUseOperation, ft as defaultAddressee, gt as DISPATCHER_MODES, h as renderHttpProblem, ht as COLUMN_IDS, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as boardWideSpurProject, m as turnHandedSchema, mt as requiredSecretKeys, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as plainHttpAllowed, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as configBindings, v as SPACE_IDS, vt as TASK_HOLDS, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, z as parseRingMarker } from "./chunk-Di9QGxO1.mjs";
1
+ import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as COLUMN_IDS, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, bt as TASK_HOLDS, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as configBindings, f as roleCanUseOperation, ft as configSchema, h as renderHttpProblem, ht as requiredSecretKeys, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as RESERVED_PROJECT, m as turnHandedSchema, mt as plainHttpAllowed, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as defaultAddressee, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as boardWideSpurProject, v as SPACE_IDS, vt as DISPATCHER_MODES, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, yt as SLACK_BOT_SCOPES, z as parseRingMarker } from "./chunk-DL9OvxPQ.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { createHash, randomUUID } from "node:crypto";
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-Di9QGxO1.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-QCOwDTOu.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-BRdjSAl1.mjs";
1
+ import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-DL9OvxPQ.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-aWb9sMi0.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-mUsK73x3.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.72.0",
3
+ "version": "0.73.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"