@ghl-ai/aw 0.1.36-beta.47 → 0.1.36-beta.49
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/commands/nuke.mjs +26 -3
- package/package.json +1 -1
package/commands/nuke.mjs
CHANGED
|
@@ -164,6 +164,27 @@ async function removeProjectSymlinks() {
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
// Find and remove stale project-level .aw git worktree directories.
|
|
168
|
+
// These are directories named ".aw" that contain a .git FILE (not dir) — the signature
|
|
169
|
+
// of a linked git worktree. Skip ~/.aw itself which is removed separately in Phase 6.
|
|
170
|
+
const AW_HOME_PATH = join(HOME, '.aw');
|
|
171
|
+
try {
|
|
172
|
+
const { stdout: awDirs } = await exec(
|
|
173
|
+
`find "${HOME}" -maxdepth 5 -name ".aw" -type d 2>/dev/null`,
|
|
174
|
+
{ encoding: 'utf8', timeout: 10000 }
|
|
175
|
+
);
|
|
176
|
+
for (const awDir of awDirs.trim().split('\n').filter(Boolean)) {
|
|
177
|
+
if (awDir === AW_HOME_PATH) continue; // ~/.aw is removed in Phase 6
|
|
178
|
+
try {
|
|
179
|
+
const gitFile = join(awDir, '.git');
|
|
180
|
+
if (lstatSync(gitFile).isFile()) { // .git file = linked worktree
|
|
181
|
+
rmSync(awDir, { recursive: true, force: true });
|
|
182
|
+
removed++;
|
|
183
|
+
}
|
|
184
|
+
} catch { /* best effort */ }
|
|
185
|
+
}
|
|
186
|
+
} catch { /* find failed, skip */ }
|
|
187
|
+
|
|
167
188
|
// Also remove legacy local .git/hooks/post-checkout installed by old aw versions
|
|
168
189
|
let hooksRemoved = 0;
|
|
169
190
|
try {
|
|
@@ -229,9 +250,11 @@ function removeIdeTasks() {
|
|
|
229
250
|
export async function nukeCommand(args) {
|
|
230
251
|
fmt.intro('aw nuke');
|
|
231
252
|
|
|
232
|
-
// Remove stale local .aw_registry symlink if present
|
|
233
|
-
|
|
234
|
-
|
|
253
|
+
// Remove stale local .aw_registry symlink if present (skip if cwd IS home — that's the global one)
|
|
254
|
+
if (process.cwd() !== HOME) {
|
|
255
|
+
const local = join(process.cwd(), '.aw_registry');
|
|
256
|
+
try { if (lstatSync(local).isSymbolicLink()) unlinkSync(local); } catch { /* fine */ }
|
|
257
|
+
}
|
|
235
258
|
|
|
236
259
|
const manifest = loadManifest();
|
|
237
260
|
|