gnosys 5.11.2 → 5.11.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.
package/dist/cli.js CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
@@ -38,7 +38,7 @@ const IDE_TARGET_DISPLAY = {
38
38
  codex: ".codex/mcp.json",
39
39
  "gemini-cli": "~/.gemini/settings.json",
40
40
  antigravity: "~/.gemini/antigravity/mcp_config.json",
41
- "grok-build": "~/.grok/config.toml",
41
+ "grok-build": "~/.grok/config.toml ([mcp_servers.gnosys])",
42
42
  };
43
43
  function ideTarget(ide) {
44
44
  return IDE_TARGET_DISPLAY[ide] ?? `.${ide}/mcp.json`;
@@ -56,14 +56,11 @@ export declare function writeApiKey(provider: string, key: string): Promise<void
56
56
  */
57
57
  export declare function detectIDEs(projectDir: string): Promise<string[]>;
58
58
  /**
59
- * Replace (or append) a `[mcp.<name>]` block inside the TOML text for
60
- * Grok Build's config file. Preserves every line outside that block
61
- * deci-046 read-then-merge rule. We can't pull in a TOML dependency
62
- * without adding to package.json, so we ship a minimal hand-rolled
63
- * updater scoped exactly to the `[mcp.gnosys]` use case.
59
+ * Replace (or append) a `[mcp_servers.<name>]` block inside Grok Build's
60
+ * `~/.grok/config.toml`. Preserves every line outside that block (deci-046).
64
61
  *
65
- * Spec assumption: TOML headers we touch are simple `[a.b]` lines with
66
- * no inline tables or nested arrays. Any other content is left alone.
62
+ * Grok Build reads `mcp_servers.*` only legacy `[mcp.*]` blocks are ignored
63
+ * by `grok mcp list` / the agent runtime (see ~/.grok/README.md).
67
64
  *
68
65
  * Exported for tests.
69
66
  */
package/dist/lib/setup.js CHANGED
@@ -567,33 +567,48 @@ export async function detectIDEs(projectDir) {
567
567
  }
568
568
  return detected;
569
569
  }
