spur-board 0.11.1 → 0.11.2

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.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { H as requiredSecretKeys, N as ERRORS, U as SLACK_BOT_SCOPES, V as configSchema, l as OPERATIONS, n as SYSTEMD_SERVICE_SETTINGS } from "./src-Dl5c0sRb.mjs";
2
- import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-DbeVLW2G.mjs";
3
- import { a as memoryVerdictCache, c as loadEnrollmentConfig, i as fileVerdictCache, l as resolveDaemonAddress, n as cliPackageVersion, o as configFile, s as loadClientConfig, t as checkCatalog } from "./config-B1OeBAM-.mjs";
1
+ import { H as requiredSecretKeys, N as ERRORS, U as SLACK_BOT_SCOPES, V as configSchema, c as roleCanUseOperation, l as OPERATIONS, n as SYSTEMD_SERVICE_SETTINGS } from "./src-CjlXSUX-.mjs";
2
+ import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-B3aIcQ5T.mjs";
3
+ import { a as memoryVerdictCache, c as loadEnrollmentConfig, i as fileVerdictCache, l as resolveDaemonAddress, n as cliPackageVersion, o as configFile, s as loadClientConfig, t as checkCatalog } from "./config-DWp8J6RP.mjs";
4
4
  import { createHash, randomBytes, randomUUID } from "node:crypto";
5
5
  import { chmodSync, closeSync, constants, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, statSync, unlinkSync, writeFileSync } from "node:fs";
6
6
  import { homedir, hostname, userInfo } from "node:os";
