daaain / daaain/claude-code-log
Support piping from claude CLI --output-format stream-json
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 98
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 13
Description
Feature Request
Add support for piping live output from claude -p --output-format stream-json directly into claude-code-log for real-time log processing.
Context
This is a follow-up to #43, which added text/markdown/chat output formats. During implementation, we discovered that the stream-json format from Claude Code's live output has a different schema than saved transcript files:
Stream-json format (from claude -p):
- Missing fields:
parentUuid,isSidechain,userType,cwd,version,timestamp - Different structure optimized for streaming
Saved transcript format (from ~/.claude/projects/):
- Complete metadata fields
- Full session information
- What claude-code-log currently supports
Proposed Solution
Add a --stream-json mode that:
- Accepts piped input from
claude -p --output-format stream-json - Handles the different schema (missing metadata fields)
- Outputs formatted text in real-time or buffers until completion
- Works with existing format options (text, markdown, chat)
Example Usage
# Real-time CI/CD log formatting
claude -p "Review this code" --output-format stream-json | claude-code-log --stream-json --format chat
# Or capture to file
claude -p "Build project" --output-format stream-json | claude-code-log --stream-json --format markdown > build-log.md
Benefits
- Enables CI/CD integration as originally requested in #43
- Real-time log visibility for long-running Claude operations
- Complements existing saved transcript processing
Related
- #43 - Plain text output (implemented)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the issue's claude -p --output-format stream-json | claude-code-log --stream-json examples and compare the stream-json schema with saved transcript input. Trace the claude-code-log CLI's existing text, markdown, and chat format handling. Done means piped stream-json input is accepted despite missing metadata and produces the requested output format during or after processing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100