memtrace 0.1.26 → 0.1.28

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 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, and plugin from settings
239
+ memtrace uninstall # removes skills, MCP server, plugin, and settings
240
240
  npm uninstall -g memtrace # removes the binary
241
241
  ```
242
242
 
243
- > **Why two commands?** npm v7+ [does not run lifecycle hooks](https://github.com/npm/cli/issues/3042) for global packages. `memtrace uninstall` handles the cleanup that npm can't.
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 uninstallPath = path.join(__dirname, "..", "uninstall.js");
15
+ const os = require("os");
16
16
 
17
- try {
18
- // Load and run the uninstall script directly
19
- require(uninstallPath);
20
- } catch (e) {
21
- console.error(`memtrace: uninstall failed: ${e.message}`);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memtrace",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Code intelligence graph — MCP server + AI agent skills + visualization UI",
5
5
  "keywords": [
6
6
  "mcp",
@@ -31,9 +31,9 @@
31
31
  "preuninstall": "node uninstall.js"
32
32
  },
33
33
  "optionalDependencies": {
34
- "@memtrace/darwin-arm64": "0.1.0",
35
- "@memtrace/linux-x64": "0.1.0",
36
- "@memtrace/win32-x64": "0.1.0"
34
+ "@memtrace/darwin-arm64": "0.1.20",
35
+ "@memtrace/linux-x64": "0.1.20",
36
+ "@memtrace/win32-x64": "0.1.20"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=18"
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