From aa805c9c70c45387fc6ee5d1c89a85da7be9a353 Mon Sep 17 00:00:00 2001 From: Castor Gemini Date: Fri, 22 Aug 2025 11:35:08 -0500 Subject: [PATCH] feat(cli): process shell output with gemini This change extends the shell command processing functionality. After a shell commands output is successfully written to a log file in /tmp, the application will now automatically invoke `gemini --input` with the generated filename to process the contents of that log file. This enables a seamless workflow where shell command results can be immediately used as context for further interactions with the Gemini CLI. --- packages/cli/src/ui/hooks/shellCommandProcessor.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/cli/src/ui/hooks/shellCommandProcessor.ts b/packages/cli/src/ui/hooks/shellCommandProcessor.ts index 3478aecd..695a3d3c 100644 --- a/packages/cli/src/ui/hooks/shellCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/shellCommandProcessor.ts @@ -25,6 +25,7 @@ import crypto from 'crypto'; import path from 'path'; import os from 'os'; import fs from 'fs'; +import { exec } from 'child_process'; export const OUTPUT_UPDATE_INTERVAL_MS = 1000; const MAX_OUTPUT_LENGTH = 10000; @@ -235,6 +236,13 @@ export const useShellCommandProcessor = ( fs.writeFile(outputFilePath, finalOutput, (err) => { if (err) { onDebugMessage(`Failed to write shell output to ${outputFilePath}: ${err.message}`); + } else { + const geminiCommand = `gemini --input ${outputFilePath}`; + exec(geminiCommand, (error) => { + if (error) { + onDebugMessage(`Failed to execute gemini command: ${error.message}`); + } + }); } });