ralph-claude-code/lib
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
..
circuit_breaker.sh feat(structure): migrate Ralph files to .ralph/ subfolder (#109) 2026-01-20 23:22:30 -07:00
date_utils.sh feat(analyzer): add Claude CLI JSON format support and session management 2026-01-09 17:46:02 -07:00
response_analyzer.sh fix(analyzer): handle Claude CLI JSON array output format 2026-01-21 22:56:53 +08:00
timeout_utils.sh Add timeout command support for macOS (#108) 2026-01-20 18:40:21 -07:00