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