(
plugin: string,
options: { scope?: string; cowork?: boolean },
)
| 840 | |
| 841 | // plugin update (lines 5918–5948) |
| 842 | export 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 | } |
no test coverage detected