MCPcopy
hub / github.com/upstash/context7 / removeCommand

Function removeCommand

packages/cli/src/commands/skill.ts:751–781  ·  view source on GitHub ↗
(name: string, options: RemoveOptions)

Source from the content-addressed store, hash-verified

749}
750
751async function removeCommand(name: string, options: RemoveOptions): Promise<void> {
752 trackEvent("command", { name: "remove" });
753 const target = await promptForSingleTarget(options);
754 if (!target) {
755 log.warn("Cancelled");
756 return;
757 }
758
759 const skillsDir = getTargetDirFromSelection(target.ide, target.scope);
760 let skillPath: string;
761 try {
762 skillPath = assertSkillNameInRoot(skillsDir, name);
763 } catch {
764 log.error(`Invalid skill name: ${name}`);
765 return;
766 }
767
768 try {
769 await rm(skillPath, { recursive: true });
770 log.success(`Removed skill: ${name}`);
771 } catch (err) {
772 const error = err as NodeJS.ErrnoException;
773 if (error.code === "ENOENT") {
774 log.error(`Skill not found: ${name}`);
775 } else if (error.code === "EACCES" || error.code === "EPERM") {
776 log.error(`Permission denied. Try: sudo rm -rf "${skillPath}"`);
777 } else {
778 log.error(`Failed to remove skill: ${error.message}`);
779 }
780 }
781}
782
783async function infoCommand(input: string): Promise<void> {
784 trackEvent("command", { name: "info" });

Callers 1

registerSkillCommandsFunction · 0.70

Calls 4

trackEventFunction · 0.85
promptForSingleTargetFunction · 0.85
assertSkillNameInRootFunction · 0.85

Tested by

no test coverage detected