refacil-sdd-ai 5.0.10 → 5.1.0

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/lib/hooks.js CHANGED
@@ -332,8 +332,8 @@ function removeProjectLevelHooks(projectRoot) {
332
332
  if (fs.existsSync(claudeSettingsPath)) {
333
333
  try {
334
334
  const settings = JSON.parse(fs.readFileSync(claudeSettingsPath, 'utf8'));
335
+ let changed = false;
335
336
  if (settings && settings.hooks) {
336
- let changed = false;
337
337
  for (const event of Object.keys(settings.hooks)) {
338
338
  if (!Array.isArray(settings.hooks[event])) continue;
339
339
  const before = settings.hooks[event].length;
@@ -344,7 +344,16 @@ function removeProjectLevelHooks(projectRoot) {
344
344
  if (settings.hooks[event].length === 0) delete settings.hooks[event];
345
345
  }
346
346
  if (Object.keys(settings.hooks).length === 0) delete settings.hooks;
347
- if (changed) fs.writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 2) + '\n');
347
+ } else if (settings && Object.keys(settings).length === 0) {
348
+ // Already empty stub — treat as changed so it gets deleted below
349
+ changed = true;
350
+ }
351
+ if (changed) {
352
+ if (Object.keys(settings).length === 0) {
353
+ fs.unlinkSync(claudeSettingsPath);
354
+ } else {
355
+ fs.writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 2) + '\n');
356
+ }
348
357
  }
349
358
  } catch (_) {}
350
359
  }
@@ -386,6 +395,16 @@ function removeProjectLevelHooks(projectRoot) {
386
395
  }
387
396
  } catch (_) {}
388
397
  }
398
+
399
+ // Remove IDE root dirs if now empty (hooks cleanup may have been the last file)
400
+ for (const ideDir of ['.claude', '.cursor', '.opencode']) {
401
+ const idePath = path.join(projectRoot, ideDir);
402
+ try {
403
+ if (fs.existsSync(idePath) && fs.readdirSync(idePath).length === 0) {
404
+ fs.rmdirSync(idePath);
405
+ }
406
+ } catch (_) {}
407
+ }
389
408
  }
390
409
 
391
410
  // ── Fachada pública ──────────────────────────────────────────────────────────
package/lib/installer.js CHANGED
@@ -356,13 +356,15 @@ function removeProjectLevelArtifacts(projectRoot) {
356
356
  fs.rmdirSync(ocPluginsDir);
357
357
  }
358
358
  } catch (_) {}
359
- // Remove .opencode/ itself if now empty
360
- const ocDir = path.join(projectRoot, '.opencode');
361
- try {
362
- if (fs.existsSync(ocDir) && fs.readdirSync(ocDir).length === 0) {
363
- fs.rmdirSync(ocDir);
364
- }
365
- } catch (_) {}
359
+ // Remove IDE root dirs if now empty
360
+ for (const ideDir of ['.opencode', '.cursor', '.claude']) {
361
+ const idePath = path.join(projectRoot, ideDir);
362
+ try {
363
+ if (fs.existsSync(idePath) && fs.readdirSync(idePath).length === 0) {
364
+ fs.rmdirSync(idePath);
365
+ }
366
+ } catch (_) {}
367
+ }
366
368
 
367
369
  return removed;
368
370
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "refacil-sdd-ai",
3
- "version": "5.0.10",
3
+ "version": "5.1.0",
4
4
  "description": "SDD-AI: Specification-Driven Development with AI — development methodology using AI with Claude Code, Cursor and OpenCode",
5
5
  "bin": {
6
6
  "refacil-sdd-ai": "./bin/cli.js"