archgraph-argo 0.5.0 → 0.5.1

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.
@@ -18,10 +18,12 @@ const { fileURLToPath } = require('node:url');
18
18
  * The workspace root is resolved from, in priority order:
19
19
  * 1. ARGO_REPO_ROOT — explicit override (set by MCP client configs).
20
20
  * 2. WORKSPACE_FOLDER — set by some hosts.
21
- * 3. The embedded repo root, when the Argo installation is still inside a repo
21
+ * 3. The MCP `roots` advertised by the client (a global server resolves the
22
+ * root that contains design/KG/SystemArchitecture.json when several roots
23
+ * are present, so it never operates on an unrelated folder).
24
+ * 4. The embedded repo root, when the Argo installation is still inside a repo
22
25
  * (i.e. `<argoRoot>/../design/KG/SystemArchitecture.json` exists).
23
- * 4. process.cwd() — the MCP client must launch the server with its cwd
24
- * set to the target workspace root.
26
+ * 5. process.cwd() — last-resort fallback when no root is available.
25
27
  */
26
28
 
27
29
  function getArgoRoot() {
@@ -59,6 +61,17 @@ function getWorkspaceRoot() {
59
61
  return path.resolve(explicit);
60
62
  }
61
63
 
64
+ // The client may expose several roots (a multi-root workspace). Never
65
+ // silently operate on an unrelated folder: prefer the root that actually
66
+ // contains the ArchGraph marker before falling back to the first root.
67
+ const marker = path.join('design', 'KG', 'SystemArchitecture.json');
68
+ for (const root of mcpWorkspaceRoots) {
69
+ const rootPath = rootToPath(root);
70
+ if (rootPath && fs.existsSync(path.join(rootPath, marker))) {
71
+ return path.resolve(rootPath);
72
+ }
73
+ }
74
+
62
75
  for (const root of mcpWorkspaceRoots) {
63
76
  const rootPath = rootToPath(root);
64
77
  if (rootPath) {
@@ -67,7 +80,7 @@ function getWorkspaceRoot() {
67
80
  }
68
81
 
69
82
  const embedded = path.resolve(getArgoRoot(), '..');
70
- if (fs.existsSync(path.join(embedded, 'design', 'KG', 'SystemArchitecture.json'))) {
83
+ if (fs.existsSync(path.join(embedded, marker))) {
71
84
  return embedded;
72
85
  }
73
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Deploy the ArchGraph ARGO toolchain, skills, and rules (schema, scripts, argo-init skill, global rule) with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {