(
plugin: string | undefined,
options: { scope?: string; cowork?: boolean; all?: boolean },
)
| 776 | |
| 777 | // plugin disable (lines 5833–5902) |
| 778 | export async function pluginDisableHandler( |
| 779 | plugin: string | undefined, |
| 780 | options: { scope?: string; cowork?: boolean; all?: boolean }, |
| 781 | ): Promise<void> { |
| 782 | if (options.all && plugin) { |
| 783 | cliError('Cannot use --all with a specific plugin') |
| 784 | } |
| 785 | |
| 786 | if (!options.all && !plugin) { |
| 787 | cliError('Please specify a plugin name or use --all to disable all plugins') |
| 788 | } |
| 789 | |
| 790 | if (options.cowork) setUseCoworkPlugins(true) |
| 791 | |
| 792 | if (options.all) { |
| 793 | if (options.scope) { |
| 794 | cliError('Cannot use --scope with --all') |
| 795 | } |
| 796 | |
| 797 | // No _PROTO_plugin_name here — --all disables all plugins. |
| 798 | // Distinguishable from the specific-plugin branch by plugin_name IS NULL. |
| 799 | logEvent('ncode_plugin_disable_command', {}) |
| 800 | |
| 801 | await disableAllPlugins() |
| 802 | return |
| 803 | } |
| 804 | |
| 805 | let scope: (typeof VALID_INSTALLABLE_SCOPES)[number] | undefined |
| 806 | if (options.scope) { |
| 807 | if ( |
| 808 | !VALID_INSTALLABLE_SCOPES.includes( |
| 809 | options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number], |
| 810 | ) |
| 811 | ) { |
| 812 | cliError( |
| 813 | `Invalid scope "${options.scope}". Valid scopes: ${VALID_INSTALLABLE_SCOPES.join(', ')}`, |
| 814 | ) |
| 815 | } |
| 816 | scope = options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number] |
| 817 | } |
| 818 | if (options.cowork && scope !== undefined && scope !== 'user') { |
| 819 | cliError('--cowork can only be used with user scope') |
| 820 | } |
| 821 | |
| 822 | // --cowork always operates at user scope |
| 823 | if (options.cowork && scope === undefined) { |
| 824 | scope = 'user' |
| 825 | } |
| 826 | |
| 827 | const { name, marketplace } = parsePluginIdentifier(plugin!) |
| 828 | logEvent('ncode_plugin_disable_command', { |
| 829 | _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 830 | ...(marketplace && { |
| 831 | _PROTO_marketplace_name: |
| 832 | marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 833 | }), |
| 834 | scope: (scope ?? |
| 835 | 'auto') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
no test coverage detected