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.
This commit is contained in:
Castor Gemini 2025-08-22 11:35:08 -05:00 committed by Jeff Carr
parent 985f472c4a
commit aa805c9c70
1 changed files with 8 additions and 0 deletions

View File

@ -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}`);
}
});
}
});