MCPcopy
hub / github.com/claude-code-best/claude-code / installPlugin

Function installPlugin

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

Source from the content-addressed store, hash-verified

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