toon-memory 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/setup.js CHANGED
@@ -9,6 +9,7 @@ import { createRequire } from "module"
9
9
  const __dirname = dirname(fileURLToPath(import.meta.url))
10
10
  const projectRoot = process.cwd()
11
11
  const sourceDir = join(__dirname, "..", "src")
12
+ const HOME = process.env.HOME || "~"
12
13
 
13
14
  // Auto-install @toon-format/toon if not present
14
15
  try {
@@ -18,28 +19,95 @@ try {
18
19
  execSync("npm install @toon-format/toon", { cwd: projectRoot, stdio: "inherit" })
19
20
  }
20
21
 
21
- // Detect agents
22
+ // Detect all supported agents
22
23
  function detectAgents() {
23
24
  const agents = []
24
25
 
25
26
  // OpenCode
26
- const opencodeGlobal = join(process.env.HOME || "~", ".config", "opencode", "opencode.json")
27
+ const opencodeGlobal = join(HOME, ".config", "opencode", "opencode.json")
27
28
  const opencodeLocal = join(projectRoot, ".opencode", "opencode.json")
28
- if (existsSync(opencodeGlobal) || existsSync(opencodeLocal)) {
29
- agents.push({ name: "opencode", global: opencodeGlobal, local: opencodeLocal })
29
+ if (existsSync(opencodeGlobal) || existsSync(opencodeLocal) || true) { // Always show opencode
30
+ agents.push({
31
+ name: "opencode",
32
+ global: opencodeGlobal,
33
+ local: opencodeLocal,
34
+ mcpKey: "mcp"
35
+ })
36
+ }
37
+
38
+ // VS Code / GitHub Copilot
39
+ const vscodeLocal = join(projectRoot, ".vscode", "mcp.json")
40
+ const vscodeGlobal = join(HOME, ".config", "Code", "User", "globalStorage", "github.copilot-chat", "mcp.json")
41
+ if (existsSync(vscodeLocal) || existsSync(vscodeGlobal) || true) {
42
+ agents.push({
43
+ name: "vscode/copilot",
44
+ global: vscodeGlobal,
45
+ local: vscodeLocal,
46
+ mcpKey: "servers"
47
+ })
30
48
  }
31
49
 
32
50
  // Claude Code
33
- const claudeGlobal = join(process.env.HOME || "~", ".claude", "settings.json")
51
+ const claudeGlobal = join(HOME, ".claude", "settings.json")
34
52
  const claudeLocal = join(projectRoot, ".claude", "settings.json")
35
53
  if (existsSync(claudeGlobal) || existsSync(claudeLocal)) {
36
- agents.push({ name: "claude", global: claudeGlobal, local: claudeLocal })
54
+ agents.push({
55
+ name: "claude",
56
+ global: claudeGlobal,
57
+ local: claudeLocal,
58
+ mcpKey: "mcpServers"
59
+ })
37
60
  }
38
61
 
39
62
  // Cursor
40
63
  const cursorLocal = join(projectRoot, ".cursor", "mcp.json")
41
64
  if (existsSync(cursorLocal)) {
42
- agents.push({ name: "cursor", local: cursorLocal })
65
+ agents.push({
66
+ name: "cursor",
67
+ local: cursorLocal,
68
+ mcpKey: "mcpServers"
69
+ })
70
+ }
71
+
72
+ // Windsurf
73
+ const windsurfLocal = join(projectRoot, ".windsurfrules")
74
+ const windsurfGlobal = join(HOME, ".codeium", "windsurf", "mcp_config.json")
75
+ if (existsSync(windsurfLocal) || existsSync(windsurfGlobal)) {
76
+ agents.push({
77
+ name: "windsurf",
78
+ global: windsurfGlobal,
79
+ local: windsurfLocal,
80
+ mcpKey: "mcpServers"
81
+ })
82
+ }
83
+
84
+ // Cline
85
+ const clineLocal = join(projectRoot, ".cline", "mcp.json")
86
+ if (existsSync(clineLocal)) {
87
+ agents.push({
88
+ name: "cline",
89
+ local: clineLocal,
90
+ mcpKey: "mcpServers"
91
+ })
92
+ }
93
+
94
+ // Continue
95
+ const continueLocal = join(projectRoot, ".continue", "config.json")
96
+ if (existsSync(continueLocal)) {
97
+ agents.push({
98
+ name: "continue",
99
+ local: continueLocal,
100
+ mcpKey: "mcpServers"
101
+ })
102
+ }
103
+
104
+ // Aider
105
+ const aiderLocal = join(projectRoot, ".aider.conf.yml")
106
+ if (existsSync(aiderLocal)) {
107
+ agents.push({
108
+ name: "aider",
109
+ local: aiderLocal
110
+ })
43
111
  }
44
112
 
45
113
  return agents
@@ -63,25 +131,47 @@ function installOpenCodeTools() {
63
131
  }
64
132
  }
65
133
 
66
- // Install MCP server config for OpenCode
67
- function installOpenCodeMCP(scope) {
68
- const configPath = scope === "global"
69
- ? join(process.env.HOME || "~", ".config", "opencode", "opencode.json")
70
- : join(projectRoot, ".opencode", "opencode.json")
134
+ // Install MCP server config for different agents
135
+ function installMCPConfig(agent, scope) {
136
+ const configPath = scope === "global" ? agent.global : agent.local
137
+
138
+ if (!configPath) {
139
+ console.log(` No ${scope} config path for ${agent.name}`)
140
+ return
141
+ }
71
142
 
72
143
  const configDir = dirname(configPath)
73
144
  if (!existsSync(configDir)) mkdirSync(configDir, { recursive: true })
74
145
 
75
146
  let config = {}
76
147
  if (existsSync(configPath)) {
77
- config = JSON.parse(readFileSync(configPath, "utf-8"))
148
+ try {
149
+ config = JSON.parse(readFileSync(configPath, "utf-8"))
150
+ } catch {
151
+ config = {}
152
+ }
78
153
  }
79
154
 
80
- if (!config.mcp) config.mcp = {}
81
- config.mcp["toon-memory"] = {
82
- type: "local",
83
- command: ["npx", "-y", "toon-memory", "mcp"],
84
- enabled: true
155
+ const mcpKey = agent.mcpKey || "mcp"
156
+ if (!config[mcpKey]) config[mcpKey] = {}
157
+
158
+ // Different agents use different config formats
159
+ if (agent.name === "vscode/copilot") {
160
+ config[mcpKey]["toon-memory"] = {
161
+ command: "npx",
162
+ args: ["-y", "toon-memory", "mcp"],
163
+ env: {}
164
+ }
165
+ } else if (agent.name === "aider") {
166
+ // Aider uses YAML, skip JSON config
167
+ console.log(` ${agent.name}: Add to .aider.conf.yml:`)
168
+ console.log(` mcp Servers:\n toon-memory:\n command: npx\n args: ["-y", "toon-memory", "mcp"]`)
169
+ return
170
+ } else {
171
+ config[mcpKey]["toon-memory"] = {
172
+ command: "npx",
173
+ args: ["-y", "toon-memory", "mcp"]
174
+ }
85
175
  }
86
176
 
87
177
  writeFileSync(configPath, JSON.stringify(config, null, 2))
@@ -99,7 +189,7 @@ if (agents.length === 0) {
99
189
  process.exit(0)
100
190
  }
101
191
 
102
- console.log("Detected agents:")
192
+ console.log("Detected/supported agents:")
103
193
  agents.forEach((a, i) => console.log(` ${i + 1}. ${a.name}`))
104
194
  console.log("")
105
195
 
@@ -109,13 +199,16 @@ rl.question("Install (1) Local or (2) Global? [1/2]: ", (answer) => {
109
199
  console.log(`\nInstalling ${scope}ly...\n`)
110
200
 
111
201
  for (const agent of agents) {
202
+ console.log(`${agent.name}:`)
203
+
112
204
  if (agent.name === "opencode") {
113
- console.log("OpenCode:")
114
205
  installOpenCodeTools()
115
- installOpenCodeMCP(scope)
116
206
  }
207
+
208
+ installMCPConfig(agent, scope)
209
+ console.log("")
117
210
  }
118
211
 
119
- console.log("\nDone! Restart your agent to use memory tools.")
212
+ console.log("Done! Restart your agent to use memory tools.")
120
213
  rl.close()
121
214
  })
package/mcp/server.js CHANGED
@@ -27664,7 +27664,7 @@ function generateId() {
27664
27664
  return randomBytes(4).toString("hex");
27665
27665
  }
27666
27666
  var server = new McpServer(
27667
- { name: "toon-memory", version: "1.0.7" },
27667
+ { name: "toon-memory", version: "1.0.8" },
27668
27668
  { capabilities: { tools: { listChanged: true } } }
27669
27669
  );
27670
27670
  server.registerTool(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "toon-memory",
3
- "version": "1.0.7",
4
- "description": "Persistent memory system for OpenCode AI agent using TOON format (40% fewer tokens than JSON)",
3
+ "version": "1.0.8",
4
+ "description": "Persistent memory system for AI coding agents using TOON format (40% fewer tokens than JSON)",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "toon-memory": "./bin/toon-memory.js"
@@ -19,6 +19,13 @@
19
19
  },
20
20
  "keywords": [
21
21
  "opencode",
22
+ "vscode",
23
+ "copilot",
24
+ "claude",
25
+ "cursor",
26
+ "windsurf",
27
+ "cline",
28
+ "continue",
22
29
  "ai-agent",
23
30
  "memory",
24
31
  "toon",
@@ -1,8 +1,21 @@
1
- # toon-memory — Persistent Memory for OpenCode
1
+ # toon-memory — Persistent Memory for AI Agents
2
2
 
3
3
  ## What is this?
4
4
 
5
- A persistent memory system for the OpenCode AI agent. It remembers decisions, patterns, bugs, and knowledge **between sessions** using TOON format (40% fewer tokens than JSON).
5
+ A persistent memory system for AI coding agents. It remembers decisions, patterns, bugs, and knowledge **between sessions** using TOON format (40% fewer tokens than JSON).
6
+
7
+ ## Supported Agents
8
+
9
+ | Agent | Config File | Format |
10
+ |-------|-------------|--------|
11
+ | OpenCode | `.opencode/opencode.json` | MCP server |
12
+ | VS Code / Copilot | `.vscode/mcp.json` | MCP server |
13
+ | Claude | `.claude/settings.json` | MCP server |
14
+ | Cursor | `.cursor/mcp.json` | MCP server |
15
+ | Windsurf | `.windsurfrules` | MCP server |
16
+ | Cline | `.cline/mcp.json` | MCP server |
17
+ | Continue | `.continue/config.json` | MCP server |
18
+ | Aider | `.aider.conf.yml` | Manual config |
6
19
 
7
20
  ## Tools
8
21
 
@@ -16,44 +29,27 @@ A persistent memory system for the OpenCode AI agent. It remembers decisions, pa
16
29
 
17
30
  ## Installation
18
31
 
19
- ### Option 1: Interactive installer (recommended)
32
+ ### Interactive installer (recommended)
20
33
 
21
34
  ```bash
22
35
  npx toon-memory
23
36
  ```
24
37
 
25
38
  This will:
26
- 1. Detect installed agents (OpenCode, Claude, Cursor)
39
+ 1. Detect installed agents
27
40
  2. Ask if you want local or global installation
28
41
  3. Configure the MCP server automatically
29
42
 
30
- ### Option 2: Global MCP Server
31
-
32
- Add to `~/.config/opencode/opencode.json`:
33
-
34
- ```json
35
- {
36
- "mcp": {
37
- "toon-memory": {
38
- "type": "local",
39
- "command": ["npx", "-y", "toon-memory", "mcp"],
40
- "enabled": true
41
- }
42
- }
43
- }
44
- ```
45
-
46
- ### Option 3: Project-level MCP Server
43
+ ### Manual installation
47
44
 
48
- Add to `.opencode/opencode.json`:
45
+ Add to your agent's MCP config:
49
46
 
50
47
  ```json
51
48
  {
52
- "mcp": {
49
+ "mcpServers": {
53
50
  "toon-memory": {
54
- "type": "local",
55
- "command": ["npx", "-y", "toon-memory", "mcp"],
56
- "enabled": true
51
+ "command": "npx",
52
+ "args": ["-y", "toon-memory", "mcp"]
57
53
  }
58
54
  }
59
55
  }
package/src/mcp/server.ts CHANGED
@@ -32,7 +32,7 @@ function generateId(): string {
32
32
  }
33
33
 
34
34
  const server = new McpServer(
35
- { name: "toon-memory", version: "1.0.7" },
35
+ { name: "toon-memory", version: "1.0.8" },
36
36
  { capabilities: { tools: { listChanged: true } } }
37
37
  )
38
38