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