Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions packages/cli/src/ui/AppContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
});
});
});

7 changes: 5 additions & 2 deletions packages/cli/src/ui/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading