( ideType: IdeType, )
| 588 | } |
| 589 | |
| 590 | export async function maybeInstallIDEExtension( |
| 591 | ideType: IdeType, |
| 592 | ): Promise<IDEExtensionInstallationStatus | null> { |
| 593 | try { |
| 594 | // Install/update the extension |
| 595 | const installedVersion = await installIDEExtension(ideType) |
| 596 | // Only track successful installations |
| 597 | logEvent('tengu_ext_installed', {}) |
| 598 | |
| 599 | // Set diff tool config to auto if it has not been set already |
| 600 | const globalConfig = getGlobalConfig() |
| 601 | if (!globalConfig.diffTool) { |
| 602 | saveGlobalConfig(current => ({ ...current, diffTool: 'auto' })) |
| 603 | } |
| 604 | return { |
| 605 | installed: true, |
| 606 | error: null, |
| 607 | installedVersion, |
| 608 | ideType: ideType, |
| 609 | } |
| 610 | } catch (error) { |
| 611 | logEvent('tengu_ext_install_error', {}) |
| 612 | // Handle installation errors |
| 613 | const errorMessage = error instanceof Error ? error.message : String(error) |
| 614 | logError(error as Error) |
| 615 | return { |
| 616 | installed: false, |
| 617 | error: errorMessage, |
| 618 | installedVersion: null, |
| 619 | ideType: ideType, |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | let currentIDESearch: AbortController | null = null |
| 625 |
no test coverage detected