( pluginId: string, )
| 922 | * @returns The removed plugin metadata, or undefined if it wasn't installed |
| 923 | */ |
| 924 | export 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 |
nothing calls this directly
no test coverage detected