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