MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / removeSkill

Function removeSkill

src/skill-manager.ts:382–416  ·  view source on GitHub ↗
(workDir: string, skillName: string)

Source from the content-addressed store, hash-verified

380}
381
382export function removeSkill(workDir: string, skillName: string): boolean {
383 const config = loadConfig(workDir);
384 const normalizedName = normalizeName(skillName);
385 const nextSkills = config.skills.filter(
386 (skill) => normalizeName(skill.name) !== normalizedName,
387 );
388
389 if (nextSkills.length === config.skills.length) {
390 console.log(chalk.yellow(`Skill not found: ${skillName}`));
391 return false;
392 }
393
394 config.skills = nextSkills;
395 saveConfig(workDir, config);
396
397 const installedMatches = scanInstalledSkills(workDir).filter(
398 (skill) => normalizeName(skill.name) === normalizedName,
399 );
400
401 if (installedMatches.length === 0) {
402 console.log(
403 chalk.yellow(`Removed config for ${skillName}, but no installed files were found`),
404 );
405 return true;
406 }
407
408 for (const skill of installedMatches) {
409 if (fs.existsSync(skill.dir)) {
410 fs.rmSync(skill.dir, { recursive: true, force: true });
411 }
412 }
413
414 console.log(chalk.green(`Removed skill: ${skillName}`));
415 return true;
416}

Callers

nothing calls this directly

Calls 4

loadConfigFunction · 0.90
normalizeNameFunction · 0.85
saveConfigFunction · 0.85
scanInstalledSkillsFunction · 0.85

Tested by

no test coverage detected