(
plugin: string,
options: { scope?: string; cowork?: boolean },
)
| 806 | |
| 807 | // plugin update (lines 5918–5948) |
| 808 | export async function pluginUpdateHandler( |
| 809 | plugin: string, |
| 810 | options: { scope?: string; cowork?: boolean }, |
| 811 | ): Promise<void> { |
| 812 | if (options.cowork) setUseCoworkPlugins(true) |
| 813 | const { name, marketplace } = parsePluginIdentifier(plugin) |
| 814 | logEvent('tengu_plugin_update_command', { |
| 815 | _PROTO_plugin_name: name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 816 | ...(marketplace && { |
| 817 | _PROTO_marketplace_name: |
| 818 | marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 819 | }), |
| 820 | }) |
| 821 | |
| 822 | let scope: (typeof VALID_UPDATE_SCOPES)[number] = 'user' |
| 823 | if (options.scope) { |
| 824 | if ( |
| 825 | !VALID_UPDATE_SCOPES.includes( |
| 826 | options.scope as (typeof VALID_UPDATE_SCOPES)[number], |
| 827 | ) |
| 828 | ) { |
| 829 | cliError( |
| 830 | `Invalid scope "${options.scope}". Valid scopes: ${VALID_UPDATE_SCOPES.join(', ')}`, |
| 831 | ) |
| 832 | } |
| 833 | scope = options.scope as (typeof VALID_UPDATE_SCOPES)[number] |
| 834 | } |
| 835 | if (options.cowork && scope !== 'user') { |
| 836 | cliError('--cowork can only be used with user scope') |
| 837 | } |
| 838 | |
| 839 | await updatePluginCli(plugin, scope) |
| 840 | } |
no test coverage detected