agentcache 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,26 @@
2
2
  import { existsSync } from "fs";
3
3
  import { join } from "path";
4
4
  import { homedir } from "os";
5
+ function getRooConfigPath() {
6
+ const home = homedir();
7
+ if (process.platform === "darwin") {
8
+ return join(home, "Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json");
9
+ }
10
+ if (process.platform === "win32") {
11
+ return join(process.env.APPDATA || join(home, "AppData/Roaming"), "Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json");
12
+ }
13
+ return join(home, ".config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json");
14
+ }
15
+ function rooDetected() {
16
+ return existsSync(getRooConfigPath());
17
+ }
5
18
  function detectInstalledIdes() {
6
19
  const home = homedir();
7
20
  return [
8
21
  {
9
22
  name: "Claude Code",
10
23
  detected: existsSync(join(home, ".claude")),
11
- mcpConfigPath: join(home, ".claude", "settings.json"),
24
+ mcpConfigPath: join(home, ".claude.json"),
12
25
  mcpConfigFormat: "claude-settings"
13
26
  },
14
27
  {
@@ -19,8 +32,8 @@ function detectInstalledIdes() {
19
32
  },
20
33
  {
21
34
  name: "Roo Code",
22
- detected: existsSync(join(home, ".roo")),
23
- mcpConfigPath: join(home, ".roo", "mcp.json"),
35
+ detected: rooDetected(),
36
+ mcpConfigPath: getRooConfigPath(),
24
37
  mcpConfigFormat: "mcp-json"
25
38
  },
26
39
  {
@@ -48,16 +61,35 @@ function detectInstalledIdes() {
48
61
  import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
49
62
  import { join as join2, dirname } from "path";
50
63
  import { homedir as homedir2 } from "os";
51
- var MCP_ENTRY_STDIO = {
52
- type: "stdio",
53
- command: "agentcache",
54
- args: ["serve"],
55
- env: {}
56
- };
57
- var MCP_ENTRY_SIMPLE = {
58
- command: "agentcache",
59
- args: ["serve"]
60
- };
64
+ import { execSync } from "child_process";
65
+ function findNodeBinary() {
66
+ try {
67
+ return execSync("which node", { encoding: "utf-8" }).trim();
68
+ } catch {
69
+ return "node";
70
+ }
71
+ }
72
+ function findAgentcacheScript() {
73
+ try {
74
+ const binPath = execSync("which agentcache", { encoding: "utf-8" }).trim();
75
+ return binPath;
76
+ } catch {
77
+ return join2(dirname(dirname(__dirname)), "dist", "cli.js");
78
+ }
79
+ }
80
+ function isVscodeExtensionIde(ide) {
81
+ return ide.name === "Roo Code";
82
+ }
83
+ var ALL_TOOLS = [
84
+ "loop_inject_context",
85
+ "loop_compile_submit",
86
+ "loop_compile_cluster",
87
+ "loop_compile_extract",
88
+ "loop_enforce",
89
+ "loop_save_observation",
90
+ "loop_get_knowledge",
91
+ "loop_deprecate_knowledge"
92
+ ];
61
93
  function registerMcpServer(ide) {
62
94
  if (!ide.detected) return false;
63
95
  if (ide.mcpConfigFormat === "claude-settings") {
@@ -72,8 +104,34 @@ function registerMcpServer(ide) {
72
104
  }
73
105
  if (!config.mcpServers) config.mcpServers = {};
74
106
  if (config.mcpServers.agentcache) return false;
75
- config.mcpServers.agentcache = MCP_ENTRY_STDIO;
107
+ config.mcpServers.agentcache = {
108
+ type: "stdio",
109
+ command: "agentcache",
110
+ args: ["serve"],
111
+ env: {}
112
+ };
76
113
  writeFileSync(claudeJsonPath, JSON.stringify(config, null, 2));
114
+ const settingsPath = join2(homedir2(), ".claude", "settings.json");
115
+ if (existsSync2(join2(homedir2(), ".claude"))) {
116
+ let settings = {};
117
+ if (existsSync2(settingsPath)) {
118
+ try {
119
+ settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
120
+ } catch {
121
+ settings = {};
122
+ }
123
+ }
124
+ if (!settings.permissions) settings.permissions = {};
125
+ if (!settings.permissions.allow) settings.permissions.allow = [];
126
+ const allowList = settings.permissions.allow;
127
+ const mcpPerms = ALL_TOOLS.map((t) => `mcp__agentcache__${t}`);
128
+ for (const perm of mcpPerms) {
129
+ if (!allowList.includes(perm)) {
130
+ allowList.push(perm);
131
+ }
132
+ }
133
+ writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
134
+ }
77
135
  return true;
78
136
  }
79
137
  if (ide.mcpConfigFormat === "mcp-json") {
@@ -87,7 +145,21 @@ function registerMcpServer(ide) {
87
145
  }
88
146
  if (!config.mcpServers) config.mcpServers = {};
89
147
  if (config.mcpServers.agentcache) return false;
90
- config.mcpServers.agentcache = MCP_ENTRY_SIMPLE;
148
+ if (isVscodeExtensionIde(ide)) {
149
+ const nodeBin = findNodeBinary();
150
+ const script = findAgentcacheScript();
151
+ config.mcpServers.agentcache = {
152
+ command: nodeBin,
153
+ args: [script, "serve"],
154
+ alwaysAllow: ALL_TOOLS,
155
+ disabled: false
156
+ };
157
+ } else {
158
+ config.mcpServers.agentcache = {
159
+ command: "agentcache",
160
+ args: ["serve"]
161
+ };
162
+ }
91
163
  mkdirSync(dirname(ide.mcpConfigPath), { recursive: true });
92
164
  writeFileSync(ide.mcpConfigPath, JSON.stringify(config, null, 2));
93
165
  return true;
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
  var program = new Command();
6
6
  program.name("agentcache").description("Engineering Knowledge Compiler \u2014 universal, zero-config").version("0.3.0");
7
7
  program.command("setup").description("Detect IDEs and register Loop (runs automatically on install)").action(async () => {
8
- const { runSetup } = await import("./setup-5Z5AHD2U.js");
8
+ const { runSetup } = await import("./setup-C6PI6YD7.js");
9
9
  await runSetup();
10
10
  });
11
11
  program.command("serve").description("Start Loop MCP server (spawned by IDEs automatically)").action(async () => {
@@ -2,7 +2,7 @@ import {
2
2
  detectInstalledIdes,
3
3
  registerClaudeHooks,
4
4
  registerMcpServer
5
- } from "./chunk-LYEV4B2E.js";
5
+ } from "./chunk-7FIT3LNA.js";
6
6
  import {
7
7
  getDbPath,
8
8
  getGlobalLoopDir
@@ -2,7 +2,7 @@ import {
2
2
  detectInstalledIdes,
3
3
  registerClaudeHooks,
4
4
  registerMcpServer
5
- } from "./chunk-LYEV4B2E.js";
5
+ } from "./chunk-7FIT3LNA.js";
6
6
  import {
7
7
  getDbPath,
8
8
  getGlobalLoopDir
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "agentcache",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Knowledge cache for AI agents — learns how you work, remembers across sessions, works everywhere",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "a21.ai",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/raghav-a21ai/loop-eng"
10
+ "url": "https://github.com/raghav-a21ai/agentcache"
11
11
  },
12
- "homepage": "https://github.com/raghav-a21ai/loop-eng#readme",
12
+ "homepage": "https://github.com/raghav-a21ai/agentcache#readme",
13
13
  "keywords": [
14
14
  "ai",
15
15
  "mcp",