@ghl-ai/aw 0.1.15 → 0.1.17

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 +59 -29
  2. package/package.json +1 -1
package/commands/nuke.mjs CHANGED
@@ -35,16 +35,44 @@ function removeCreatedFiles(manifest) {
35
35
  }
36
36
 
37
37
  // 2. Remove symlinks from IDE dirs that point into .aw_registry
38
+ // Scans both ~ (global) and cwd (project-level)
38
39
  function removeIdeSymlinks() {
39
40
  let removed = 0;
41
+ const cwd = process.cwd();
42
+ const baseDirs = new Set([HOME]);
43
+ if (cwd !== HOME) baseDirs.add(cwd);
44
+
45
+ for (const base of baseDirs) {
46
+ for (const ide of IDE_DIRS) {
47
+ for (const type of [...CONTENT_TYPES, 'commands/aw', 'commands/ghl']) {
48
+ const dir = join(base, ide, type);
49
+ if (!existsSync(dir)) continue;
50
+
51
+ for (const entry of readdirSync(dir)) {
52
+ const p = join(dir, entry);
53
+ try {
54
+ const stat = lstatSync(p);
55
+ if (stat.isSymbolicLink()) {
56
+ const target = readlinkSync(p);
57
+ if (target.includes('.aw_registry') || target.includes('aw_registry')) {
58
+ unlinkSync(p); removed++;
59
+ }
60
+ } else if (stat.isDirectory()) {
61
+ // Check if this is an AW-generated skill folder (contains SKILL.md)
62
+ const skillMd = join(p, 'SKILL.md');
63
+ if (existsSync(skillMd)) {
64
+ rmSync(p, { recursive: true, force: true }); removed++;
65
+ }
66
+ }
67
+ } catch { /* best effort */ }
68
+ }
69
+ // Remove dir if now empty
70
+ try { if (readdirSync(dir).length === 0) rmSync(dir); } catch {}
71
+ }
40
72
 
41
- for (const ide of IDE_DIRS) {
42
- for (const type of [...CONTENT_TYPES, 'commands/aw', 'commands/ghl']) {
43
- const dir = join(HOME, ide, type);
44
- if (!existsSync(dir)) continue;
45
-
46
- for (const entry of readdirSync(dir)) {
47
- const p = join(dir, entry);
73
+ // Also clean CLAUDE.md / AGENTS.md if they're AW-generated
74
+ for (const file of ['CLAUDE.md', 'AGENTS.md']) {
75
+ const p = join(base, ide, file);
48
76
  try {
49
77
  if (lstatSync(p).isSymbolicLink()) {
50
78
  const target = readlinkSync(p);
@@ -52,38 +80,40 @@ function removeIdeSymlinks() {
52
80
  unlinkSync(p); removed++;
53
81
  }
54
82
  }
55
- } catch { /* best effort */ }
83
+ } catch { /* not a symlink or doesn't exist */ }
56
84
  }
57
- // Remove dir if now empty
58
- try { if (readdirSync(dir).length === 0) rmSync(dir); } catch {}
85
+
86
+ // Clean up empty IDE dirs
87
+ const ideDir = join(base, ide);
88
+ try {
89
+ for (const type of CONTENT_TYPES) {
90
+ const dir = join(ideDir, type);
91
+ if (existsSync(dir) && readdirSync(dir).length === 0) rmSync(dir);
92
+ }
93
+ if (existsSync(ideDir) && readdirSync(ideDir).length === 0) rmSync(ideDir);
94
+ } catch {}
59
95
  }
60
96
 
61
- // Also clean CLAUDE.md / AGENTS.md if they're AW-generated
97
+ // Also clean root-level CLAUDE.md / AGENTS.md if AW-generated
62
98
  for (const file of ['CLAUDE.md', 'AGENTS.md']) {
63
- const p = join(HOME, ide, file);
99
+ const p = join(base, file);
64
100
  try {
65
- if (lstatSync(p).isSymbolicLink()) {
66
- const target = readlinkSync(p);
67
- if (target.includes('.aw_registry') || target.includes('aw_registry')) {
101
+ if (existsSync(p)) {
102
+ const content = readFileSync(p, 'utf8');
103
+ // Only remove if it contains AW markers
104
+ if (content.includes('aw_registry') || content.includes('.aw_docs') || content.includes('Agentic Workspace')) {
68
105
  unlinkSync(p); removed++;
69
106
  }
70
107
  }
71
- } catch { /* not a symlink or doesn't exist */ }
108
+ } catch { /* best effort */ }
72
109
  }
73
- }
74
110
 
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 {}
111
+ // Clean .aw_docs in project dir
112
+ const projectAwDocs = join(base, '.aw_docs');
113
+ if (base !== HOME && existsSync(projectAwDocs)) {
114
+ rmSync(projectAwDocs, { recursive: true, force: true });
115
+ removed++;
116
+ }
87
117
  }
88
118
 
89
119
  if (removed > 0) fmt.logStep(`Removed ${removed} IDE symlink${removed > 1 ? 's' : ''}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {