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

Function installPlugin

src/services/plugins/pluginCliCommands.ts:103–146  ·  view source on GitHub ↗
(
  plugin: string,
  scope: InstallableScope = 'user',
)

Source from the content-addressed store, hash-verified

101 * @param scope Installation scope: user, project, or local (defaults to 'user')
102 */
103export async function installPlugin(
104 plugin: string,
105 scope: InstallableScope = 'user',
106): Promise<void> {
107 try {
108 // biome-ignore lint/suspicious/noConsole:: intentional console output
109 console.log(`Installing plugin "${plugin}"...`)
110
111 const result = await installPluginOp(plugin, scope)
112
113 if (!result.success) {
114 throw new Error(result.message)
115 }
116
117 // biome-ignore lint/suspicious/noConsole:: intentional console output
118 console.log(`${figures.tick} ${result.message}`)
119
120 // _PROTO_* routes to PII-tagged plugin_name/marketplace_name BQ columns.
121 // Unredacted plugin_id was previously logged to general-access
122 // additional_metadata for all users — dropped in favor of the privileged
123 // column route.
124 const { name, marketplace } = parsePluginIdentifier(
125 result.pluginId || plugin,
126 )
127 logEvent('tengu_plugin_installed_cli', {
128 _PROTO_plugin_name:
129 name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
130 ...(marketplace && {
131 _PROTO_marketplace_name:
132 marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
133 }),
134 scope: (result.scope ||
135 scope) as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
136 install_source:
137 'cli-explicit' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
138 ...buildPluginTelemetryFields(name, marketplace, getManagedPluginNames()),
139 })
140
141 // eslint-disable-next-line custom-rules/no-process-exit
142 process.exit(0)
143 } catch (error) {
144 handlePluginCommandError(error, 'install', plugin)
145 }
146}
147
148/**
149 * CLI command: Uninstall a plugin non-interactively

Callers 1

pluginInstallHandlerFunction · 0.85

Calls 6

installPluginOpFunction · 0.85
parsePluginIdentifierFunction · 0.85
logEventFunction · 0.85
getManagedPluginNamesFunction · 0.85
handlePluginCommandErrorFunction · 0.85

Tested by

no test coverage detected