MCPcopy Create free account
hub / github.com/freecodexyz/free-code / removeInstalledPlugin

Function removeInstalledPlugin

src/utils/plugins/installedPluginsManager.ts:924–952  ·  view source on GitHub ↗
(
  pluginId: string,
)

Source from the content-addressed store, hash-verified

922 * @returns The removed plugin metadata, or undefined if it wasn't installed
923 */
924export function removeInstalledPlugin(
925 pluginId: string,
926): InstalledPlugin | undefined {
927 const v2Data = loadInstalledPluginsFromDisk()
928 const installations = v2Data.plugins[pluginId]
929
930 if (!installations || installations.length === 0) {
931 return undefined
932 }
933
934 // Extract V1-compatible metadata from first installation for return value
935 const firstInstall = installations[0]
936 const metadata: InstalledPlugin | undefined = firstInstall
937 ? {
938 version: firstInstall.version || 'unknown',
939 installedAt: firstInstall.installedAt || new Date().toISOString(),
940 lastUpdated: firstInstall.lastUpdated,
941 installPath: firstInstall.installPath,
942 gitCommitSha: firstInstall.gitCommitSha,
943 }
944 : undefined
945
946 delete v2Data.plugins[pluginId]
947 saveInstalledPluginsV2(v2Data)
948
949 logForDebugging(`Removed installed plugin: ${pluginId}`)
950
951 return metadata
952}
953
954/**
955 * Delete a plugin's cache directory

Callers

nothing calls this directly

Calls 3

saveInstalledPluginsV2Function · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected