toon-memory 1.0.9 → 1.1.1

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 luiggival
3
+ Copyright (c) 2026 Luis Angel Valencia Valera
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -31,10 +31,10 @@ AI agents forget everything between sessions. toon-memory fixes this by providin
31
31
 
32
32
  ```bash
33
33
  # macOS / Linux
34
- curl -fsSL https://raw.githubusercontent.com/luiggival/toon-memory/main/install.sh | sh
34
+ curl -fsSL https://raw.githubusercontent.com/LuiggiVal08/toon-memory/main/install.sh | sh
35
35
 
36
36
  # Windows (PowerShell)
37
- irm https://raw.githubusercontent.com/luiggival/toon-memory/main/install.ps1 | iex
37
+ irm https://raw.githubusercontent.com/LuiggiVal08/toon-memory/main/install.ps1 | iex
38
38
 
39
39
  # Or with npm (any platform)
40
40
  npm i -g toon-memory
@@ -110,7 +110,10 @@ summaries:
110
110
 
111
111
  ```bash
112
112
  npx toon-memory # Interactive installer
113
+ npx toon-memory init # Quick setup (no prompts)
113
114
  npx toon-memory mcp # Run MCP server directly
115
+ npx toon-memory status # Check installation status
116
+ npx toon-memory upgrade # Update to latest version
114
117
  npx toon-memory uninstall # Remove from all agents
115
118
  ```
116
119
 
@@ -198,7 +201,7 @@ TOON (Token-Oriented Object Notation) is designed for LLMs:
198
201
  ## Development
199
202
 
200
203
  ```bash
201
- git clone https://github.com/luiggival/toon-memory.git
204
+ git clone https://github.com/LuiggiVal08/toon-memory.git
202
205
  cd toon-memory
203
206
  npm install
204
207
  npm run build
@@ -8,7 +8,7 @@ const args = process.argv.slice(2)
8
8
 
9
9
  const target = args[0] === "mcp"
10
10
  ? join(__dirname, "..", "mcp", "server.js")
11
- : join(__dirname, "setup.js")
11
+ : join(__dirname, "..", "dist", "cli", "setup.js")
12
12
 
13
13
  const extraArgs = args[0] === "mcp" ? [] : args
14
14
  const child = spawn("node", [target, ...extraArgs], { stdio: "inherit" })
