memtrace 0.1.26 → 0.1.27
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/README.md +6 -2
- package/bin/memtrace.js +20 -6
- package/install.js +13 -0
- package/package.json +1 -1
- package/uninstall.js +11 -0
package/README.md
CHANGED
|
@@ -236,11 +236,15 @@ Skills and plugins are shared between Claude Code and Claude Desktop — both ac
|
|
|
236
236
|
### Uninstall
|
|
237
237
|
|
|
238
238
|
```bash
|
|
239
|
-
memtrace uninstall # removes skills, MCP server,
|
|
239
|
+
memtrace uninstall # removes skills, MCP server, plugin, and settings
|
|
240
240
|
npm uninstall -g memtrace # removes the binary
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
Already ran `npm uninstall` first? The cleanup script is persisted at `~/.memtrace/uninstall.js`:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
node ~/.memtrace/uninstall.js
|
|
247
|
+
```
|
|
244
248
|
|
|
245
249
|
## Languages
|
|
246
250
|
|
package/bin/memtrace.js
CHANGED
|
@@ -12,13 +12,27 @@ const args = process.argv.slice(2);
|
|
|
12
12
|
|
|
13
13
|
if (args[0] === "uninstall" || args[0] === "cleanup") {
|
|
14
14
|
const path = require("path");
|
|
15
|
-
const
|
|
15
|
+
const os = require("os");
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
// Try the bundled script first, then the persisted copy in ~/.memtrace/
|
|
18
|
+
const candidates = [
|
|
19
|
+
path.join(__dirname, "..", "uninstall.js"),
|
|
20
|
+
path.join(os.homedir(), ".memtrace", "uninstall.js"),
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
let ran = false;
|
|
24
|
+
for (const p of candidates) {
|
|
25
|
+
try {
|
|
26
|
+
require(p);
|
|
27
|
+
ran = true;
|
|
28
|
+
break;
|
|
29
|
+
} catch (e) {
|
|
30
|
+
// try next candidate
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!ran) {
|
|
35
|
+
console.error("memtrace: could not find uninstall script");
|
|
22
36
|
process.exit(1);
|
|
23
37
|
}
|
|
24
38
|
|
package/install.js
CHANGED
|
@@ -231,6 +231,19 @@ if (require.main === module) {
|
|
|
231
231
|
console.warn(`memtrace: MCP server registration failed: ${e.message}`);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
+
|
|
235
|
+
// 5. Persist uninstall script to ~/.memtrace/ so it survives `npm uninstall -g`
|
|
236
|
+
// (npm v7+ does NOT fire preuninstall hooks for global packages — npm/cli#3042)
|
|
237
|
+
try {
|
|
238
|
+
const memtraceDir = path.join(os.homedir(), ".memtrace");
|
|
239
|
+
fs.mkdirSync(memtraceDir, { recursive: true });
|
|
240
|
+
const src = path.join(__dirname, "uninstall.js");
|
|
241
|
+
const dest = path.join(memtraceDir, "uninstall.js");
|
|
242
|
+
fs.copyFileSync(src, dest);
|
|
243
|
+
console.log(`memtrace: persisted uninstall script to ${dest}`);
|
|
244
|
+
} catch (e) {
|
|
245
|
+
console.warn(`memtrace: failed to persist uninstall script: ${e.message}`);
|
|
246
|
+
}
|
|
234
247
|
}
|
|
235
248
|
|
|
236
249
|
module.exports = { getBinaryPath };
|
package/package.json
CHANGED
package/uninstall.js
CHANGED
|
@@ -171,6 +171,17 @@ function run() {
|
|
|
171
171
|
console.warn(`memtrace: MCP server removal failed: ${e.message}`);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
// 5. Clean up ~/.memtrace/ (the persisted uninstall script itself)
|
|
175
|
+
try {
|
|
176
|
+
const memtraceDir = path.join(os.homedir(), ".memtrace");
|
|
177
|
+
if (fs.existsSync(memtraceDir)) {
|
|
178
|
+
fs.rmSync(memtraceDir, { recursive: true, force: true });
|
|
179
|
+
console.log("memtrace: removed ~/.memtrace/");
|
|
180
|
+
}
|
|
181
|
+
} catch (e) {
|
|
182
|
+
console.warn(`memtrace: failed to remove ~/.memtrace/: ${e.message}`);
|
|
183
|
+
}
|
|
184
|
+
|
|
174
185
|
console.log("memtrace: uninstall complete");
|
|
175
186
|
}
|
|
176
187
|
|