diff options
| author | Victor May <[email protected]> | 2025-08-21 14:47:40 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-21 18:47:40 +0000 |
| commit | 720eb81890c3d4b479accb851c77c4ee869d6024 (patch) | |
| tree | e50f8777dbeb35f1ce5955453ea92dfc625ad9ea /packages/cli/src/nonInteractiveCli.ts | |
| parent | 1e5ead6960d531c51593be25c8665e4e8f118562 (diff) | |
At Command Race Condition Bugfix For Non-Interactive Mode (#6676)
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++; |