570
+ /** Remove a single `[section]` block from Grok TOML (hand-rolled; see upsertGrokMcpBlock). */
571
+ function removeGrokTomlSection(existing, sectionHeader) {
572
+ const lines = existing.split("\n");
573
+ const headerIdx = lines.findIndex((line) => line.trim() === sectionHeader);
574
+ if (headerIdx === -1)
575
+ return existing;
576
+ let endIdx = lines.length;
577
+ for (let i = headerIdx + 1; i < lines.length; i++) {
578
+ if (/^\s*\[/.test(lines[i])) {
579
+ endIdx = i;
580
+ break;
581
+ }
582
+ }
583
+ const before = lines.slice(0, headerIdx).join("\n");
584
+ const after = lines.slice(endIdx).join("\n");
585
+ const merged = [before, after].filter((s) => s.length > 0).join("\n");
586
+ return merged.length > 0 ? `${merged}\n` : "";
587
+ }
570
588
  /**
571
- * Replace (or append) a `[mcp.<name>]` block inside the TOML text for
572
- * Grok Build's config file. Preserves every line outside that block
573
- * deci-046 read-then-merge rule. We can't pull in a TOML dependency
574
- * without adding to package.json, so we ship a minimal hand-rolled
575
- * updater scoped exactly to the `[mcp.gnosys]` use case.
589
+ * Replace (or append) a `[mcp_servers.<name>]` block inside Grok Build's
590
+ * `~/.grok/config.toml`. Preserves every line outside that block (deci-046).
576
591
  *
577
- * Spec assumption: TOML headers we touch are simple `[a.b]` lines with
578
- * no inline tables or nested arrays. Any other content is left alone.
592
+ * Grok Build reads `mcp_servers.*` only legacy `[mcp.*]` blocks are ignored
593
+ * by `grok mcp list` / the agent runtime (see ~/.grok/README.md).
579
594
  *
580
595
  * Exported for tests.
581
596
  */
582
597
  export function upsertGrokMcpBlock(existing, name, entry) {
583
- const sectionHeader = `[mcp.${name}]`;
584
- const lines = existing.split("\n");
598
+ // Drop mistaken v5.9.4 `[mcp.<name>]` sections so we don't leave dead config.
599
+ let content = removeGrokTomlSection(existing, `[mcp.${name}]`);
600
+ const sectionHeader = `[mcp_servers.${name}]`;
601
+ const lines = content.split("\n");
585
602
  const headerIdx = lines.findIndex((line) => line.trim() === sectionHeader);
586
603
  const blockBody = renderGrokMcpBlock(entry);
587
604
  if (headerIdx === -1) {
588
- // Append a fresh block, separated by a blank line if the file has content.
589
- const prefix = existing.length === 0 || existing.endsWith("\n\n")
590
- ? existing
591
- : existing.endsWith("\n") ? `${existing}\n` : `${existing}\n\n`;
605
+ const prefix = content.length === 0 || content.endsWith("\n\n")
606
+ ? content
607
+ : content.endsWith("\n")
608
+ ? `${content}\n`
609
+ : `${content}\n\n`;
592
610
  return `${prefix}${sectionHeader}\n${blockBody}`;
593
611
  }
594
- // Replace the existing block — everything from sectionHeader up to the
595
- // next `[` header (or EOF). Count blank lines immediately after the block
596
- // so we can preserve the original spacing before the next section.
597
612
  let endIdx = lines.length;
598
613
  for (let i = headerIdx + 1; i < lines.length; i++) {
599
614
  if (/^\s*\[/.test(lines[i])) {
@@ -611,7 +626,6 @@ export function upsertGrokMcpBlock(existing, name, entry) {
611
626
  const beforeBlock = lines.slice(0, headerIdx).join("\n");
612
627
  const head = beforeBlock.length > 0 ? `${beforeBlock}\n` : "";
613
628
  if (!hasFollowingSection) {
614
- // No following section — drop trailing blank lines and end with a single \n.
615
629
  return `${head}${sectionHeader}\n${blockBody}`;
616
630
  }
617
631
  const gap = "\n".repeat(Math.max(1, trailingBlankBeforeNext));
@@ -814,10 +828,9 @@ export async function setupIDE(ide, projectDir) {
814
828
  return { success: true, message: "Antigravity MCP config updated (~/.gemini/antigravity/mcp_config.json)" };
815
829
  }
816
830
  case "grok-build": {
817
- // v5.9.4 Bug 12 — Grok Build reads its MCP servers from a
818
- // `[mcp.<name>]` block in ~/.grok/config.toml. We never clobber
819
- // unrelated TOML content (per deci-046 read-then-merge rule); the
820
- // helper preserves every line outside the `[mcp.gnosys]` block.
831
+ // v5.9.4 Bug 12 — Grok Build reads MCP from `[mcp_servers.<name>]`
832
+ // in ~/.grok/config.toml (not `[mcp.<name>]`). We never clobber
833
+ // unrelated TOML content (per deci-046 read-then-merge rule).
821
834
  const grokDir = path.join(os.homedir(), ".grok");
822
835
  const configPath = path.join(grokDir, "config.toml");
823
836
  await fs.mkdir(grokDir, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gnosys",
3
- "version": "5.11.2",
3
+ "version": "5.11.3",
4
4
  "description": "Gnosys — Persistent Memory for AI Agents. Sandbox-first runtime, central SQLite brain, federated search, Dream Mode, Web Knowledge Base, Obsidian export.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "docs:mcp-tools": "node scripts/gen-mcp-tools.mjs --write",
35
35
  "docs:cli": "node scripts/gen-cli-docs.mjs --write",
36
36
  "postinstall": "node dist/postinstall.js || true",
37
- "prepublishOnly": "npm run build:publish"
37
+ "prepublishOnly": "npm run build:publish && node -e \"const fs=require('fs');for (const f of ['dist/cli.js','dist/index.js']) fs.chmodSync(f,0o755)\""
38
38
  },
39
39
  "dependencies": {
40
40
  "@anthropic-ai/sdk": "^0.78.0",