@agenticmail/openclaw 0.3.1 → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/openclaw",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "OpenClaw plugin and skill for AgenticMail",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,6 +14,7 @@
14
14
  "files": [
15
15
  "dist",
16
16
  "openclaw.plugin.json",
17
+ "scripts",
17
18
  "skill",
18
19
  "README.md",
19
20
  "REFERENCE.md",
@@ -26,7 +27,8 @@
26
27
  },
27
28
  "scripts": {
28
29
  "build": "tsup index.ts --format esm --dts --clean",
29
- "test": "vitest run",
30
+ "test": "vitest run --passWithNoTests",
31
+ "preuninstall": "node scripts/uninstall.mjs",
30
32
  "prepublishOnly": "npm run build"
31
33
  },
32
34
  "dependencies": {},
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Cleanup script that runs on `npm uninstall @agenticmail/openclaw`.
5
+ * Removes the agenticmail plugin entry from ~/.openclaw/openclaw.json
6
+ * and cleans up the plugin load path so OpenClaw doesn't error on
7
+ * a missing plugin.
8
+ */
9
+
10
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
11
+ import { join } from 'node:path';
12
+ import { homedir } from 'node:os';
13
+
14
+ const configPath = join(homedir(), '.openclaw', 'openclaw.json');
15
+
16
+ if (!existsSync(configPath)) process.exit(0);
17
+
18
+ try {
19
+ const raw = readFileSync(configPath, 'utf-8');
20
+ const config = JSON.parse(raw);
21
+
22
+ let changed = false;
23
+
24
+ // Remove plugins.entries.agenticmail
25
+ if (config.plugins?.entries?.agenticmail) {
26
+ delete config.plugins.entries.agenticmail;
27
+ changed = true;
28
+
29
+ // Clean up empty entries object
30
+ if (Object.keys(config.plugins.entries).length === 0) {
31
+ delete config.plugins.entries;
32
+ }
33
+ }
34
+
35
+ // Remove our path from plugins.load.paths
36
+ if (Array.isArray(config.plugins?.load?.paths)) {
37
+ const before = config.plugins.load.paths.length;
38
+ config.plugins.load.paths = config.plugins.load.paths.filter(
39
+ (p) => !p.includes('@agenticmail/openclaw')
40
+ );
41
+ if (config.plugins.load.paths.length !== before) changed = true;
42
+
43
+ // Clean up empty paths array
44
+ if (config.plugins.load.paths.length === 0) {
45
+ delete config.plugins.load.paths;
46
+ if (Object.keys(config.plugins.load).length === 0) {
47
+ delete config.plugins.load;
48
+ }
49
+ }
50
+ }
51
+
52
+ if (changed) {
53
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
54
+ console.log('[agenticmail] Cleaned up OpenClaw config:', configPath);
55
+ }
56
+ } catch {
57
+ // Don't fail the uninstall if cleanup fails
58
+ }