MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / pluginDisableHandler

Function pluginDisableHandler

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

Source from the content-addressed store, hash-verified

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