@ace3-memory/ace 3.0.29 → 3.0.30

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.
Files changed (2) hide show
  1. package/package.json +3 -1
  2. package/preuninstall.js +62 -0
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@ace3-memory/ace",
3
- "version": "3.0.29",
3
+ "version": "3.0.30",
4
4
  "description": "Your Logbook for AI - persistent memory for ChatGPT, Claude, Gemini, and more",
5
5
  "main": "index.js",
6
6
  "bin": {
7
7
  "ace": "./cli.js"
8
8
  },
9
9
  "scripts": {
10
+ "preuninstall": "node preuninstall.js",
10
11
  "postinstall": "node download-binary.js",
11
12
  "test": "./scripts/test-report.sh run",
12
13
  "test:report": "./scripts/test-report.sh",
@@ -56,6 +57,7 @@
56
57
  "files": [
57
58
  "cli.js",
58
59
  "download-binary.js",
60
+ "preuninstall.js",
59
61
  "README.md",
60
62
  "LICENSE",
61
63
  "bin"
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ACE Preuninstall Script
4
+ * Stops the ACE server daemon before uninstalling
5
+ */
6
+
7
+ const { execSync, spawn } = require('child_process');
8
+ const path = require('path');
9
+ const fs = require('fs');
10
+
11
+ console.log('[ACE] Stopping server before uninstall...');
12
+
13
+ // Try to stop using the binary first
14
+ const platform = process.platform;
15
+ const binaryName = 'ace' + (platform === 'win32' ? '.exe' : '');
16
+ const binaryPath = path.join(__dirname, 'bin', binaryName);
17
+
18
+ if (fs.existsSync(binaryPath)) {
19
+ try {
20
+ execSync(`"${binaryPath}" stop`, { stdio: 'inherit', timeout: 10000 });
21
+ console.log('[ACE] Server stopped via CLI');
22
+ process.exit(0);
23
+ } catch (e) {
24
+ // CLI stop failed, try direct kill
25
+ }
26
+ }
27
+
28
+ // Fallback: kill any process on port 7777
29
+ try {
30
+ if (platform === 'win32') {
31
+ // Windows: find and kill process on port 7777
32
+ try {
33
+ const result = execSync('netstat -ano | findstr :7777', { encoding: 'utf8' });
34
+ const lines = result.trim().split('\n');
35
+ for (const line of lines) {
36
+ const parts = line.trim().split(/\s+/);
37
+ const pid = parts[parts.length - 1];
38
+ if (pid && !isNaN(pid)) {
39
+ execSync(`taskkill /F /PID ${pid}`, { stdio: 'ignore' });
40
+ console.log(`[ACE] Killed process ${pid} on port 7777`);
41
+ }
42
+ }
43
+ } catch (e) {
44
+ // No process found on port
45
+ }
46
+ } else {
47
+ // macOS/Linux: use lsof
48
+ try {
49
+ const pid = execSync('lsof -t -i :7777', { encoding: 'utf8' }).trim();
50
+ if (pid) {
51
+ execSync(`kill ${pid}`, { stdio: 'ignore' });
52
+ console.log(`[ACE] Killed process ${pid} on port 7777`);
53
+ }
54
+ } catch (e) {
55
+ // No process found on port
56
+ }
57
+ }
58
+ } catch (e) {
59
+ // Ignore errors - process might not be running
60
+ }
61
+
62
+ console.log('[ACE] Cleanup complete');