@@ -0,0 +1,237 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync, unlinkSync } from "fs";
2
+ import { dirname, join } from "path";
3
+ import { fileURLToPath } from "url";
4
+ import { execSync } from "child_process";
5
+ import { createInterface } from "readline";
6
+ import { createRequire } from "module";
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const projectRoot = process.cwd();
9
+ const sourceDir = join(__dirname, "..", "src");
10
+ const HOME = process.env.HOME || process.env.USERPROFILE || "~";
11
+ try {
12
+ createRequire(import.meta.url).resolve("@toon-format/toon");
13
+ } catch {
14
+ console.log("Installing @toon-format/toon...");
15
+ execSync("npm install @toon-format/toon", { cwd: projectRoot, stdio: "inherit" });
16
+ }
17
+ function detectAgents() {
18
+ const agents2 = [];
19
+ const opencodeGlobal = join(HOME, ".config", "opencode", "opencode.json");
20
+ const opencodeLocal = join(projectRoot, ".opencode", "opencode.json");
21
+ agents2.push({
22
+ name: "opencode",
23
+ global: opencodeGlobal,
24
+ local: opencodeLocal,
25
+ mcpKey: "mcp"
26
+ });
27
+ const vscodeLocal = join(projectRoot, ".vscode", "mcp.json");
28
+ agents2.push({
29
+ name: "vscode/copilot",
30
+ local: vscodeLocal,
31
+ mcpKey: "servers"
32
+ });
33
+ const claudeGlobal = join(HOME, ".claude", "settings.json");
34
+ const claudeLocal = join(projectRoot, ".claude", "settings.json");
35
+ agents2.push({
36
+ name: "claude",
37
+ global: claudeGlobal,
38
+ local: claudeLocal,
39
+ mcpKey: "mcpServers"
40
+ });
41
+ const cursorLocal = join(projectRoot, ".cursor", "mcp.json");
42
+ agents2.push({
43
+ name: "cursor",
44
+ local: cursorLocal,
45
+ mcpKey: "mcpServers"
46
+ });
47
+ const windsurfGlobal = join(HOME, ".codeium", "windsurf", "mcp_config.json");
48
+ agents2.push({
49
+ name: "windsurf",
50
+ global: windsurfGlobal,
51
+ mcpKey: "mcpServers"
52
+ });
53
+ const clineLocal = join(projectRoot, ".cline", "mcp.json");
54
+ agents2.push({
55
+ name: "cline",
56
+ local: clineLocal,
57
+ mcpKey: "mcpServers"
58
+ });
59
+ const continueLocal = join(projectRoot, ".continue", "config.json");
60
+ agents2.push({
61
+ name: "continue",
62
+ local: continueLocal,
63
+ mcpKey: "mcpServers"
64
+ });
65
+ return agents2;
66
+ }
67
+ function installOpenCodeTools() {
68
+ const toolsDir = join(projectRoot, ".opencode", "tools");
69
+ const memoryDir = join(projectRoot, ".opencode", "memory");
70
+ const memoryFile = join(memoryDir, "data.toon");
71
+ if (!existsSync(toolsDir)) mkdirSync(toolsDir, { recursive: true });
72
+ if (!existsSync(memoryDir)) mkdirSync(memoryDir, { recursive: true });
73
+ cpSync(join(sourceDir, "memory.ts"), join(toolsDir, "memory.ts"));
74
+ console.log(" Copied memory.ts to .opencode/tools/");
75
+ if (!existsSync(memoryFile)) {
76
+ writeFileSync(memoryFile, "version: 1\nentries[0|]{id|category|key|content|file|tags|date}:\n");
77
+ console.log(" Created .opencode/memory/data.toon");
78
+ }
79
+ }
80
+ function installMCPConfig(agent, scope) {
81
+ const configPath = scope === "global" ? agent.global : agent.local;
82
+ if (!configPath) {
83
+ console.log(` No ${scope} config path for ${agent.name}`);
84
+ return;
85
+ }
86
+ const configDir = dirname(configPath);
87
+ if (!existsSync(configDir)) mkdirSync(configDir, { recursive: true });
88
+ let config = {};
89
+ if (existsSync(configPath)) {
90
+ try {
91
+ config = JSON.parse(readFileSync(configPath, "utf-8"));
92
+ } catch {
93
+ config = {};
94
+ }
95
+ }
96
+ const mcpKey = agent.mcpKey || "mcpServers";
97
+ if (!config[mcpKey]) config[mcpKey] = {};
98
+ config[mcpKey]["toon-memory"] = {
99
+ command: "npx",
100
+ args: ["-y", "toon-memory", "mcp"]
101
+ };
102
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
103
+ console.log(` MCP server added to ${configPath}`);
104
+ }
105
+ function uninstall() {
106
+ console.log("\n\u{1F9E0} toon-memory uninstaller\n");
107
+ const agents2 = detectAgents();
108
+ for (const agent of agents2) {
109
+ const configs = [agent.global, agent.local].filter(Boolean);
110
+ for (const configPath of configs) {
111
+ if (!existsSync(configPath)) continue;
112
+ try {
113
+ const config = JSON.parse(readFileSync(configPath, "utf-8"));
114
+ const mcpKey = agent.mcpKey || "mcpServers";
115
+ if (config[mcpKey]?.["toon-memory"]) {
116
+ delete config[mcpKey]["toon-memory"];
117
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
118
+ console.log(` \u2705 Removed from ${agent.name} (${configPath})`);
119
+ }
120
+ } catch {
121
+ }
122
+ }
123
+ }
124
+ const toolsFile = join(projectRoot, ".opencode", "tools", "memory.ts");
125
+ if (existsSync(toolsFile)) {
126
+ unlinkSync(toolsFile);
127
+ console.log(" \u2705 Removed .opencode/tools/memory.ts");
128
+ }
129
+ console.log("\n\u2705 toon-memory uninstalled from all agents\n");
130
+ }
131
+ function init(scope = "local") {
132
+ console.log("\n\u{1F9E0} toon-memory init\n");
133
+ const agents2 = detectAgents();
134
+ for (const agent of agents2) {
135
+ console.log(`${agent.name}:`);
136
+ if (agent.name === "opencode") {
137
+ installOpenCodeTools();
138
+ }
139
+ installMCPConfig(agent, scope);
140
+ console.log("");
141
+ }
142
+ console.log("Done! Restart your agent to use memory tools.\n");
143
+ }
144
+ function status() {
145
+ console.log("\n\u{1F9E0} toon-memory status\n");
146
+ try {
147
+ const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
148
+ console.log(`Version: ${pkg.version}`);
149
+ } catch {
150
+ console.log("Version: unknown");
151
+ }
152
+ const memoryFile = join(projectRoot, ".opencode", "memory", "data.toon");
153
+ if (existsSync(memoryFile)) {
154
+ const data = readFileSync(memoryFile, "utf-8");
155
+ const lines = data.split("\n").filter((l) => l.startsWith(" ") && l.includes("|"));
156
+ console.log(`Memory: ${lines.length} entries`);
157
+ } else {
158
+ console.log("Memory: not initialized");
159
+ }
160
+ const agents2 = detectAgents();
161
+ console.log("\nAgent configs:");
162
+ for (const agent of agents2) {
163
+ const configs = [agent.global, agent.local].filter(Boolean);
164
+ let found = false;
165
+ for (const configPath of configs) {
166
+ if (!existsSync(configPath)) continue;
167
+ try {
168
+ const config = JSON.parse(readFileSync(configPath, "utf-8"));
169
+ const mcpKey = agent.mcpKey || "mcpServers";
170
+ if (config[mcpKey]?.["toon-memory"]) {
171
+ console.log(` \u2705 ${agent.name} (${configPath})`);
172
+ found = true;
173
+ }
174
+ } catch {
175
+ }
176
+ }
177
+ if (!found) {
178
+ console.log(` \u274C ${agent.name} (not configured)`);
179
+ }
180
+ }
181
+ console.log("");
182
+ }
183
+ function upgrade() {
184
+ console.log("\n\u{1F9E0} toon-memory upgrade\n");
185
+ try {
186
+ console.log("Checking for updates...");
187
+ const latest = execSync("npm view toon-memory version", { encoding: "utf-8" }).trim();
188
+ console.log(`Latest version: ${latest}`);
189
+ console.log("Upgrading...");
190
+ execSync("npm install -g toon-memory@" + latest, { stdio: "inherit" });
191
+ console.log(`
192
+ \u2705 Upgraded to toon-memory@${latest}`);
193
+ console.log("Restart your agent to use the new version.\n");
194
+ } catch (error) {
195
+ console.error("Upgrade failed:", error.message);
196
+ }
197
+ }
198
+ const args = process.argv.slice(2);
199
+ if (args[0] === "uninstall") {
200
+ uninstall();
201
+ process.exit(0);
202
+ }
203
+ if (args[0] === "init") {
204
+ init(args[1] || "local");
205
+ process.exit(0);
206
+ }
207
+ if (args[0] === "status") {
208
+ status();
209
+ process.exit(0);
210
+ }
211
+ if (args[0] === "upgrade") {
212
+ upgrade();
213
+ process.exit(0);
214
+ }
215
+ const agents = detectAgents();
216
+ console.log("\n\u{1F9E0} toon-memory installer\n");
217
+ console.log("Supported agents:");
218
+ agents.forEach((a, i) => console.log(` ${i + 1}. ${a.name}`));
219
+ console.log("");
220
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
221
+ rl.question("Install (1) Local or (2) Global? [1/2]: ", (answer) => {
222
+ const scope = answer === "2" ? "global" : "local";
223
+ console.log(`
224
+ Installing ${scope}ly...
225
+ `);
226
+ for (const agent of agents) {
227
+ console.log(`${agent.name}:`);
228
+ if (agent.name === "opencode") {
229
+ installOpenCodeTools();
230
+ }
231
+ installMCPConfig(agent, scope);
232
+ console.log("");
233
+ }
234
+ console.log("Done! Restart your agent to use memory tools.");
235
+ console.log("Run 'npx toon-memory uninstall' to remove.\n");
236
+ rl.close();
237
+ });
@@ -0,0 +1,9 @@
1
+ import { dirname, join } from "path";
2
+ import { fileURLToPath } from "url";
3
+ import { spawn } from "child_process";
4
+ const __dirname = dirname(fileURLToPath(import.meta.url));
5
+ const args = process.argv.slice(2);
6
+ const target = args[0] === "mcp" ? join(__dirname, "..", "mcp", "server.js") : join(__dirname, "..", "dist", "cli", "setup.js");
7
+ const extraArgs = args[0] === "mcp" ? [] : args;
8
+ const child = spawn("node", [target, ...extraArgs], { stdio: "inherit" });
9
+ child.on("exit", (code) => process.exit(code ?? 0));
package/install.ps1 ADDED
@@ -0,0 +1,62 @@
1
+ # toon-memory installer for Windows (PowerShell)
2
+ # Usage: irm https://raw.githubusercontent.com/LuiggiVal08/toon-memory/main/install.ps1 | iex
3
+
4
+ $TOON_VERSION = "1.0.9"
5
+
6
+ Write-Host "🧠 toon-memory installer" -ForegroundColor Cyan
7
+ Write-Host ""
8
+
9
+ # Check if npm is available
10
+ if (Get-Command npm -ErrorAction SilentlyContinue) {
11
+ Write-Host "Installing toon-memory via npm..."
12
+ npm install -g toon-memory@$TOON_VERSION
13
+ Write-Host ""
14
+ Write-Host "✅ toon-memory installed!" -ForegroundColor Green
15
+ Write-Host ""
16
+ Write-Host "Next steps:"
17
+ Write-Host " 1. Run: npx toon-memory"
18
+ Write-Host " 2. Select your agent(s)"
19
+ Write-Host " 3. Choose local or global install"
20
+ Write-Host ""
21
+ } else {
22
+ Write-Host "npm not found. Installing standalone..." -ForegroundColor Yellow
23
+ Write-Host ""
24
+
25
+ # Create installation directory
26
+ $INSTALL_DIR = "$env:USERPROFILE\.toon-memory"
27
+ New-Item -ItemType Directory -Force -Path $INSTALL_DIR | Out-Null
28
+
29
+ # Download the package
30
+ Write-Host "Downloading toon-memory v$TOON_VERSION..."
31
+ $url = "https://registry.npmjs.org/toon-memory/-/toon-memory-$TOON_VERSION.tgz"
32
+ $tgzPath = "$INSTALL_DIR\toon-memory.tgz"
33
+ Invoke-WebRequest -Uri $url -OutFile $tgzPath
34
+
35
+ # Extract
36
+ cd $INSTALL_DIR
37
+ tar xzf toon-memory.tgz
38
+ Move-Item -Path "package\*" -Destination "." -Force
39
+ Remove-Item -Path "package" -Recurse -Force
40
+ Remove-Item -Path $tgzPath -Force
41
+
42
+ # Create launcher script
43
+ $launcherContent = @"
44
+ `$SCRIPT_DIR = Split-Path -Parent `$MyInvocation.MyCommand.Path
45
+ node "`$SCRIPT_DIR\bin\toon-memory.js" @args
46
+ "@
47
+ Set-Content -Path "$INSTALL_DIR\toon-memory.ps1" -Value $launcherContent
48
+
49
+ # Add to PATH if not already there
50
+ $currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
51
+ if ($currentPath -notlike "*$INSTALL_DIR*") {
52
+ [Environment]::SetEnvironmentVariable("Path", "$INSTALL_DIR;$currentPath", "User")
53
+ Write-Host "Added to PATH"
54
+ }
55
+
56
+ Write-Host ""
57
+ Write-Host "✅ toon-memory installed to $INSTALL_DIR" -ForegroundColor Green
58
+ Write-Host ""
59
+ Write-Host "⚠️ Open a new PowerShell window, then run:"
60
+ Write-Host " toon-memory.ps1"
61
+ Write-Host ""
62
+ }
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.9" },
27667
+ { name: "toon-memory", version: "1.1.0" },
27668
27668
  { capabilities: { tools: { listChanged: true } } }
