@ghl-ai/aw 0.1.36-beta.53 → 0.1.36-beta.55
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/init.mjs +13 -1
- package/commands/nuke.mjs +7 -1
- package/package.json +1 -1
package/commands/init.mjs
CHANGED
|
@@ -295,13 +295,25 @@ export async function initCommand(args) {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
// Create backward-compat symlink: ~/.aw_registry/ → ~/.aw/.aw_registry/
|
|
298
|
-
|
|
298
|
+
// Use lstatSync (not existsSync) so we handle dangling symlinks correctly.
|
|
299
|
+
let awRegistryLstat = null;
|
|
300
|
+
try { awRegistryLstat = lstatSync(GLOBAL_AW_DIR); } catch { /* doesn't exist */ }
|
|
301
|
+
if (!awRegistryLstat) {
|
|
299
302
|
try {
|
|
300
303
|
symlinkSync(join(AW_HOME, REGISTRY_DIR), GLOBAL_AW_DIR);
|
|
301
304
|
fmt.logStep('Created ~/.aw_registry/ symlink');
|
|
302
305
|
} catch (e) {
|
|
303
306
|
fmt.logWarn(`Could not create symlink ~/.aw_registry/: ${e.message}`);
|
|
304
307
|
}
|
|
308
|
+
} else if (awRegistryLstat.isSymbolicLink()) {
|
|
309
|
+
// Stale or dangling — re-point to the new clone
|
|
310
|
+
try {
|
|
311
|
+
rmSync(GLOBAL_AW_DIR);
|
|
312
|
+
symlinkSync(join(AW_HOME, REGISTRY_DIR), GLOBAL_AW_DIR);
|
|
313
|
+
fmt.logStep('Updated ~/.aw_registry/ symlink');
|
|
314
|
+
} catch (e) {
|
|
315
|
+
fmt.logWarn(`Could not update symlink ~/.aw_registry/: ${e.message}`);
|
|
316
|
+
}
|
|
305
317
|
}
|
|
306
318
|
|
|
307
319
|
// Create sync config
|
package/commands/nuke.mjs
CHANGED
|
@@ -54,7 +54,9 @@ function removeIdeSymlinks() {
|
|
|
54
54
|
const dir = join(base, ide, type);
|
|
55
55
|
if (!existsSync(dir)) continue;
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
let entries;
|
|
58
|
+
try { entries = readdirSync(dir); } catch { continue; }
|
|
59
|
+
for (const entry of entries) {
|
|
58
60
|
const p = join(dir, entry);
|
|
59
61
|
try {
|
|
60
62
|
const stat = lstatSync(p);
|
|
@@ -200,6 +202,10 @@ function removeIdeTasks() {
|
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
export async function nukeCommand(args) {
|
|
205
|
+
// Catch unhandled errors and surface them instead of letting clack show generic "Something went wrong"
|
|
206
|
+
process.on('uncaughtException', (e) => { fmt.cancel(`Unexpected error: ${e.message}`); });
|
|
207
|
+
process.on('unhandledRejection', (e) => { fmt.cancel(`Unexpected error: ${e?.message ?? e}`); });
|
|
208
|
+
|
|
203
209
|
fmt.intro('aw nuke');
|
|
204
210
|
|
|
205
211
|
// Remove stale local .aw_registry symlink if present (skip if cwd IS home — that's the global one)
|