MCPcopy Create free account
hub / github.com/Noumena-Network/code / pluginEnableHandler

Function pluginEnableHandler

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

Source from the content-addressed store, hash-verified

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

Callers 1

runFunction · 0.85

Calls 5

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

Tested by

no test coverage detected