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

Function checkServerInstallation

src/cm/lsp/serverLauncher.ts:606–658  ·  view source on GitHub ↗
(
  server: LspServerDefinition,
)

Source from the content-addressed store, hash-verified

604}
605
606export async function checkServerInstallation(
607 server: LspServerDefinition,
608): Promise<InstallCheckResult> {
609 const bundle = getServerBundle(server.id);
610 if (bundle?.checkInstallation) {
611 try {
612 const result = await bundle.checkInstallation(server.id, server);
613 if (result) return result;
614 } catch (error) {
615 return {
616 status: "failed",
617 version: null,
618 canInstall: Boolean(getInstallCommand(server, "install")),
619 canUpdate: Boolean(getInstallCommand(server, "update")),
620 message: error instanceof Error ? error.message : String(error),
621 };
622 }
623 }
624
625 const launcher = server.launcher;
626 const installCommand = getInstallCommand(server, "install");
627 const updateCommand = getInstallCommand(server, "update");
628 const checkCommand =
629 launcher?.checkCommand || buildDerivedCheckCommand(server);
630
631 if (!checkCommand) {
632 return {
633 status: "unknown",
634 version: await readServerVersion(server),
635 canInstall: Boolean(installCommand),
636 canUpdate: Boolean(updateCommand),
637 message: "No install check configured for this server.",
638 };
639 }
640
641 try {
642 await runQuickCommand(checkCommand);
643 return {
644 status: "present",
645 version: await readServerVersion(server),
646 canInstall: Boolean(installCommand),
647 canUpdate: Boolean(updateCommand),
648 };
649 } catch (error) {
650 return {
651 status: installCommand ? "missing" : "failed",
652 version: null,
653 canInstall: Boolean(installCommand),
654 canUpdate: Boolean(updateCommand),
655 message: error instanceof Error ? error.message : String(error),
656 };
657 }
658}
659
660export function resetInstallState(serverId?: string): void {
661 if (!serverId) {

Callers 2

checkInstallationFunction · 0.90
installServerFunction · 0.85

Calls 6

getServerBundleFunction · 0.90
runQuickCommandFunction · 0.90
StringInterface · 0.85
buildDerivedCheckCommandFunction · 0.85
readServerVersionFunction · 0.85
getInstallCommandFunction · 0.70

Tested by

no test coverage detected