( plugin: string, scope: InstallableScope = 'user', keepData = false, )
| 150 | * @param scope Uninstall from scope: user, project, or local (defaults to 'user') |
| 151 | */ |
| 152 | export async function uninstallPlugin( |
| 153 | plugin: string, |
| 154 | scope: InstallableScope = 'user', |
| 155 | keepData = false, |
| 156 | ): Promise<void> { |
| 157 | try { |
| 158 | const result = await uninstallPluginOp(plugin, scope, !keepData) |
| 159 | |
| 160 | if (!result.success) { |
| 161 | throw new Error(result.message) |
| 162 | } |
| 163 | |
| 164 | // biome-ignore lint/suspicious/noConsole:: intentional console output |
| 165 | console.log(`${figures.tick} ${result.message}`) |
| 166 | |
| 167 | const { name, marketplace } = parsePluginIdentifier( |
| 168 | result.pluginId || plugin, |
| 169 | ) |
| 170 | logEvent('ncode_plugin_uninstalled_cli', { |
| 171 | _PROTO_plugin_name: |
| 172 | name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 173 | ...(marketplace && { |
| 174 | _PROTO_marketplace_name: |
| 175 | marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 176 | }), |
| 177 | scope: (result.scope || |
| 178 | scope) as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 179 | ...buildPluginTelemetryFields(name, marketplace, getManagedPluginNames()), |
| 180 | }) |
| 181 | |
| 182 | cliOk() |
| 183 | } catch (error) { |
| 184 | handlePluginCommandError(error, 'uninstall', plugin) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * CLI command: Enable a plugin non-interactively |
no test coverage detected