( agentName: SetupAgent, scope: Scope, skillNames: readonly string[] )
| 401 | } |
| 402 | |
| 403 | async function uninstallSkills( |
| 404 | agentName: SetupAgent, |
| 405 | scope: Scope, |
| 406 | skillNames: readonly string[] |
| 407 | ): Promise<SkillCleanupStatus[]> { |
| 408 | const agent = getAgent(agentName); |
| 409 | const skillsDir = |
| 410 | scope === "global" |
| 411 | ? agent.skill.dir("global") |
| 412 | : join(process.cwd(), agent.skill.dir("project")); |
| 413 | |
| 414 | const results: SkillCleanupStatus[] = []; |
| 415 | |
| 416 | for (const skillName of skillNames) { |
| 417 | const skillPath = join(skillsDir, skillName); |
| 418 | try { |
| 419 | await rm(skillPath, { recursive: true }); |
| 420 | results.push({ name: skillName, status: "removed", path: skillPath }); |
| 421 | } catch (err) { |
| 422 | const error = err as NodeJS.ErrnoException; |
| 423 | if (error.code === "ENOENT") { |
| 424 | results.push({ name: skillName, status: "not found", path: skillPath }); |
| 425 | } else { |
| 426 | results.push({ name: skillName, status: `failed: ${error.message}`, path: skillPath }); |
| 427 | } |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | return results; |
| 432 | } |
| 433 | |
| 434 | async function uninstallAgent( |
| 435 | agentName: SetupAgent, |
no test coverage detected