bmad-method 6.8.1-next.7 → 6.8.1-next.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "bmad-method",
4
- "version": "6.8.1-next.7",
4
+ "version": "6.8.1-next.8",
5
5
  "description": "Breakthrough Method of Agile AI-driven Development",
6
6
  "keywords": [
7
7
  "agile",
@@ -419,10 +419,35 @@ class Installer {
419
419
  const sourceDir = path.dirname(path.join(bmadDir, relativePath));
420
420
  if (await fs.pathExists(sourceDir)) {
421
421
  await fs.remove(sourceDir);
422
+ await this._removeEmptyParents(path.dirname(sourceDir), bmadDir);
422
423
  }
423
424
  }
424
425
  }
425
426
 
427
+ /**
428
+ * Remove now-empty parent directories left behind after skill dir cleanup.
429
+ * Walks up from dir, stopping at (and never removing) bmadDir. Best-effort:
430
+ * a directory that vanishes or fills in mid-walk just ends the walk.
431
+ * @param {string} dir - Directory to start walking up from
432
+ * @param {string} bmadDir - BMAD installation directory (boundary)
433
+ */
434
+ async _removeEmptyParents(dir, bmadDir) {
435
+ let current = dir;
436
+ while (true) {
437
+ // Path-boundary check (not a string prefix, so siblings like _bmad2 don't match).
438
+ const rel = path.relative(bmadDir, current);
439
+ if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) break;
440
+ try {
441
+ const entries = await fs.readdir(current);
442
+ if (entries.length > 0) break;
443
+ await fs.rmdir(current);
444
+ } catch {
445
+ break;
446
+ }
447
+ current = path.dirname(current);
448
+ }
449
+ }
450
+
426
451
  async _readSkillManifestRows(bmadDir) {
427
452
  const csvPath = path.join(bmadDir, '_config', 'skill-manifest.csv');
428
453
  if (!(await fs.pathExists(csvPath))) return [];