From 8180ed9a687daff1720a6b1ee5a558e9d0a824e5 Mon Sep 17 00:00:00 2001 From: Juliette Love Date: Sun, 20 Apr 2025 21:13:32 +0100 Subject: [PATCH] Add terminal clear (#69) --- packages/cli/src/ui/hooks/useGeminiStream.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index 1cd9f5d6..6e3e8e84 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -108,7 +108,13 @@ export const useGeminiStream = ( if (typeof query === 'string') { setDebugMessage(`User query: ${query}`); const maybeCommand = query.split(/\s+/)[0]; - if (config.getPassthroughCommands().includes(maybeCommand)) { + if (query.trim() === 'clear') { + // This just clears the *UI* history, not the model history. + // TODO: add a slash command for that. + setDebugMessage('Clearing terminal.'); + setHistory((prevHistory) => []); + return; + } else if (config.getPassthroughCommands().includes(maybeCommand)) { // Execute and capture output setDebugMessage(`Executing shell command directly: ${query}`); _exec(query, (error, stdout, stderr) => {