* Delete a skill * @param name - Skill name to delete * @param source - Where the skill is located * @param mode - Optional mode (to locate in skills-{mode}/ directory)
(name: string, source: "global" | "project", mode?: string)
| 430 | * @param mode - Optional mode (to locate in skills-{mode}/ directory) |
| 431 | */ |
| 432 | async deleteSkill(name: string, source: "global" | "project", mode?: string): Promise<void> { |
| 433 | // Find the skill |
| 434 | const skill = this.getSkill(name, source, mode) |
| 435 | if (!skill) { |
| 436 | const modeInfo = mode ? ` (mode: ${mode})` : "" |
| 437 | throw new Error(t("skills:errors.not_found", { name, source, modeInfo })) |
| 438 | } |
| 439 | |
| 440 | // Get the skill directory (parent of SKILL.md) |
| 441 | const skillDir = path.dirname(skill.path) |
| 442 | |
| 443 | // Delete the entire skill directory |
| 444 | await fs.rm(skillDir, { recursive: true, force: true }) |
| 445 | |
| 446 | // Refresh skills list |
| 447 | await this.discoverSkills() |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * Move a skill to a different mode |
no test coverage detected