* Removes skill directories for workflows when delivery changed to commands-only. * Returns the number of directories removed.
(skillsDir: string)
| 399 | * Returns the number of directories removed. |
| 400 | */ |
| 401 | private async removeSkillDirs(skillsDir: string): Promise<number> { |
| 402 | let removed = 0; |
| 403 | |
| 404 | for (const workflow of ALL_WORKFLOWS) { |
| 405 | const dirName = WORKFLOW_TO_SKILL_DIR[workflow]; |
| 406 | if (!dirName) continue; |
| 407 | |
| 408 | const skillDir = path.join(skillsDir, dirName); |
| 409 | try { |
| 410 | if (fs.existsSync(skillDir)) { |
| 411 | await fs.promises.rm(skillDir, { recursive: true, force: true }); |
| 412 | removed++; |
| 413 | } |
| 414 | } catch { |
| 415 | // Ignore errors |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | return removed; |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * Removes skill directories for workflows that are no longer selected in the active profile. |