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

Function pluginEnableHandler

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

Source from the content-addressed store, hash-verified

738
739// plugin enable (lines 5783–5818)
740export async function pluginEnableHandler(
741 plugin: string,
742 options: { scope?: string; cowork?: boolean },
743): Promise<void> {
744 if (options.cowork) setUseCoworkPlugins(true)
745 let scope: (typeof VALID_INSTALLABLE_SCOPES)[number] | undefined
746 if (options.scope) {
747 if (
748 !VALID_INSTALLABLE_SCOPES.includes(
749 options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number],
750 )
751 ) {
752 cliError(
753 `Invalid scope "${options.scope}". Valid scopes: ${VALID_INSTALLABLE_SCOPES.join(', ')}`,
754 )
755 }
756 scope = options.scope as (typeof VALID_INSTALLABLE_SCOPES)[number]
757 }
758 if (options.cowork && scope !== undefined && scope !== 'user') {
759 cliError('--cowork can only be used with user scope')
760 }
761
762 // --cowork always operates at user scope
763 if (options.cowork && scope === undefined) {
764 scope = 'user'
765 }
766
767 const { name, marketplace } = parsePluginIdentifier(plugin)
768 logEvent('tengu_plugin_enable_command', {
769 _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
770 ...(marketplace && {
771 _PROTO_marketplace_name:
772 marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
773 }),
774 scope: (scope ??
775 'auto') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
776 })
777
778 await enablePlugin(plugin, scope)
779}
780
781// plugin disable (lines 5833–5902)
782export 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