@workpowers/speckle 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -26,6 +26,34 @@ claude mcp add speckle -s user \
26
26
  Generate the key at **Account → MCP** (`/account#mcp`) on your Speckle host. One
27
27
  key covers every project you have access to.
28
28
 
29
+ ### Desktop and other GUI hosts
30
+
31
+ A desktop client starts the router from a fixed directory of its own — usually
32
+ your home directory — and its MCP client negotiates no `roots` capability, so
33
+ there is no way for it to tell the router where you are working. Name the
34
+ directory yourself:
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "speckle": {
40
+ "command": "npx",
41
+ "args": ["-y", "@workpowers/speckle"],
42
+ "env": {
43
+ "SPECKLE_MCP_BASE_URL": "https://speckle.workpowers.ai",
44
+ "SPECKLE_MCP_KEY": "lsk_your_key_here",
45
+ "SPECKLE_MCP_WORKSPACE_ROOT": "/Users/you/code/your-repo"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ Without it the session still works, but it runs rootless: discovery tools only,
53
+ and it cannot tell the server anything about your checkout — so freshness stays
54
+ `unknown` no matter what is installed on disk. `speckle-mcp doctor` prints which
55
+ directory it searched.
56
+
29
57
  ## Point a repo at a project
30
58
 
31
59
  Commit a `.speckle` marker at the repo root:
@@ -87,9 +115,16 @@ which makes it the right first command when something feels off.
87
115
  |---|---|---|
88
116
  | `SPECKLE_MCP_KEY` | yes | Your API key. The only secret the router accepts. |
89
117
  | `SPECKLE_MCP_BASE_URL` | yes | The Speckle host. A marker's own `speckle_url` wins over it, so a repo can point at a different host than your default. |
118
+ | `SPECKLE_MCP_WORKSPACE_ROOT` | no | Directory to resolve the `.speckle` marker from, for hosts that cannot launch the router inside your repo. Takes priority over the process working directory. |
90
119
  | `SPECKLE_PROJECT_ID` | no | Fallback project binding for contexts with no marker. |
91
120
  | `SPECKLE_MCP_ALLOW_REPO_MISMATCH` | no | Set to `1` to proceed when the marker's repo does not match the checkout. |
92
121
 
122
+ `SPECKLE_MCP_WORKSPACE_ROOT` and `SPECKLE_PROJECT_ID` answer different
123
+ questions and do not substitute for each other. The project id says *which
124
+ project* a markerless session talks to; the workspace root says *which
125
+ directory on disk* to read. Only the second gives the router a checkout to
126
+ observe, so only the second lets it report whether your `SPECKLE.md` is current.
127
+
93
128
  A key is scoped to one Speckle host. If the marker selects a host your
94
129
  `SPECKLE_MCP_BASE_URL` disagrees with, the router refuses rather than sending
95
130
  your key somewhere it does not belong.
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@
13
13
  import { writeFileSync, existsSync } from "node:fs";
14
14
  import path from "node:path";
15
15
  import { renderSpeckleMarker } from "./marker.js";
16
- import { resolveWorkspace } from "./workspace.js";
16
+ import { resolveWorkspace, workspaceOptionsFromConfig } from "./workspace.js";
17
17
  import { loadRouterConfig, resolveSpeckleHost } from "./config.js";
18
18
  import { SpeckleRouterError } from "./errors.js";
19
19
  import { runWorkflowCommand } from "./workflow-command.js";
@@ -87,16 +87,22 @@ function runDoctor() {
87
87
  let config;
88
88
  try {
89
89
  config = loadRouterConfig();
90
- report.config = { baseUrl: config.baseUrl, keyConfigured: Boolean(config.apiKey) };
90
+ report.config = {
91
+ baseUrl: config.baseUrl,
92
+ keyConfigured: Boolean(config.apiKey),
93
+ // Named explicitly: when a marker is not found, the first question is
94
+ // always which directory was actually searched.
95
+ workspaceRoot: config.workspaceRoot ?? null,
96
+ workspaceRootSource: config.workspaceRoot ? "SPECKLE_MCP_WORKSPACE_ROOT" : "process cwd",
97
+ };
91
98
  }
92
99
  catch (err) {
93
100
  report.config = formatError(err);
94
101
  }
95
102
  try {
96
- const workspace = resolveWorkspace({
97
- cwd: process.cwd(),
98
- allowRepoMismatch: config?.allowRepoMismatch ?? false,
99
- });
103
+ const workspace = resolveWorkspace(config
104
+ ? workspaceOptionsFromConfig(config)
105
+ : { cwd: process.cwd(), allowRepoMismatch: false });
100
106
  report.workspace = {
101
107
  workspaceRoot: workspace.workspaceRoot,
102
108
  markerPath: workspace.markerPath,
@@ -141,6 +147,10 @@ function printHelp() {
141
147
  " --url <speckle_url> Optional Speckle host URL when not using the default.",
142
148
  " --force Overwrite an existing .speckle file.",
143
149
  " speckle-mcp doctor Diagnose local config and marker state (no network).",
150
+ "",
151
+ "Environment:",
152
+ " SPECKLE_MCP_WORKSPACE_ROOT Directory to resolve the .speckle marker from,",
153
+ " for hosts that launch the router outside the repo.",
144
154
  " speckle-mcp workflow Fetch live guidance and preview dedicated local files.",
145
155
  " --apply Apply after ownership checks; review the Git diff.",
146
156
  " --cache Also keep planning guidance for explicit offline fallback.",
package/dist/config.d.ts CHANGED
@@ -4,6 +4,13 @@
4
4
  * The router accepts only one secret (`SPECKLE_MCP_KEY`) and one optional
5
5
  * host hint (`SPECKLE_MCP_BASE_URL`). Everything else — project context,
6
6
  * repo identity — comes from the committed `.speckle` marker.
7
+ *
8
+ * `SPECKLE_MCP_WORKSPACE_ROOT` says WHERE to look for that marker when the
9
+ * process cannot be started inside the repo. A GUI host launches the router
10
+ * from a fixed directory, and its MCP client offers no `roots` capability to
11
+ * negotiate one, so the path has to arrive as launch configuration. It is a
12
+ * claim about where work happens, never proof of it: the marker still has to
13
+ * be there, and the repo cross-check still applies.
7
14
  */
8
15
  export interface RouterConfig {
9
16
  /** Speckle MCP base URL — `<host>/mcp` is constructed from this. */
@@ -12,8 +19,14 @@ export interface RouterConfig {
12
19
  apiKey: string;
13
20
  /** SPECKLE_MCP_ALLOW_REPO_MISMATCH=1 escape hatch state. */
14
21
  allowRepoMismatch: boolean;
15
- /** Process cwd at startup (workspace fallback when MCP roots are absent). */
22
+ /** Process cwd at startup — the fallback when no explicit root is configured. */
16
23
  cwd: string;
24
+ /**
25
+ * SPECKLE_MCP_WORKSPACE_ROOT — an explicit directory to resolve the marker
26
+ * from, for hosts that launch the router outside the repo. Takes priority
27
+ * over `cwd`; absent or blank, resolution behaves exactly as before.
28
+ */
29
+ workspaceRoot?: string;
17
30
  /**
18
31
  * SPECKLE_PROJECT_ID — optional fallback binding for markerless contexts
19
32
  * (Claude Desktop / Cowork, where the router process runs outside any
package/dist/config.js CHANGED
@@ -4,7 +4,15 @@
4
4
  * The router accepts only one secret (`SPECKLE_MCP_KEY`) and one optional
5
5
  * host hint (`SPECKLE_MCP_BASE_URL`). Everything else — project context,
6
6
  * repo identity — comes from the committed `.speckle` marker.
7
+ *
8
+ * `SPECKLE_MCP_WORKSPACE_ROOT` says WHERE to look for that marker when the
9
+ * process cannot be started inside the repo. A GUI host launches the router
10
+ * from a fixed directory, and its MCP client offers no `roots` capability to
11
+ * negotiate one, so the path has to arrive as launch configuration. It is a
12
+ * claim about where work happens, never proof of it: the marker still has to
13
+ * be there, and the repo cross-check still applies.
7
14
  */
15
+ import path from "node:path";
8
16
  import { SpeckleRouterError } from "./errors.js";
9
17
  export function loadRouterConfig(env = process.env) {
10
18
  const baseUrl = (env.SPECKLE_MCP_BASE_URL ?? "").trim();
@@ -22,9 +30,21 @@ export function loadRouterConfig(env = process.env) {
22
30
  apiKey,
23
31
  allowRepoMismatch: env.SPECKLE_MCP_ALLOW_REPO_MISMATCH === "1",
24
32
  cwd: process.cwd(),
33
+ workspaceRoot: parseWorkspaceRoot(env.SPECKLE_MCP_WORKSPACE_ROOT),
25
34
  fallbackProjectId: parseFallbackProjectId(env.SPECKLE_PROJECT_ID),
26
35
  };
27
36
  }
37
+ /**
38
+ * Parse the optional SPECKLE_MCP_WORKSPACE_ROOT. Blank counts as unset, the
39
+ * same way MCP bundle hosts pass empty strings for unfilled optional config.
40
+ * A path that does not exist is NOT rejected here: resolution already fails
41
+ * closed on a missing marker, and demoting to rootless is the safe outcome —
42
+ * failing the boot would take away the discovery tools as well.
43
+ */
44
+ function parseWorkspaceRoot(raw) {
45
+ const trimmed = (raw ?? "").trim();
46
+ return trimmed === "" ? undefined : path.resolve(trimmed);
47
+ }
28
48
  /**
29
49
  * Parse the optional SPECKLE_PROJECT_ID fallback. Empty/whitespace counts as
30
50
  * unset (MCP bundle hosts pass empty strings for blank optional config), but
package/dist/headers.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import type { ResolvedWorkspace } from "./workspace.js";
15
15
  export declare const ROUTER_CLIENT_NAME = "@workpowers/speckle";
16
- export declare const ROUTER_CLIENT_VERSION = "0.4.0";
16
+ export declare const ROUTER_CLIENT_VERSION = "0.5.0";
17
17
  export interface RouterRequestHeaders {
18
18
  Authorization: string;
19
19
  "X-Speckle-Client": string;
package/dist/headers.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * the server then exposes a project-agnostic discovery toolset.
13
13
  */
14
14
  export const ROUTER_CLIENT_NAME = "@workpowers/speckle";
15
- export const ROUTER_CLIENT_VERSION = "0.4.0";
15
+ export const ROUTER_CLIENT_VERSION = "0.5.0";
16
16
  export function buildRouterHeaders(args) {
17
17
  const { apiKey, workspace, fallbackProjectId } = args;
18
18
  const headers = {
package/dist/index.d.ts CHANGED
@@ -7,7 +7,10 @@
7
7
  *
8
8
  * Flow:
9
9
  * 1. Load env config (`SPECKLE_MCP_BASE_URL`, `SPECKLE_MCP_KEY`).
10
- * 2. Resolve workspace + marker (cwd-based v1; MCP-roots support is a TODO).
10
+ * 2. Resolve workspace + marker from SPECKLE_MCP_WORKSPACE_ROOT when set,
11
+ * otherwise from process cwd. Protocol-level MCP roots are deliberately
12
+ * not the transport: the desktop client negotiates no `roots` capability,
13
+ * so a GUI host can only hand us a path as launch configuration.
11
14
  * If no marker is found, fall through to rootless mode (the server will
12
15
  * expose a project-agnostic discovery toolset instead). Other marker
13
16
  * errors (invalid TOML, remote mismatch, host mismatch) still fail loud
package/dist/index.js CHANGED
@@ -7,7 +7,10 @@
7
7
  *
8
8
  * Flow:
9
9
  * 1. Load env config (`SPECKLE_MCP_BASE_URL`, `SPECKLE_MCP_KEY`).
10
- * 2. Resolve workspace + marker (cwd-based v1; MCP-roots support is a TODO).
10
+ * 2. Resolve workspace + marker from SPECKLE_MCP_WORKSPACE_ROOT when set,
11
+ * otherwise from process cwd. Protocol-level MCP roots are deliberately
12
+ * not the transport: the desktop client negotiates no `roots` capability,
13
+ * so a GUI host can only hand us a path as launch configuration.
11
14
  * If no marker is found, fall through to rootless mode (the server will
12
15
  * expose a project-agnostic discovery toolset instead). Other marker
13
16
  * errors (invalid TOML, remote mismatch, host mismatch) still fail loud
@@ -27,7 +30,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
27
30
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
28
31
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
29
32
  import { loadRouterConfig, resolveSpeckleHost } from "./config.js";
30
- import { resolveWorkspace } from "./workspace.js";
33
+ import { resolveWorkspace, workspaceOptionsFromConfig, rootOriginFromConfig } from "./workspace.js";
31
34
  import { buildRouterHeaders, ROUTER_CLIENT_NAME, ROUTER_CLIENT_VERSION } from "./headers.js";
32
35
  import { mirrorServerOptions, wireProxyHandlers } from "./proxy.js";
33
36
  import { SpeckleRouterError } from "./errors.js";
@@ -37,10 +40,7 @@ export async function startRouter() {
37
40
  const config = loadRouterConfig();
38
41
  let workspace;
39
42
  try {
40
- workspace = resolveWorkspace({
41
- cwd: config.cwd,
42
- allowRepoMismatch: config.allowRepoMismatch,
43
- });
43
+ workspace = resolveWorkspace(workspaceOptionsFromConfig(config));
44
44
  }
45
45
  catch (err) {
46
46
  if (err instanceof SpeckleRouterError && err.code === "marker_not_found") {
@@ -50,6 +50,9 @@ export async function startRouter() {
50
50
  }
51
51
  else {
52
52
  process.stderr.write("speckle-mcp: no .speckle marker found — running in rootless mode (discovery tools only). " +
53
+ (config.workspaceRoot
54
+ ? `Searched SPECKLE_MCP_WORKSPACE_ROOT (${config.workspaceRoot}) and upward. `
55
+ : "") +
53
56
  "Run `speckle-mcp init --project <id>` in a repo to bind it to a project.\n");
54
57
  }
55
58
  }
@@ -73,6 +76,7 @@ export async function startRouter() {
73
76
  wireProxyHandlers(downstream, upstream, capabilities, createWorkflowClient({
74
77
  root: workspace ? path.dirname(workspace.markerPath) : undefined,
75
78
  workspaceId: workspace?.workspaceRootHash,
79
+ rootOrigin: rootOriginFromConfig(config),
76
80
  host: host.hostUrl,
77
81
  }));
78
82
  const stdio = new StdioServerTransport();
@@ -3,6 +3,7 @@ export declare function createWorkflowClient(options: {
3
3
  root?: string;
4
4
  workspaceId?: string;
5
5
  host: string;
6
+ rootOrigin?: "config" | "cwd";
6
7
  }): {
7
8
  prepare(params: CallToolRequest["params"]): CallToolRequest["params"];
8
9
  received(params: CallToolRequest["params"], result: unknown): void;
@@ -15,7 +15,9 @@ export function createWorkflowClient(options) {
15
15
  return { ...params, _meta: { ...params._meta, [WORKFLOW_META]: {
16
16
  client_id: clientId, workspace_id: options.workspaceId ?? `rootless:${clientId}`,
17
17
  seen_notice: seenNotice, fetched_revision: fetchedRevision,
18
- ...(options.root ? { evidence: observeWorkflowFiles(options.root, options.host) } : {}),
18
+ ...(options.root
19
+ ? { evidence: observeWorkflowFiles(options.root, options.host, options.rootOrigin) }
20
+ : {}),
19
21
  } } };
20
22
  },
21
23
  received(params, result) {
@@ -3,7 +3,7 @@ import path from "node:path";
3
3
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
4
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
5
5
  import { loadRouterConfig, resolveSpeckleHost } from "./config.js";
6
- import { resolveWorkspace } from "./workspace.js";
6
+ import { resolveWorkspace, workspaceOptionsFromConfig } from "./workspace.js";
7
7
  import { buildRouterHeaders, ROUTER_CLIENT_NAME, ROUTER_CLIENT_VERSION } from "./headers.js";
8
8
  import { publicationSchema } from "./workflow-contract.js";
9
9
  import { applyWorkflowFiles, cachedWorkflowFallback } from "./workflow-files.js";
@@ -12,7 +12,10 @@ export async function runWorkflowCommand(args) {
12
12
  throw new Error("Usage: speckle-mcp workflow [--apply] [--cache]");
13
13
  }
14
14
  const config = loadRouterConfig();
15
- const workspace = resolveWorkspace({ cwd: config.cwd, allowRepoMismatch: config.allowRepoMismatch });
15
+ // Adoption has to work from wherever the host launches us: this is the
16
+ // command that installs the managed file, so a cwd-only resolution here
17
+ // would leave exactly the population this exists for unable to run it.
18
+ const workspace = resolveWorkspace(workspaceOptionsFromConfig(config));
16
19
  const root = path.dirname(workspace.markerPath);
17
20
  const host = resolveSpeckleHost(config, workspace.marker.marker.speckleUrl).hostUrl;
18
21
  const client = new Client({ name: ROUTER_CLIENT_NAME, version: ROUTER_CLIENT_VERSION }, { capabilities: {} });
@@ -114,6 +114,7 @@ export declare const workflowContextSchema: z.ZodObject<{
114
114
  seen_notice: z.ZodOptional<z.ZodString>;
115
115
  evidence: z.ZodOptional<z.ZodObject<{
116
116
  source: z.ZodEnum<["router", "agent"]>;
117
+ root_origin: z.ZodOptional<z.ZodEnum<["config", "cwd"]>>;
117
118
  bootstrap: z.ZodObject<{
118
119
  state: z.ZodEnum<["observed", "missing", "unreadable"]>;
119
120
  hash: z.ZodOptional<z.ZodString>;
@@ -147,6 +148,7 @@ export declare const workflowContextSchema: z.ZodObject<{
147
148
  baseline_hash?: string | undefined;
148
149
  };
149
150
  source: "router" | "agent";
151
+ root_origin?: "config" | "cwd" | undefined;
150
152
  planning_cache?: {
151
153
  state: "missing" | "observed" | "unreadable";
152
154
  hash?: string | undefined;
@@ -159,6 +161,7 @@ export declare const workflowContextSchema: z.ZodObject<{
159
161
  baseline_hash?: string | undefined;
160
162
  };
161
163
  source: "router" | "agent";
164
+ root_origin?: "config" | "cwd" | undefined;
162
165
  planning_cache?: {
163
166
  state: "missing" | "observed" | "unreadable";
164
167
  hash?: string | undefined;
@@ -177,6 +180,7 @@ export declare const workflowContextSchema: z.ZodObject<{
177
180
  baseline_hash?: string | undefined;
178
181
  };
179
182
  source: "router" | "agent";
183
+ root_origin?: "config" | "cwd" | undefined;
180
184
  planning_cache?: {
181
185
  state: "missing" | "observed" | "unreadable";
182
186
  hash?: string | undefined;
@@ -195,6 +199,7 @@ export declare const workflowContextSchema: z.ZodObject<{
195
199
  baseline_hash?: string | undefined;
196
200
  };
197
201
  source: "router" | "agent";
202
+ root_origin?: "config" | "cwd" | undefined;
198
203
  planning_cache?: {
199
204
  state: "missing" | "observed" | "unreadable";
200
205
  hash?: string | undefined;
@@ -29,6 +29,12 @@ export const workflowContextSchema = z.object({
29
29
  seen_notice: hash.optional(),
30
30
  evidence: z.object({
31
31
  source: z.enum(["router", "agent"]),
32
+ // WHERE the observed root came from. A configured root is a static launch
33
+ // value: it can name a checkout nobody is working in, and that reads
34
+ // identically to the right one unless the origin travels with the report.
35
+ // Carried for consumers that show coverage; `workflowStatus` ignores it,
36
+ // so reporting it changes no existing answer.
37
+ root_origin: z.enum(["config", "cwd"]).optional(),
32
38
  bootstrap: observation,
33
39
  planning_cache: observation.optional(),
34
40
  }).optional(),
@@ -2,8 +2,7 @@ import { type WorkflowCache, type WorkflowPublication } from "./workflow-contrac
2
2
  /** Fixed filenames, regular files only. Do not follow an instruction/cache symlink. */
3
3
  export declare function readManagedFile(file: string): string | undefined;
4
4
  export declare function readWorkflowCache(root: string, host: string): WorkflowCache | undefined;
5
- export declare function observeWorkflowFiles(root: string, host: string): {
6
- source: "router";
5
+ export declare function observeWorkflowFiles(root: string, host: string, rootOrigin?: "config" | "cwd"): {
7
6
  bootstrap: {
8
7
  state: "missing" | "observed" | "unreadable";
9
8
  hash?: string | undefined;
@@ -14,6 +13,8 @@ export declare function observeWorkflowFiles(root: string, host: string): {
14
13
  hash?: string | undefined;
15
14
  baseline_hash?: string | undefined;
16
15
  };
16
+ root_origin?: "config" | "cwd" | undefined;
17
+ source: "router";
17
18
  };
18
19
  /** Refuse modified/unowned files before writing either artifact. Recheck before each rename. */
19
20
  export declare function applyWorkflowFiles(root: string, host: string, input: WorkflowPublication, options?: {
@@ -47,7 +47,7 @@ export function readWorkflowCache(root, host) {
47
47
  throw new Error("Workflow receipt has a future timestamp");
48
48
  return cache;
49
49
  }
50
- export function observeWorkflowFiles(root, host) {
50
+ export function observeWorkflowFiles(root, host, rootOrigin) {
51
51
  let cache;
52
52
  let cacheUnreadable = false;
53
53
  try {
@@ -69,7 +69,8 @@ export function observeWorkflowFiles(root, host) {
69
69
  const planning_cache = cacheUnreadable ? { state: "unreadable" } : cache?.planning ? {
70
70
  state: "observed", hash: hashContent(cache.planning.content), baseline_hash: cache.planning.revision,
71
71
  } : { state: "missing" };
72
- return { source: "router", bootstrap, planning_cache };
72
+ return { source: "router", ...(rootOrigin ? { root_origin: rootOrigin } : {}),
73
+ bootstrap, planning_cache };
73
74
  }
74
75
  /** Refuse modified/unowned files before writing either artifact. Recheck before each rename. */
75
76
  export function applyWorkflowFiles(root, host, input, options = {}) {
@@ -31,6 +31,21 @@ export interface ResolveOptions {
31
31
  /** Allow remote-mismatch via env (default off). */
32
32
  allowRepoMismatch?: boolean;
33
33
  }
34
+ /**
35
+ * Build resolution inputs from router config. An explicitly configured root
36
+ * takes priority over process cwd; with none set, this is the old behaviour
37
+ * exactly. Every caller goes through here so the three entry points — the
38
+ * router, `doctor` and the workflow command — cannot drift apart again.
39
+ */
40
+ export declare function workspaceOptionsFromConfig(config: {
41
+ workspaceRoot?: string;
42
+ cwd: string;
43
+ allowRepoMismatch: boolean;
44
+ }): ResolveOptions;
45
+ /** Where a resolved root came from, travelling with the evidence it produces. */
46
+ export declare function rootOriginFromConfig(config: {
47
+ workspaceRoot?: string;
48
+ }): "config" | "cwd";
34
49
  export declare function resolveWorkspace(opts?: ResolveOptions): ResolvedWorkspace;
35
50
  /**
36
51
  * Canonical form: `host:org/repo` (lowercase host, no trailing `.git`,
package/dist/workspace.js CHANGED
@@ -14,6 +14,23 @@ import { execFileSync } from "node:child_process";
14
14
  import { SpeckleRouterError } from "./errors.js";
15
15
  import { parseSpeckleMarker } from "./marker.js";
16
16
  const MARKER_FILENAME = ".speckle";
17
+ /**
18
+ * Build resolution inputs from router config. An explicitly configured root
19
+ * takes priority over process cwd; with none set, this is the old behaviour
20
+ * exactly. Every caller goes through here so the three entry points — the
21
+ * router, `doctor` and the workflow command — cannot drift apart again.
22
+ */
23
+ export function workspaceOptionsFromConfig(config) {
24
+ return {
25
+ ...(config.workspaceRoot ? { workspaceRoots: [config.workspaceRoot] } : {}),
26
+ cwd: config.cwd,
27
+ allowRepoMismatch: config.allowRepoMismatch,
28
+ };
29
+ }
30
+ /** Where a resolved root came from, travelling with the evidence it produces. */
31
+ export function rootOriginFromConfig(config) {
32
+ return config.workspaceRoot ? "config" : "cwd";
33
+ }
17
34
  export function resolveWorkspace(opts = {}) {
18
35
  const roots = (opts.workspaceRoots ?? []).filter(Boolean);
19
36
  const cwd = opts.cwd ?? process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workpowers/speckle",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Local MCP router for Speckle — resolves project context from a committed .speckle marker and forwards calls to the remote Speckle MCP endpoint.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",