@agentmemory/agentmemory 0.9.24 → 0.9.25

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.
Files changed (88) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/cli.d.mts.map +1 -1
  4. package/dist/cli.mjs +125 -65
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/{connect-Cf9bmBqO.mjs → connect-bmZ5eqYN.mjs} +17 -56
  7. package/dist/{connect-Cf9bmBqO.mjs.map → connect-bmZ5eqYN.mjs.map} +1 -1
  8. package/dist/hooks/notification.mjs +2 -4
  9. package/dist/hooks/notification.mjs.map +1 -1
  10. package/dist/hooks/post-commit.mjs +2 -3
  11. package/dist/hooks/post-commit.mjs.map +1 -1
  12. package/dist/hooks/post-tool-failure.mjs +2 -4
  13. package/dist/hooks/post-tool-failure.mjs.map +1 -1
  14. package/dist/hooks/post-tool-use.mjs +2 -4
  15. package/dist/hooks/post-tool-use.mjs.map +1 -1
  16. package/dist/hooks/pre-compact.mjs +2 -4
  17. package/dist/hooks/pre-compact.mjs.map +1 -1
  18. package/dist/hooks/pre-tool-use.mjs +2 -2
  19. package/dist/hooks/pre-tool-use.mjs.map +1 -1
  20. package/dist/hooks/prompt-submit.mjs +2 -4
  21. package/dist/hooks/prompt-submit.mjs.map +1 -1
  22. package/dist/hooks/session-end.mjs +2 -2
  23. package/dist/hooks/session-start.mjs +2 -4
  24. package/dist/hooks/session-start.mjs.map +1 -1
  25. package/dist/hooks/stop.mjs +2 -2
  26. package/dist/hooks/subagent-start.mjs +2 -4
  27. package/dist/hooks/subagent-start.mjs.map +1 -1
  28. package/dist/hooks/subagent-stop.mjs +2 -4
  29. package/dist/hooks/subagent-stop.mjs.map +1 -1
  30. package/dist/hooks/task-completed.mjs +2 -4
  31. package/dist/hooks/task-completed.mjs.map +1 -1
  32. package/dist/image-refs-C7h9L5wx.mjs +52 -0
  33. package/dist/image-refs-C7h9L5wx.mjs.map +1 -0
  34. package/dist/{image-refs-CJS5B9Gq.mjs → image-store-Gpo2mgM9.mjs} +11 -42
  35. package/dist/image-store-Gpo2mgM9.mjs.map +1 -0
  36. package/dist/index.mjs +941 -493
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/{logger-xlVlvCWX.mjs → logger-yHTcEBAI.mjs} +2 -2
  39. package/dist/{logger-xlVlvCWX.mjs.map → logger-yHTcEBAI.mjs.map} +1 -1
  40. package/dist/rolldown-runtime-twds-ZHy.mjs +14 -0
  41. package/dist/{schema-BkALl7Z_.mjs → schema-Dsr_V2Wp.mjs} +4 -4
  42. package/dist/schema-Dsr_V2Wp.mjs.map +1 -0
  43. package/dist/{src-B8J9Exum.mjs → src-fQOMXeCp.mjs} +936 -483
  44. package/dist/src-fQOMXeCp.mjs.map +1 -0
  45. package/dist/{standalone-CPfsVTBA.mjs → standalone-BzfA1zu8.mjs} +6 -10
  46. package/dist/{standalone-CPfsVTBA.mjs.map → standalone-BzfA1zu8.mjs.map} +1 -1
  47. package/dist/standalone.mjs +3 -14
  48. package/dist/standalone.mjs.map +1 -1
  49. package/dist/{tools-registry-DJizX9Az.mjs → tools-registry-Dzxv9iUu.mjs} +7 -5
  50. package/dist/tools-registry-Dzxv9iUu.mjs.map +1 -0
  51. package/dist/version-C3hZKw8n.mjs +6 -0
  52. package/dist/version-C3hZKw8n.mjs.map +1 -0
  53. package/dist/viewer/index.html +155 -9
  54. package/package.json +9 -4
  55. package/plugin/.claude-plugin/plugin.json +1 -1
  56. package/plugin/.codex-plugin/plugin.json +1 -1
  57. package/plugin/plugin.json +1 -1
  58. package/plugin/scripts/notification.mjs +2 -4
  59. package/plugin/scripts/notification.mjs.map +1 -1
  60. package/plugin/scripts/post-commit.mjs +2 -3
  61. package/plugin/scripts/post-commit.mjs.map +1 -1
  62. package/plugin/scripts/post-tool-failure.mjs +2 -4
  63. package/plugin/scripts/post-tool-failure.mjs.map +1 -1
  64. package/plugin/scripts/post-tool-use.mjs +2 -4
  65. package/plugin/scripts/post-tool-use.mjs.map +1 -1
  66. package/plugin/scripts/pre-compact.mjs +2 -4
  67. package/plugin/scripts/pre-compact.mjs.map +1 -1
  68. package/plugin/scripts/pre-tool-use.mjs +2 -2
  69. package/plugin/scripts/pre-tool-use.mjs.map +1 -1
  70. package/plugin/scripts/prompt-submit.mjs +2 -4
  71. package/plugin/scripts/prompt-submit.mjs.map +1 -1
  72. package/plugin/scripts/session-end.mjs +2 -2
  73. package/plugin/scripts/session-start.mjs +2 -4
  74. package/plugin/scripts/session-start.mjs.map +1 -1
  75. package/plugin/scripts/stop.mjs +2 -2
  76. package/plugin/scripts/subagent-start.mjs +2 -4
  77. package/plugin/scripts/subagent-start.mjs.map +1 -1
  78. package/plugin/scripts/subagent-stop.mjs +2 -4
  79. package/plugin/scripts/subagent-stop.mjs.map +1 -1
  80. package/plugin/scripts/task-completed.mjs +2 -4
  81. package/plugin/scripts/task-completed.mjs.map +1 -1
  82. package/dist/image-refs-CJS5B9Gq.mjs.map +0 -1
  83. package/dist/image-store-CdE0amb1.mjs +0 -3
  84. package/dist/schema-BkALl7Z_.mjs.map +0 -1
  85. package/dist/src-B8J9Exum.mjs.map +0 -1
  86. package/dist/tools-registry-DJizX9Az.mjs.map +0 -1
  87. package/dist/version-BWEBnKAp.mjs +0 -6
  88. package/dist/version-BWEBnKAp.mjs.map +0 -1
