diff options
Diffstat (limited to 'packages/cli/src/nonInteractiveCli.ts')
| -rw-r--r-- | packages/cli/src/nonInteractiveCli.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/packages/cli/src/nonInteractiveCli.ts b/packages/cli/src/nonInteractiveCli.ts index 6aec2754..36337c8f 100644 --- a/packages/cli/src/nonInteractiveCli.ts +++ b/packages/cli/src/nonInteractiveCli.ts @@ -16,6 +16,7 @@ import { import { Content, Part, FunctionCall } from '@google/genai'; import { ConsolePatcher } from './ui/utils/ConsolePatcher.js'; +import { handleAtCommand } from './ui/hooks/atCommandProcessor.js'; export async function runNonInteractive( config: Config, @@ -40,9 +41,27 @@ export async function runNonInteractive( const geminiClient = config.getGeminiClient(); const abortController = new AbortController(); + + const { processedQuery, shouldProceed } = await handleAtCommand({ + query: input, + config, + addItem: (_item, _timestamp) => 0, + onDebugMessage: () => {}, + messageId: Date.now(), + signal: abortController.signal, + }); + + if (!shouldProceed || !processedQuery) { + // An error occurred during @include processing (e.g., file not found). + // The error message is already logged by handleAtCommand. + console.error('Exiting due to an error processing the @ command.'); + process.exit(1); + } + let currentMessages: Content[] = [ - { role: 'user', parts: [{ text: input }] }, + { role: 'user', parts: processedQuery as Part[] }, ]; + let turnCount = 0; while (true) { turnCount++; |