27669
27669
  );
27670
27670
  server.registerTool(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toon-memory",
3
- "version": "1.0.9",
3
+ "version": "1.1.1",
4
4
  "description": "Persistent memory system for AI coding agents using TOON format (40% fewer tokens than JSON)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,13 +9,17 @@
9
9
  "files": [
10
10
  "src/",
11
11
  "bin/",
12
+ "dist/",
12
13
  "mcp/",
13
14
  "skills/",
14
15
  "install.sh",
16
+ "install.ps1",
15
17
  "uninstall.sh"
16
18
  ],
17
19
  "scripts": {
18
- "build": "esbuild src/mcp/server.ts --bundle --platform=node --format=esm --outfile=mcp/server.js",
20
+ "build": "npm run build:mcp && npm run build:cli",
21
+ "build:mcp": "esbuild src/mcp/server.ts --bundle --platform=node --format=esm --outfile=mcp/server.js",
22
+ "build:cli": "esbuild src/cli/setup.ts --platform=node --format=esm --outfile=dist/cli/setup.js && esbuild src/cli/toon-memory.ts --platform=node --format=esm --outfile=dist/cli/toon-memory.js",
19
23
  "prepublishOnly": "npm run build"
20
24
  },
21
25
  "dependencies": {
@@ -46,10 +50,10 @@
46
50
  "license": "MIT",
47
51
  "repository": {
48
52
  "type": "git",
49
- "url": "https://github.com/luiggival/toon-memory.git"
53
+ "url": "https://github.com/LuiggiVal08/toon-memory.git"
50
54
  },
51
- "homepage": "https://github.com/luiggival/toon-memory#readme",
55
+ "homepage": "https://github.com/LuiggiVal08/toon-memory#readme",
52
56
  "bugs": {
53
- "url": "https://github.com/luiggival/toon-memory/issues"
57
+ "url": "https://github.com/LuiggiVal08/toon-memory/issues"
54
58
  }
55
59
  }
@@ -1,5 +1,4 @@
1
- #!/usr/bin/env node
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync, unlinkSync, rmdirSync } from "fs"
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync, unlinkSync } from "fs"
3
2
  import { dirname, join } from "path"
