(
plugin: string,
options: { scope?: string; cowork?: boolean },
)
| 700 | |
| 701 | // plugin enable (lines 5783–5818) |
| 702 | export async function pluginEnableHandler( |
| 703 | plugin: string, |
| 704 | options: { scope?: string; cowork?: boolean }, |
| 705 | ): Promise<void> { |
| 706 | if (options.cowork) setUseCoworkPlugins(true) |
| 707 | let scope: (typeof VALID_INSTALLABLE_SCOPES)[number] | undefined |
| 708 | if (options.scope) { |
| 709 | if ( |
| 710 | !VALID_INSTALLABLE_SCOPES.includes( |
| 711 | options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number], |
| 712 | ) |
| 713 | ) { |
| 714 | cliError( |
| 715 | `Invalid scope "${options.scope}". Valid scopes: ${VALID_INSTALLABLE_SCOPES.join(', ')}`, |
| 716 | ) |
| 717 | } |
| 718 | scope = options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number] |
| 719 | } |
| 720 | if (options.cowork && scope !== undefined && scope !== 'user') { |
| 721 | cliError('--cowork can only be used with user scope') |
| 722 | } |
| 723 | |
| 724 | // --cowork always operates at user scope |
| 725 | if (options.cowork && scope === undefined) { |
| 726 | scope = 'user' |
| 727 | } |
| 728 | |
| 729 | const { name, marketplace } = parsePluginIdentifier(plugin) |
| 730 | logEvent('tengu_plugin_enable_command', { |
| 731 | _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 732 | ...(marketplace && { |
| 733 | _PROTO_marketplace_name: |
| 734 | marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 735 | }), |
| 736 | scope: (scope ?? |
| 737 | 'auto') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 738 | }) |
| 739 | |
| 740 | await enablePlugin(plugin, scope) |
| 741 | } |
| 742 | |
| 743 | // plugin disable (lines 5833–5902) |
| 744 | export async function pluginDisableHandler( |
no test coverage detected