MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / pluginDisableHandler

Function pluginDisableHandler

src/cli/handlers/plugins.ts:744–805  ·  view source on GitHub ↗
(
  plugin: string | undefined,
  options: { scope?: string; cowork?: boolean; all?: boolean },
)

Source from the content-addressed store, hash-verified

742
743// plugin disable (lines 5833–5902)
744export async function pluginDisableHandler(
745 plugin: string | undefined,
746 options: { scope?: string; cowork?: boolean; all?: boolean },
747): Promise<void> {
748 if (options.all && plugin) {
749 cliError('Cannot use --all with a specific plugin')
750 }
751
752 if (!options.all && !plugin) {
753 cliError('Please specify a plugin name or use --all to disable all plugins')
754 }
755
756 if (options.cowork) setUseCoworkPlugins(true)
757
758 if (options.all) {
759 if (options.scope) {
760 cliError('Cannot use --scope with --all')
761 }
762
763 // No _PROTO_plugin_name here — --all disables all plugins.
764 // Distinguishable from the specific-plugin branch by plugin_name IS NULL.
765 logEvent('tengu_plugin_disable_command', {})
766
767 await disableAllPlugins()
768 return
769 }
770
771 let scope: (typeof VALID_INSTALLABLE_SCOPES)[number] | undefined
772 if (options.scope) {
773 if (
774 !VALID_INSTALLABLE_SCOPES.includes(
775 options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number],
776 )
777 ) {
778 cliError(
779 `Invalid scope "${options.scope}". Valid scopes: ${VALID_INSTALLABLE_SCOPES.join(', ')}`,
780 )
781 }
782 scope = options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number]
783 }
784 if (options.cowork && scope !== undefined && scope !== 'user') {
785 cliError('--cowork can only be used with user scope')
786 }
787
788 // --cowork always operates at user scope
789 if (options.cowork && scope === undefined) {
790 scope = 'user'
791 }
792
793 const { name, marketplace } = parsePluginIdentifier(plugin!)
794 logEvent('tengu_plugin_disable_command', {
795 _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
796 ...(marketplace && {
797 _PROTO_marketplace_name:
798 marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
799 }),
800 scope: (scope ??
801 'auto') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,

Callers 1

runFunction · 0.85

Calls 6

cliErrorFunction · 0.85
setUseCoworkPluginsFunction · 0.85
logEventFunction · 0.85
disableAllPluginsFunction · 0.85
parsePluginIdentifierFunction · 0.85
disablePluginFunction · 0.85

Tested by

no test coverage detected