(
plugin: string,
options: { scope?: string; cowork?: boolean },
)
| 738 | |
| 739 | // plugin enable (lines 5783–5818) |
| 740 | export async function pluginEnableHandler( |
| 741 | plugin: string, |
| 742 | options: { scope?: string; cowork?: boolean }, |
| 743 | ): Promise<void> { |
| 744 | if (options.cowork) setUseCoworkPlugins(true) |
| 745 | let scope: (typeof VALID_INSTALLABLE_SCOPES)[number] | undefined |
| 746 | if (options.scope) { |
| 747 | if ( |
| 748 | !VALID_INSTALLABLE_SCOPES.includes( |
| 749 | options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number], |
| 750 | ) |
| 751 | ) { |
| 752 | cliError( |
| 753 | `Invalid scope "${options.scope}". Valid scopes: ${VALID_INSTALLABLE_SCOPES.join(', ')}`, |
| 754 | ) |
| 755 | } |
| 756 | scope = options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number] |
| 757 | } |
| 758 | if (options.cowork && scope !== undefined && scope !== 'user') { |
| 759 | cliError('--cowork can only be used with user scope') |
| 760 | } |
| 761 | |
| 762 | // --cowork always operates at user scope |
| 763 | if (options.cowork && scope === undefined) { |
| 764 | scope = 'user' |
| 765 | } |
| 766 | |
| 767 | const { name, marketplace } = parsePluginIdentifier(plugin) |
| 768 | logEvent('tengu_plugin_enable_command', { |
| 769 | _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 770 | ...(marketplace && { |
| 771 | _PROTO_marketplace_name: |
| 772 | marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 773 | }), |
| 774 | scope: (scope ?? |
| 775 | 'auto') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 776 | }) |
| 777 | |
| 778 | await enablePlugin(plugin, scope) |
| 779 | } |
| 780 | |
| 781 | // plugin disable (lines 5833–5902) |
| 782 | export async function pluginDisableHandler( |
no test coverage detected