feat(tests): add CLI API response format tests and output format detection

This commit is contained in:
catlog22
2026-02-02 11:46:12 +08:00
parent a54246a46f
commit 48871f0d9e
3 changed files with 263 additions and 2 deletions

View File

@@ -386,8 +386,14 @@ export function buildCommand(params: {
fullCommand: `${command} ${args.join(' ')}${useStdin ? ' (stdin)' : ''}`,
});
// Auto-detect output format: Codex uses --json flag for JSONL output
const outputFormat = tool.toLowerCase() === 'codex' ? 'json-lines' : 'text';
// Auto-detect output format: All CLI tools use JSON lines output
// - Codex: --json
// - Gemini: -o stream-json
// - Qwen: -o stream-json
// - Claude: --output-format stream-json
// - OpenCode: --format json
const jsonLineTools = ['codex', 'gemini', 'qwen', 'claude', 'opencode'];
const outputFormat = jsonLineTools.includes(tool.toLowerCase()) ? 'json-lines' : 'text';
return { command, args, useStdin, outputFormat };
}