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

Function updatePluginCli

src/services/plugins/pluginCliCommands.ts:295–339  ·  view source on GitHub ↗
(
  plugin: string,
  scope: PluginScope,
)

Source from the content-addressed store, hash-verified

293 * @param scope Scope to update
294 */
295export async function updatePluginCli(
296 plugin: string,
297 scope: PluginScope,
298): Promise<void> {
299 try {
300 writeToStdout(
301 `Checking for updates for plugin "${plugin}" at ${scope} scope…\n`,
302 )
303
304 const result = await updatePluginOp(plugin, scope)
305
306 if (!result.success) {
307 throw new Error(result.message)
308 }
309
310 writeToStdout(`${figures.tick} ${result.message}\n`)
311
312 if (!result.alreadyUpToDate) {
313 const { name, marketplace } = parsePluginIdentifier(
314 result.pluginId || plugin,
315 )
316 logEvent('ncode_plugin_updated_cli', {
317 _PROTO_plugin_name:
318 name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
319 ...(marketplace && {
320 _PROTO_marketplace_name:
321 marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
322 }),
323 old_version: (result.oldVersion ||
324 'unknown') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
325 new_version: (result.newVersion ||
326 'unknown') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
327 ...buildPluginTelemetryFields(
328 name,
329 marketplace,
330 getManagedPluginNames(),
331 ),
332 })
333 }
334
335 await gracefulShutdown(0)
336 } catch (error) {
337 handlePluginCommandError(error, 'update', plugin)
338 }
339}

Callers 1

pluginUpdateHandlerFunction · 0.85

Calls 8

writeToStdoutFunction · 0.85
updatePluginOpFunction · 0.85
parsePluginIdentifierFunction · 0.85
getManagedPluginNamesFunction · 0.85
gracefulShutdownFunction · 0.85
handlePluginCommandErrorFunction · 0.85
logEventFunction · 0.50

Tested by

no test coverage detected