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

Function pluginEnableHandler

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

Source from the content-addressed store, hash-verified

700
701// plugin enable (lines 5783–5818)
702export async function pluginEnableHandler(
703 plugin: string,
704 options: { scope?: string; cowork?: boolean },
705): Promise<void> {
706 if (options.cowork) setUseCoworkPlugins(true)
707 let scope: (typeof VALID_INSTALLABLE_SCOPES)[number] | undefined
708 if (options.scope) {
709 if (
710 !VALID_INSTALLABLE_SCOPES.includes(
711 options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number],
712 )
713 ) {
714 cliError(
715 `Invalid scope "${options.scope}". Valid scopes: ${VALID_INSTALLABLE_SCOPES.join(', ')}`,
716 )
717 }
718 scope = options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number]
719 }
720 if (options.cowork && scope !== undefined && scope !== 'user') {
721 cliError('--cowork can only be used with user scope')
722 }
723
724 // --cowork always operates at user scope
725 if (options.cowork && scope === undefined) {
726 scope = 'user'
727 }
728
729 const { name, marketplace } = parsePluginIdentifier(plugin)
730 logEvent('tengu_plugin_enable_command', {
731 _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
732 ...(marketplace && {
733 _PROTO_marketplace_name:
734 marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
735 }),
736 scope: (scope ??
737 'auto') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
738 })
739
740 await enablePlugin(plugin, scope)
741}
742
743// plugin disable (lines 5833–5902)
744export async function pluginDisableHandler(

Callers 1

runFunction · 0.85

Calls 5

setUseCoworkPluginsFunction · 0.85
cliErrorFunction · 0.85
parsePluginIdentifierFunction · 0.85
logEventFunction · 0.85
enablePluginFunction · 0.85

Tested by

no test coverage detected