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