MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / buildUninstallCommand

Function buildUninstallCommand

src/cm/lsp/serverLauncher.ts:439–478  ·  view source on GitHub ↗
(server: LspServerDefinition)

Source from the content-addressed store, hash-verified

437}
438
439function buildUninstallCommand(server: LspServerDefinition): string | null {
440 const spec = normalizeInstallSpec(server);
441 if (!spec) return null;
442
443 if (spec.uninstallCommand) {
444 return spec.uninstallCommand;
445 }
446 if (server.launcher?.uninstallCommand) {
447 return server.launcher.uninstallCommand;
448 }
449
450 switch (spec.kind) {
451 case "apk":
452 return spec.packages.length
453 ? `apk del ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`
454 : null;
455 case "npm": {
456 if (!spec.packages.length) return null;
457 const npmCommand = spec.npmCommand || "npm";
458 const uninstallFlags =
459 spec.global !== false ? "uninstall -g" : "uninstall";
460 return `${npmCommand} ${uninstallFlags} ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`;
461 }
462 case "pip":
463 return spec.packages.length
464 ? `${spec.pipCommand || "pip"} uninstall -y ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`
465 : null;
466 case "cargo":
467 return spec.packages.length
468 ? spec.packages
469 .map((entry) => `cargo uninstall ${quoteArg(entry)}`)
470 .join(" && ")
471 : null;
472 case "github-release":
473 case "manual":
474 return spec.binaryPath ? `rm -f ${quoteArg(spec.binaryPath)}` : null;
475 default:
476 return null;
477 }
478}
479
480function buildInstallCommand(
481 server: LspServerDefinition,

Callers 1

getUninstallCommandFunction · 0.85

Calls 2

quoteArgFunction · 0.90
normalizeInstallSpecFunction · 0.85

Tested by

no test coverage detected