diff options
Diffstat (limited to 'packages/cli/src/ui/App.tsx')
| -rw-r--r-- | packages/cli/src/ui/App.tsx | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index a2ed7cdc..39cbaf47 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -10,6 +10,7 @@ import { StreamingState, type HistoryItem } from './types.js'; import { useGeminiStream } from './hooks/useGeminiStream.js'; import { useLoadingIndicator } from './hooks/useLoadingIndicator.js'; import { useThemeCommand } from './hooks/useThemeCommand.js'; +import { useSlashCommandProcessor } from './hooks/slashCommandProcessor.js'; import { Header } from './components/Header.js'; import { LoadingIndicator } from './components/LoadingIndicator.js'; import { EditorState, InputPrompt } from './components/InputPrompt.js'; @@ -36,36 +37,40 @@ interface AppProps { export const App = ({ config, settings, cliVersion }: AppProps) => { const { history, addItem, clearItems } = useHistory(); + const [staticKey, setStaticKey] = useState(0); + const refreshStatic = useCallback(() => { + setStaticKey((prev) => prev + 1); + }, [setStaticKey]); + const [startupWarnings, setStartupWarnings] = useState<string[]>([]); + const [debugMessage, setDebugMessage] = useState<string>(''); const [showHelp, setShowHelp] = useState<boolean>(false); const [themeError, setThemeError] = useState<string | null>(null); + const { isThemeDialogOpen, openThemeDialog, handleThemeSelect, handleThemeHighlight, } = useThemeCommand(settings, setThemeError); - - const [staticKey, setStaticKey] = useState(0); - const refreshStatic = useCallback(() => { - setStaticKey((prev) => prev + 1); - }, [setStaticKey]); - - const { - streamingState, - submitQuery, - initError, - debugMessage, - slashCommands, - pendingHistoryItem, - } = useGeminiStream( + const { handleSlashCommand, slashCommands } = useSlashCommandProcessor( addItem, clearItems, refreshStatic, setShowHelp, - config, + setDebugMessage, openThemeDialog, ); + + const { streamingState, submitQuery, initError, pendingHistoryItem } = + useGeminiStream( + addItem, + refreshStatic, + setShowHelp, + config, + setDebugMessage, + handleSlashCommand, + ); const { elapsedTime, currentLoadingPhrase } = useLoadingIndicator(streamingState); |
