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