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

Function pluginUpdateHandler

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

Source from the content-addressed store, hash-verified

840
841// plugin update (lines 5918–5948)
842export async function pluginUpdateHandler(
843 plugin: string,
844 options: { scope?: string; cowork?: boolean },
845): Promise<void> {
846 if (options.cowork) setUseCoworkPlugins(true)
847 const { name, marketplace } = parsePluginIdentifier(plugin)
848 logEvent('ncode_plugin_update_command', {
849 _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
850 ...(marketplace && {
851 _PROTO_marketplace_name:
852 marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
853 }),
854 })
855
856 let scope: (typeof VALID_UPDATE_SCOPES)[number] = 'user'
857 if (options.scope) {
858 if (
859 !VALID_UPDATE_SCOPES.includes(
860 options.scope as (typeof VALID_UPDATE_SCOPES)[number],
861 )
862 ) {
863 cliError(
864 `Invalid scope "${options.scope}". Valid scopes: ${VALID_UPDATE_SCOPES.join(', ')}`,
865 )
866 }
867 scope = options.scope as (typeof VALID_UPDATE_SCOPES)[number]
868 }
869 if (options.cowork && scope !== 'user') {
870 cliError('--cowork can only be used with user scope')
871 }
872
873 await updatePluginCli(plugin, scope)
874}

Callers 1

runFunction · 0.85

Calls 5

setUseCoworkPluginsFunction · 0.85
parsePluginIdentifierFunction · 0.85
cliErrorFunction · 0.85
updatePluginCliFunction · 0.85
logEventFunction · 0.50

Tested by

no test coverage detected