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

Function pluginInstallHandler

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

Source from the content-addressed store, hash-verified

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