@@ -880,6 +880,22 @@ function shellValue(value) {
880
880
  const text = String(value);
881
881
  return /^[A-Za-z0-9_./#:@-]+$/.test(text) ? text : JSON.stringify(text);
882
882
  }
883
+ /** The identity an operation in the selected input mode needs, when only one kind of caller can run it. */
884
+ function identityHint(op, mode) {
885
+ const flag = op.cli.modes?.find((item) => item.mode === mode)?.flag;
886
+ const command = `\`board ${op.cli.command}${flag ? ` ${flag}` : ""}\``;
887
+ 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.`;
888
+ if (!roleCanUseOperation(op, "operator", mode)) return `${command} needs an agent identity: run it in a Spur session of a project listed in config.yaml.`;
889
+ }
890
+ function loadOperationConfig(op, input, env) {
891
+ try {
892
+ return loadClientConfig(env);
893
+ } catch (error) {
894
+ const hint = identityHint(op, typeof input === "object" && input !== null && "mode" in input && typeof input.mode === "string" ? input.mode : void 0);
895
+ if (error instanceof CliError && error.code === "identity_missing" && hint) throw new CliError(error.code, error.context, error.requestId, hint);
896
+ throw error;
897
+ }
898
+ }
883
899
  function exampleCommand(op, input) {
884
900
  const words = ["board", op.cli.command];
885
901
  for (const arg of op.cli.args) {
@@ -1076,7 +1092,7 @@ function createProgram(options = {}) {
1076
1092
  if (keyOption === "") throw new CliError("usage");
1077
1093
  if (keyOption !== void 0 && escapeTerminalControls(keyOption) !== keyOption) throw new CliError("usage", void 0, void 0, "The idempotency key must contain only printable characters.");
1078
1094
  if (op.kind === "mutation" && env["SPUR_SESSION"] && !keyOption) throw new CliError("usage");
1079
- const config = options.clientConfig ?? loadClientConfig(env);
1095
+ const config = options.clientConfig ?? loadOperationConfig(op, input, env);
1080
1096
  const key = op.kind === "mutation" ? keyOption || randomUUID() : void 0;
1081
1097
  if (key) io.stderr(`key: ${escapeTerminalControls(key)}\n`);
1082
1098
  let instance;
@@ -1,4 +1,4 @@
1
- import { F as errorEnvelopeSchema, I as successEnvelopeSchema, N as ERRORS, P as errorContextSchema, d as renderJsonError } from "./src-Dl5c0sRb.mjs";
1
+ import { F as errorEnvelopeSchema, I as successEnvelopeSchema, N as ERRORS, P as errorContextSchema, d as renderJsonError } from "./src-CjlXSUX-.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
@@ -153,7 +153,7 @@ function send({ method, path, body, config, anonymous, decode, observe }) {
153
153
  }
154
154
  /** Shared daemon HTTP client. The CLI owns output; this module owns transport and wire parsing. */
155
155
  async function requestOperation(op, input, key, config, observe) {
156
- if (!config.session && !config.token) throw new CliError("config");
156
+ if (!config.session && !config.token) throw new CliError("identity_missing");
157
157
  return send({
158
158
  method: "POST",
159
159
  path: `/v1/ops/${encodeURIComponent(op.id)}`,
package/dist/client.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-DbeVLW2G.mjs";
1
+ import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-B3aIcQ5T.mjs";
2
2
  export { fetchCatalogVersion, requestOperation, requestTokenEnrollment };
@@ -1,5 +1,5 @@
1
- import { V as configSchema, l as OPERATIONS, s as buildCatalogSnapshot } from "./src-Dl5c0sRb.mjs";
2
- import { i as CliError, t as fetchCatalogVersion } from "./client-DbeVLW2G.mjs";
1
+ import { V as configSchema, l as OPERATIONS, s as buildCatalogSnapshot } from "./src-CjlXSUX-.mjs";
2
+ import { i as CliError, t as fetchCatalogVersion } from "./client-B3aIcQ5T.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";
@@ -90,7 +90,10 @@ function loadClientConfig(env = process.env, paths = {
90
90
  const address = resolveDaemonAddress(env, paths.home);
91
91
  const session = env["SPUR_SESSION"] || void 0;
92
92
  const token = session ? void 0 : env["BOARD_TOKEN"] === void 0 ? findTokenFile(paths.cwd, paths.home) : env["BOARD_TOKEN"];
93
- if (!session && !token) throw new CliError("config", { environmentVariable: "BOARD_TOKEN" });
93
+ if (!session && !token) {
94
+ if (env["BOARD_TOKEN"] === "") throw new CliError("config", { environmentVariable: "BOARD_TOKEN" });
95
+ throw new CliError("identity_missing");
96
+ }
94
97
  return {
95
98
  address,
96
99
  session,
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as parseActorId, B as RESERVED_PROJECT, C as prFactsSchema, D as actorIdSchema, E as ticketFactsSchema, H as requiredSecretKeys, I as successEnvelopeSchema, M as taskKeySchema, N as ERRORS, O as encodeActorId, S as SESSION_STATUSES, T as sessionFactsSchema, U as SLACK_BOT_SCOPES, V as configSchema, _ as messageRefSchema, a as entityRefSchema, b as eventPayloadSchemas, c as roleCanUseOperation, g as interactionRefSchema, h as inboundEventSchema, i as batchSchema, j as parseRef$1, k as errorCodeOf, l as OPERATIONS, m as conversationRefSchema, o as sourceCursorSchema, p as SPACE_IDS, r as AdapterError, s as buildCatalogSnapshot, t as BOARD_TICK_MS, u as renderHttpProblem, v as userIdSchema, w as prRefSchema, x as SESSION_HEALTH_STATES, y as EVENT_KINDS, z as DEFAULT_SLACK_COMMAND } from "./src-Dl5c0sRb.mjs";
1
+ import { A as parseActorId, B as RESERVED_PROJECT, C as prFactsSchema, D as actorIdSchema, E as ticketFactsSchema, H as requiredSecretKeys, I as successEnvelopeSchema, M as taskKeySchema, N as ERRORS, O as encodeActorId, S as SESSION_STATUSES, T as sessionFactsSchema, U as SLACK_BOT_SCOPES, V as configSchema, _ as messageRefSchema, a as entityRefSchema, b as eventPayloadSchemas, c as roleCanUseOperation, g as interactionRefSchema, h as inboundEventSchema, i as batchSchema, j as parseRef$1, k as errorCodeOf, l as OPERATIONS, m as conversationRefSchema, o as sourceCursorSchema, p as SPACE_IDS, r as AdapterError, s as buildCatalogSnapshot, t as BOARD_TICK_MS, u as renderHttpProblem, v as userIdSchema, w as prRefSchema, x as SESSION_HEALTH_STATES, y as EVENT_KINDS, z as DEFAULT_SLACK_COMMAND } from "./src-CjlXSUX-.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { closeSync, existsSync, fstatSync, ftruncateSync, mkdirSync, openSync, readFileSync, readdirSync, writeSync } from "node:fs";
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { N as ERRORS, f as renderMcpError, l as OPERATIONS } from "./src-Dl5c0sRb.mjs";
2
- import { i as CliError, n as requestOperation } from "./client-DbeVLW2G.mjs";
3
- import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-B1OeBAM-.mjs";
1
+ import { N as ERRORS, f as renderMcpError, l as OPERATIONS } from "./src-CjlXSUX-.mjs";
2
+ import { i as CliError, n as requestOperation } from "./client-B3aIcQ5T.mjs";
3
+ import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-DWp8J6RP.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";
@@ -551,6 +551,13 @@ const ERRORS = {
551
551
  hint: "Fix the configuration file named in the error, then run the command again.",
552
552
  recovery: noRetry("Fix the named configuration file and retry.")
553
553
  }),
554
+ identity_missing: spec("identity_missing", {
555
+ status: null,
556
+ exit: EXIT_CODES.config,
557
+ 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.",
558
+ 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.",
559
+ recovery: noRetry("Get a caller identity as the fix says, then run the command again.")
560
+ }),
554
561
  outcome_unknown: spec("outcome_unknown", {
555
562
  status: null,
556
563
  exit: EXIT_CODES.outcomeUnknown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"