From 083e67426c382ce534bed4830bedbede94cfdca7 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Wed, 24 Dec 2025 05:26:02 -0500 Subject: [PATCH] feat(kiro): add UI toggle and auth hint for --no-incognito option - Add "Kiro: Use normal browser" toggle in config dashboard (Proxy section) - Add --no-incognito documentation to ccs --help output - Show hint after successful Kiro auth about saving AWS credentials --- src/cliproxy/auth/oauth-handler.ts | 12 +++- src/commands/help-command.ts | 1 + .../pages/settings/sections/proxy/index.tsx | 70 ++++++++++++++++++- 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/src/cliproxy/auth/oauth-handler.ts b/src/cliproxy/auth/oauth-handler.ts index 2d73e7d0..877c9e8f 100644 --- a/src/cliproxy/auth/oauth-handler.ts +++ b/src/cliproxy/auth/oauth-handler.ts @@ -202,7 +202,7 @@ export async function triggerOAuth( } // Execute OAuth process - return executeOAuthProcess({ + const account = await executeOAuthProcess({ provider, binaryPath, args, @@ -214,6 +214,16 @@ export async function triggerOAuth( isCLI, nickname, }); + + // Show hint for Kiro users about --no-incognito option (first-time auth only) + if (account && provider === 'kiro' && !noIncognito) { + console.log(''); + console.log(info('Tip: To save your AWS login credentials for future sessions:')); + console.log(' Use: ccs kiro --no-incognito'); + console.log(' Or enable "Kiro: Use normal browser" in: ccs config'); + } + + return account; } /** diff --git a/src/commands/help-command.ts b/src/commands/help-command.ts index 224230ae..984b1ed3 100644 --- a/src/commands/help-command.ts +++ b/src/commands/help-command.ts @@ -173,6 +173,7 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim(); ['ccs --config', 'Change model (agy, gemini)'], ['ccs --logout', 'Clear authentication'], ['ccs --headless', 'Headless auth (for SSH)'], + ['ccs kiro --no-incognito', 'Use normal browser (saves AWS login)'], ['ccs codex "explain code"', 'Use with prompt'], ] ); diff --git a/ui/src/pages/settings/sections/proxy/index.tsx b/ui/src/pages/settings/sections/proxy/index.tsx index 14a8b666..18b0737e 100644 --- a/ui/src/pages/settings/sections/proxy/index.tsx +++ b/ui/src/pages/settings/sections/proxy/index.tsx @@ -3,7 +3,7 @@ * Settings section for CLIProxyAPI configuration (local/remote) */ -import { useEffect } from 'react'; +import { useEffect, useState, useCallback } from 'react'; import { Button } from '@/components/ui/button'; import { Alert, AlertDescription } from '@/components/ui/alert'; import { ScrollArea } from '@/components/ui/scroll-area'; @@ -12,6 +12,7 @@ import { RefreshCw, CheckCircle2, AlertCircle, Laptop, Cloud } from 'lucide-reac import { useProxyConfig, useRawConfig } from '../../hooks'; import { LocalProxyCard } from './local-proxy-card'; import { RemoteProxyCard } from './remote-proxy-card'; +import { api } from '@/lib/api-client'; export default function ProxySection() { const { @@ -37,11 +38,54 @@ export default function ProxySection() { const { fetchRawConfig } = useRawConfig(); + // Kiro provider settings state + const [kiroNoIncognito, setKiroNoIncognito] = useState(false); + const [kiroSettingsLoading, setKiroSettingsLoading] = useState(true); + const [kiroSaving, setKiroSaving] = useState(false); + + // Fetch Kiro settings from unified config + const fetchKiroSettings = useCallback(async () => { + try { + setKiroSettingsLoading(true); + const unifiedConfig = await api.config.get(); + const cliproxyConfig = unifiedConfig.cliproxy as { kiro_no_incognito?: boolean } | undefined; + setKiroNoIncognito(cliproxyConfig?.kiro_no_incognito ?? false); + } catch { + // Config may not exist yet, use default + setKiroNoIncognito(false); + } finally { + setKiroSettingsLoading(false); + } + }, []); + + // Save Kiro no-incognito setting + const saveKiroNoIncognito = useCallback(async (enabled: boolean) => { + setKiroNoIncognito(enabled); // Optimistic update + setKiroSaving(true); + try { + const unifiedConfig = await api.config.get(); + const existingCliproxy = (unifiedConfig.cliproxy ?? {}) as Record; + await api.config.update({ + ...unifiedConfig, + cliproxy: { + ...existingCliproxy, + kiro_no_incognito: enabled, + }, + }); + } catch { + // Revert on error + setKiroNoIncognito(!enabled); + } finally { + setKiroSaving(false); + } + }, []); + // Load data on mount useEffect(() => { fetchConfig(); fetchRawConfig(); - }, [fetchConfig, fetchRawConfig]); + fetchKiroSettings(); + }, [fetchConfig, fetchRawConfig, fetchKiroSettings]); if (loading || !config) { return ( @@ -265,6 +309,27 @@ export default function ProxySection() { onSaveConfig={saveConfig} /> )} + + {/* Provider Settings */} +
+

Provider Settings

+
+ {/* Kiro: Use normal browser */} +
+
+

Kiro: Use normal browser

+

+ Save AWS login credentials (disable incognito mode) +

+
+ +
+
+
@@ -276,6 +341,7 @@ export default function ProxySection() { onClick={() => { fetchConfig(); fetchRawConfig(); + fetchKiroSettings(); }} disabled={loading || saving} className="w-full"