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

Function pluginInstallHandler

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

Source from the content-addressed store, hash-verified

668
669// plugin install (lines 5690–5721)
670export async function pluginInstallHandler(
671 plugin: string,
672 options: { scope?: string; cowork?: boolean },
673): Promise<void> {
674 if (options.cowork) setUseCoworkPlugins(true)
675 const scope = options.scope || 'user'
676 if (options.cowork && scope !== 'user') {
677 cliError('--cowork can only be used with user scope')
678 }
679 if (
680 !VALID_INSTALLABLE_SCOPES.includes(
681 scope as (typeof VALID_INSTALLABLE_SCOPES)[number],
682 )
683 ) {
684 cliError(
685 `Invalid scope: ${scope}. Must be one of: ${VALID_INSTALLABLE_SCOPES.join(', ')}.`,
686 )
687 }
688 // _PROTO_* routes to PII-tagged plugin_name/marketplace_name BQ columns.
689 // Unredacted plugin arg was previously logged to general-access
690 // additional_metadata for all users — dropped in favor of the privileged
691 // column route. marketplace may be undefined (fires before resolution).
692 const { name, marketplace } = parsePluginIdentifier(plugin)
693 logEvent('tengu_plugin_install_command', {
694 _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
695 ...(marketplace && {
696 _PROTO_marketplace_name:
697 marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
698 }),
699 scope: scope as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
700 })
701
702 await installPlugin(plugin, scope as 'user' | 'project' | 'local')
703}
704
705// plugin uninstall (lines 5738–5769)
706export async function pluginUninstallHandler(

Callers 1

runFunction · 0.85

Calls 5

setUseCoworkPluginsFunction · 0.85
cliErrorFunction · 0.85
parsePluginIdentifierFunction · 0.85
logEventFunction · 0.85
installPluginFunction · 0.85

Tested by

no test coverage detected