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