spur-board 0.170.2 → 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";
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";