Overview
Thepreview command lets you test your statusline script with realistic mock data before installing it into Claude Code. This is essential for debugging and verifying your configuration.
Basic Usage
The preview command works with any statusline script path, not just
.claude/statusline.shWhat Preview Does
Loads Your Script
Reads the statusline script from the specified path.Displays the detected configuration from the script header.
Generates Mock Data
Creates realistic Claude Code JSON input that simulates:
- Current workspace directory
- Active model information
- Context window usage
- Session metadata
- Version information
Executes the Script
Runs your statusline script with the mock data as input.Measures execution time for performance analysis.
Example Output
Fromsrc/cli/preview.ts:9-76, here’s what you’ll see:
Performance Metrics
Preview analyzes execution time and categorizes performance:🚀 Excellent (<100ms)
🚀 Excellent (<100ms)
Ideal performance. Your statusline is optimized and will have no noticeable impact on Claude Code.This is the target performance for all configurations.
✅ Good (100-500ms)
✅ Good (100-500ms)
Acceptable performance. Slight delay but generally not noticeable in normal usage.Consider disabling heavy features if you want faster execution.
⚠️ Slow (500-1000ms)
⚠️ Slow (500-1000ms)
Performance concern. Noticeable delay when statusline updates.Recommendations:
- Disable ccusage integration if not needed
- Remove token statistics feature
- Disable session reset time tracking
🐌 Timeout (>1000ms)
🐌 Timeout (>1000ms)
Poor performance. Significant delay impacting user experience.Action required:
- Check if jq is installed properly
- Verify ccusage isn’t hanging
- Reduce enabled features to minimal set
- Check debug logs for errors
src/cli/preview.ts:88-92:
Detected Configuration
Preview automatically extracts configuration from your script header:Feature Validation
Preview performs basic validation to ensure features are working:Mock Data Generation
The preview command uses realistic mock data fromsrc/utils/tester.ts:
Use Cases
Before Installation
Test your configuration before installing:After Customization
If you’ve manually edited your statusline script:Performance Testing
Benchmark different feature combinations:Debugging
Combine preview with debug logging:Limitations
- No ccusage integration - Usage costs and session time are not tested (requires real Claude Code session)
- Mock git data - Git branch is detected from your actual repository, but may differ from Claude Code’s working directory
- Static context - Context window data is mocked and won’t reflect actual usage
Troubleshooting Preview Issues
Script Not Found
Permission Denied
No Output
Next Steps
Configuration Guide
Learn about all available features and options
Performance Optimization
Optimize your statusline for speed