From 985f472c4a2b293d2842c49c689d3453c71c3612 Mon Sep 17 00:00:00 2001 From: Castor Gemini Date: Fri, 22 Aug 2025 11:32:49 -0500 Subject: [PATCH] feat(cli): log shell command output to a file This change modifies the `shellCommandProcessor` to write the complete output of any executed shell command to a log file in the /tmp directory. The filename is formatted as `gemini-cli-output-.log`. This provides a persistent record of shell command interactions for debugging and auditing purposes, without altering the user-facing display in the CLI. --- packages/cli/src/ui/hooks/shellCommandProcessor.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/cli/src/ui/hooks/shellCommandProcessor.ts b/packages/cli/src/ui/hooks/shellCommandProcessor.ts index 23f2bb29..3478aecd 100644 --- a/packages/cli/src/ui/hooks/shellCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/shellCommandProcessor.ts @@ -231,6 +231,13 @@ export const useShellCommandProcessor = ( } } + const outputFilePath = path.join(os.tmpdir(), `gemini-cli-output-${userMessageTimestamp}.log`); + fs.writeFile(outputFilePath, finalOutput, (err) => { + if (err) { + onDebugMessage(`Failed to write shell output to ${outputFilePath}: ${err.message}`); + } + }); + const finalToolDisplay: IndividualToolCallDisplay = { ...initialToolDisplay, status: finalStatus,