diff --git a/packages/cli/src/ui/AppContainer.test.tsx b/packages/cli/src/ui/AppContainer.test.tsx index b0e4be44e39..7b358c1ab46 100644 --- a/packages/cli/src/ui/AppContainer.test.tsx +++ b/packages/cli/src/ui/AppContainer.test.tsx @@ -39,6 +39,8 @@ const mockCoreEvents = vi.hoisted(() => ({ off: vi.fn(), drainBacklogs: vi.fn(), emit: vi.fn(), + emitFeedback: vi.fn(), + emitSettingsChanged: vi.fn(), })); // Mock IdeClient @@ -3707,4 +3709,49 @@ describe('AppContainer State Management', () => { unmount(); }); }); + + describe('IDE Companion Integration Nudge', () => { + let mockHandleSlashCommand: Mock; + + beforeEach(() => { + mockHandleSlashCommand = vi.fn(); + mockedUseSlashCommandProcessor.mockReturnValue({ + handleSlashCommand: mockHandleSlashCommand, + slashCommands: [], + pendingHistoryItems: [], + commandContext: {}, + shellConfirmationRequest: null, + confirmationRequest: null, + }); + }); + + it('executes "/ide enable" when companion extension is pre-installed', async () => { + const { unmount } = await act(async () => renderAppContainer()); + + act(() => { + capturedUIActions.handleIdePromptComplete({ + userSelection: 'yes', + isExtensionPreInstalled: true, + }); + }); + + expect(mockHandleSlashCommand).toHaveBeenCalledWith('/ide enable'); + unmount(); + }); + + it('executes "/ide install" when companion extension is not pre-installed', async () => { + const { unmount } = await act(async () => renderAppContainer()); + + act(() => { + capturedUIActions.handleIdePromptComplete({ + userSelection: 'yes', + isExtensionPreInstalled: false, + }); + }); + + expect(mockHandleSlashCommand).toHaveBeenCalledWith('/ide install'); + unmount(); + }); + }); }); + diff --git a/packages/cli/src/ui/AppContainer.tsx b/packages/cli/src/ui/AppContainer.tsx index e11282788bc..c7d25ed2c33 100644 --- a/packages/cli/src/ui/AppContainer.tsx +++ b/packages/cli/src/ui/AppContainer.tsx @@ -1773,8 +1773,11 @@ Logging in with Google... Restarting Gemini CLI to continue. const handleIdePromptComplete = useCallback( (result: IdeIntegrationNudgeResult) => { if (result.userSelection === 'yes') { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - handleSlashCommand('/ide install'); + if (result.isExtensionPreInstalled) { + void handleSlashCommand('/ide enable'); + } else { + void handleSlashCommand('/ide install'); + } settings.setValue(SettingScope.User, 'ide.hasSeenNudge', true); } else if (result.userSelection === 'dismiss') { settings.setValue(SettingScope.User, 'ide.hasSeenNudge', true);