* Removes command files for workflows when delivery changed to skills-only. * Returns the number of files removed.
(
projectPath: string,
toolId: string,
)
| 454 | * Returns the number of files removed. |
| 455 | */ |
| 456 | private async removeCommandFiles( |
| 457 | projectPath: string, |
| 458 | toolId: string, |
| 459 | ): Promise<number> { |
| 460 | let removed = 0; |
| 461 | |
| 462 | const adapter = CommandAdapterRegistry.get(toolId); |
| 463 | if (!adapter) return 0; |
| 464 | |
| 465 | for (const workflow of ALL_WORKFLOWS) { |
| 466 | const cmdPath = adapter.getFilePath(workflow); |
| 467 | const fullPath = path.isAbsolute(cmdPath) ? cmdPath : path.join(projectPath, cmdPath); |
| 468 | |
| 469 | try { |
| 470 | if (fs.existsSync(fullPath)) { |
| 471 | await fs.promises.unlink(fullPath); |
| 472 | removed++; |
| 473 | } |
| 474 | } catch { |
| 475 | // Ignore errors |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | return removed; |
| 480 | } |
| 481 | |
| 482 | /** |
| 483 | * Removes command files for workflows that are no longer selected in the active profile. |
no test coverage detected