summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks
diff options
context:
space:
mode:
authorCastor Gemini <[email protected]>2025-08-22 11:35:08 -0500
committerJeff Carr <[email protected]>2025-08-22 11:35:08 -0500
commitaa805c9c70c45387fc6ee5d1c89a85da7be9a353 (patch)
tree15aff1e244b4777b082b73400b8983a277978aad /packages/cli/src/ui/hooks
parent985f472c4a2b293d2842c49c689d3453c71c3612 (diff)
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.
Diffstat (limited to 'packages/cli/src/ui/hooks')
-rw-r--r--packages/cli/src/ui/hooks/shellCommandProcessor.ts8
1 files changed, 8 insertions, 0 deletions
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}`);
+ }
+ });
}
});