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