ralph-claude-code/tests
zerone0x 5ce9bc81d7 fix(analyzer): handle Claude CLI JSON array output format
Claude Code CLI outputs a JSON array instead of a single object:
[{type: "system", ...}, {type: "assistant", ...}, {type: "result", ...}]

This caused parse_json_response to fail with "jq: invalid JSON text"
because it assumed the top-level JSON was an object.

Changes:
- Detect if JSON is an array before parsing
- Extract the "result" type message from the array
- Preserve session_id from init message for continuity
- Normalize to object format for existing parsing logic
- Clean up temporary file after processing

Fixes #112

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 22:56:53 +08:00
..
helpers feat(structure): migrate Ralph files to .ralph/ subfolder (#109) 2026-01-20 23:22:30 -07:00
integration feat(structure): migrate Ralph files to .ralph/ subfolder (#109) 2026-01-20 23:22:30 -07:00
unit fix(analyzer): handle Claude CLI JSON array output format 2026-01-21 22:56:53 +08:00
test_error_detection.sh fix(circuit-breaker): address CodeRabbit review feedback 2025-12-31 13:34:21 -07:00
test_stuck_loop_detection.sh fix(circuit-breaker): fix multi-line error matching in detect_stuck_loop 2025-12-31 14:03:56 -07:00