feat(cli): undeprecate the --prompt flag (#13981)

Co-authored-by: Allen Hutchison <adh@google.com>
This commit is contained in:
Alex Austin Chettiar
2026-01-15 04:39:27 +05:30
committed by GitHub
parent fb7640886b
commit a2dab146b9
4 changed files with 1 additions and 78 deletions

View File

@@ -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,