claude-formatter
v0.1.1
Published
A CLI tool to format Claude's streaming JSON output for better readability
Maintainers
Readme
claude-formatter
A CLI tool to format Claude's streaming JSON output for better readability.
Installation
npm install -g claude-formatterUsage
Pipe Claude's streaming JSON output to claude-formatter:
claude --continue -p "Continue iterating..." --output-format stream-json | claude-formatterFeatures
- Formats streaming JSON output from Claude
- Converts escaped sequences (
\n,\t) to actual characters - Pretty prints different message types with emojis
- Color-codes output for better readability
- Handles tool calls and responses
- Shows token usage statistics
Examples
Basic usage
# Pipe Claude output directly
claude --output-format stream-json "Your prompt here" | claude-formatter
# Use with Claude's continue feature
claude --continue -p "Continue iterating..." --output-format stream-json | claude-formatter
# Save formatted output to a file
claude --output-format stream-json "Your prompt" | claude-formatter > output.logMessage Types
The formatter recognizes and specially formats these message types:
- 🤖 Assistant messages - Shows model responses with content blocks
- 👤 User messages - Displays user inputs
- ⚙️ System messages - System information and available tools
- 🛠️ Tool use - When Claude uses a tool
- 🔧 Tool results - Results from tool execution
- 📝 Text content - Regular text content
- ❌ Errors - JSON parsing errors
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
ISC
