toon-memory 1.6.4 ā 1.6.5
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/dist/cli/setup.js +10 -18
- package/package.json +1 -1
- package/src/cli/setup.ts +10 -20
- package/uninstall.sh +15 -33
package/dist/cli/setup.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync, readdirSync, statSync } from "fs";
|
|
2
2
|
import { basename, dirname, join } from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
|
-
import { execSync } from "child_process";
|
|
5
4
|
import { createInterface } from "readline";
|
|
6
|
-
import { createRequire } from "module";
|
|
7
5
|
import { gzipSync, gunzipSync } from "zlib";
|
|
8
6
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
7
|
const projectRoot = process.cwd();
|
|
10
8
|
const sourceDir = join(__dirname, "..", "..", "src");
|
|
11
9
|
const HOME = process.env.HOME || process.env.USERPROFILE || "~";
|
|
12
|
-
try {
|
|
13
|
-
createRequire(import.meta.url).resolve("@toon-format/toon");
|
|
14
|
-
} catch {
|
|
15
|
-
console.log("Installing @toon-format/toon...");
|
|
16
|
-
execSync("npm install @toon-format/toon", { cwd: projectRoot, stdio: "inherit" });
|
|
17
|
-
}
|
|
18
10
|
function detectAgents() {
|
|
19
11
|
const agents2 = [];
|
|
20
12
|
const opencodeGlobal = join(HOME, ".config", "opencode", "opencode.json");
|
|
@@ -206,16 +198,16 @@ function status() {
|
|
|
206
198
|
function upgrade() {
|
|
207
199
|
console.log("\n\u{1F9E0} toon-memory upgrade\n");
|
|
208
200
|
try {
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
console.log(`
|
|
212
|
-
console.log("
|
|
213
|
-
|
|
214
|
-
console.log(
|
|
215
|
-
|
|
216
|
-
console.log("
|
|
217
|
-
|
|
218
|
-
console.
|
|
201
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
202
|
+
const currentVersion = pkg.version;
|
|
203
|
+
console.log(`Current version: ${currentVersion}`);
|
|
204
|
+
console.log("\nTo upgrade, run:");
|
|
205
|
+
console.log(" npm install -g toon-memory@latest");
|
|
206
|
+
console.log("\nThen restart your agent.\n");
|
|
207
|
+
} catch {
|
|
208
|
+
console.log("To upgrade, run:");
|
|
209
|
+
console.log(" npm install -g toon-memory@latest");
|
|
210
|
+
console.log("\nThen restart your agent.\n");
|
|
219
211
|
}
|
|
220
212
|
}
|
|
221
213
|
function stats() {
|
package/package.json
CHANGED
package/src/cli/setup.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync, unlinkSync, readdirSync, statSync } from "fs"
|
|
2
2
|
import { basename, dirname, join } from "path"
|
|
3
3
|
import { fileURLToPath } from "url"
|
|
4
|
-
import { execSync } from "child_process"
|
|
5
4
|
import { createInterface } from "readline"
|
|
6
|
-
import { createRequire } from "module"
|
|
7
5
|
import { gzipSync, gunzipSync } from "zlib"
|
|
8
6
|
|
|
9
7
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
@@ -25,14 +23,6 @@ interface Agent {
|
|
|
25
23
|
mcpKey: string
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
// Auto-install @toon-format/toon if not present
|
|
29
|
-
try {
|
|
30
|
-
createRequire(import.meta.url).resolve("@toon-format/toon")
|
|
31
|
-
} catch {
|
|
32
|
-
console.log("Installing @toon-format/toon...")
|
|
33
|
-
execSync("npm install @toon-format/toon", { cwd: projectRoot, stdio: "inherit" })
|
|
34
|
-
}
|
|
35
|
-
|
|
36
26
|
/**
|
|
37
27
|
* Detect all supported AI coding agents on the system.
|
|
38
28
|
*
|
|
@@ -375,17 +365,17 @@ function upgrade(): void {
|
|
|
375
365
|
console.log("\nš§ toon-memory upgrade\n")
|
|
376
366
|
|
|
377
367
|
try {
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
console.log(`Latest version: ${latest}`)
|
|
381
|
-
|
|
382
|
-
console.log("Upgrading...")
|
|
383
|
-
execSync("npm install -g toon-memory@" + latest, { stdio: "inherit" })
|
|
368
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"))
|
|
369
|
+
const currentVersion = pkg.version
|
|
384
370
|
|
|
385
|
-
console.log(
|
|
386
|
-
console.log("
|
|
387
|
-
|
|
388
|
-
console.
|
|
371
|
+
console.log(`Current version: ${currentVersion}`)
|
|
372
|
+
console.log("\nTo upgrade, run:")
|
|
373
|
+
console.log(" npm install -g toon-memory@latest")
|
|
374
|
+
console.log("\nThen restart your agent.\n")
|
|
375
|
+
} catch {
|
|
376
|
+
console.log("To upgrade, run:")
|
|
377
|
+
console.log(" npm install -g toon-memory@latest")
|
|
378
|
+
console.log("\nThen restart your agent.\n")
|
|
389
379
|
}
|
|
390
380
|
}
|
|
391
381
|
|
package/uninstall.sh
CHANGED
|
@@ -4,59 +4,41 @@ set -e
|
|
|
4
4
|
# toon-memory uninstaller
|
|
5
5
|
# Usage: npx toon-memory uninstall
|
|
6
6
|
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
|
|
7
9
|
echo "š§ toon-memory uninstaller"
|
|
8
10
|
echo ""
|
|
9
11
|
|
|
10
|
-
#
|
|
11
|
-
OPENCODE_GLOBAL="${HOME}/.config/opencode/opencode.json"
|
|
12
|
-
OPENCODE_LOCAL=".opencode/opencode.json"
|
|
13
|
-
|
|
12
|
+
# Helper: remove toon-memory from a config file
|
|
14
13
|
remove_from_config() {
|
|
15
14
|
local file="$1"
|
|
16
|
-
local name="$2"
|
|
17
|
-
|
|
18
15
|
if [ -f "${file}" ]; then
|
|
19
|
-
|
|
20
|
-
echo "Removing from ${name} (${file})..."
|
|
21
|
-
# Use node to remove the MCP entry
|
|
22
|
-
node -e "
|
|
23
|
-
const fs = require('fs');
|
|
24
|
-
const config = JSON.parse(fs.readFileSync('${file}', 'utf-8'));
|
|
25
|
-
if (config.mcp && config.mcp['toon-memory']) {
|
|
26
|
-
delete config.mcp['toon-memory'];
|
|
27
|
-
fs.writeFileSync('${file}', JSON.stringify(config, null, 2));
|
|
28
|
-
console.log(' ā
Removed');
|
|
29
|
-
} else if (config.mcpServers && config.mcpServers['toon-memory']) {
|
|
30
|
-
delete config.mcpServers['toon-memory'];
|
|
31
|
-
fs.writeFileSync('${file}', JSON.stringify(config, null, 2));
|
|
32
|
-
console.log(' ā
Removed');
|
|
33
|
-
} else {
|
|
34
|
-
console.log(' ā ļø Not found');
|
|
35
|
-
}
|
|
36
|
-
" 2>/dev/null || echo " ā ļø Could not parse config"
|
|
37
|
-
fi
|
|
16
|
+
node "${SCRIPT_DIR}/scripts/remove-mcp.js" "${file}"
|
|
38
17
|
fi
|
|
39
18
|
}
|
|
40
19
|
|
|
41
20
|
# OpenCode
|
|
42
|
-
remove_from_config "${
|
|
43
|
-
remove_from_config "
|
|
21
|
+
remove_from_config "${HOME}/.config/opencode/opencode.json"
|
|
22
|
+
remove_from_config ".opencode/opencode.json"
|
|
44
23
|
|
|
45
24
|
# VS Code
|
|
46
|
-
remove_from_config ".vscode/mcp.json"
|
|
25
|
+
remove_from_config ".vscode/mcp.json"
|
|
47
26
|
|
|
48
27
|
# Claude
|
|
49
|
-
remove_from_config "${HOME}/.claude/settings.json"
|
|
50
|
-
remove_from_config ".claude/settings.json"
|
|
28
|
+
remove_from_config "${HOME}/.claude/settings.json"
|
|
29
|
+
remove_from_config ".claude/settings.json"
|
|
51
30
|
|
|
52
31
|
# Cursor
|
|
53
|
-
remove_from_config ".cursor/mcp.json"
|
|
32
|
+
remove_from_config ".cursor/mcp.json"
|
|
33
|
+
|
|
34
|
+
# Windsurf
|
|
35
|
+
remove_from_config "${HOME}/.codeium/windsurf/mcp_config.json"
|
|
54
36
|
|
|
55
37
|
# Cline
|
|
56
|
-
remove_from_config ".cline/mcp.json"
|
|
38
|
+
remove_from_config ".cline/mcp.json"
|
|
57
39
|
|
|
58
40
|
# Continue
|
|
59
|
-
remove_from_config ".continue/config.json"
|
|
41
|
+
remove_from_config ".continue/config.json"
|
|
60
42
|
|
|
61
43
|
# Remove custom tools if they exist
|
|
62
44
|
if [ -d ".opencode/tools" ]; then
|