agentcache 0.1.1 → 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
|
|
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:
|
|
23
|
-
mcpConfigPath:
|
|
35
|
+
detected: rooDetected(),
|
|
36
|
+
mcpConfigPath: getRooConfigPath(),
|
|
24
37
|
mcpConfigFormat: "mcp-json"
|
|
25
38
|
},
|
|
26
39
|
{
|
|
@@ -48,26 +61,77 @@ 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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
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
|
+
];
|
|
55
93
|
function registerMcpServer(ide) {
|
|
56
94
|
if (!ide.detected) return false;
|
|
57
95
|
if (ide.mcpConfigFormat === "claude-settings") {
|
|
58
|
-
|
|
59
|
-
|
|
96
|
+
const claudeJsonPath = join2(homedir2(), ".claude.json");
|
|
97
|
+
let config = {};
|
|
98
|
+
if (existsSync2(claudeJsonPath)) {
|
|
60
99
|
try {
|
|
61
|
-
|
|
100
|
+
config = JSON.parse(readFileSync(claudeJsonPath, "utf-8"));
|
|
62
101
|
} catch {
|
|
63
|
-
|
|
102
|
+
config = {};
|
|
64
103
|
}
|
|
65
104
|
}
|
|
66
|
-
if (!
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
105
|
+
if (!config.mcpServers) config.mcpServers = {};
|
|
106
|
+
if (config.mcpServers.agentcache) return false;
|
|
107
|
+
config.mcpServers.agentcache = {
|
|
108
|
+
type: "stdio",
|
|
109
|
+
command: "agentcache",
|
|
110
|
+
args: ["serve"],
|
|
111
|
+
env: {}
|
|
112
|
+
};
|
|
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
|
+
}
|
|
71
135
|
return true;
|
|
72
136
|
}
|
|
73
137
|
if (ide.mcpConfigFormat === "mcp-json") {
|
|
@@ -81,7 +145,21 @@ function registerMcpServer(ide) {
|
|
|
81
145
|
}
|
|
82
146
|
if (!config.mcpServers) config.mcpServers = {};
|
|
83
147
|
if (config.mcpServers.agentcache) return false;
|
|
84
|
-
|
|
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
|
+
}
|
|
85
163
|
mkdirSync(dirname(ide.mcpConfigPath), { recursive: true });
|
|
86
164
|
writeFileSync(ide.mcpConfigPath, JSON.stringify(config, null, 2));
|
|
87
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-
|
|
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 () => {
|
package/dist/postinstall.js
CHANGED
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentcache",
|
|
3
|
-
"version": "0.1.
|
|
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/
|
|
10
|
+
"url": "https://github.com/raghav-a21ai/agentcache"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://github.com/raghav-a21ai/
|
|
12
|
+
"homepage": "https://github.com/raghav-a21ai/agentcache#readme",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"ai",
|
|
15
15
|
"mcp",
|