summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/App.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/App.tsx')
-rw-r--r--packages/cli/src/ui/App.tsx45
1 files changed, 43 insertions, 2 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx
index f2dcc79e..2be681e5 100644
--- a/packages/cli/src/ui/App.tsx
+++ b/packages/cli/src/ui/App.tsx
@@ -39,7 +39,7 @@ import { EditorSettingsDialog } from './components/EditorSettingsDialog.js';
import { ShellConfirmationDialog } from './components/ShellConfirmationDialog.js';
import { Colors } from './colors.js';
import { loadHierarchicalGeminiMemory } from '../config/config.js';
-import { LoadedSettings } from '../config/settings.js';
+import { LoadedSettings, SettingScope } from '../config/settings.js';
import { Tips } from './components/Tips.js';
import { ConsolePatcher } from './utils/ConsolePatcher.js';
import { registerCleanup } from '../utils/cleanup.js';
@@ -62,6 +62,10 @@ import {
type IdeContext,
ideContext,
} from '@google/gemini-cli-core';
+import {
+ IdeIntegrationNudge,
+ IdeIntegrationNudgeResult,
+} from './IdeIntegrationNudge.js';
import { validateAuthMethod } from '../config/auth.js';
import { useLogger } from './hooks/useLogger.js';
import { StreamingContext } from './contexts/StreamingContext.js';
@@ -115,6 +119,15 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
const nightly = version.includes('nightly');
const { history, addItem, clearItems, loadHistory } = useHistory();
+ const [idePromptAnswered, setIdePromptAnswered] = useState(false);
+ const currentIDE = config.getIdeClient().getCurrentIde();
+ const shouldShowIdePrompt =
+ config.getIdeModeFeature() &&
+ currentIDE &&
+ !config.getIdeMode() &&
+ !settings.merged.hasSeenIdeIntegrationNudge &&
+ !idePromptAnswered;
+
useEffect(() => {
const cleanup = setUpdateHandler(addItem, setUpdateInfo);
return cleanup;
@@ -538,6 +551,27 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
[submitQuery],
);
+ const handleIdePromptComplete = useCallback(
+ (result: IdeIntegrationNudgeResult) => {
+ if (result === 'yes') {
+ handleSlashCommand('/ide install');
+ settings.setValue(
+ SettingScope.User,
+ 'hasSeenIdeIntegrationNudge',
+ true,
+ );
+ } else if (result === 'dismiss') {
+ settings.setValue(
+ SettingScope.User,
+ 'hasSeenIdeIntegrationNudge',
+ true,
+ );
+ }
+ setIdePromptAnswered(true);
+ },
+ [handleSlashCommand, settings],
+ );
+
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
const pendingHistoryItems = [...pendingSlashCommandHistoryItems];
pendingHistoryItems.push(...pendingGeminiHistoryItems);
@@ -768,6 +802,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
</Box>
);
}
+
const mainAreaWidth = Math.floor(terminalWidth * 0.9);
const debugConsoleMaxHeight = Math.floor(Math.max(terminalHeight * 0.2, 5));
// Arbitrary threshold to ensure that items in the static area are large
@@ -859,7 +894,13 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
</Box>
)}
- {shellConfirmationRequest ? (
+ {shouldShowIdePrompt ? (
+ <IdeIntegrationNudge
+ question="Do you want to connect your VS Code editor to Gemini CLI?"
+ description="If you select Yes, we'll install an extension that allows the CLI to access your open files and display diffs directly in VS Code."
+ onComplete={handleIdePromptComplete}
+ />
+ ) : shellConfirmationRequest ? (
<ShellConfirmationDialog request={shellConfirmationRequest} />
) : isThemeDialogOpen ? (
<Box flexDirection="column">