( plugin: string, scope?: InstallableScope, )
| 234 | * @param scope Optional scope. If not provided, finds the most specific scope for the current project. |
| 235 | */ |
| 236 | export async function disablePlugin( |
| 237 | plugin: string, |
| 238 | scope?: InstallableScope, |
| 239 | ): Promise<void> { |
| 240 | try { |
| 241 | const result = await disablePluginOp(plugin, scope) |
| 242 | |
| 243 | if (!result.success) { |
| 244 | throw new Error(result.message) |
| 245 | } |
| 246 | |
| 247 | // biome-ignore lint/suspicious/noConsole:: intentional console output |
| 248 | console.log(`${figures.tick} ${result.message}`) |
| 249 | |
| 250 | const { name, marketplace } = parsePluginIdentifier( |
| 251 | result.pluginId || plugin, |
| 252 | ) |
| 253 | logEvent('tengu_plugin_disabled_cli', { |
| 254 | _PROTO_plugin_name: |
| 255 | name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 256 | ...(marketplace && { |
| 257 | _PROTO_marketplace_name: |
| 258 | marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 259 | }), |
| 260 | scope: |
| 261 | result.scope as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 262 | ...buildPluginTelemetryFields(name, marketplace, getManagedPluginNames()), |
| 263 | }) |
| 264 | |
| 265 | // eslint-disable-next-line custom-rules/no-process-exit |
| 266 | process.exit(0) |
| 267 | } catch (error) { |
| 268 | handlePluginCommandError(error, 'disable', plugin) |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * CLI command: Disable all enabled plugins non-interactively |
no test coverage detected