@@ -1,27 +1,9 @@
1
- import { createRequire } from "node:module";
1
+ import { t as __exportAll } from "./rolldown-runtime-twds-ZHy.mjs";
2
2
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
3
3
  import { dirname, join, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { homedir, platform } from "node:os";
6
6
  import * as p from "@clack/prompts";
7
-
8
- //#region \0rolldown/runtime.js
9
- var __defProp = Object.defineProperty;
10
- var __exportAll = (all, no_symbols) => {
11
- let target = {};
12
- for (var name in all) {
13
- __defProp(target, name, {
14
- get: all[name],
15
- enumerable: true
16
- });
17
- }
18
- if (!no_symbols) {
19
- __defProp(target, Symbol.toStringTag, { value: "Module" });
20
- }
21
- return target;
22
- };
23
-
24
- //#endregion
25
7
  //#region src/cli/connect/util.ts
26
8
  const AGENTMEMORY_MCP_BLOCK = {
27
9
  command: "npx",
@@ -32,23 +14,22 @@ const AGENTMEMORY_MCP_BLOCK = {
32
14
  AGENTMEMORY_TOOLS: "${AGENTMEMORY_TOOLS:-all}"
33
15
  }
34
16
  };
35
- const COPILOT_MCP_COMMAND = process.platform === "win32" ? {
36
- command: process.env["ComSpec"] || process.env["COMSPEC"] || "cmd.exe",
37
- args: [
38
- "/d",
39
- "/s",
40
- "/c",
41
- "npx",
42
- "-y",
43
- "@agentmemory/mcp"
44
- ]
45
- } : {
46
- command: "npx",
47
- args: ["-y", "@agentmemory/mcp"]
48
- };
49
17
  const AGENTMEMORY_COPILOT_MCP_BLOCK = {
50
18
  type: "local",
51
- ...COPILOT_MCP_COMMAND,
19
+ ...process.platform === "win32" ? {
20
+ command: process.env["ComSpec"] || process.env["COMSPEC"] || "cmd.exe",
21
+ args: [
22
+ "/d",
23
+ "/s",
24
+ "/c",
25
+ "npx",
26
+ "-y",
27
+ "@agentmemory/mcp"
28
+ ]
29
+ } : {
30
+ command: "npx",
31
+ args: ["-y", "@agentmemory/mcp"]
32
+ },
52
33
  env: {
53
34
  AGENTMEMORY_URL: "${AGENTMEMORY_URL:-http://localhost:3111}",
54
35
  AGENTMEMORY_SECRET: "${AGENTMEMORY_SECRET:-}",
@@ -97,7 +78,6 @@ function logAlreadyWired(label, target) {
97
78
  function logBackup(target) {
98
79
  p.log.info(`Backup: ${target}`);
99
80
  }
100
-
101
81
  //#endregion
102
82
  //#region src/cli/connect/json-mcp-adapter.ts
103
83
  function entryMatches$2(entry) {
@@ -163,7 +143,6 @@ function createJsonMcpAdapter(config) {
163
143
  }
164
144
  };
165
145
  }
166
-
167
146
  //#endregion
168
147
  //#region src/cli/connect/antigravity.ts
169
148
  const ANTIGRAVITY_DIR = platform() === "darwin" ? join(homedir(), "Library", "Application Support", "Antigravity", "User") : join(homedir(), ".config", "Antigravity", "User");
@@ -175,7 +154,6 @@ const adapter$16 = createJsonMcpAdapter({
175
154
  docs: "https://github.com/rohitg00/agentmemory#other-agents",
176
155
  protocolNote: "→ Using MCP via mcp_config.json. Antigravity replaces Gemini CLI (sunset 2026-06-18)."
177
156
  });
178
-
179
157
  //#endregion
180
158
  //#region src/cli/connect/codex-hooks.ts
181
159
  /**
@@ -235,7 +213,6 @@ function isAgentmemoryEntry(entry, scriptsDir) {
235
213
  function normalizePathForCommandMatch(value) {
236
214
  return value.replace(/\\/g, "/");
237
215
  }
238
-
239
216
  //#endregion
240
217
  //#region src/cli/connect/claude-code.ts
241
218
  const CLAUDE_DIR = join(homedir(), ".claude");
@@ -356,7 +333,6 @@ function installClaudeHooks(opts) {
356
333
  ...backupPath !== void 0 && { backupPath }
357
334
  };
358
335
  }
359
-
360
336
  //#endregion
361
337
  //#region src/cli/connect/cline.ts
362
338
  const adapter$14 = createJsonMcpAdapter({
@@ -367,7 +343,6 @@ const adapter$14 = createJsonMcpAdapter({
367
343
  docs: "https://github.com/rohitg00/agentmemory#other-agents",
368
344
  protocolNote: "→ Using MCP via ~/.cline/mcp.json (CLI). VS Code users: add the same block via Cline Settings → MCP Servers → Edit JSON."
369
345
  });
370
-
371
346
  //#endregion
372
347
  //#region src/cli/connect/copilot-cli.ts
373
348
  const COPILOT_DIR = process.env["COPILOT_HOME"] || join(homedir(), ".copilot");
@@ -427,7 +402,6 @@ const adapter$13 = {
427
402
  };
428
403
  }
429
404
  };
430
-
431
405
  //#endregion
432
406
  //#region src/cli/connect/codex.ts
433
407
  const CODEX_DIR = join(homedir(), ".codex");
@@ -552,7 +526,6 @@ function installCodexHooks(opts) {
552
526
  ...backupPath !== void 0 && { backupPath }
553
527
  };
554
528
  }
555
-
556
529
  //#endregion
557
530
  //#region src/cli/connect/continue.ts
558
531
  const CONTINUE_DIR = join(homedir(), ".continue");
@@ -661,7 +634,6 @@ const adapter$11 = {
661
634
  };
662
635
  }
663
636
  };
664
-
665
637
  //#endregion
666
638
  //#region src/cli/connect/cursor.ts
667
639
  const adapter$10 = createJsonMcpAdapter({
@@ -672,7 +644,6 @@ const adapter$10 = createJsonMcpAdapter({
672
644
  docs: "https://github.com/rohitg00/agentmemory#other-agents",
673
645
  protocolNote: "→ Using MCP (the only protocol Cursor speaks). Memory bridge runs at :3111 underneath."
674
646
  });
675
-
676
647
  //#endregion
677
648
  //#region src/cli/connect/droid.ts
678
649
  const adapter$9 = createJsonMcpAdapter({
@@ -684,7 +655,6 @@ const adapter$9 = createJsonMcpAdapter({
684
655
  protocolNote: "→ Using MCP via ~/.factory/mcp.json. The `/mcp` slash command inside droid lists configured servers.",
685
656
  extraEntryFields: { type: "stdio" }
686
657
  });
687
-
688
658
  //#endregion
689
659
  //#region src/cli/connect/gemini-cli.ts
690
660
  const adapter$8 = createJsonMcpAdapter({
@@ -695,7 +665,6 @@ const adapter$8 = createJsonMcpAdapter({
695
665
  docs: "https://github.com/rohitg00/agentmemory#other-agents",
696
666
  protocolNote: "→ Using MCP (the only protocol Gemini CLI speaks). Memory bridge runs at :3111 underneath."
697
667
  });
698
-
699
668
  //#endregion
700
669
  //#region src/cli/connect/hermes.ts
701
670
  const HERMES_DIR = join(homedir(), ".hermes");
@@ -730,7 +699,6 @@ const adapter$7 = {
730
699
  };
731
700
  }
732
701
  };
733
-
734
702
  //#endregion
735
703
  //#region src/cli/connect/kiro.ts
736
704
  const adapter$6 = createJsonMcpAdapter({
@@ -741,7 +709,6 @@ const adapter$6 = createJsonMcpAdapter({
741
709
  docs: "https://github.com/rohitg00/agentmemory#other-agents",
742
710
  protocolNote: "→ Using MCP via ~/.kiro/settings/mcp.json (user-level). Workspace overrides live in .kiro/settings/mcp.json."
743
711
  });
744
-
745
712
  //#endregion
746
713
  //#region src/cli/connect/openclaw.ts
747
714
  const adapter$5 = createJsonMcpAdapter({
@@ -752,7 +719,6 @@ const adapter$5 = createJsonMcpAdapter({
752
719
  docs: "https://github.com/rohitg00/agentmemory/tree/main/integrations/openclaw",
753
720
  protocolNote: "→ Using MCP. Hooks are also available — see docs/openclaw.md."
754
721
  });
755
-
756
722
  //#endregion
757
723
  //#region src/cli/connect/openhuman.ts
758
724
  const OPENHUMAN_DIR = join(homedir(), ".openhuman");
@@ -781,7 +747,6 @@ const adapter$4 = {
781
747
  };
782
748
  }
783
749
  };
784
-
785
750
  //#endregion
786
751
  //#region src/cli/connect/pi.ts
787
752
  const PI_DIR = join(homedir(), ".pi");
@@ -815,7 +780,6 @@ const adapter$3 = {
815
780
  };
816
781
  }
817
782
  };
818
-
819
783
  //#endregion
820
784
  //#region src/cli/connect/qwen.ts
821
785
  const adapter$2 = createJsonMcpAdapter({
@@ -826,7 +790,6 @@ const adapter$2 = createJsonMcpAdapter({
826
790
  docs: "https://github.com/rohitg00/agentmemory#other-agents",
827
791
  protocolNote: "→ Using MCP via ~/.qwen/settings.json. Qwen Code's hook system can also be wired separately — see docs."
828
792
  });
829
-
830
793
  //#endregion
831
794
  //#region src/cli/connect/warp.ts
832
795
  const adapter$1 = createJsonMcpAdapter({
@@ -837,7 +800,6 @@ const adapter$1 = createJsonMcpAdapter({
837
800
  docs: "https://github.com/rohitg00/agentmemory#other-agents",
838
801
  protocolNote: "→ Using MCP via ~/.warp/.mcp.json. Skills auto-discover from .claude/skills/ if the Claude Code plugin is also installed."
839
802
  });
840
-
841
803
  //#endregion
842
804
  //#region src/cli/connect/zed.ts
843
805
  const zedConfigDir = join(homedir(), ".config", "zed");
@@ -850,7 +812,6 @@ const adapter = createJsonMcpAdapter({
850
812
  docs: "https://github.com/rohitg00/agentmemory#other-agents",
851
813
  protocolNote: "→ Using MCP via ~/.config/zed/settings.json (key: context_servers)."
852
814
  });
853
-
854
815
  //#endregion
855
816
  //#region src/cli/connect/index.ts
856
817
  var connect_exports = /* @__PURE__ */ __exportAll({
@@ -1014,7 +975,7 @@ function summarize(results) {
1014
975
  if (results.some((r) => r.result.kind === "installed" || r.result.kind === "already-wired")) p.log.info("Next: install agentmemory's 8 skills into the same agent(s) so they know when to call the tools:\n npx skills add rohitg00/agentmemory -y");
1015
976
  p.outro("Restart any wired agent (or open a new session) to pick up agentmemory.");
1016
977
  }
1017
-
1018
978
  //#endregion
1019
979
  export { resolveAdapter as n, runAdapter as r, connect_exports as t };
1020
- //# sourceMappingURL=connect-Cf9bmBqO.mjs.map
980
+
981
+ //# sourceMappingURL=connect-bmZ5eqYN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-Cf9bmBqO.mjs","names":["entryMatches","adapter","entryMatches","adapter","adapter","adapter","adapter","adapter","adapter","adapter","adapter","DOCS","adapter","adapter","adapter","DOCS","adapter","adapter","adapter","adapter","claudeCode","copilotCli","codex","cursor","geminiCli","qwen","antigravity","kiro","warp","cline","continueDev","zed","droid","openclaw","hermes","pi","openhuman"],"sources":["../src/cli/connect/util.ts","../src/cli/connect/json-mcp-adapter.ts","../src/cli/connect/antigravity.ts","../src/cli/connect/codex-hooks.ts","../src/cli/connect/claude-code.ts","../src/cli/connect/cline.ts","../src/cli/connect/copilot-cli.ts","../src/cli/connect/codex.ts","../src/cli/connect/continue.ts","../src/cli/connect/cursor.ts","../src/cli/connect/droid.ts","../src/cli/connect/gemini-cli.ts","../src/cli/connect/hermes.ts","../src/cli/connect/kiro.ts","../src/cli/connect/openclaw.ts","../src/cli/connect/openhuman.ts","../src/cli/connect/pi.ts","../src/cli/connect/qwen.ts","../src/cli/connect/warp.ts","../src/cli/connect/zed.ts","../src/cli/connect/index.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n copyFileSync,\n renameSync,\n} from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport * as p from \"@clack/prompts\";\n\n// Env values use ${VAR:-default} expansion so the wired MCP entry\n// inherits AGENTMEMORY_URL / AGENTMEMORY_SECRET / AGENTMEMORY_TOOLS\n// from the user's shell, but never fails parse when the var is unset\n// (#510). Earlier `${VAR}` form caused Claude Code to silently drop the\n// server when no shell-level export existed — per the Claude Code MCP\n// docs, \"If a required environment variable is not set and has no\n// default value, Claude Code will fail to parse the config.\"\n//\n// Defaults match the documented runtime: localhost:3111 (no auth, all\n// tools). One wired entry now serves local AND remote (Kubernetes /\n// reverse-proxied) deployments without doctor-warning duplicates (#375)\n// AND fresh installs that haven't exported envs (#510).\nexport const AGENTMEMORY_MCP_BLOCK = {\n command: \"npx\",\n args: [\"-y\", \"@agentmemory/mcp\"],\n env: {\n AGENTMEMORY_URL: \"${AGENTMEMORY_URL:-http://localhost:3111}\",\n AGENTMEMORY_SECRET: \"${AGENTMEMORY_SECRET:-}\",\n AGENTMEMORY_TOOLS: \"${AGENTMEMORY_TOOLS:-all}\",\n },\n};\n\nconst COPILOT_MCP_COMMAND =\n process.platform === \"win32\"\n ? {\n command: process.env[\"ComSpec\"] || process.env[\"COMSPEC\"] || \"cmd.exe\",\n args: [\"/d\", \"/s\", \"/c\", \"npx\", \"-y\", \"@agentmemory/mcp\"],\n }\n : {\n command: \"npx\",\n args: [\"-y\", \"@agentmemory/mcp\"],\n };\n\nexport const AGENTMEMORY_COPILOT_MCP_BLOCK = {\n type: \"local\" as const,\n ...COPILOT_MCP_COMMAND,\n env: {\n AGENTMEMORY_URL: \"${AGENTMEMORY_URL:-http://localhost:3111}\",\n AGENTMEMORY_SECRET: \"${AGENTMEMORY_SECRET:-}\",\n AGENTMEMORY_TOOLS: \"${AGENTMEMORY_TOOLS:-all}\",\n },\n tools: [\"*\"],\n};\n\nexport function backupsDir(): string {\n return join(homedir(), \".agentmemory\", \"backups\");\n}\n\nexport function ensureBackupsDir(): string {\n const dir = backupsDir();\n mkdirSync(dir, { recursive: true });\n return dir;\n}\n\nexport function timestampSlug(): string {\n return new Date().toISOString().replace(/[:.]/g, \"-\");\n}\n\nexport function backupFile(\n sourcePath: string,\n agent: string,\n ext = \"json\",\n): string {\n ensureBackupsDir();\n const stamp = timestampSlug();\n const target = join(backupsDir(), `${agent}-${stamp}.${ext}`);\n copyFileSync(sourcePath, target);\n return target;\n}\n\nexport function readJsonSafe<T = unknown>(path: string): T | null {\n if (!existsSync(path)) return null;\n try {\n return JSON.parse(readFileSync(path, \"utf-8\")) as T;\n } catch {\n return null;\n }\n}\n\nexport function writeJsonAtomic(path: string, value: unknown): void {\n mkdirSync(dirname(path), { recursive: true });\n const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;\n writeFileSync(tmp, `${JSON.stringify(value, null, 2)}\\n`, \"utf-8\");\n renameSync(tmp, path);\n}\n\nexport function logInstalled(label: string, target: string): void {\n p.log.success(`${label} → wired into ${target}`);\n}\n\nexport function logAlreadyWired(label: string, target: string): void {\n p.log.info(`${label} already wired in ${target} (use --force to re-install)`);\n}\n\nexport function logBackup(target: string): void {\n p.log.info(`Backup: ${target}`);\n}\n","import { existsSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n AGENTMEMORY_MCP_BLOCK,\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\n\nexport type JsonMcpAdapterConfig = {\n name: string;\n displayName: string;\n detectDir: string;\n configPath: string;\n docs?: string;\n protocolNote?: string;\n // Wrapper key under which servers live. Default \"mcpServers\".\n // Zed uses \"context_servers\"; otherwise same shape.\n wrapperKey?: string;\n // Extra fields merged into the agentmemory entry. Droid requires\n // type: \"stdio\"; other hosts ignore unknown fields.\n extraEntryFields?: Record<string, unknown>;\n};\n\ntype McpEntry = typeof AGENTMEMORY_MCP_BLOCK;\ntype McpConfig = Record<string, unknown>;\n\nfunction entryMatches(entry: unknown): boolean {\n if (!entry || typeof entry !== \"object\") return false;\n const e = entry as Record<string, unknown>;\n if (e[\"command\"] !== \"npx\") return false;\n const args = Array.isArray(e[\"args\"]) ? (e[\"args\"] as string[]) : [];\n return args.includes(\"@agentmemory/mcp\");\n}\n\nexport function createJsonMcpAdapter(\n config: JsonMcpAdapterConfig,\n): ConnectAdapter {\n const wrapperKey = config.wrapperKey ?? \"mcpServers\";\n return {\n name: config.name,\n displayName: config.displayName,\n ...(config.docs !== undefined && { docs: config.docs }),\n ...(config.protocolNote !== undefined && {\n protocolNote: config.protocolNote,\n }),\n\n detect(): boolean {\n return existsSync(config.detectDir);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const existing = readJsonSafe<McpConfig>(config.configPath);\n const next: McpConfig = existing ? { ...existing } : {};\n const servers: Record<string, McpEntry> = {\n ...((next[wrapperKey] as Record<string, McpEntry>) ?? {}),\n };\n\n const alreadyHas = entryMatches(servers[\"agentmemory\"]);\n if (alreadyHas && !opts.force) {\n logAlreadyWired(config.displayName, config.configPath);\n return { kind: \"already-wired\", mutatedPath: config.configPath };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} ${wrapperKey}.agentmemory in ${config.configPath}`,\n );\n return { kind: \"installed\", mutatedPath: config.configPath };\n }\n\n let backupPath: string | undefined;\n if (existsSync(config.configPath)) {\n backupPath = backupFile(config.configPath, config.name);\n logBackup(backupPath);\n } else {\n mkdirSync(dirname(config.configPath), { recursive: true });\n }\n\n servers[\"agentmemory\"] = {\n ...AGENTMEMORY_MCP_BLOCK,\n ...(config.extraEntryFields ?? {}),\n };\n next[wrapperKey] = servers;\n writeJsonAtomic(config.configPath, next);\n\n const verify = readJsonSafe<McpConfig>(config.configPath);\n const verifyServers = verify?.[wrapperKey] as\n | Record<string, McpEntry>\n | undefined;\n if (!entryMatches(verifyServers?.[\"agentmemory\"])) {\n p.log.error(\n `Verification failed: ${config.configPath} did not contain ${wrapperKey}.agentmemory after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(config.displayName, config.configPath);\n return {\n kind: \"installed\",\n mutatedPath: config.configPath,\n ...(backupPath !== undefined && { backupPath }),\n };\n },\n };\n}\n","import { homedir, platform } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Antigravity stores MCP config in mcp_config.json under its app\n// support directory. The schema follows the standard MCP envelope —\n// `{ mcpServers: { ... } }`. Path varies by platform:\n// macOS: ~/Library/Application Support/Antigravity/User/mcp_config.json\n// Linux: ~/.config/Antigravity/User/mcp_config.json\n// Windows: %APPDATA%/Antigravity/User/mcp_config.json\n// Connect is gated on win32 elsewhere; we cover macOS + Linux here.\nconst ANTIGRAVITY_DIR =\n platform() === \"darwin\"\n ? join(homedir(), \"Library\", \"Application Support\", \"Antigravity\", \"User\")\n : join(homedir(), \".config\", \"Antigravity\", \"User\");\n\nexport const adapter = createJsonMcpAdapter({\n name: \"antigravity\",\n displayName: \"Antigravity\",\n detectDir: ANTIGRAVITY_DIR,\n configPath: join(ANTIGRAVITY_DIR, \"mcp_config.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via mcp_config.json. Antigravity replaces Gemini CLI (sunset 2026-06-18).\",\n});\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Workaround for openai/codex#16430 — Codex Desktop does not dispatch\n * plugin-local `hooks.json` even though both `CodexHooks` and `PluginHooks`\n * feature flags are stable + default-enabled in\n * `codex-rs/features/src/lib.rs`. Until upstream fixes plugin-scope\n * dispatch, the same hook commands can be mirrored into the global\n * `~/.codex/hooks.json`, which is loaded reliably.\n *\n * This module builds that mirror, with `${CLAUDE_PLUGIN_ROOT}` resolved to\n * the bundled `plugin/` directory so the user-scope file does not depend\n * on env-var expansion (Codex only injects `CLAUDE_PLUGIN_ROOT` for\n * plugin-scope hooks).\n *\n * Identification on re-install: every command we write contains the\n * resolved `<pluginRoot>/scripts/` prefix, so subsequent installs can\n * strip our entries and re-add cleanly without touching the user's other\n * hook entries.\n */\n\ntype HookHandler = { type: string; command: string };\ntype HookEntry = { matcher?: string; hooks: HookHandler[] };\nexport type HookManifest = { hooks: Record<string, HookEntry[]> };\n\n/**\n * Locate the bundled `plugin/` directory at runtime. Walks up from the\n * module's own location looking for `plugin/scripts/` + `plugin/hooks/`,\n * both shipped via the npm `files` field. Works for both `dist/cli.mjs`\n * (bundled) and `src/cli/connect/codex-hooks.ts` (dev) layouts.\n */\nexport function findPluginRoot(startUrl: string = import.meta.url): string {\n const here = dirname(fileURLToPath(startUrl));\n let dir = here;\n for (let i = 0; i < 12; i++) {\n if (\n existsSync(join(dir, \"plugin\", \"scripts\")) &&\n existsSync(join(dir, \"plugin\", \"hooks\"))\n ) {\n return resolve(join(dir, \"plugin\"));\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n throw new Error(\n `agentmemory: could not locate bundled plugin/ directory (searched up from ${here})`,\n );\n}\n\n/**\n * Build the merged hooks.json content.\n *\n * 1. Strip any entry from `existing` whose first hook command points\n * under `<pluginRoot>/scripts/`. This lets us re-install idempotently\n * without leaving stale references.\n * 2. Append fresh entries from the bundled Codex manifest with\n * `${CLAUDE_PLUGIN_ROOT}` rewritten to the absolute plugin path.\n * Matcher values from the bundled manifest are preserved so PreToolUse\n * event routing keeps working.\n */\nexport function buildMergedHooks(\n existing: HookManifest | null,\n pluginRoot: string,\n manifestFile = \"hooks.codex.json\",\n): HookManifest {\n const bundledManifestPath = join(pluginRoot, \"hooks\", manifestFile);\n const ours = JSON.parse(readFileSync(bundledManifestPath, \"utf-8\")) as HookManifest;\n const scriptsDir = join(pluginRoot, \"scripts\");\n\n const out: HookManifest = { hooks: {} };\n\n if (existing?.hooks) {\n for (const [event, entries] of Object.entries(existing.hooks)) {\n const kept = entries.filter((entry) => !isAgentmemoryEntry(entry, scriptsDir));\n if (kept.length > 0) out.hooks[event] = kept;\n }\n }\n\n for (const [event, entries] of Object.entries(ours.hooks)) {\n const resolvedEntries: HookEntry[] = entries.map((entry) => {\n const next: HookEntry = {\n hooks: entry.hooks.map((handler) => ({\n type: handler.type,\n command: handler.command.replace(/\\$\\{CLAUDE_PLUGIN_ROOT\\}/g, pluginRoot),\n })),\n };\n if (entry.matcher !== undefined) next.matcher = entry.matcher;\n return next;\n });\n out.hooks[event] = [...(out.hooks[event] ?? []), ...resolvedEntries];\n }\n\n return out;\n}\n\nfunction isAgentmemoryEntry(entry: HookEntry, scriptsDir: string): boolean {\n const normalizedScriptsDir = normalizePathForCommandMatch(scriptsDir);\n return entry.hooks.some((handler) =>\n normalizePathForCommandMatch(handler.command).includes(normalizedScriptsDir),\n );\n}\n\nfunction normalizePathForCommandMatch(value: string): string {\n return value.replace(/\\\\/g, \"/\");\n}\n","import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n AGENTMEMORY_MCP_BLOCK,\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\nimport {\n buildMergedHooks,\n findPluginRoot,\n type HookManifest,\n} from \"./codex-hooks.js\";\n\nconst CLAUDE_DIR = join(homedir(), \".claude\");\nconst CLAUDE_JSON = join(homedir(), \".claude.json\");\nconst CLAUDE_SETTINGS = join(CLAUDE_DIR, \"settings.json\");\n\ntype ClaudeMcpEntry = typeof AGENTMEMORY_MCP_BLOCK;\ntype ClaudeConfig = {\n mcpServers?: Record<string, ClaudeMcpEntry>;\n [key: string]: unknown;\n};\n\nfunction entryMatches(entry: unknown): boolean {\n if (!entry || typeof entry !== \"object\") return false;\n const e = entry as Record<string, unknown>;\n if (e[\"command\"] !== \"npx\") return false;\n const args = Array.isArray(e[\"args\"]) ? (e[\"args\"] as string[]) : [];\n return args.includes(\"@agentmemory/mcp\");\n}\n\nexport const adapter: ConnectAdapter = {\n name: \"claude-code\",\n displayName: \"Claude Code\",\n docs: \"https://github.com/rohitg00/agentmemory#claude-code-one-block-paste-it\",\n protocolNote:\n \"→ Using MCP. Hooks are also available — see docs/claude-code.md.\",\n\n detect(): boolean {\n return existsSync(CLAUDE_DIR);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const existing = readJsonSafe<ClaudeConfig>(CLAUDE_JSON);\n const next: ClaudeConfig = existing ? { ...existing } : {};\n const servers: Record<string, ClaudeMcpEntry> = {\n ...((next.mcpServers as Record<string, ClaudeMcpEntry>) ?? {}),\n };\n\n const alreadyHas = entryMatches(servers[\"agentmemory\"]);\n if (alreadyHas && !opts.force) {\n logAlreadyWired(\"Claude Code\", CLAUDE_JSON);\n // --with-hooks is independent of MCP wiring (issue #508). Run the\n // hooks fallback even when MCP is already in place so users with a\n // healthy MCP setup can still pick up version-stable hook paths.\n if (opts.withHooks) {\n const hookResult = installClaudeHooks(opts);\n if (hookResult.kind === \"skipped\") {\n p.log.warn(\n `Claude Code hooks fallback skipped: ${hookResult.reason}.`,\n );\n }\n }\n return { kind: \"already-wired\", mutatedPath: CLAUDE_JSON };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} mcpServers.agentmemory in ${CLAUDE_JSON}`,\n );\n return { kind: \"installed\", mutatedPath: CLAUDE_JSON };\n }\n\n let backupPath: string | undefined;\n if (existsSync(CLAUDE_JSON)) {\n backupPath = backupFile(CLAUDE_JSON, \"claude-code\");\n logBackup(backupPath);\n } else {\n mkdirSync(CLAUDE_DIR, { recursive: true });\n writeFileSync(CLAUDE_JSON, \"{}\\n\", \"utf-8\");\n }\n\n servers[\"agentmemory\"] = AGENTMEMORY_MCP_BLOCK;\n next.mcpServers = servers;\n writeJsonAtomic(CLAUDE_JSON, next);\n\n const verify = readJsonSafe<ClaudeConfig>(CLAUDE_JSON);\n if (!entryMatches(verify?.mcpServers?.[\"agentmemory\"])) {\n p.log.error(\n `Verification failed: ${CLAUDE_JSON} did not contain mcpServers.agentmemory after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(\"Claude Code\", CLAUDE_JSON);\n p.log.info(\n \"Restart Claude Code (or run `/mcp` inside a session) to pick up the new server.\",\n );\n\n if (opts.withHooks) {\n const hookResult = installClaudeHooks(opts);\n if (hookResult.kind === \"skipped\") {\n p.log.warn(\n `Claude Code hooks fallback skipped: ${hookResult.reason}. MCP wiring still applied.`,\n );\n }\n }\n\n return { kind: \"installed\", mutatedPath: CLAUDE_JSON, backupPath };\n },\n};\n\n/**\n * Merge the bundled `plugin/hooks/hooks.json` into\n * `~/.claude/settings.json`'s top-level `hooks` field with absolute\n * script paths. Use this when agentmemory is NOT installed through\n * `/plugin marketplace add` (e.g. MCP standalone wiring), so the\n * hook scripts survive version bumps without `${CLAUDE_PLUGIN_ROOT}`\n * expansion (issue #508).\n *\n * Re-install strips entries whose command points under\n * `<pluginRoot>/scripts/`; unrelated user hook entries survive.\n */\nfunction installClaudeHooks(opts: ConnectOptions): ConnectResult {\n let pluginRoot: string;\n try {\n pluginRoot = findPluginRoot();\n } catch (err) {\n return {\n kind: \"skipped\",\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n\n type ClaudeSettings = { hooks?: HookManifest[\"hooks\"]; [key: string]: unknown };\n const existing = readJsonSafe<ClaudeSettings>(CLAUDE_SETTINGS) ?? {};\n const existingHooks: HookManifest | null = existing.hooks\n ? { hooks: existing.hooks }\n : null;\n const merged = buildMergedHooks(existingHooks, pluginRoot, \"hooks.json\");\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would merge agentmemory hook entries into ${CLAUDE_SETTINGS} (${Object.keys(merged.hooks).length} event(s))`,\n );\n return { kind: \"installed\", mutatedPath: CLAUDE_SETTINGS };\n }\n\n let backupPath: string | undefined;\n if (existsSync(CLAUDE_SETTINGS)) {\n backupPath = backupFile(CLAUDE_SETTINGS, \"claude-settings\", \"json\");\n logBackup(backupPath);\n } else {\n mkdirSync(CLAUDE_DIR, { recursive: true });\n }\n\n const next: ClaudeSettings = { ...existing, hooks: merged.hooks };\n writeJsonAtomic(CLAUDE_SETTINGS, next);\n\n logInstalled(\"Claude Code hooks (workaround for #508)\", CLAUDE_SETTINGS);\n p.log.info(\n \"User-scope hook entries reference absolute paths under the bundled plugin/ dir. Re-run `agentmemory connect claude-code --with-hooks` after upgrading agentmemory to refresh them.\",\n );\n\n return {\n kind: \"installed\",\n mutatedPath: CLAUDE_SETTINGS,\n ...(backupPath !== undefined && { backupPath }),\n };\n}\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Cline CLI stores MCP server config at ~/.cline/mcp.json with the\n// canonical `mcpServers` wrapper — same schema as Claude Code with\n// optional `disabled` and `autoApprove` fields per entry.\n// VS Code extension users manage MCP through Cline's Settings UI;\n// this adapter targets the standalone CLI surface.\n// Source: github.com/cline/cline/blob/main/docs/mcp/mcp-overview.mdx\nexport const adapter = createJsonMcpAdapter({\n name: \"cline\",\n displayName: \"Cline\",\n detectDir: join(homedir(), \".cline\"),\n configPath: join(homedir(), \".cline\", \"mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.cline/mcp.json (CLI). VS Code users: add the same block via Cline Settings → MCP Servers → Edit JSON.\",\n});\n","import { existsSync, mkdirSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n AGENTMEMORY_COPILOT_MCP_BLOCK,\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\n\nconst COPILOT_DIR = process.env[\"COPILOT_HOME\"] || join(homedir(), \".copilot\");\nconst COPILOT_MCP_JSON = join(COPILOT_DIR, \"mcp-config.json\");\n\ntype CopilotMcpEntry = typeof AGENTMEMORY_COPILOT_MCP_BLOCK;\ntype CopilotConfig = {\n mcpServers?: Record<string, CopilotMcpEntry>;\n [key: string]: unknown;\n};\n\nfunction entryMatches(entry: unknown): boolean {\n if (!entry || typeof entry !== \"object\") return false;\n return JSON.stringify(entry) === JSON.stringify(AGENTMEMORY_COPILOT_MCP_BLOCK);\n}\n\nexport const adapter: ConnectAdapter = {\n name: \"copilot-cli\",\n displayName: \"GitHub Copilot CLI\",\n docs: \"https://github.com/rohitg00/agentmemory#github-copilot-cli\",\n protocolNote:\n \"→ Using MCP. Install the plugin too for full hooks/skills coverage.\",\n\n detect(): boolean {\n return existsSync(COPILOT_DIR);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const existing = readJsonSafe<CopilotConfig>(COPILOT_MCP_JSON);\n const next: CopilotConfig = existing ? { ...existing } : {};\n const servers: Record<string, CopilotMcpEntry> = {\n ...((next.mcpServers as Record<string, CopilotMcpEntry>) ?? {}),\n };\n\n const alreadyHas = entryMatches(servers[\"agentmemory\"]);\n if (alreadyHas && !opts.force) {\n logAlreadyWired(\"GitHub Copilot CLI\", COPILOT_MCP_JSON);\n return { kind: \"already-wired\", mutatedPath: COPILOT_MCP_JSON };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} mcpServers.agentmemory in ${COPILOT_MCP_JSON}`,\n );\n return { kind: \"installed\", mutatedPath: COPILOT_MCP_JSON };\n }\n\n let backupPath: string | undefined;\n if (existsSync(COPILOT_MCP_JSON)) {\n backupPath = backupFile(COPILOT_MCP_JSON, \"copilot-cli\");\n logBackup(backupPath);\n } else {\n mkdirSync(dirname(COPILOT_MCP_JSON), { recursive: true });\n }\n\n servers[\"agentmemory\"] = AGENTMEMORY_COPILOT_MCP_BLOCK;\n next.mcpServers = servers;\n writeJsonAtomic(COPILOT_MCP_JSON, next);\n\n const verify = readJsonSafe<CopilotConfig>(COPILOT_MCP_JSON);\n if (!entryMatches(verify?.mcpServers?.[\"agentmemory\"])) {\n p.log.error(\n `Verification failed: ${COPILOT_MCP_JSON} did not contain mcpServers.agentmemory after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(\"GitHub Copilot CLI\", COPILOT_MCP_JSON);\n p.log.info(\n \"Copilot picks up MCP servers on next launch or after `/mcp`. Install the plugin too for full hooks/skills.\",\n );\n return {\n kind: \"installed\",\n mutatedPath: COPILOT_MCP_JSON,\n ...(backupPath !== undefined && { backupPath }),\n };\n },\n};\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join, dirname } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\nimport {\n buildMergedHooks,\n findPluginRoot,\n type HookManifest,\n} from \"./codex-hooks.js\";\n\nconst CODEX_DIR = join(homedir(), \".codex\");\nconst CODEX_TOML = join(CODEX_DIR, \"config.toml\");\nconst CODEX_HOOKS = join(CODEX_DIR, \"hooks.json\");\n\nconst TOML_BLOCK = `[mcp_servers.agentmemory]\ncommand = \"npx\"\nargs = [\"-y\", \"@agentmemory/mcp\"]\n\n[mcp_servers.agentmemory.env]\nAGENTMEMORY_URL = \"http://localhost:3111\"\n`;\n\nconst SECTION_HEADER = \"[mcp_servers.agentmemory]\";\n\nfunction isWiredText(toml: string): boolean {\n return toml.includes(SECTION_HEADER);\n}\n\nfunction stripExistingBlock(toml: string): string {\n const lines = toml.split(/\\r?\\n/);\n const out: string[] = [];\n let skipping = false;\n for (const line of lines) {\n const trimmed = line.trim();\n if (\n trimmed === SECTION_HEADER ||\n trimmed === \"[mcp_servers.agentmemory.env]\"\n ) {\n skipping = true;\n continue;\n }\n if (\n skipping &&\n trimmed.startsWith(\"[\") &&\n trimmed !== \"[mcp_servers.agentmemory.env]\"\n ) {\n skipping = false;\n }\n if (!skipping) out.push(line);\n }\n return out.join(\"\\n\").replace(/\\n{3,}$/, \"\\n\\n\").trimEnd() + \"\\n\";\n}\n\nexport const adapter: ConnectAdapter = {\n name: \"codex\",\n displayName: \"Codex CLI\",\n docs: \"https://github.com/rohitg00/agentmemory#codex-cli-codex-plugin-platform\",\n protocolNote:\n \"→ Using MCP. Hooks ship via the Codex plugin; on Codex Desktop, also pass --with-hooks to install the global hooks.json workaround for openai/codex#16430.\",\n\n detect(): boolean {\n return existsSync(CODEX_DIR);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const exists = existsSync(CODEX_TOML);\n const current = exists ? readFileSync(CODEX_TOML, \"utf-8\") : \"\";\n const wired = isWiredText(current);\n\n if (wired && !opts.force) {\n logAlreadyWired(\"Codex CLI\", CODEX_TOML);\n return { kind: \"already-wired\", mutatedPath: CODEX_TOML };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${wired ? \"rewrite\" : \"append\"} [mcp_servers.agentmemory] in ${CODEX_TOML}`,\n );\n if (opts.withHooks) installCodexHooks(opts);\n return { kind: \"installed\", mutatedPath: CODEX_TOML };\n }\n\n let backupPath: string | undefined;\n if (exists) {\n backupPath = backupFile(CODEX_TOML, \"codex\", \"toml\");\n logBackup(backupPath);\n } else {\n mkdirSync(dirname(CODEX_TOML), { recursive: true });\n }\n\n const cleaned = wired ? stripExistingBlock(current) : current;\n const joiner = cleaned.length === 0 || cleaned.endsWith(\"\\n\") ? \"\" : \"\\n\";\n const next = `${cleaned}${joiner}${cleaned.length > 0 ? \"\\n\" : \"\"}${TOML_BLOCK}`;\n writeFileSync(CODEX_TOML, next, \"utf-8\");\n\n const verify = readFileSync(CODEX_TOML, \"utf-8\");\n if (!isWiredText(verify)) {\n p.log.error(\n `Verification failed: ${CODEX_TOML} did not contain ${SECTION_HEADER} after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(\"Codex CLI\", CODEX_TOML);\n p.log.info(\n \"Codex picks up MCP servers on next launch. For the deeper plugin install, run: codex plugin marketplace add rohitg00/agentmemory && codex plugin add agentmemory@agentmemory\",\n );\n\n if (opts.withHooks) {\n const hookResult = installCodexHooks(opts);\n if (hookResult.kind === \"skipped\") {\n p.log.warn(\n `Codex hooks fallback skipped: ${hookResult.reason}. MCP wiring still applied.`,\n );\n }\n }\n\n return {\n kind: \"installed\",\n mutatedPath: CODEX_TOML,\n ...(backupPath !== undefined && { backupPath }),\n };\n },\n};\n\n/**\n * Install the global `~/.codex/hooks.json` fallback. See\n * `codex-hooks.ts` for context (openai/codex#16430). Returns a result\n * describing the side effect for the caller's summary; failures here do\n * not roll back the MCP wiring.\n */\nfunction installCodexHooks(opts: ConnectOptions): ConnectResult {\n let pluginRoot: string;\n try {\n pluginRoot = findPluginRoot();\n } catch (err) {\n return {\n kind: \"skipped\",\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n\n const existing = readJsonSafe<HookManifest>(CODEX_HOOKS);\n const merged = buildMergedHooks(existing, pluginRoot);\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${existing ? \"merge\" : \"create\"} ${CODEX_HOOKS} with ${Object.keys(merged.hooks).length} event(s)`,\n );\n return { kind: \"installed\", mutatedPath: CODEX_HOOKS };\n }\n\n let backupPath: string | undefined;\n if (existsSync(CODEX_HOOKS)) {\n backupPath = backupFile(CODEX_HOOKS, \"codex-hooks\", \"json\");\n logBackup(backupPath);\n }\n\n writeJsonAtomic(CODEX_HOOKS, merged);\n\n logInstalled(\"Codex hooks (workaround for openai/codex#16430)\", CODEX_HOOKS);\n p.log.info(\n \"User-scope hooks reference absolute paths under the bundled plugin/ dir. Re-run `agentmemory connect codex --with-hooks` after upgrading agentmemory to refresh them.\",\n );\n\n return {\n kind: \"installed\",\n mutatedPath: CODEX_HOOKS,\n ...(backupPath !== undefined && { backupPath }),\n };\n}\n","import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n AGENTMEMORY_MCP_BLOCK,\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\n\n// Continue.dev v1+ prefers ~/.continue/config.yaml; config.json is\n// deprecated and ignored when yaml is present. Three branches:\n// - config.yaml exists → emit stub with manual edit instructions\n// (no YAML dep in tree; preserving comments/anchors safely needs it)\n// - config.json exists → modify it (legacy path still loaded when no yaml)\n// - neither → create config.yaml from scratch (no merge risk)\n// Source: docs.continue.dev/reference/yaml-migration\nconst CONTINUE_DIR = join(homedir(), \".continue\");\nconst YAML_PATH = join(CONTINUE_DIR, \"config.yaml\");\nconst JSON_PATH = join(CONTINUE_DIR, \"config.json\");\n\ntype ContinueEntry = {\n name: string;\n command: string;\n args: string[];\n env?: Record<string, string>;\n};\n\ntype ContinueJsonConfig = {\n mcpServers?: ContinueEntry[];\n [key: string]: unknown;\n};\n\nfunction buildEntry(): ContinueEntry {\n return {\n name: \"agentmemory\",\n command: AGENTMEMORY_MCP_BLOCK.command,\n args: [...AGENTMEMORY_MCP_BLOCK.args],\n env: { ...AGENTMEMORY_MCP_BLOCK.env },\n };\n}\n\nfunction entryIsAgentmemory(entry: ContinueEntry | undefined): boolean {\n if (!entry) return false;\n return entry.name === \"agentmemory\" && entry.args.includes(\"@agentmemory/mcp\");\n}\n\n// Minimal YAML emitter for the agentmemory entry. Quotes string values\n// that contain ${ ... } expansion to keep parsers happy. Only used when\n// creating a fresh config.yaml — never when modifying an existing one.\nfunction renderFreshYaml(): string {\n const e = buildEntry();\n const envLines = Object.entries(e.env ?? {})\n .map(([k, v]) => ` ${k}: \"${v}\"`)\n .join(\"\\n\");\n return [\n \"mcpServers:\",\n ` - name: ${e.name}`,\n ` command: ${e.command}`,\n \" args:\",\n ...e.args.map((a) => ` - \"${a}\"`),\n \" env:\",\n envLines,\n \"\",\n ].join(\"\\n\");\n}\n\nexport const adapter: ConnectAdapter = {\n name: \"continue\",\n displayName: \"Continue\",\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.continue/config.yaml (preferred) or config.json (legacy, only when no yaml).\",\n\n detect(): boolean {\n return existsSync(CONTINUE_DIR);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const yamlExists = existsSync(YAML_PATH);\n const jsonExists = existsSync(JSON_PATH);\n\n // Branch 1: yaml present — refuse to silently mutate user's yaml\n // config (preserving comments/anchors needs a proper parser).\n if (yamlExists) {\n const indented = renderFreshYaml()\n .split(\"\\n\")\n .map((l) => (l ? ` ${l}` : l))\n .join(\"\\n\");\n const manual = `\\nMerge this block into ~/.continue/config.yaml (the snippet already includes the top-level mcpServers key — if your config already has a mcpServers list, append the agentmemory entry to it instead of duplicating the key):\\n\\n${indented}`;\n p.log.info(\n `Continue: ${YAML_PATH} already exists. Manual edit needed.${manual}`,\n );\n return { kind: \"stub\", reason: \"config.yaml-needs-manual-edit\" };\n }\n\n // Branch 2: legacy json present — modify in place.\n if (jsonExists) {\n const existing = readJsonSafe<ContinueJsonConfig>(JSON_PATH);\n const next: ContinueJsonConfig = existing ? { ...existing } : {};\n const servers = Array.isArray(next.mcpServers)\n ? [...next.mcpServers]\n : [];\n\n const idx = servers.findIndex((s) => s?.name === \"agentmemory\");\n const alreadyHas = idx >= 0 && entryIsAgentmemory(servers[idx]);\n if (alreadyHas && !opts.force) {\n logAlreadyWired(\"Continue\", JSON_PATH);\n return { kind: \"already-wired\", mutatedPath: JSON_PATH };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} mcpServers[agentmemory] in ${JSON_PATH}`,\n );\n return { kind: \"installed\", mutatedPath: JSON_PATH };\n }\n\n const backupPath = backupFile(JSON_PATH, \"continue\");\n logBackup(backupPath);\n\n const entry = buildEntry();\n if (idx >= 0) servers[idx] = entry;\n else servers.push(entry);\n next.mcpServers = servers;\n writeJsonAtomic(JSON_PATH, next);\n\n const verify = readJsonSafe<ContinueJsonConfig>(JSON_PATH);\n const verifyEntry = verify?.mcpServers?.find(\n (s) => s?.name === \"agentmemory\",\n );\n if (!entryIsAgentmemory(verifyEntry)) {\n p.log.error(\n `Verification failed: ${JSON_PATH} did not contain mcpServers[agentmemory] after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(\"Continue (legacy config.json)\", JSON_PATH);\n return {\n kind: \"installed\",\n mutatedPath: JSON_PATH,\n backupPath,\n };\n }\n\n // Branch 3: neither exists — create config.yaml from scratch (modern path).\n if (opts.dryRun) {\n p.log.info(`[dry-run] Would create ${YAML_PATH} with agentmemory entry`);\n return { kind: \"installed\", mutatedPath: YAML_PATH };\n }\n\n mkdirSync(dirname(YAML_PATH), { recursive: true });\n writeFileSync(YAML_PATH, renderFreshYaml(), \"utf-8\");\n logInstalled(\"Continue\", YAML_PATH);\n return { kind: \"installed\", mutatedPath: YAML_PATH };\n },\n};\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\nexport const adapter = createJsonMcpAdapter({\n name: \"cursor\",\n displayName: \"Cursor\",\n detectDir: join(homedir(), \".cursor\"),\n configPath: join(homedir(), \".cursor\", \"mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP (the only protocol Cursor speaks). Memory bridge runs at :3111 underneath.\",\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Factory.ai's Droid CLI stores MCP server config at ~/.factory/mcp.json\n// with the canonical `mcpServers` wrapper. Project-scoped overrides live\n// at <repo>/.factory/mcp.json. Each entry adds an optional `type` field\n// (\"stdio\" | \"http\") and `disabled` boolean — agentmemory's stdio block\n// works against the same shape without needing the explicit type tag.\n// Source: docs.factory.ai/cli/configuration/mcp\nexport const adapter = createJsonMcpAdapter({\n name: \"droid\",\n displayName: \"Droid (Factory.ai)\",\n detectDir: join(homedir(), \".factory\"),\n configPath: join(homedir(), \".factory\", \"mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.factory/mcp.json. The `/mcp` slash command inside droid lists configured servers.\",\n // Droid requires `type` per the documented schema. stdio for npx-spawned shim.\n extraEntryFields: { type: \"stdio\" },\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\nexport const adapter = createJsonMcpAdapter({\n name: \"gemini-cli\",\n displayName: \"Gemini CLI\",\n detectDir: join(homedir(), \".gemini\"),\n configPath: join(homedir(), \".gemini\", \"settings.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP (the only protocol Gemini CLI speaks). Memory bridge runs at :3111 underneath.\",\n});\n","import { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\n\nconst HERMES_DIR = join(homedir(), \".hermes\");\nconst HERMES_CONFIG = join(HERMES_DIR, \"config.yaml\");\nconst DOCS = \"https://github.com/rohitg00/agentmemory/tree/main/integrations/hermes\";\n\nexport const adapter: ConnectAdapter = {\n name: \"hermes\",\n displayName: \"Hermes Agent\",\n docs: DOCS,\n protocolNote:\n \"→ Using MCP. Hooks are also available — see docs/hermes.md.\",\n\n detect(): boolean {\n return existsSync(HERMES_DIR);\n },\n\n async install(_opts: ConnectOptions): Promise<ConnectResult> {\n p.log.warn(\n \"Hermes uses YAML config. Automated merge isn't implemented yet — manual install required.\",\n );\n p.note(\n [\n `Add to ${HERMES_CONFIG}:`,\n \"\",\n \" mcp_servers:\",\n \" agentmemory:\",\n \" command: npx\",\n ' args: [\"-y\", \"@agentmemory/mcp\"]',\n \"\",\n \" memory:\",\n \" provider: agentmemory\",\n \"\",\n `Full guide: ${DOCS}`,\n ].join(\"\\n\"),\n \"Hermes manual install\",\n );\n return {\n kind: \"stub\",\n reason: \"yaml-merge-not-implemented\",\n };\n },\n};\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Kiro stores user-level MCP servers in ~/.kiro/settings/mcp.json.\n// Schema follows the standard MCP envelope { mcpServers: { ... } }.\n// Source: kiro.dev/docs/cli/mcp\nexport const adapter = createJsonMcpAdapter({\n name: \"kiro\",\n displayName: \"Kiro\",\n detectDir: join(homedir(), \".kiro\"),\n configPath: join(homedir(), \".kiro\", \"settings\", \"mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.kiro/settings/mcp.json (user-level). Workspace overrides live in .kiro/settings/mcp.json.\",\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\nexport const adapter = createJsonMcpAdapter({\n name: \"openclaw\",\n displayName: \"OpenClaw\",\n detectDir: join(homedir(), \".openclaw\"),\n configPath: join(homedir(), \".openclaw\", \"openclaw.json\"),\n docs: \"https://github.com/rohitg00/agentmemory/tree/main/integrations/openclaw\",\n protocolNote:\n \"→ Using MCP. Hooks are also available — see docs/openclaw.md.\",\n});\n","import { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\n\nconst OPENHUMAN_DIR = join(homedir(), \".openhuman\");\nconst DOCS = \"https://github.com/tinyhumansai/openhuman\";\n\nexport const adapter: ConnectAdapter = {\n name: \"openhuman\",\n displayName: \"OpenHuman\",\n docs: DOCS,\n protocolNote:\n \"→ Using native hooks (REST API at :3111). MCP not required.\",\n\n detect(): boolean {\n return existsSync(OPENHUMAN_DIR);\n },\n\n async install(_opts: ConnectOptions): Promise<ConnectResult> {\n p.log.warn(\n \"OpenHuman integration is not yet automated. No `integrations/openhuman/` folder exists in the agentmemory repo today.\",\n );\n p.note(\n [\n \"OpenHuman is a Memory-trait host. The expected wiring is the REST\",\n \"proxy at http://localhost:3111 plus an OpenHuman-side Memory trait\",\n \"impl. Once integrations/openhuman/ lands in agentmemory we'll wire\",\n \"this up automatically.\",\n \"\",\n `Tracking: ${DOCS}`,\n ].join(\"\\n\"),\n \"OpenHuman manual install\",\n );\n return {\n kind: \"stub\",\n reason: \"no-integration-folder-yet\",\n };\n },\n};\n","import { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\n\nconst PI_DIR = join(homedir(), \".pi\");\nconst PI_EXT_DIR = join(PI_DIR, \"agent\", \"extensions\", \"agentmemory\");\nconst DOCS = \"https://github.com/rohitg00/agentmemory/tree/main/integrations/pi\";\n\nexport const adapter: ConnectAdapter = {\n name: \"pi\",\n displayName: \"pi\",\n docs: DOCS,\n protocolNote:\n \"→ Using native hooks (REST API at :3111). MCP not required.\",\n\n detect(): boolean {\n return existsSync(PI_DIR);\n },\n\n async install(_opts: ConnectOptions): Promise<ConnectResult> {\n p.log.warn(\n \"pi uses a TypeScript extension file. Automated copy + register isn't implemented yet — manual install required.\",\n );\n p.note(\n [\n \"Run these from the agentmemory repo root:\",\n \"\",\n ` mkdir -p ${PI_EXT_DIR}`,\n ` cp integrations/pi/index.ts ${PI_EXT_DIR}/index.ts`,\n ` cp integrations/pi/security.ts ${PI_EXT_DIR}/security.ts`,\n \"\",\n \"Then add to ~/.pi/agent/settings.json:\",\n ' { \"extensions\": [\"~/.pi/agent/extensions/agentmemory\"] }',\n \"\",\n `Full guide: ${DOCS}`,\n ].join(\"\\n\"),\n \"pi manual install\",\n );\n return {\n kind: \"stub\",\n reason: \"ts-extension-copy-not-implemented\",\n };\n },\n};\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Qwen Code stores its settings (mcpServers + hooks) in\n// ~/.qwen/settings.json. Schema for mcpServers matches Claude Code's\n// shape, so the shared JSON adapter handles the wiring.\n// Source: qwenlm.github.io/qwen-code-docs/en/users/features/mcp\nexport const adapter = createJsonMcpAdapter({\n name: \"qwen\",\n displayName: \"Qwen Code\",\n detectDir: join(homedir(), \".qwen\"),\n configPath: join(homedir(), \".qwen\", \"settings.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.qwen/settings.json. Qwen Code's hook system can also be wired separately — see docs.\",\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Warp stores MCP server config at ~/.warp/.mcp.json with the\n// canonical `mcpServers` wrapper — identical schema to Claude Code.\n// Warp also auto-discovers skills from .claude/skills/ so the\n// agentmemory plugin's 8 skills are surfaced natively once the\n// Claude Code plugin is installed.\n// Source: docs.warp.dev/agent-platform/capabilities/mcp/\nexport const adapter = createJsonMcpAdapter({\n name: \"warp\",\n displayName: \"Warp\",\n detectDir: join(homedir(), \".warp\"),\n configPath: join(homedir(), \".warp\", \".mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.warp/.mcp.json. Skills auto-discover from .claude/skills/ if the Claude Code plugin is also installed.\",\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Zed stores its settings (including MCP servers) under \"context_servers\"\n// in settings.json — NOT \"mcpServers\". User config lives at\n// ~/.config/zed/settings.json on all platforms (Zed uses the XDG path\n// even on macOS; ~/Library/Application Support/Zed/ holds runtime data\n// like the database + cached language servers, not the config).\n// Source: zed.dev/docs/ai/mcp + zed.dev/docs/configuring-zed\nconst zedConfigDir = join(homedir(), \".config\", \"zed\");\n\nexport const adapter = createJsonMcpAdapter({\n name: \"zed\",\n displayName: \"Zed\",\n detectDir: zedConfigDir,\n configPath: join(zedConfigDir, \"settings.json\"),\n wrapperKey: \"context_servers\",\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.config/zed/settings.json (key: context_servers).\",\n});\n","import { platform } from \"node:os\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport { adapter as antigravity } from \"./antigravity.js\";\nimport { adapter as claudeCode } from \"./claude-code.js\";\nimport { adapter as cline } from \"./cline.js\";\nimport { adapter as copilotCli } from \"./copilot-cli.js\";\nimport { adapter as codex } from \"./codex.js\";\nimport { adapter as continueDev } from \"./continue.js\";\nimport { adapter as cursor } from \"./cursor.js\";\nimport { adapter as droid } from \"./droid.js\";\nimport { adapter as geminiCli } from \"./gemini-cli.js\";\nimport { adapter as hermes } from \"./hermes.js\";\nimport { adapter as kiro } from \"./kiro.js\";\nimport { adapter as openclaw } from \"./openclaw.js\";\nimport { adapter as openhuman } from \"./openhuman.js\";\nimport { adapter as pi } from \"./pi.js\";\nimport { adapter as qwen } from \"./qwen.js\";\nimport { adapter as warp } from \"./warp.js\";\nimport { adapter as zed } from \"./zed.js\";\n\nexport const ADAPTERS: readonly ConnectAdapter[] = [\n claudeCode,\n copilotCli,\n codex,\n cursor,\n geminiCli,\n qwen,\n antigravity,\n kiro,\n warp,\n cline,\n continueDev,\n zed,\n droid,\n openclaw,\n hermes,\n pi,\n openhuman,\n];\n\nexport function resolveAdapter(name: string): ConnectAdapter | null {\n const lower = name.toLowerCase();\n return ADAPTERS.find((a) => a.name === lower) ?? null;\n}\n\nexport function knownAgents(): string[] {\n return ADAPTERS.map((a) => a.name);\n}\n\nfunction parseFlags(args: string[]): {\n dryRun: boolean;\n force: boolean;\n all: boolean;\n withHooks: boolean;\n positional: string[];\n} {\n const positional: string[] = [];\n let dryRun = false;\n let force = false;\n let all = false;\n let withHooks = false;\n for (const a of args) {\n if (a === \"--dry-run\") dryRun = true;\n else if (a === \"--force\") force = true;\n else if (a === \"--all\") all = true;\n else if (a === \"--with-hooks\") withHooks = true;\n else if (!a.startsWith(\"-\")) positional.push(a);\n }\n return { dryRun, force, all, withHooks, positional };\n}\n\nexport async function runAdapter(\n adapter: ConnectAdapter,\n opts: ConnectOptions,\n): Promise<ConnectResult> {\n if (!adapter.detect()) {\n p.log.warn(\n `${adapter.displayName}: not detected on this machine (skipping).${adapter.docs ? ` Docs: ${adapter.docs}` : \"\"}`,\n );\n return { kind: \"skipped\", reason: \"not-detected\" };\n }\n p.log.step(`Wiring ${adapter.displayName}…`);\n if (adapter.protocolNote) {\n p.log.message(adapter.protocolNote);\n }\n try {\n return await adapter.install(opts);\n } catch (err) {\n p.log.error(\n `${adapter.displayName}: ${err instanceof Error ? err.message : String(err)}`,\n );\n return { kind: \"skipped\", reason: \"exception\" };\n }\n}\n\nexport async function runConnect(args: string[]): Promise<void> {\n const { dryRun, force, all, withHooks, positional } = parseFlags(args);\n const allowWindowsAdapter =\n positional.length === 1 && positional[0]?.toLowerCase() === \"copilot-cli\";\n if (platform() === \"win32\" && !allowWindowsAdapter) {\n p.intro(\"agentmemory connect\");\n p.log.warn(\n \"Windows: automated `connect` is not supported yet. See https://github.com/rohitg00/agentmemory#other-agents for manual install steps.\",\n );\n p.outro(\"Windows: manual install required — see docs\");\n return;\n }\n\n const opts: ConnectOptions = { dryRun, force, withHooks };\n\n p.intro(\"agentmemory connect\");\n\n if (positional.length === 0 && !all) {\n const detected = ADAPTERS.filter((a) => a.detect());\n if (detected.length === 0) {\n p.log.error(\"No supported agents detected on this machine.\");\n p.outro(`Supported: ${knownAgents().join(\", \")}`);\n process.exit(1);\n }\n const picked = await p.multiselect<string>({\n message: \"Wire agentmemory into which agents?\",\n options: detected.map((a) => ({ value: a.name, label: a.displayName })),\n required: true,\n });\n if (p.isCancel(picked)) {\n p.cancel(\"Cancelled.\");\n return;\n }\n const results: { name: string; result: ConnectResult }[] = [];\n for (const name of picked as string[]) {\n const adapter = resolveAdapter(name);\n if (!adapter) continue;\n results.push({ name, result: await runAdapter(adapter, opts) });\n }\n summarize(results);\n return;\n }\n\n if (all) {\n const detected = ADAPTERS.filter((a) => a.detect());\n if (detected.length === 0) {\n p.log.error(\"No supported agents detected on this machine.\");\n process.exit(1);\n }\n const results: { name: string; result: ConnectResult }[] = [];\n for (const adapter of detected) {\n results.push({\n name: adapter.name,\n result: await runAdapter(adapter, opts),\n });\n }\n summarize(results);\n return;\n }\n\n const agentName = positional[0]!;\n const adapter = resolveAdapter(agentName);\n if (!adapter) {\n p.log.error(`Unknown agent: ${agentName}`);\n p.outro(`Supported: ${knownAgents().join(\", \")}`);\n process.exit(1);\n }\n\n const result = await runAdapter(adapter, opts);\n summarize([{ name: agentName, result }]);\n if (result.kind === \"skipped\" && (result as { reason: string }).reason !== \"not-detected\") {\n process.exit(1);\n }\n}\n\nfunction summarize(\n results: { name: string; result: ConnectResult }[],\n): void {\n const lines = results.map(({ name, result }) => {\n switch (result.kind) {\n case \"installed\":\n return ` ✓ ${name}${result.mutatedPath ? ` → ${result.mutatedPath}` : \"\"}`;\n case \"already-wired\":\n return ` ✓ ${name} (already wired)`;\n case \"stub\":\n return ` ⚠ ${name} (manual install required: ${result.reason})`;\n case \"skipped\":\n return ` ✗ ${name} (skipped: ${result.reason})`;\n }\n });\n p.note(lines.join(\"\\n\"), \"summary\");\n\n const stubs = results.filter((r) => r.result.kind === \"stub\");\n if (stubs.length > 0) {\n p.log.info(\n `${stubs.length} agent(s) require manual install — see docs links above.`,\n );\n }\n\n const wiredAny = results.some(\n (r) => r.result.kind === \"installed\" || r.result.kind === \"already-wired\",\n );\n if (wiredAny) {\n p.log.info(\n \"Next: install agentmemory's 8 skills into the same agent(s) so they know when to call the tools:\\n npx skills add rohitg00/agentmemory -y\",\n );\n }\n\n p.outro(\"Restart any wired agent (or open a new session) to pick up agentmemory.\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,wBAAwB;CACnC,SAAS;CACT,MAAM,CAAC,MAAM,mBAAmB;CAChC,KAAK;EACH,iBAAiB;EACjB,oBAAoB;EACpB,mBAAmB;EACpB;CACF;AAED,MAAM,sBACJ,QAAQ,aAAa,UACjB;CACE,SAAS,QAAQ,IAAI,cAAc,QAAQ,IAAI,cAAc;CAC7D,MAAM;EAAC;EAAM;EAAM;EAAM;EAAO;EAAM;EAAmB;CAC1D,GACD;CACE,SAAS;CACT,MAAM,CAAC,MAAM,mBAAmB;CACjC;AAEP,MAAa,gCAAgC;CAC3C,MAAM;CACN,GAAG;CACH,KAAK;EACH,iBAAiB;EACjB,oBAAoB;EACpB,mBAAmB;EACpB;CACD,OAAO,CAAC,IAAI;CACb;AAED,SAAgB,aAAqB;AACnC,QAAO,KAAK,SAAS,EAAE,gBAAgB,UAAU;;AAGnD,SAAgB,mBAA2B;CACzC,MAAM,MAAM,YAAY;AACxB,WAAU,KAAK,EAAE,WAAW,MAAM,CAAC;AACnC,QAAO;;AAGT,SAAgB,gBAAwB;AACtC,yBAAO,IAAI,MAAM,EAAC,aAAa,CAAC,QAAQ,SAAS,IAAI;;AAGvD,SAAgB,WACd,YACA,OACA,MAAM,QACE;AACR,mBAAkB;CAClB,MAAM,QAAQ,eAAe;CAC7B,MAAM,SAAS,KAAK,YAAY,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM;AAC7D,cAAa,YAAY,OAA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MAAM,SAAS,MAAM,WAAW,SAAS,KAAK;AAC9C,WAAU,CAAC;EAAE,MAAM;EAAW;EAAQ,CAAC,CAAC;AACxC,KAAI,OAAO,SAAS,aAAc,OAA8B,WAAW,eACzE,SAAQ,KAAK,EAAE;;AAInB,SAAS,UACP,SACM;CACN,MAAM,QAAQ,QAAQ,KAAK,EAAE,MAAM,aAAa;AAC9C,UAAQ,OAAO,MAAf;GACE,KAAK,YACH,QAAO,OAAO,OAAO,OAAO,cAAc,MAAM,OAAO,gBAAgB;GACzE,KAAK,gBACH,QAAO,OAAO,KAAK;GACrB,KAAK,OACH,QAAO,OAAO,KAAK,6BAA6B,OAAO,OAAO;GAChE,KAAK,UACH,QAAO,OAAO,KAAK,aAAa,OAAO,OAAO;;GAElD;AACF,GAAE,KAAK,MAAM,KAAK,KAAK,EAAE,UAAU;CAEnC,MAAM,QAAQ,QAAQ,QAAQ,MAAM,EAAE,OAAO,SAAS,OAAO;AAC7D,KAAI,MAAM,SAAS,EACjB,GAAE,IAAI,KACJ,GAAG,MAAM,OAAO,0DACjB;AAMH,KAHiB,QAAQ,MACtB,MAAM,EAAE,OAAO,SAAS,eAAe,EAAE,OAAO,SAAS,gBAC3D,CAEC,GAAE,IAAI,KACJ,6IACD;AAGH,GAAE,MAAM,0EAA0E"}
1
+ {"version":3,"file":"connect-bmZ5eqYN.mjs","names":["entryMatches","adapter","entryMatches","adapter","adapter","adapter","adapter","adapter","adapter","adapter","adapter","DOCS","adapter","adapter","adapter","DOCS","adapter","adapter","adapter","adapter","claudeCode","copilotCli","codex","cursor","geminiCli","qwen","antigravity","kiro","warp","cline","continueDev","zed","droid","openclaw","hermes","pi","openhuman"],"sources":["../src/cli/connect/util.ts","../src/cli/connect/json-mcp-adapter.ts","../src/cli/connect/antigravity.ts","../src/cli/connect/codex-hooks.ts","../src/cli/connect/claude-code.ts","../src/cli/connect/cline.ts","../src/cli/connect/copilot-cli.ts","../src/cli/connect/codex.ts","../src/cli/connect/continue.ts","../src/cli/connect/cursor.ts","../src/cli/connect/droid.ts","../src/cli/connect/gemini-cli.ts","../src/cli/connect/hermes.ts","../src/cli/connect/kiro.ts","../src/cli/connect/openclaw.ts","../src/cli/connect/openhuman.ts","../src/cli/connect/pi.ts","../src/cli/connect/qwen.ts","../src/cli/connect/warp.ts","../src/cli/connect/zed.ts","../src/cli/connect/index.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n copyFileSync,\n renameSync,\n} from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport * as p from \"@clack/prompts\";\n\n// Env values use ${VAR:-default} expansion so the wired MCP entry\n// inherits AGENTMEMORY_URL / AGENTMEMORY_SECRET / AGENTMEMORY_TOOLS\n// from the user's shell, but never fails parse when the var is unset\n// (#510). Earlier `${VAR}` form caused Claude Code to silently drop the\n// server when no shell-level export existed — per the Claude Code MCP\n// docs, \"If a required environment variable is not set and has no\n// default value, Claude Code will fail to parse the config.\"\n//\n// Defaults match the documented runtime: localhost:3111 (no auth, all\n// tools). One wired entry now serves local AND remote (Kubernetes /\n// reverse-proxied) deployments without doctor-warning duplicates (#375)\n// AND fresh installs that haven't exported envs (#510).\nexport const AGENTMEMORY_MCP_BLOCK = {\n command: \"npx\",\n args: [\"-y\", \"@agentmemory/mcp\"],\n env: {\n AGENTMEMORY_URL: \"${AGENTMEMORY_URL:-http://localhost:3111}\",\n AGENTMEMORY_SECRET: \"${AGENTMEMORY_SECRET:-}\",\n AGENTMEMORY_TOOLS: \"${AGENTMEMORY_TOOLS:-all}\",\n },\n};\n\nconst COPILOT_MCP_COMMAND =\n process.platform === \"win32\"\n ? {\n command: process.env[\"ComSpec\"] || process.env[\"COMSPEC\"] || \"cmd.exe\",\n args: [\"/d\", \"/s\", \"/c\", \"npx\", \"-y\", \"@agentmemory/mcp\"],\n }\n : {\n command: \"npx\",\n args: [\"-y\", \"@agentmemory/mcp\"],\n };\n\nexport const AGENTMEMORY_COPILOT_MCP_BLOCK = {\n type: \"local\" as const,\n ...COPILOT_MCP_COMMAND,\n env: {\n AGENTMEMORY_URL: \"${AGENTMEMORY_URL:-http://localhost:3111}\",\n AGENTMEMORY_SECRET: \"${AGENTMEMORY_SECRET:-}\",\n AGENTMEMORY_TOOLS: \"${AGENTMEMORY_TOOLS:-all}\",\n },\n tools: [\"*\"],\n};\n\nexport function backupsDir(): string {\n return join(homedir(), \".agentmemory\", \"backups\");\n}\n\nexport function ensureBackupsDir(): string {\n const dir = backupsDir();\n mkdirSync(dir, { recursive: true });\n return dir;\n}\n\nexport function timestampSlug(): string {\n return new Date().toISOString().replace(/[:.]/g, \"-\");\n}\n\nexport function backupFile(\n sourcePath: string,\n agent: string,\n ext = \"json\",\n): string {\n ensureBackupsDir();\n const stamp = timestampSlug();\n const target = join(backupsDir(), `${agent}-${stamp}.${ext}`);\n copyFileSync(sourcePath, target);\n return target;\n}\n\nexport function readJsonSafe<T = unknown>(path: string): T | null {\n if (!existsSync(path)) return null;\n try {\n return JSON.parse(readFileSync(path, \"utf-8\")) as T;\n } catch {\n return null;\n }\n}\n\nexport function writeJsonAtomic(path: string, value: unknown): void {\n mkdirSync(dirname(path), { recursive: true });\n const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;\n writeFileSync(tmp, `${JSON.stringify(value, null, 2)}\\n`, \"utf-8\");\n renameSync(tmp, path);\n}\n\nexport function logInstalled(label: string, target: string): void {\n p.log.success(`${label} → wired into ${target}`);\n}\n\nexport function logAlreadyWired(label: string, target: string): void {\n p.log.info(`${label} already wired in ${target} (use --force to re-install)`);\n}\n\nexport function logBackup(target: string): void {\n p.log.info(`Backup: ${target}`);\n}\n","import { existsSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n AGENTMEMORY_MCP_BLOCK,\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\n\nexport type JsonMcpAdapterConfig = {\n name: string;\n displayName: string;\n detectDir: string;\n configPath: string;\n docs?: string;\n protocolNote?: string;\n // Wrapper key under which servers live. Default \"mcpServers\".\n // Zed uses \"context_servers\"; otherwise same shape.\n wrapperKey?: string;\n // Extra fields merged into the agentmemory entry. Droid requires\n // type: \"stdio\"; other hosts ignore unknown fields.\n extraEntryFields?: Record<string, unknown>;\n};\n\ntype McpEntry = typeof AGENTMEMORY_MCP_BLOCK;\ntype McpConfig = Record<string, unknown>;\n\nfunction entryMatches(entry: unknown): boolean {\n if (!entry || typeof entry !== \"object\") return false;\n const e = entry as Record<string, unknown>;\n if (e[\"command\"] !== \"npx\") return false;\n const args = Array.isArray(e[\"args\"]) ? (e[\"args\"] as string[]) : [];\n return args.includes(\"@agentmemory/mcp\");\n}\n\nexport function createJsonMcpAdapter(\n config: JsonMcpAdapterConfig,\n): ConnectAdapter {\n const wrapperKey = config.wrapperKey ?? \"mcpServers\";\n return {\n name: config.name,\n displayName: config.displayName,\n ...(config.docs !== undefined && { docs: config.docs }),\n ...(config.protocolNote !== undefined && {\n protocolNote: config.protocolNote,\n }),\n\n detect(): boolean {\n return existsSync(config.detectDir);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const existing = readJsonSafe<McpConfig>(config.configPath);\n const next: McpConfig = existing ? { ...existing } : {};\n const servers: Record<string, McpEntry> = {\n ...((next[wrapperKey] as Record<string, McpEntry>) ?? {}),\n };\n\n const alreadyHas = entryMatches(servers[\"agentmemory\"]);\n if (alreadyHas && !opts.force) {\n logAlreadyWired(config.displayName, config.configPath);\n return { kind: \"already-wired\", mutatedPath: config.configPath };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} ${wrapperKey}.agentmemory in ${config.configPath}`,\n );\n return { kind: \"installed\", mutatedPath: config.configPath };\n }\n\n let backupPath: string | undefined;\n if (existsSync(config.configPath)) {\n backupPath = backupFile(config.configPath, config.name);\n logBackup(backupPath);\n } else {\n mkdirSync(dirname(config.configPath), { recursive: true });\n }\n\n servers[\"agentmemory\"] = {\n ...AGENTMEMORY_MCP_BLOCK,\n ...(config.extraEntryFields ?? {}),\n };\n next[wrapperKey] = servers;\n writeJsonAtomic(config.configPath, next);\n\n const verify = readJsonSafe<McpConfig>(config.configPath);\n const verifyServers = verify?.[wrapperKey] as\n | Record<string, McpEntry>\n | undefined;\n if (!entryMatches(verifyServers?.[\"agentmemory\"])) {\n p.log.error(\n `Verification failed: ${config.configPath} did not contain ${wrapperKey}.agentmemory after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(config.displayName, config.configPath);\n return {\n kind: \"installed\",\n mutatedPath: config.configPath,\n ...(backupPath !== undefined && { backupPath }),\n };\n },\n };\n}\n","import { homedir, platform } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Antigravity stores MCP config in mcp_config.json under its app\n// support directory. The schema follows the standard MCP envelope —\n// `{ mcpServers: { ... } }`. Path varies by platform:\n// macOS: ~/Library/Application Support/Antigravity/User/mcp_config.json\n// Linux: ~/.config/Antigravity/User/mcp_config.json\n// Windows: %APPDATA%/Antigravity/User/mcp_config.json\n// Connect is gated on win32 elsewhere; we cover macOS + Linux here.\nconst ANTIGRAVITY_DIR =\n platform() === \"darwin\"\n ? join(homedir(), \"Library\", \"Application Support\", \"Antigravity\", \"User\")\n : join(homedir(), \".config\", \"Antigravity\", \"User\");\n\nexport const adapter = createJsonMcpAdapter({\n name: \"antigravity\",\n displayName: \"Antigravity\",\n detectDir: ANTIGRAVITY_DIR,\n configPath: join(ANTIGRAVITY_DIR, \"mcp_config.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via mcp_config.json. Antigravity replaces Gemini CLI (sunset 2026-06-18).\",\n});\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Workaround for openai/codex#16430 — Codex Desktop does not dispatch\n * plugin-local `hooks.json` even though both `CodexHooks` and `PluginHooks`\n * feature flags are stable + default-enabled in\n * `codex-rs/features/src/lib.rs`. Until upstream fixes plugin-scope\n * dispatch, the same hook commands can be mirrored into the global\n * `~/.codex/hooks.json`, which is loaded reliably.\n *\n * This module builds that mirror, with `${CLAUDE_PLUGIN_ROOT}` resolved to\n * the bundled `plugin/` directory so the user-scope file does not depend\n * on env-var expansion (Codex only injects `CLAUDE_PLUGIN_ROOT` for\n * plugin-scope hooks).\n *\n * Identification on re-install: every command we write contains the\n * resolved `<pluginRoot>/scripts/` prefix, so subsequent installs can\n * strip our entries and re-add cleanly without touching the user's other\n * hook entries.\n */\n\ntype HookHandler = { type: string; command: string };\ntype HookEntry = { matcher?: string; hooks: HookHandler[] };\nexport type HookManifest = { hooks: Record<string, HookEntry[]> };\n\n/**\n * Locate the bundled `plugin/` directory at runtime. Walks up from the\n * module's own location looking for `plugin/scripts/` + `plugin/hooks/`,\n * both shipped via the npm `files` field. Works for both `dist/cli.mjs`\n * (bundled) and `src/cli/connect/codex-hooks.ts` (dev) layouts.\n */\nexport function findPluginRoot(startUrl: string = import.meta.url): string {\n const here = dirname(fileURLToPath(startUrl));\n let dir = here;\n for (let i = 0; i < 12; i++) {\n if (\n existsSync(join(dir, \"plugin\", \"scripts\")) &&\n existsSync(join(dir, \"plugin\", \"hooks\"))\n ) {\n return resolve(join(dir, \"plugin\"));\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n throw new Error(\n `agentmemory: could not locate bundled plugin/ directory (searched up from ${here})`,\n );\n}\n\n/**\n * Build the merged hooks.json content.\n *\n * 1. Strip any entry from `existing` whose first hook command points\n * under `<pluginRoot>/scripts/`. This lets us re-install idempotently\n * without leaving stale references.\n * 2. Append fresh entries from the bundled Codex manifest with\n * `${CLAUDE_PLUGIN_ROOT}` rewritten to the absolute plugin path.\n * Matcher values from the bundled manifest are preserved so PreToolUse\n * event routing keeps working.\n */\nexport function buildMergedHooks(\n existing: HookManifest | null,\n pluginRoot: string,\n manifestFile = \"hooks.codex.json\",\n): HookManifest {\n const bundledManifestPath = join(pluginRoot, \"hooks\", manifestFile);\n const ours = JSON.parse(readFileSync(bundledManifestPath, \"utf-8\")) as HookManifest;\n const scriptsDir = join(pluginRoot, \"scripts\");\n\n const out: HookManifest = { hooks: {} };\n\n if (existing?.hooks) {\n for (const [event, entries] of Object.entries(existing.hooks)) {\n const kept = entries.filter((entry) => !isAgentmemoryEntry(entry, scriptsDir));\n if (kept.length > 0) out.hooks[event] = kept;\n }\n }\n\n for (const [event, entries] of Object.entries(ours.hooks)) {\n const resolvedEntries: HookEntry[] = entries.map((entry) => {\n const next: HookEntry = {\n hooks: entry.hooks.map((handler) => ({\n type: handler.type,\n command: handler.command.replace(/\\$\\{CLAUDE_PLUGIN_ROOT\\}/g, pluginRoot),\n })),\n };\n if (entry.matcher !== undefined) next.matcher = entry.matcher;\n return next;\n });\n out.hooks[event] = [...(out.hooks[event] ?? []), ...resolvedEntries];\n }\n\n return out;\n}\n\nfunction isAgentmemoryEntry(entry: HookEntry, scriptsDir: string): boolean {\n const normalizedScriptsDir = normalizePathForCommandMatch(scriptsDir);\n return entry.hooks.some((handler) =>\n normalizePathForCommandMatch(handler.command).includes(normalizedScriptsDir),\n );\n}\n\nfunction normalizePathForCommandMatch(value: string): string {\n return value.replace(/\\\\/g, \"/\");\n}\n","import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n AGENTMEMORY_MCP_BLOCK,\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\nimport {\n buildMergedHooks,\n findPluginRoot,\n type HookManifest,\n} from \"./codex-hooks.js\";\n\nconst CLAUDE_DIR = join(homedir(), \".claude\");\nconst CLAUDE_JSON = join(homedir(), \".claude.json\");\nconst CLAUDE_SETTINGS = join(CLAUDE_DIR, \"settings.json\");\n\ntype ClaudeMcpEntry = typeof AGENTMEMORY_MCP_BLOCK;\ntype ClaudeConfig = {\n mcpServers?: Record<string, ClaudeMcpEntry>;\n [key: string]: unknown;\n};\n\nfunction entryMatches(entry: unknown): boolean {\n if (!entry || typeof entry !== \"object\") return false;\n const e = entry as Record<string, unknown>;\n if (e[\"command\"] !== \"npx\") return false;\n const args = Array.isArray(e[\"args\"]) ? (e[\"args\"] as string[]) : [];\n return args.includes(\"@agentmemory/mcp\");\n}\n\nexport const adapter: ConnectAdapter = {\n name: \"claude-code\",\n displayName: \"Claude Code\",\n docs: \"https://github.com/rohitg00/agentmemory#claude-code-one-block-paste-it\",\n protocolNote:\n \"→ Using MCP. Hooks are also available — see docs/claude-code.md.\",\n\n detect(): boolean {\n return existsSync(CLAUDE_DIR);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const existing = readJsonSafe<ClaudeConfig>(CLAUDE_JSON);\n const next: ClaudeConfig = existing ? { ...existing } : {};\n const servers: Record<string, ClaudeMcpEntry> = {\n ...((next.mcpServers as Record<string, ClaudeMcpEntry>) ?? {}),\n };\n\n const alreadyHas = entryMatches(servers[\"agentmemory\"]);\n if (alreadyHas && !opts.force) {\n logAlreadyWired(\"Claude Code\", CLAUDE_JSON);\n // --with-hooks is independent of MCP wiring (issue #508). Run the\n // hooks fallback even when MCP is already in place so users with a\n // healthy MCP setup can still pick up version-stable hook paths.\n if (opts.withHooks) {\n const hookResult = installClaudeHooks(opts);\n if (hookResult.kind === \"skipped\") {\n p.log.warn(\n `Claude Code hooks fallback skipped: ${hookResult.reason}.`,\n );\n }\n }\n return { kind: \"already-wired\", mutatedPath: CLAUDE_JSON };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} mcpServers.agentmemory in ${CLAUDE_JSON}`,\n );\n return { kind: \"installed\", mutatedPath: CLAUDE_JSON };\n }\n\n let backupPath: string | undefined;\n if (existsSync(CLAUDE_JSON)) {\n backupPath = backupFile(CLAUDE_JSON, \"claude-code\");\n logBackup(backupPath);\n } else {\n mkdirSync(CLAUDE_DIR, { recursive: true });\n writeFileSync(CLAUDE_JSON, \"{}\\n\", \"utf-8\");\n }\n\n servers[\"agentmemory\"] = AGENTMEMORY_MCP_BLOCK;\n next.mcpServers = servers;\n writeJsonAtomic(CLAUDE_JSON, next);\n\n const verify = readJsonSafe<ClaudeConfig>(CLAUDE_JSON);\n if (!entryMatches(verify?.mcpServers?.[\"agentmemory\"])) {\n p.log.error(\n `Verification failed: ${CLAUDE_JSON} did not contain mcpServers.agentmemory after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(\"Claude Code\", CLAUDE_JSON);\n p.log.info(\n \"Restart Claude Code (or run `/mcp` inside a session) to pick up the new server.\",\n );\n\n if (opts.withHooks) {\n const hookResult = installClaudeHooks(opts);\n if (hookResult.kind === \"skipped\") {\n p.log.warn(\n `Claude Code hooks fallback skipped: ${hookResult.reason}. MCP wiring still applied.`,\n );\n }\n }\n\n return { kind: \"installed\", mutatedPath: CLAUDE_JSON, backupPath };\n },\n};\n\n/**\n * Merge the bundled `plugin/hooks/hooks.json` into\n * `~/.claude/settings.json`'s top-level `hooks` field with absolute\n * script paths. Use this when agentmemory is NOT installed through\n * `/plugin marketplace add` (e.g. MCP standalone wiring), so the\n * hook scripts survive version bumps without `${CLAUDE_PLUGIN_ROOT}`\n * expansion (issue #508).\n *\n * Re-install strips entries whose command points under\n * `<pluginRoot>/scripts/`; unrelated user hook entries survive.\n */\nfunction installClaudeHooks(opts: ConnectOptions): ConnectResult {\n let pluginRoot: string;\n try {\n pluginRoot = findPluginRoot();\n } catch (err) {\n return {\n kind: \"skipped\",\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n\n type ClaudeSettings = { hooks?: HookManifest[\"hooks\"]; [key: string]: unknown };\n const existing = readJsonSafe<ClaudeSettings>(CLAUDE_SETTINGS) ?? {};\n const existingHooks: HookManifest | null = existing.hooks\n ? { hooks: existing.hooks }\n : null;\n const merged = buildMergedHooks(existingHooks, pluginRoot, \"hooks.json\");\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would merge agentmemory hook entries into ${CLAUDE_SETTINGS} (${Object.keys(merged.hooks).length} event(s))`,\n );\n return { kind: \"installed\", mutatedPath: CLAUDE_SETTINGS };\n }\n\n let backupPath: string | undefined;\n if (existsSync(CLAUDE_SETTINGS)) {\n backupPath = backupFile(CLAUDE_SETTINGS, \"claude-settings\", \"json\");\n logBackup(backupPath);\n } else {\n mkdirSync(CLAUDE_DIR, { recursive: true });\n }\n\n const next: ClaudeSettings = { ...existing, hooks: merged.hooks };\n writeJsonAtomic(CLAUDE_SETTINGS, next);\n\n logInstalled(\"Claude Code hooks (workaround for #508)\", CLAUDE_SETTINGS);\n p.log.info(\n \"User-scope hook entries reference absolute paths under the bundled plugin/ dir. Re-run `agentmemory connect claude-code --with-hooks` after upgrading agentmemory to refresh them.\",\n );\n\n return {\n kind: \"installed\",\n mutatedPath: CLAUDE_SETTINGS,\n ...(backupPath !== undefined && { backupPath }),\n };\n}\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Cline CLI stores MCP server config at ~/.cline/mcp.json with the\n// canonical `mcpServers` wrapper — same schema as Claude Code with\n// optional `disabled` and `autoApprove` fields per entry.\n// VS Code extension users manage MCP through Cline's Settings UI;\n// this adapter targets the standalone CLI surface.\n// Source: github.com/cline/cline/blob/main/docs/mcp/mcp-overview.mdx\nexport const adapter = createJsonMcpAdapter({\n name: \"cline\",\n displayName: \"Cline\",\n detectDir: join(homedir(), \".cline\"),\n configPath: join(homedir(), \".cline\", \"mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.cline/mcp.json (CLI). VS Code users: add the same block via Cline Settings → MCP Servers → Edit JSON.\",\n});\n","import { existsSync, mkdirSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n AGENTMEMORY_COPILOT_MCP_BLOCK,\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\n\nconst COPILOT_DIR = process.env[\"COPILOT_HOME\"] || join(homedir(), \".copilot\");\nconst COPILOT_MCP_JSON = join(COPILOT_DIR, \"mcp-config.json\");\n\ntype CopilotMcpEntry = typeof AGENTMEMORY_COPILOT_MCP_BLOCK;\ntype CopilotConfig = {\n mcpServers?: Record<string, CopilotMcpEntry>;\n [key: string]: unknown;\n};\n\nfunction entryMatches(entry: unknown): boolean {\n if (!entry || typeof entry !== \"object\") return false;\n return JSON.stringify(entry) === JSON.stringify(AGENTMEMORY_COPILOT_MCP_BLOCK);\n}\n\nexport const adapter: ConnectAdapter = {\n name: \"copilot-cli\",\n displayName: \"GitHub Copilot CLI\",\n docs: \"https://github.com/rohitg00/agentmemory#github-copilot-cli\",\n protocolNote:\n \"→ Using MCP. Install the plugin too for full hooks/skills coverage.\",\n\n detect(): boolean {\n return existsSync(COPILOT_DIR);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const existing = readJsonSafe<CopilotConfig>(COPILOT_MCP_JSON);\n const next: CopilotConfig = existing ? { ...existing } : {};\n const servers: Record<string, CopilotMcpEntry> = {\n ...((next.mcpServers as Record<string, CopilotMcpEntry>) ?? {}),\n };\n\n const alreadyHas = entryMatches(servers[\"agentmemory\"]);\n if (alreadyHas && !opts.force) {\n logAlreadyWired(\"GitHub Copilot CLI\", COPILOT_MCP_JSON);\n return { kind: \"already-wired\", mutatedPath: COPILOT_MCP_JSON };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} mcpServers.agentmemory in ${COPILOT_MCP_JSON}`,\n );\n return { kind: \"installed\", mutatedPath: COPILOT_MCP_JSON };\n }\n\n let backupPath: string | undefined;\n if (existsSync(COPILOT_MCP_JSON)) {\n backupPath = backupFile(COPILOT_MCP_JSON, \"copilot-cli\");\n logBackup(backupPath);\n } else {\n mkdirSync(dirname(COPILOT_MCP_JSON), { recursive: true });\n }\n\n servers[\"agentmemory\"] = AGENTMEMORY_COPILOT_MCP_BLOCK;\n next.mcpServers = servers;\n writeJsonAtomic(COPILOT_MCP_JSON, next);\n\n const verify = readJsonSafe<CopilotConfig>(COPILOT_MCP_JSON);\n if (!entryMatches(verify?.mcpServers?.[\"agentmemory\"])) {\n p.log.error(\n `Verification failed: ${COPILOT_MCP_JSON} did not contain mcpServers.agentmemory after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(\"GitHub Copilot CLI\", COPILOT_MCP_JSON);\n p.log.info(\n \"Copilot picks up MCP servers on next launch or after `/mcp`. Install the plugin too for full hooks/skills.\",\n );\n return {\n kind: \"installed\",\n mutatedPath: COPILOT_MCP_JSON,\n ...(backupPath !== undefined && { backupPath }),\n };\n },\n};\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join, dirname } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\nimport {\n buildMergedHooks,\n findPluginRoot,\n type HookManifest,\n} from \"./codex-hooks.js\";\n\nconst CODEX_DIR = join(homedir(), \".codex\");\nconst CODEX_TOML = join(CODEX_DIR, \"config.toml\");\nconst CODEX_HOOKS = join(CODEX_DIR, \"hooks.json\");\n\nconst TOML_BLOCK = `[mcp_servers.agentmemory]\ncommand = \"npx\"\nargs = [\"-y\", \"@agentmemory/mcp\"]\n\n[mcp_servers.agentmemory.env]\nAGENTMEMORY_URL = \"http://localhost:3111\"\n`;\n\nconst SECTION_HEADER = \"[mcp_servers.agentmemory]\";\n\nfunction isWiredText(toml: string): boolean {\n return toml.includes(SECTION_HEADER);\n}\n\nfunction stripExistingBlock(toml: string): string {\n const lines = toml.split(/\\r?\\n/);\n const out: string[] = [];\n let skipping = false;\n for (const line of lines) {\n const trimmed = line.trim();\n if (\n trimmed === SECTION_HEADER ||\n trimmed === \"[mcp_servers.agentmemory.env]\"\n ) {\n skipping = true;\n continue;\n }\n if (\n skipping &&\n trimmed.startsWith(\"[\") &&\n trimmed !== \"[mcp_servers.agentmemory.env]\"\n ) {\n skipping = false;\n }\n if (!skipping) out.push(line);\n }\n return out.join(\"\\n\").replace(/\\n{3,}$/, \"\\n\\n\").trimEnd() + \"\\n\";\n}\n\nexport const adapter: ConnectAdapter = {\n name: \"codex\",\n displayName: \"Codex CLI\",\n docs: \"https://github.com/rohitg00/agentmemory#codex-cli-codex-plugin-platform\",\n protocolNote:\n \"→ Using MCP. Hooks ship via the Codex plugin; on Codex Desktop, also pass --with-hooks to install the global hooks.json workaround for openai/codex#16430.\",\n\n detect(): boolean {\n return existsSync(CODEX_DIR);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const exists = existsSync(CODEX_TOML);\n const current = exists ? readFileSync(CODEX_TOML, \"utf-8\") : \"\";\n const wired = isWiredText(current);\n\n if (wired && !opts.force) {\n logAlreadyWired(\"Codex CLI\", CODEX_TOML);\n return { kind: \"already-wired\", mutatedPath: CODEX_TOML };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${wired ? \"rewrite\" : \"append\"} [mcp_servers.agentmemory] in ${CODEX_TOML}`,\n );\n if (opts.withHooks) installCodexHooks(opts);\n return { kind: \"installed\", mutatedPath: CODEX_TOML };\n }\n\n let backupPath: string | undefined;\n if (exists) {\n backupPath = backupFile(CODEX_TOML, \"codex\", \"toml\");\n logBackup(backupPath);\n } else {\n mkdirSync(dirname(CODEX_TOML), { recursive: true });\n }\n\n const cleaned = wired ? stripExistingBlock(current) : current;\n const joiner = cleaned.length === 0 || cleaned.endsWith(\"\\n\") ? \"\" : \"\\n\";\n const next = `${cleaned}${joiner}${cleaned.length > 0 ? \"\\n\" : \"\"}${TOML_BLOCK}`;\n writeFileSync(CODEX_TOML, next, \"utf-8\");\n\n const verify = readFileSync(CODEX_TOML, \"utf-8\");\n if (!isWiredText(verify)) {\n p.log.error(\n `Verification failed: ${CODEX_TOML} did not contain ${SECTION_HEADER} after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(\"Codex CLI\", CODEX_TOML);\n p.log.info(\n \"Codex picks up MCP servers on next launch. For the deeper plugin install, run: codex plugin marketplace add rohitg00/agentmemory && codex plugin add agentmemory@agentmemory\",\n );\n\n if (opts.withHooks) {\n const hookResult = installCodexHooks(opts);\n if (hookResult.kind === \"skipped\") {\n p.log.warn(\n `Codex hooks fallback skipped: ${hookResult.reason}. MCP wiring still applied.`,\n );\n }\n }\n\n return {\n kind: \"installed\",\n mutatedPath: CODEX_TOML,\n ...(backupPath !== undefined && { backupPath }),\n };\n },\n};\n\n/**\n * Install the global `~/.codex/hooks.json` fallback. See\n * `codex-hooks.ts` for context (openai/codex#16430). Returns a result\n * describing the side effect for the caller's summary; failures here do\n * not roll back the MCP wiring.\n */\nfunction installCodexHooks(opts: ConnectOptions): ConnectResult {\n let pluginRoot: string;\n try {\n pluginRoot = findPluginRoot();\n } catch (err) {\n return {\n kind: \"skipped\",\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n\n const existing = readJsonSafe<HookManifest>(CODEX_HOOKS);\n const merged = buildMergedHooks(existing, pluginRoot);\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${existing ? \"merge\" : \"create\"} ${CODEX_HOOKS} with ${Object.keys(merged.hooks).length} event(s)`,\n );\n return { kind: \"installed\", mutatedPath: CODEX_HOOKS };\n }\n\n let backupPath: string | undefined;\n if (existsSync(CODEX_HOOKS)) {\n backupPath = backupFile(CODEX_HOOKS, \"codex-hooks\", \"json\");\n logBackup(backupPath);\n }\n\n writeJsonAtomic(CODEX_HOOKS, merged);\n\n logInstalled(\"Codex hooks (workaround for openai/codex#16430)\", CODEX_HOOKS);\n p.log.info(\n \"User-scope hooks reference absolute paths under the bundled plugin/ dir. Re-run `agentmemory connect codex --with-hooks` after upgrading agentmemory to refresh them.\",\n );\n\n return {\n kind: \"installed\",\n mutatedPath: CODEX_HOOKS,\n ...(backupPath !== undefined && { backupPath }),\n };\n}\n","import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport {\n AGENTMEMORY_MCP_BLOCK,\n backupFile,\n logAlreadyWired,\n logBackup,\n logInstalled,\n readJsonSafe,\n writeJsonAtomic,\n} from \"./util.js\";\n\n// Continue.dev v1+ prefers ~/.continue/config.yaml; config.json is\n// deprecated and ignored when yaml is present. Three branches:\n// - config.yaml exists → emit stub with manual edit instructions\n// (no YAML dep in tree; preserving comments/anchors safely needs it)\n// - config.json exists → modify it (legacy path still loaded when no yaml)\n// - neither → create config.yaml from scratch (no merge risk)\n// Source: docs.continue.dev/reference/yaml-migration\nconst CONTINUE_DIR = join(homedir(), \".continue\");\nconst YAML_PATH = join(CONTINUE_DIR, \"config.yaml\");\nconst JSON_PATH = join(CONTINUE_DIR, \"config.json\");\n\ntype ContinueEntry = {\n name: string;\n command: string;\n args: string[];\n env?: Record<string, string>;\n};\n\ntype ContinueJsonConfig = {\n mcpServers?: ContinueEntry[];\n [key: string]: unknown;\n};\n\nfunction buildEntry(): ContinueEntry {\n return {\n name: \"agentmemory\",\n command: AGENTMEMORY_MCP_BLOCK.command,\n args: [...AGENTMEMORY_MCP_BLOCK.args],\n env: { ...AGENTMEMORY_MCP_BLOCK.env },\n };\n}\n\nfunction entryIsAgentmemory(entry: ContinueEntry | undefined): boolean {\n if (!entry) return false;\n return entry.name === \"agentmemory\" && entry.args.includes(\"@agentmemory/mcp\");\n}\n\n// Minimal YAML emitter for the agentmemory entry. Quotes string values\n// that contain ${ ... } expansion to keep parsers happy. Only used when\n// creating a fresh config.yaml — never when modifying an existing one.\nfunction renderFreshYaml(): string {\n const e = buildEntry();\n const envLines = Object.entries(e.env ?? {})\n .map(([k, v]) => ` ${k}: \"${v}\"`)\n .join(\"\\n\");\n return [\n \"mcpServers:\",\n ` - name: ${e.name}`,\n ` command: ${e.command}`,\n \" args:\",\n ...e.args.map((a) => ` - \"${a}\"`),\n \" env:\",\n envLines,\n \"\",\n ].join(\"\\n\");\n}\n\nexport const adapter: ConnectAdapter = {\n name: \"continue\",\n displayName: \"Continue\",\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.continue/config.yaml (preferred) or config.json (legacy, only when no yaml).\",\n\n detect(): boolean {\n return existsSync(CONTINUE_DIR);\n },\n\n async install(opts: ConnectOptions): Promise<ConnectResult> {\n const yamlExists = existsSync(YAML_PATH);\n const jsonExists = existsSync(JSON_PATH);\n\n // Branch 1: yaml present — refuse to silently mutate user's yaml\n // config (preserving comments/anchors needs a proper parser).\n if (yamlExists) {\n const indented = renderFreshYaml()\n .split(\"\\n\")\n .map((l) => (l ? ` ${l}` : l))\n .join(\"\\n\");\n const manual = `\\nMerge this block into ~/.continue/config.yaml (the snippet already includes the top-level mcpServers key — if your config already has a mcpServers list, append the agentmemory entry to it instead of duplicating the key):\\n\\n${indented}`;\n p.log.info(\n `Continue: ${YAML_PATH} already exists. Manual edit needed.${manual}`,\n );\n return { kind: \"stub\", reason: \"config.yaml-needs-manual-edit\" };\n }\n\n // Branch 2: legacy json present — modify in place.\n if (jsonExists) {\n const existing = readJsonSafe<ContinueJsonConfig>(JSON_PATH);\n const next: ContinueJsonConfig = existing ? { ...existing } : {};\n const servers = Array.isArray(next.mcpServers)\n ? [...next.mcpServers]\n : [];\n\n const idx = servers.findIndex((s) => s?.name === \"agentmemory\");\n const alreadyHas = idx >= 0 && entryIsAgentmemory(servers[idx]);\n if (alreadyHas && !opts.force) {\n logAlreadyWired(\"Continue\", JSON_PATH);\n return { kind: \"already-wired\", mutatedPath: JSON_PATH };\n }\n\n if (opts.dryRun) {\n p.log.info(\n `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} mcpServers[agentmemory] in ${JSON_PATH}`,\n );\n return { kind: \"installed\", mutatedPath: JSON_PATH };\n }\n\n const backupPath = backupFile(JSON_PATH, \"continue\");\n logBackup(backupPath);\n\n const entry = buildEntry();\n if (idx >= 0) servers[idx] = entry;\n else servers.push(entry);\n next.mcpServers = servers;\n writeJsonAtomic(JSON_PATH, next);\n\n const verify = readJsonSafe<ContinueJsonConfig>(JSON_PATH);\n const verifyEntry = verify?.mcpServers?.find(\n (s) => s?.name === \"agentmemory\",\n );\n if (!entryIsAgentmemory(verifyEntry)) {\n p.log.error(\n `Verification failed: ${JSON_PATH} did not contain mcpServers[agentmemory] after write.`,\n );\n return { kind: \"skipped\", reason: \"verification-failed\" };\n }\n\n logInstalled(\"Continue (legacy config.json)\", JSON_PATH);\n return {\n kind: \"installed\",\n mutatedPath: JSON_PATH,\n backupPath,\n };\n }\n\n // Branch 3: neither exists — create config.yaml from scratch (modern path).\n if (opts.dryRun) {\n p.log.info(`[dry-run] Would create ${YAML_PATH} with agentmemory entry`);\n return { kind: \"installed\", mutatedPath: YAML_PATH };\n }\n\n mkdirSync(dirname(YAML_PATH), { recursive: true });\n writeFileSync(YAML_PATH, renderFreshYaml(), \"utf-8\");\n logInstalled(\"Continue\", YAML_PATH);\n return { kind: \"installed\", mutatedPath: YAML_PATH };\n },\n};\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\nexport const adapter = createJsonMcpAdapter({\n name: \"cursor\",\n displayName: \"Cursor\",\n detectDir: join(homedir(), \".cursor\"),\n configPath: join(homedir(), \".cursor\", \"mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP (the only protocol Cursor speaks). Memory bridge runs at :3111 underneath.\",\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Factory.ai's Droid CLI stores MCP server config at ~/.factory/mcp.json\n// with the canonical `mcpServers` wrapper. Project-scoped overrides live\n// at <repo>/.factory/mcp.json. Each entry adds an optional `type` field\n// (\"stdio\" | \"http\") and `disabled` boolean — agentmemory's stdio block\n// works against the same shape without needing the explicit type tag.\n// Source: docs.factory.ai/cli/configuration/mcp\nexport const adapter = createJsonMcpAdapter({\n name: \"droid\",\n displayName: \"Droid (Factory.ai)\",\n detectDir: join(homedir(), \".factory\"),\n configPath: join(homedir(), \".factory\", \"mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.factory/mcp.json. The `/mcp` slash command inside droid lists configured servers.\",\n // Droid requires `type` per the documented schema. stdio for npx-spawned shim.\n extraEntryFields: { type: \"stdio\" },\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\nexport const adapter = createJsonMcpAdapter({\n name: \"gemini-cli\",\n displayName: \"Gemini CLI\",\n detectDir: join(homedir(), \".gemini\"),\n configPath: join(homedir(), \".gemini\", \"settings.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP (the only protocol Gemini CLI speaks). Memory bridge runs at :3111 underneath.\",\n});\n","import { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\n\nconst HERMES_DIR = join(homedir(), \".hermes\");\nconst HERMES_CONFIG = join(HERMES_DIR, \"config.yaml\");\nconst DOCS = \"https://github.com/rohitg00/agentmemory/tree/main/integrations/hermes\";\n\nexport const adapter: ConnectAdapter = {\n name: \"hermes\",\n displayName: \"Hermes Agent\",\n docs: DOCS,\n protocolNote:\n \"→ Using MCP. Hooks are also available — see docs/hermes.md.\",\n\n detect(): boolean {\n return existsSync(HERMES_DIR);\n },\n\n async install(_opts: ConnectOptions): Promise<ConnectResult> {\n p.log.warn(\n \"Hermes uses YAML config. Automated merge isn't implemented yet — manual install required.\",\n );\n p.note(\n [\n `Add to ${HERMES_CONFIG}:`,\n \"\",\n \" mcp_servers:\",\n \" agentmemory:\",\n \" command: npx\",\n ' args: [\"-y\", \"@agentmemory/mcp\"]',\n \"\",\n \" memory:\",\n \" provider: agentmemory\",\n \"\",\n `Full guide: ${DOCS}`,\n ].join(\"\\n\"),\n \"Hermes manual install\",\n );\n return {\n kind: \"stub\",\n reason: \"yaml-merge-not-implemented\",\n };\n },\n};\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Kiro stores user-level MCP servers in ~/.kiro/settings/mcp.json.\n// Schema follows the standard MCP envelope { mcpServers: { ... } }.\n// Source: kiro.dev/docs/cli/mcp\nexport const adapter = createJsonMcpAdapter({\n name: \"kiro\",\n displayName: \"Kiro\",\n detectDir: join(homedir(), \".kiro\"),\n configPath: join(homedir(), \".kiro\", \"settings\", \"mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.kiro/settings/mcp.json (user-level). Workspace overrides live in .kiro/settings/mcp.json.\",\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\nexport const adapter = createJsonMcpAdapter({\n name: \"openclaw\",\n displayName: \"OpenClaw\",\n detectDir: join(homedir(), \".openclaw\"),\n configPath: join(homedir(), \".openclaw\", \"openclaw.json\"),\n docs: \"https://github.com/rohitg00/agentmemory/tree/main/integrations/openclaw\",\n protocolNote:\n \"→ Using MCP. Hooks are also available — see docs/openclaw.md.\",\n});\n","import { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\n\nconst OPENHUMAN_DIR = join(homedir(), \".openhuman\");\nconst DOCS = \"https://github.com/tinyhumansai/openhuman\";\n\nexport const adapter: ConnectAdapter = {\n name: \"openhuman\",\n displayName: \"OpenHuman\",\n docs: DOCS,\n protocolNote:\n \"→ Using native hooks (REST API at :3111). MCP not required.\",\n\n detect(): boolean {\n return existsSync(OPENHUMAN_DIR);\n },\n\n async install(_opts: ConnectOptions): Promise<ConnectResult> {\n p.log.warn(\n \"OpenHuman integration is not yet automated. No `integrations/openhuman/` folder exists in the agentmemory repo today.\",\n );\n p.note(\n [\n \"OpenHuman is a Memory-trait host. The expected wiring is the REST\",\n \"proxy at http://localhost:3111 plus an OpenHuman-side Memory trait\",\n \"impl. Once integrations/openhuman/ lands in agentmemory we'll wire\",\n \"this up automatically.\",\n \"\",\n `Tracking: ${DOCS}`,\n ].join(\"\\n\"),\n \"OpenHuman manual install\",\n );\n return {\n kind: \"stub\",\n reason: \"no-integration-folder-yet\",\n };\n },\n};\n","import { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\n\nconst PI_DIR = join(homedir(), \".pi\");\nconst PI_EXT_DIR = join(PI_DIR, \"agent\", \"extensions\", \"agentmemory\");\nconst DOCS = \"https://github.com/rohitg00/agentmemory/tree/main/integrations/pi\";\n\nexport const adapter: ConnectAdapter = {\n name: \"pi\",\n displayName: \"pi\",\n docs: DOCS,\n protocolNote:\n \"→ Using native hooks (REST API at :3111). MCP not required.\",\n\n detect(): boolean {\n return existsSync(PI_DIR);\n },\n\n async install(_opts: ConnectOptions): Promise<ConnectResult> {\n p.log.warn(\n \"pi uses a TypeScript extension file. Automated copy + register isn't implemented yet — manual install required.\",\n );\n p.note(\n [\n \"Run these from the agentmemory repo root:\",\n \"\",\n ` mkdir -p ${PI_EXT_DIR}`,\n ` cp integrations/pi/index.ts ${PI_EXT_DIR}/index.ts`,\n ` cp integrations/pi/security.ts ${PI_EXT_DIR}/security.ts`,\n \"\",\n \"Then add to ~/.pi/agent/settings.json:\",\n ' { \"extensions\": [\"~/.pi/agent/extensions/agentmemory\"] }',\n \"\",\n `Full guide: ${DOCS}`,\n ].join(\"\\n\"),\n \"pi manual install\",\n );\n return {\n kind: \"stub\",\n reason: \"ts-extension-copy-not-implemented\",\n };\n },\n};\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Qwen Code stores its settings (mcpServers + hooks) in\n// ~/.qwen/settings.json. Schema for mcpServers matches Claude Code's\n// shape, so the shared JSON adapter handles the wiring.\n// Source: qwenlm.github.io/qwen-code-docs/en/users/features/mcp\nexport const adapter = createJsonMcpAdapter({\n name: \"qwen\",\n displayName: \"Qwen Code\",\n detectDir: join(homedir(), \".qwen\"),\n configPath: join(homedir(), \".qwen\", \"settings.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.qwen/settings.json. Qwen Code's hook system can also be wired separately — see docs.\",\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Warp stores MCP server config at ~/.warp/.mcp.json with the\n// canonical `mcpServers` wrapper — identical schema to Claude Code.\n// Warp also auto-discovers skills from .claude/skills/ so the\n// agentmemory plugin's 8 skills are surfaced natively once the\n// Claude Code plugin is installed.\n// Source: docs.warp.dev/agent-platform/capabilities/mcp/\nexport const adapter = createJsonMcpAdapter({\n name: \"warp\",\n displayName: \"Warp\",\n detectDir: join(homedir(), \".warp\"),\n configPath: join(homedir(), \".warp\", \".mcp.json\"),\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.warp/.mcp.json. Skills auto-discover from .claude/skills/ if the Claude Code plugin is also installed.\",\n});\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createJsonMcpAdapter } from \"./json-mcp-adapter.js\";\n\n// Zed stores its settings (including MCP servers) under \"context_servers\"\n// in settings.json — NOT \"mcpServers\". User config lives at\n// ~/.config/zed/settings.json on all platforms (Zed uses the XDG path\n// even on macOS; ~/Library/Application Support/Zed/ holds runtime data\n// like the database + cached language servers, not the config).\n// Source: zed.dev/docs/ai/mcp + zed.dev/docs/configuring-zed\nconst zedConfigDir = join(homedir(), \".config\", \"zed\");\n\nexport const adapter = createJsonMcpAdapter({\n name: \"zed\",\n displayName: \"Zed\",\n detectDir: zedConfigDir,\n configPath: join(zedConfigDir, \"settings.json\"),\n wrapperKey: \"context_servers\",\n docs: \"https://github.com/rohitg00/agentmemory#other-agents\",\n protocolNote:\n \"→ Using MCP via ~/.config/zed/settings.json (key: context_servers).\",\n});\n","import { platform } from \"node:os\";\nimport * as p from \"@clack/prompts\";\nimport type { ConnectAdapter, ConnectOptions, ConnectResult } from \"./types.js\";\nimport { adapter as antigravity } from \"./antigravity.js\";\nimport { adapter as claudeCode } from \"./claude-code.js\";\nimport { adapter as cline } from \"./cline.js\";\nimport { adapter as copilotCli } from \"./copilot-cli.js\";\nimport { adapter as codex } from \"./codex.js\";\nimport { adapter as continueDev } from \"./continue.js\";\nimport { adapter as cursor } from \"./cursor.js\";\nimport { adapter as droid } from \"./droid.js\";\nimport { adapter as geminiCli } from \"./gemini-cli.js\";\nimport { adapter as hermes } from \"./hermes.js\";\nimport { adapter as kiro } from \"./kiro.js\";\nimport { adapter as openclaw } from \"./openclaw.js\";\nimport { adapter as openhuman } from \"./openhuman.js\";\nimport { adapter as pi } from \"./pi.js\";\nimport { adapter as qwen } from \"./qwen.js\";\nimport { adapter as warp } from \"./warp.js\";\nimport { adapter as zed } from \"./zed.js\";\n\nexport const ADAPTERS: readonly ConnectAdapter[] = [\n claudeCode,\n copilotCli,\n codex,\n cursor,\n geminiCli,\n qwen,\n antigravity,\n kiro,\n warp,\n cline,\n continueDev,\n zed,\n droid,\n openclaw,\n hermes,\n pi,\n openhuman,\n];\n\nexport function resolveAdapter(name: string): ConnectAdapter | null {\n const lower = name.toLowerCase();\n return ADAPTERS.find((a) => a.name === lower) ?? null;\n}\n\nexport function knownAgents(): string[] {\n return ADAPTERS.map((a) => a.name);\n}\n\nfunction parseFlags(args: string[]): {\n dryRun: boolean;\n force: boolean;\n all: boolean;\n withHooks: boolean;\n positional: string[];\n} {\n const positional: string[] = [];\n let dryRun = false;\n let force = false;\n let all = false;\n let withHooks = false;\n for (const a of args) {\n if (a === \"--dry-run\") dryRun = true;\n else if (a === \"--force\") force = true;\n else if (a === \"--all\") all = true;\n else if (a === \"--with-hooks\") withHooks = true;\n else if (!a.startsWith(\"-\")) positional.push(a);\n }\n return { dryRun, force, all, withHooks, positional };\n}\n\nexport async function runAdapter(\n adapter: ConnectAdapter,\n opts: ConnectOptions,\n): Promise<ConnectResult> {\n if (!adapter.detect()) {\n p.log.warn(\n `${adapter.displayName}: not detected on this machine (skipping).${adapter.docs ? ` Docs: ${adapter.docs}` : \"\"}`,\n );\n return { kind: \"skipped\", reason: \"not-detected\" };\n }\n p.log.step(`Wiring ${adapter.displayName}…`);\n if (adapter.protocolNote) {\n p.log.message(adapter.protocolNote);\n }\n try {\n return await adapter.install(opts);\n } catch (err) {\n p.log.error(\n `${adapter.displayName}: ${err instanceof Error ? err.message : String(err)}`,\n );\n return { kind: \"skipped\", reason: \"exception\" };\n }\n}\n\nexport async function runConnect(args: string[]): Promise<void> {\n const { dryRun, force, all, withHooks, positional } = parseFlags(args);\n const allowWindowsAdapter =\n positional.length === 1 && positional[0]?.toLowerCase() === \"copilot-cli\";\n if (platform() === \"win32\" && !allowWindowsAdapter) {\n p.intro(\"agentmemory connect\");\n p.log.warn(\n \"Windows: automated `connect` is not supported yet. See https://github.com/rohitg00/agentmemory#other-agents for manual install steps.\",\n );\n p.outro(\"Windows: manual install required — see docs\");\n return;\n }\n\n const opts: ConnectOptions = { dryRun, force, withHooks };\n\n p.intro(\"agentmemory connect\");\n\n if (positional.length === 0 && !all) {\n const detected = ADAPTERS.filter((a) => a.detect());\n if (detected.length === 0) {\n p.log.error(\"No supported agents detected on this machine.\");\n p.outro(`Supported: ${knownAgents().join(\", \")}`);\n process.exit(1);\n }\n const picked = await p.multiselect<string>({\n message: \"Wire agentmemory into which agents?\",\n options: detected.map((a) => ({ value: a.name, label: a.displayName })),\n required: true,\n });\n if (p.isCancel(picked)) {\n p.cancel(\"Cancelled.\");\n return;\n }\n const results: { name: string; result: ConnectResult }[] = [];\n for (const name of picked as string[]) {\n const adapter = resolveAdapter(name);\n if (!adapter) continue;\n results.push({ name, result: await runAdapter(adapter, opts) });\n }\n summarize(results);\n return;\n }\n\n if (all) {\n const detected = ADAPTERS.filter((a) => a.detect());\n if (detected.length === 0) {\n p.log.error(\"No supported agents detected on this machine.\");\n process.exit(1);\n }\n const results: { name: string; result: ConnectResult }[] = [];\n for (const adapter of detected) {\n results.push({\n name: adapter.name,\n result: await runAdapter(adapter, opts),\n });\n }\n summarize(results);\n return;\n }\n\n const agentName = positional[0]!;\n const adapter = resolveAdapter(agentName);\n if (!adapter) {\n p.log.error(`Unknown agent: ${agentName}`);\n p.outro(`Supported: ${knownAgents().join(\", \")}`);\n process.exit(1);\n }\n\n const result = await runAdapter(adapter, opts);\n summarize([{ name: agentName, result }]);\n if (result.kind === \"skipped\" && (result as { reason: string }).reason !== \"not-detected\") {\n process.exit(1);\n }\n}\n\nfunction summarize(\n results: { name: string; result: ConnectResult }[],\n): void {\n const lines = results.map(({ name, result }) => {\n switch (result.kind) {\n case \"installed\":\n return ` ✓ ${name}${result.mutatedPath ? ` → ${result.mutatedPath}` : \"\"}`;\n case \"already-wired\":\n return ` ✓ ${name} (already wired)`;\n case \"stub\":\n return ` ⚠ ${name} (manual install required: ${result.reason})`;\n case \"skipped\":\n return ` ✗ ${name} (skipped: ${result.reason})`;\n }\n });\n p.note(lines.join(\"\\n\"), \"summary\");\n\n const stubs = results.filter((r) => r.result.kind === \"stub\");\n if (stubs.length > 0) {\n p.log.info(\n `${stubs.length} agent(s) require manual install — see docs links above.`,\n );\n }\n\n const wiredAny = results.some(\n (r) => r.result.kind === \"installed\" || r.result.kind === \"already-wired\",\n );\n if (wiredAny) {\n p.log.info(\n \"Next: install agentmemory's 8 skills into the same agent(s) so they know when to call the tools:\\n npx skills add rohitg00/agentmemory -y\",\n );\n }\n\n p.outro(\"Restart any wired agent (or open a new session) to pick up agentmemory.\");\n}\n"],"mappings":";;;;;;;AAwBA,MAAa,wBAAwB;CACnC,SAAS;CACT,MAAM,CAAC,MAAM,mBAAmB;CAChC,KAAK;EACH,iBAAiB;EACjB,oBAAoB;EACpB,mBAAmB;EACpB;CACF;AAaD,MAAa,gCAAgC;CAC3C,MAAM;CACN,GAZA,QAAQ,aAAa,UACjB;EACE,SAAS,QAAQ,IAAI,cAAc,QAAQ,IAAI,cAAc;EAC7D,MAAM;GAAC;GAAM;GAAM;GAAM;GAAO;GAAM;GAAmB;EAC1D,GACD;EACE,SAAS;EACT,MAAM,CAAC,MAAM,mBAAmB;EACjC;CAKL,KAAK;EACH,iBAAiB;EACjB,oBAAoB;EACpB,mBAAmB;EACpB;CACD,OAAO,CAAC,IAAI;CACb;AAED,SAAgB,a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0E"}
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { execSync } from "node:child_process";
3
3
  import { basename } from "node:path";
4
-
5
4
  //#region src/hooks/_project.ts
6
5
  function resolveProject(cwd) {
7
6
  const explicit = process.env["AGENTMEMORY_PROJECT_NAME"];
@@ -21,7 +20,6 @@ function resolveProject(cwd) {
21
20
  } catch {}
22
21
  return basename(dir);
23
22
  }
24
-
25
23
  //#endregion
26
24
  //#region src/hooks/notification.ts
27
25
  function isSdkChildContext(payload) {
@@ -70,7 +68,7 @@ async function main() {
70
68
  setTimeout(() => process.exit(0), 500).unref();
71
69
  }
72
70
  main();
73
-
74
71
  //#endregion
75
- export { };
72
+ export {};
73
+
76
74
  //# sourceMappingURL=notification.mjs.map