4
3
  import { fileURLToPath } from "url"
5
4
  import { execSync } from "child_process"
@@ -9,7 +8,14 @@ import { createRequire } from "module"
9
8
  const __dirname = dirname(fileURLToPath(import.meta.url))
10
9
  const projectRoot = process.cwd()
11
10
  const sourceDir = join(__dirname, "..", "src")
12
- const HOME = process.env.HOME || "~"
11
+ const HOME = process.env.HOME || process.env.USERPROFILE || "~"
12
+
13
+ interface Agent {
14
+ name: string
15
+ global?: string
16
+ local?: string
17
+ mcpKey: string
18
+ }
13
19
 
14
20
  // Auto-install @toon-format/toon if not present
15
21
  try {
@@ -20,8 +26,8 @@ try {
20
26
  }
21
27
 
22
28
  // Detect all supported agents
23
- function detectAgents() {
24
- const agents = []
29
+ function detectAgents(): Agent[] {
30
+ const agents: Agent[] = []
25
31
 
26
32
  // OpenCode
27
33
  const opencodeGlobal = join(HOME, ".config", "opencode", "opencode.json")
@@ -87,7 +93,7 @@ function detectAgents() {
87
93
  }
88
94
 
89
95
  // Install custom tools for OpenCode
90
- function installOpenCodeTools() {
96
+ function installOpenCodeTools(): void {
91
97
  const toolsDir = join(projectRoot, ".opencode", "tools")
92
98
  const memoryDir = join(projectRoot, ".opencode", "memory")
93
99
  const memoryFile = join(memoryDir, "data.toon")
@@ -105,7 +111,7 @@ function installOpenCodeTools() {
105
111
  }
106
112
 
107
113
  // Install MCP server config for different agents
108
- function installMCPConfig(agent, scope) {
114
+ function installMCPConfig(agent: Agent, scope: string): void {
109
115
  const configPath = scope === "global" ? agent.global : agent.local
110
116
 
111
117
  if (!configPath) {
@@ -116,7 +122,7 @@ function installMCPConfig(agent, scope) {
116
122
  const configDir = dirname(configPath)
117
123
  if (!existsSync(configDir)) mkdirSync(configDir, { recursive: true })
118
124
 
119
- let config = {}
125
+ let config: Record<string, any> = {}
120
126
  if (existsSync(configPath)) {
121
127
  try {
122
128
  config = JSON.parse(readFileSync(configPath, "utf-8"))
@@ -138,13 +144,13 @@ function installMCPConfig(agent, scope) {
138
144
  }
139
145
 
140
146
  // Uninstall from all agents
141
- function uninstall() {
147
+ function uninstall(): void {
142
148
  console.log("\n🧠 toon-memory uninstaller\n")
143
149
 
144
150
  const agents = detectAgents()
145
151
 
146
152
  for (const agent of agents) {
147
- const configs = [agent.global, agent.local].filter(Boolean)
153
+ const configs = [agent.global, agent.local].filter(Boolean) as string[]
148
154
 
149
155
  for (const configPath of configs) {
150
156
  if (!existsSync(configPath)) continue
@@ -172,6 +178,97 @@ function uninstall() {
172
178
  console.log("\n✅ toon-memory uninstalled from all agents\n")
173
179
  }
174
180
 
181
+ // Quick init without interactive prompts
182
+ function init(scope: string = "local"): void {
183
+ console.log("\n🧠 toon-memory init\n")
184
+
185
+ const agents = detectAgents()
186
+
187
+ for (const agent of agents) {
188
+ console.log(`${agent.name}:`)
189
+
190
+ if (agent.name === "opencode") {
191
+ installOpenCodeTools()
192
+ }
193
+
194
+ installMCPConfig(agent, scope)
195
+ console.log("")
196
+ }
197
+
198
+ console.log("Done! Restart your agent to use memory tools.\n")
199
+ }
200
+
201
+ // Show installation status
202
+ function status(): void {
203
+ console.log("\n🧠 toon-memory status\n")
204
+
205
+ // Check npm package
206
+ try {
207
+ const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"))
208
+ console.log(`Version: ${pkg.version}`)
209
+ } catch {
210
+ console.log("Version: unknown")
211
+ }
212
+
213
+ // Check memory file
214
+ const memoryFile = join(projectRoot, ".opencode", "memory", "data.toon")
215
+ if (existsSync(memoryFile)) {
216
+ const data = readFileSync(memoryFile, "utf-8")
217
+ const lines = data.split("\n").filter((l: string) => l.startsWith(" ") && l.includes("|"))
218
+ console.log(`Memory: ${lines.length} entries`)
219
+ } else {
220
+ console.log("Memory: not initialized")
221
+ }
222
+
223
+ // Check agent configs
224
+ const agents = detectAgents()
225
+ console.log("\nAgent configs:")
226
+
227
+ for (const agent of agents) {
228
+ const configs = [agent.global, agent.local].filter(Boolean) as string[]
229
+ let found = false
230
+
231
+ for (const configPath of configs) {
232
+ if (!existsSync(configPath)) continue
233
+
234
+ try {
235
+ const config = JSON.parse(readFileSync(configPath, "utf-8"))
236
+ const mcpKey = agent.mcpKey || "mcpServers"
237
+
238
+ if (config[mcpKey]?.["toon-memory"]) {
239
+ console.log(` ✅ ${agent.name} (${configPath})`)
240
+ found = true
241
+ }
242
+ } catch {}
243
+ }
244
+
245
+ if (!found) {
246
+ console.log(` ❌ ${agent.name} (not configured)`)
247
+ }
248
+ }
249
+
250
+ console.log("")
251
+ }
252
+
253
+ // Upgrade to latest version
254
+ function upgrade(): void {
255
+ console.log("\n🧠 toon-memory upgrade\n")
256
+
257
+ try {
258
+ console.log("Checking for updates...")
259
+ const latest = execSync("npm view toon-memory version", { encoding: "utf-8" }).trim()
260
+ console.log(`Latest version: ${latest}`)
261
+
262
+ console.log("Upgrading...")
263
+ execSync("npm install -g toon-memory@" + latest, { stdio: "inherit" })
264
+
265
+ console.log(`\n✅ Upgraded to toon-memory@${latest}`)
266
+ console.log("Restart your agent to use the new version.\n")
267
+ } catch (error) {
268
+ console.error("Upgrade failed:", (error as Error).message)
269
+ }
270
+ }
271
+
175
272
  // Main
176
273
  const args = process.argv.slice(2)
177
274
 
@@ -180,15 +277,30 @@ if (args[0] === "uninstall") {
180
277
  process.exit(0)
181
278
  }
182
279
 
280
+ if (args[0] === "init") {
281
+ init(args[1] || "local")
282
+ process.exit(0)
283
+ }
284
+
285
+ if (args[0] === "status") {
286
+ status()
287
+ process.exit(0)
288
+ }
289
+
290
+ if (args[0] === "upgrade") {
291
+ upgrade()
292
+ process.exit(0)
293
+ }
294
+
183
295
  const agents = detectAgents()
184
296
  console.log("\n🧠 toon-memory installer\n")
185
297
 
186
298
  console.log("Supported agents:")
187
- agents.forEach((a, i) => console.log(` ${i + 1}. ${a.name}`))
299
+ agents.forEach((a: Agent, i: number) => console.log(` ${i + 1}. ${a.name}`))
188
300
  console.log("")
189
301
 
190
302
  const rl = createInterface({ input: process.stdin, output: process.stdout })
191
- rl.question("Install (1) Local or (2) Global? [1/2]: ", (answer) => {
303
+ rl.question("Install (1) Local or (2) Global? [1/2]: ", (answer: string) => {
192
304
  const scope = answer === "2" ? "global" : "local"
193
305
  console.log(`\nInstalling ${scope}ly...\n`)
194
306
 
@@ -0,0 +1,14 @@
1
+ import { dirname, join } from "path"
2
+ import { fileURLToPath } from "url"
3
+ import { spawn } from "child_process"
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url))
6
+ const args = process.argv.slice(2)
7
+
8
+ const target = args[0] === "mcp"
9
+ ? join(__dirname, "..", "mcp", "server.js")
10
+ : join(__dirname, "..", "dist", "cli", "setup.js")
11
+
12
+ const extraArgs = args[0] === "mcp" ? [] : args
13
+ const child = spawn("node", [target, ...extraArgs], { stdio: "inherit" })
14
+ child.on("exit", (code) => process.exit(code ?? 0))
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.9" },
35
+ { name: "toon-memory", version: "1.1.0" },
36
36
  { capabilities: { tools: { listChanged: true } } }
37
37
  )
38
38