@ghl-ai/aw 0.1.13 → 0.1.15

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/commands/nuke.mjs +38 -2
  2. package/package.json +4 -1
package/commands/nuke.mjs CHANGED
@@ -13,7 +13,7 @@ const HOME = homedir();
13
13
  const GLOBAL_AW_DIR = join(HOME, '.aw_registry');
14
14
  const MANIFEST_PATH = join(GLOBAL_AW_DIR, '.aw-manifest.json');
15
15
 
16
- const IDE_DIRS = ['.claude', '.cursor', '.codex'];
16
+ const IDE_DIRS = ['.claude', '.cursor', '.codex', '.agents'];
17
17
  const CONTENT_TYPES = ['agents', 'skills', 'commands', 'blueprints', 'evals'];
18
18
 
19
19
  function loadManifest() {
@@ -72,6 +72,20 @@ function removeIdeSymlinks() {
72
72
  }
73
73
  }
74
74
 
75
+ // Clean up empty IDE dirs (e.g. ~/.agents/ if it only had AW content)
76
+ for (const ide of IDE_DIRS) {
77
+ const ideDir = join(HOME, ide);
78
+ try {
79
+ // Remove empty subdirs first
80
+ for (const type of CONTENT_TYPES) {
81
+ const dir = join(ideDir, type);
82
+ if (existsSync(dir) && readdirSync(dir).length === 0) rmSync(dir);
83
+ }
84
+ // Remove IDE dir if now empty
85
+ if (existsSync(ideDir) && readdirSync(ideDir).length === 0) rmSync(ideDir);
86
+ } catch {}
87
+ }
88
+
75
89
  if (removed > 0) fmt.logStep(`Removed ${removed} IDE symlink${removed > 1 ? 's' : ''}`);
76
90
  }
77
91
 
@@ -211,7 +225,29 @@ export function nukeCommand(args) {
211
225
  fmt.logStep('Removed ~/.aw_docs/');
212
226
  }
213
227
 
214
- // 7. Remove ~/.aw_registry/ itself (source of truth — last!)
228
+ // 7. Remove any manual `aw` symlinks (e.g. ~/.local/bin/aw)
229
+ const manualBins = [
230
+ join(HOME, '.local', 'bin', 'aw'),
231
+ join(HOME, 'bin', 'aw'),
232
+ ];
233
+ for (const bin of manualBins) {
234
+ try {
235
+ if (lstatSync(bin).isSymbolicLink()) {
236
+ unlinkSync(bin);
237
+ fmt.logStep(`Removed manual symlink ${bin.replace(HOME, '~')}`);
238
+ }
239
+ } catch { /* doesn't exist */ }
240
+ }
241
+
242
+ // 8. Uninstall npm global package (skip if already in npm uninstall lifecycle)
243
+ if (!process.env.npm_lifecycle_event) {
244
+ try {
245
+ execSync('npm uninstall -g @ghl-ai/aw', { stdio: 'pipe', timeout: 15000 });
246
+ fmt.logStep('Uninstalled @ghl-ai/aw globally');
247
+ } catch { /* not installed via npm or no permissions */ }
248
+ }
249
+
250
+ // 9. Remove ~/.aw_registry/ itself (source of truth — last!)
215
251
  rmSync(GLOBAL_AW_DIR, { recursive: true, force: true });
216
252
  fmt.logStep('Removed ~/.aw_registry/');
217
253
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,6 +36,9 @@
36
36
  ],
37
37
  "author": "GoHighLevel",
38
38
  "license": "MIT",
39
+ "scripts": {
40
+ "preuninstall": "node bin.js nuke 2>/dev/null || true"
41
+ },
39
42
  "publishConfig": {
40
43
  "access": "public"
41
44
  },