diff --git a/ccw/tests/verify-single-execution.ts b/ccw/tests/verify-single-execution.ts new file mode 100644 index 00000000..0fab6011 --- /dev/null +++ b/ccw/tests/verify-single-execution.ts @@ -0,0 +1,68 @@ +/** + * Quick verification script for a specific execution ID + */ + +import { getHistoryStore } from '../src/tools/cli-history-store.js'; + +const executionId = process.argv[2]; +if (!executionId) { + console.error('Usage: tsx verify-single-execution.ts '); + process.exit(1); +} + +const projectPath = 'D:\\Claude_dms3'; +const store = getHistoryStore(projectPath); +const conversation = store.getConversationWithNativeInfo(executionId); + +if (!conversation) { + console.log(`āŒ Execution not found: ${executionId}`); + process.exit(1); +} + +console.log(`\nāœ… Execution found: ${executionId}`); +console.log(` Tool: ${conversation.tool}`); +console.log(` Mode: ${conversation.mode}`); +console.log(` Turns: ${conversation.turns.length}\n`); + +if (conversation.turns.length > 0) { + const turn = conversation.turns[0]; + const stdout = turn.output.stdout || ''; + const parsedOutput = turn.output.parsed_output || ''; + + console.log('šŸ“Š Output Analysis:'); + console.log(` stdout length: ${stdout.length}`); + console.log(` parsed_output length: ${parsedOutput.length}\n`); + + // Check if stdout is JSON lines + const stdoutFirstLine = stdout.split('\n')[0]?.trim(); + let stdoutIsJson = false; + if (stdoutFirstLine) { + try { + JSON.parse(stdoutFirstLine); + stdoutIsJson = true; + } catch {} + } + + // Check if parsed_output is JSON lines + const parsedFirstLine = parsedOutput.split('\n')[0]?.trim(); + let parsedIsJson = false; + if (parsedFirstLine) { + try { + JSON.parse(parsedFirstLine); + parsedIsJson = true; + } catch {} + } + + console.log('šŸ“ Content Format:'); + console.log(` stdout: ${stdoutIsJson ? 'āš ļø JSON lines' : 'āœ… Plain text'}`); + console.log(` parsed_output: ${parsedIsJson ? 'āŒ JSON lines (BUG!)' : 'āœ… Plain text (CORRECT)'}\n`); + + console.log('šŸ“„ First 150 chars of parsed_output:'); + console.log(` "${parsedOutput.substring(0, 150)}${parsedOutput.length > 150 ? '...' : ''}"\n`); + + if (parsedIsJson) { + console.log('āŒ ISSUE: parsed_output still contains JSON lines!'); + } else { + console.log('āœ… SUCCESS: parsed_output contains plain text'); + } +}