diff --git a/packages/cli/src/config/config.ts b/packages/cli/src/config/config.ts index beccbfa0a9..40601eea1c 100755 --- a/packages/cli/src/config/config.ts +++ b/packages/cli/src/config/config.ts @@ -242,11 +242,7 @@ export async function parseArguments(settings: Settings): Promise { type: 'string', description: 'Path to a file to record model responses for testing.', hidden: true, - }) - .deprecateOption( - 'prompt', - 'Use the positional prompt instead. This flag will be removed in a future version.', - ), + }), ) // Register MCP subcommands .command(mcpCommand) diff --git a/packages/cli/src/gemini.tsx b/packages/cli/src/gemini.tsx index 741632af85..3f808c20b7 100644 --- a/packages/cli/src/gemini.tsx +++ b/packages/cli/src/gemini.tsx @@ -689,9 +689,6 @@ export async function main() { debugLogger.log('Session ID: %s', sessionId); } - const hasDeprecatedPromptArg = process.argv.some((arg) => - arg.startsWith('--prompt'), - ); initializeOutputListenersAndFlush(); await runNonInteractive({ @@ -699,7 +696,6 @@ export async function main() { settings, input, prompt_id, - hasDeprecatedPromptArg, resumedSessionData, }); // Call cleanup before process.exit, which causes cleanup to not run diff --git a/packages/cli/src/nonInteractiveCli.test.ts b/packages/cli/src/nonInteractiveCli.test.ts index c4ce96452a..8a05ac1178 100644 --- a/packages/cli/src/nonInteractiveCli.test.ts +++ b/packages/cli/src/nonInteractiveCli.test.ts @@ -1418,58 +1418,6 @@ describe('runNonInteractive', () => { }); }); - it('should display a deprecation warning if hasDeprecatedPromptArg is true', async () => { - const events: ServerGeminiStreamEvent[] = [ - { type: GeminiEventType.Content, value: 'Final Answer' }, - { - type: GeminiEventType.Finished, - value: { reason: undefined, usageMetadata: { totalTokenCount: 10 } }, - }, - ]; - mockGeminiClient.sendMessageStream.mockReturnValue( - createStreamFromEvents(events), - ); - - await runNonInteractive({ - config: mockConfig, - settings: mockSettings, - input: 'Test input', - prompt_id: 'prompt-id-deprecated', - hasDeprecatedPromptArg: true, - }); - - expect(processStderrSpy).toHaveBeenCalledWith( - 'The --prompt (-p) flag has been deprecated and will be removed in a future version. Please use a positional argument for your prompt. See gemini --help for more information.\n', - ); - expect(processStdoutSpy).toHaveBeenCalledWith('Final Answer'); - }); - - it('should display a deprecation warning for JSON format', async () => { - const events: ServerGeminiStreamEvent[] = [ - { type: GeminiEventType.Content, value: 'Final Answer' }, - { - type: GeminiEventType.Finished, - value: { reason: undefined, usageMetadata: { totalTokenCount: 10 } }, - }, - ]; - mockGeminiClient.sendMessageStream.mockReturnValue( - createStreamFromEvents(events), - ); - vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.JSON); - - await runNonInteractive({ - config: mockConfig, - settings: mockSettings, - input: 'Test input', - prompt_id: 'prompt-id-deprecated-json', - hasDeprecatedPromptArg: true, - }); - - const deprecateText = - 'The --prompt (-p) flag has been deprecated and will be removed in a future version. Please use a positional argument for your prompt. See gemini --help for more information.\n'; - expect(processStderrSpy).toHaveBeenCalledWith(deprecateText); - }); - it('should emit appropriate events for streaming JSON output', async () => { vi.mocked(mockConfig.getOutputFormat).mockReturnValue( OutputFormat.STREAM_JSON, diff --git a/packages/cli/src/nonInteractiveCli.ts b/packages/cli/src/nonInteractiveCli.ts index 7830798dd5..8eac2f61d3 100644 --- a/packages/cli/src/nonInteractiveCli.ts +++ b/packages/cli/src/nonInteractiveCli.ts @@ -51,7 +51,6 @@ interface RunNonInteractiveParams { settings: LoadedSettings; input: string; prompt_id: string; - hasDeprecatedPromptArg?: boolean; resumedSessionData?: ResumedSessionData; } @@ -60,7 +59,6 @@ export async function runNonInteractive({ settings, input, prompt_id, - hasDeprecatedPromptArg, resumedSessionData, }: RunNonInteractiveParams): Promise { return promptIdContext.run(prompt_id, async () => { @@ -264,21 +262,6 @@ export async function runNonInteractive({ let currentMessages: Content[] = [{ role: 'user', parts: query }]; let turnCount = 0; - const deprecateText = - 'The --prompt (-p) flag has been deprecated and will be removed in a future version. Please use a positional argument for your prompt. See gemini --help for more information.\n'; - if (hasDeprecatedPromptArg) { - if (streamFormatter) { - streamFormatter.emitEvent({ - type: JsonStreamEventType.MESSAGE, - timestamp: new Date().toISOString(), - role: 'assistant', - content: deprecateText, - delta: true, - }); - } else { - process.stderr.write(deprecateText); - } - } while (true) { turnCount++; if (