mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-09 02:24:11 +08:00
fix: Auto-detect JSON Lines output format for Codex CLI
Problem: Codex CLI uses --json flag to output JSONL events, but executor was using plain text parser. This prevented proper parsing of structured events, breaking session creation. Root cause: buildCommand() added --json flag for Codex but never communicated this to the output parser. Result: JSONL events treated as raw text → session markers lost. Solution: - Extend buildCommand() to return outputFormat - Auto-detect 'json-lines' when tool is 'codex' - Use auto-detected format in executeCliTool() - Properly parse structured events and extract session data Files modified: - ccw/src/tools/cli-executor-utils.ts: Add output format auto-detection - ccw/src/tools/cli-executor-core.ts: Use auto-detected format for parser - ccw/src/commands/cli.ts: Add debug instrumentation Verified: - Codex outputs valid JSONL (confirmed via direct test) - CLI_EXECUTION_STARTED events broadcast correctly - Issue was downstream in output parsing, not event transmission
This commit is contained in:
@@ -166,7 +166,7 @@ export function buildCommand(params: {
|
||||
commit?: string;
|
||||
title?: string;
|
||||
};
|
||||
}): { command: string; args: string[]; useStdin: boolean } {
|
||||
}): { command: string; args: string[]; useStdin: boolean; outputFormat?: 'text' | 'json-lines' } {
|
||||
const { tool, prompt, mode = 'analysis', model, dir, include, nativeResume, settingsFile, reviewOptions } = params;
|
||||
|
||||
debugLog('BUILD_CMD', `Building command for tool: ${tool}`, {
|
||||
@@ -381,5 +381,8 @@ export function buildCommand(params: {
|
||||
fullCommand: `${command} ${args.join(' ')}${useStdin ? ' (stdin)' : ''}`,
|
||||
});
|
||||
|
||||
return { command, args, useStdin };
|
||||
// Auto-detect output format: Codex uses --json flag for JSONL output
|
||||
const outputFormat = tool.toLowerCase() === 'codex' ? 'json-lines' : 'text';
|
||||
|
||||
return { command, args, useStdin, outputFormat };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user