| name | collect-cli-fixtures |
| description | Collects real CLI (Claude, Gemini) stream-json output as .jsonl fixture files. Use when adding new fixture scenarios, updating after CLI version changes, or covering new protocol event types. |
Collect CLI Fixtures
Capture Script
scripts/capture-fixture.sh <name> [prompt]
Print mode
claude --output-format stream-json -p "say hello" 2>/dev/null > /tmp/claude-simple-text.jsonl
Interactive mode (control protocol)
mkfifo /tmp/claude-stdin
claude --output-format stream-json --input-format stream-json --verbose \
< /tmp/claude-stdin 2>/dev/null | tee /tmp/claude-interactive.jsonl &
exec 3>/tmp/claude-stdin
exec 3>&-; kill %1 2>/dev/null; rm /tmp/claude-stdin
From DB
mysql -u root -h 127.0.0.1 -P 3306 code_quest -N -e \
"SELECT raw FROM raw_entries WHERE raw LIKE '{\"type\":\"<type>\"%' LIMIT 1;"
Validation
while IFS= read -r line; do
echo "$line" | jq . > /dev/null 2>&1 || echo "INVALID: $line"
done < /tmp/fixture.jsonl
cat /tmp/fixture.jsonl | jq -r '.type' | sort | uniq -c
Sanitization
sed -i '' 's/"session_id":"[^"]*"/"session_id":"test-session-id"/g' fixture.jsonl
grep -l "sk-" fixture.jsonl
Destination
apps/summoner/src/__fixtures__/claude/
├── real/<name>.jsonl # From DB or real CLI
└── synthetic/<name>.jsonl # Hand-crafted (mark for future replacement)
Checklist
Reference
- Tracking:
docs/fixture-capture-tracking.md
- Fixture-Driven TDD:
/fixture-driven-tdd