memtrace 0.1.25 → 0.1.26

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
@@ -233,6 +233,15 @@ Skills and plugins are shared between Claude Code and Claude Desktop — both ac
233
233
  }
234
234
  ```
235
235
 
236
+ ### Uninstall
237
+
238
+ ```bash
239
+ memtrace uninstall # removes skills, MCP server, and plugin from settings
240
+ npm uninstall -g memtrace # removes the binary
241
+ ```
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.
244
+
236
245
  ## Languages
237
246
 
238
247
  Rust · Go · TypeScript · JavaScript · Python · Java · C · C++ · C# · Swift · Kotlin · Ruby · PHP · Dart · Scala · Perl — and more via Tree-sitter.
package/bin/memtrace.js CHANGED
@@ -4,6 +4,31 @@
4
4
  const { spawnSync } = require("child_process");
5
5
  const { getBinaryPath } = require("../install.js");
6
6
 
7
+ // ── Handle `memtrace uninstall` before delegating to the Rust binary ────────
8
+ // npm v7+ does NOT fire preuninstall hooks for global packages (npm/cli#3042).
9
+ // This command provides reliable cleanup users can run before `npm uninstall -g`.
10
+
11
+ const args = process.argv.slice(2);
12
+
13
+ if (args[0] === "uninstall" || args[0] === "cleanup") {
14
+ const path = require("path");
15
+ const uninstallPath = path.join(__dirname, "..", "uninstall.js");
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}`);
22
+ process.exit(1);
23
+ }
24
+
25
+ console.log("");
26
+ console.log("Now run: npm uninstall -g memtrace");
27
+ process.exit(0);
28
+ }
29
+
30
+ // ── Delegate everything else to the Rust binary ─────────────────────────────
31
+
7
32
  let binaryPath;
8
33
  try {
9
34
  binaryPath = getBinaryPath();
@@ -12,7 +37,7 @@ try {
12
37
  process.exit(1);
13
38
  }
14
39
 
15
- const result = spawnSync(binaryPath, process.argv.slice(2), {
40
+ const result = spawnSync(binaryPath, args, {
16
41
  stdio: "inherit",
17
42
  env: process.env,
18
43
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memtrace",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Code intelligence graph — MCP server + AI agent skills + visualization UI",
5
5
  "keywords": [
6
6
  "mcp",
package/uninstall.js CHANGED
@@ -138,9 +138,9 @@ function tryClaudeCliUninstall() {
138
138
  }
139
139
  }
140
140
 
141
- // ── Main preuninstall ───────────────────────────────────────────────────────
141
+ // ── Main uninstall logic ───────────────────────────────────────────────────
142
142
 
143
- if (require.main === module) {
143
+ function run() {
144
144
  console.log("memtrace: cleaning up...");
145
145
 
146
146
  // 1. Remove skills
@@ -173,3 +173,11 @@ if (require.main === module) {
173
173
 
174
174
  console.log("memtrace: uninstall complete");
175
175
  }
176
+
177
+ // Run when called directly (npm preuninstall hook) or when require()'d
178
+ if (require.main === module) {
179
+ run();
180
+ } else {
181
+ // Called via `memtrace uninstall` — run immediately
182
+ run();
183
+ }