Add support for output-format stream-jsonflag for headless mode (#10883)

This commit is contained in:
anj-s
2025-10-15 13:55:37 -07:00
committed by GitHub
parent 7bed302f21
commit 47f693173a
12 changed files with 957 additions and 20 deletions
+16
View File
@@ -3432,6 +3432,22 @@ describe('Output format', () => {
expect(config.getOutputFormat()).toBe(OutputFormat.JSON);
});
it('should accept stream-json as a valid output format', async () => {
process.argv = ['node', 'script.js', '--output-format', 'stream-json'];
const argv = await parseArguments({} as Settings);
const config = await loadCliConfig(
{},
[],
new ExtensionEnablementManager(
ExtensionStorage.getUserExtensionsDir(),
argv.extensions,
),
'test-session',
argv,
);
expect(config.getOutputFormat()).toBe(OutputFormat.STREAM_JSON);
});
it('should error on invalid --output-format argument', async () => {
process.argv = ['node', 'script.js', '--output-format', 'yaml'];
const mockExit = vi.spyOn(process, 'exit').mockImplementation(() => {
+1 -1
View File
@@ -286,7 +286,7 @@ export async function parseArguments(settings: Settings): Promise<CliArgs> {
alias: 'o',
type: 'string',
description: 'The format of the CLI output.',
choices: ['text', 'json'],
choices: ['text', 'json', 'stream-json'],
})
.deprecateOption(
'show-memory-usage',