( plugin: string, scope?: InstallableScope, )
| 193 | * @param scope Optional scope. If not provided, finds the most specific scope for the current project. |
| 194 | */ |
| 195 | export async function enablePlugin( |
| 196 | plugin: string, |
| 197 | scope?: InstallableScope, |
| 198 | ): Promise<void> { |
| 199 | try { |
| 200 | const result = await enablePluginOp(plugin, scope) |
| 201 | |
| 202 | if (!result.success) { |
| 203 | throw new Error(result.message) |
| 204 | } |
| 205 | |
| 206 | // biome-ignore lint/suspicious/noConsole:: intentional console output |
| 207 | console.log(`${figures.tick} ${result.message}`) |
| 208 | |
| 209 | const { name, marketplace } = parsePluginIdentifier( |
| 210 | result.pluginId || plugin, |
| 211 | ) |
| 212 | logEvent('tengu_plugin_enabled_cli', { |
| 213 | _PROTO_plugin_name: |
| 214 | name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 215 | ...(marketplace && { |
| 216 | _PROTO_marketplace_name: |
| 217 | marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 218 | }), |
| 219 | scope: |
| 220 | result.scope as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 221 | ...buildPluginTelemetryFields(name, marketplace, getManagedPluginNames()), |
| 222 | }) |
| 223 | |
| 224 | // eslint-disable-next-line custom-rules/no-process-exit |
| 225 | process.exit(0) |
| 226 | } catch (error) { |
| 227 | handlePluginCommandError(error, 'enable', plugin) |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * CLI command: Disable a plugin non-interactively |
no test coverage detected