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

Function pluginDisableHandler

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

Source from the content-addressed store, hash-verified

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