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