Package Exports
- @chongdashu/cc-statusline
- @chongdashu/cc-statusline/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@chongdashu/cc-statusline) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cc-statusline
A beautiful, informative statusline for Claude Code
Real-time directory, git branch, model info, costs, and session time tracking
โก Quick Start
One command. Three questions. Custom statusline.
npx @chongdashu/cc-statusline@latest initThat's it! Answer a few simple questions, restart Claude Code, and enjoy your new statusline.
๐ Installation Options (v1.2.4+)
- ๐ Global Installation (
~/.claude/) - Use across all your projects - ๐ Project Installation (
./.claude/) - Keep settings project-specific
๐ What's New in v1.3.0
- ๐ฅ Improved Burn Rate - Now calculates $/hour directly from Claude Code data (no ccusage dependency)
- ๐ Smart Logging - Logs are created relative to statusline installation location
- โจ Version Headers - Generated statuslines now include the cc-statusline version
๐ฏ Simple Setup
โจ What You Get
Enhance your Claude Code terminal with useful information:
- ๐ Directory Display - Current folder with
~abbreviation - ๐ฟ Git Integration - Current branch name
- ๐ค Model Info - Shows which Claude model you're using plus Claude Code version
- ๐ง Context Usage - Real-time context window usage with progress bars
- ๐ฐ Cost Tracking - Live cost monitoring with burn rates via ccusage
- โ Session Timer - Time remaining until usage limit resets
- ๐ Token Analytics - Token consumption and burn rate metrics
- ๐จ Color Support - 256-color palette for Claude Code terminals
- โก Fast Execution - Optimized bash script with <100ms execution time
๐๏ธ Features Overview
๐ฅ Default Features (All Pre-selected in v1.2.2+)
| Feature | Description | Example |
|---|---|---|
| ๐ Directory | Current working directory | ~/my-project |
| ๐ฟ Git Branch | Active git branch | feature/statusline |
| ๐ค Model | Claude model name & version | Sonnet 4 |
| ๐ Claude Code | Claude Code version | v1.0.85 |
| ๐จ Output Style | Current output style setting | default |
| ๐ง Context | Remaining context with progress bar | 83% [========--] |
| ๐ฐ Cost | Live costs with highlighted burn rate | $49.00 ($16.55/h) |
| โ Session | Time until reset with progress | 3h 7m until reset at 01:00 (37%) [===-------] |
๐ Power Features (Also Pre-selected)
| Feature | Description | Example |
|---|---|---|
| ๐ Tokens | Token consumption with burn rate | 14638846 tok (279900 tpm) |
๐จ Example Outputs
New 3-Line Modern Layout (v1.2.2+):
๐ ~/Projects/cc-statusline ๐ฟ feature/context-usage-output-styles ๐ค Sonnet 4 ๐ v1.0.85 ๐จ default
๐ง Context Remaining: 83% [========--] โ 3h 7m until reset at 01:00 (37%) [===-------]
๐ฐ $49.00 ($16.55/h) ๐ 14638846 tok (279900 tpm)Compact Mode:
๐ ~/my-app ๐ฟ main ๐ค Claude Sonnet ๐ v1.0.85
๐ง Context Remaining: 95% [=========-]
๐ฐ $2.48 ($12.50/h)๐ ๏ธ Advanced Usage
Preview Your Statusline
Test your statusline before restarting Claude Code:
cc-statusline preview .claude/statusline.shWhat preview does:
- ๐ Loads your actual statusline script
- ๐งช Runs it with realistic mock data
- ๐ Shows exactly what the output will look like
- โก Reports performance metrics and functionality
Installation Safety Features (v1.2.4+)
- ๐ Safe Updates - Never overwrites existing statuslines without confirmation
- ๐ก๏ธ Settings Protection - Preserves your existing settings.json configurations
- โ ๏ธ Conflict Detection - Warns when other statuslines are configured
- โ Smart Defaults - Project-level installation by default for safety
Custom Installation
# Generate to custom location
cc-statusline init --output ./my-statusline.sh
# Skip auto-installation (manual setup)
cc-statusline init --no-install
# Global installation for convenience
npm install -g @chongdashu/cc-statusline๐ง How It Works
How It Works
- ๐ฏ Configuration - Two questions configure your preferences
- ๐๏ธ Generation - Creates optimized bash script tailored to your needs
- โ๏ธ Installation - Integrates with Claude Code settings
- ๐ Updates - Connects to ccusage for live usage statistics
Technical Architecture
- โก Bash-First - Native shell execution for maximum speed
- ๐จ Claude Code Optimized - Forces colors for Claude Code terminals (respects NO_COLOR)
- ๐ Environment Respect - Honors
NO_COLORand other terminal conventions - ๐ฆ Zero Dependencies - Self-contained script with graceful fallbacks
- ๐ Secure - No network requests except ccusage integration
๐ Requirements
โ Required (You Already Have These!)
- Claude Code - The tool you're already using
- jq - JSON processing (pre-installed on most systems)
๐ Optional Enhancements
- git - For branch display (you probably have this)
- ccusage - For usage stats (works via
npx- no install needed)
Quick Compatibility Check
command -v jq && echo "โ
Ready to go!"๐ File Structure
After installation, you'll have a clean setup:
.claude/
โโโ statusline.sh # ๐ฏ Your generated statusline script
โโโ settings.json # โ๏ธ Auto-updated Claude Code configurationManual Configuration (Backup Plan)
If auto-configuration fails, simply add this to .claude/settings.json:
{
"statusLine": {
"type": "command",
"command": ".claude/statusline.sh",
"padding": 0
}
}๐ง Troubleshooting
๐ซ Statusline Not Showing
- Restart Claude Code after installation
- Verify settings - Check
.claude/settings.jsoncontains the configuration above - Check permissions - Ensure script is executable:
chmod +x .claude/statusline.sh
๐ Performance Issues
- Test performance:
cc-statusline preview .claude/statusline.sh - Optimize features: Disable heavy features if execution > 500ms
- Disable ccusage: Remove usage tracking if not needed
๐งฉ Missing Features
- Install jq:
brew install jq(macOS) orapt install jq(Ubuntu) - ccusage setup: Works automatically via
npx ccusage@latest - Git not found: Install git for branch display
- Context not showing: Ensure you're in an active Claude Code session with context usage
- Colors not working: Check that NO_COLOR environment variable is not set
๐ Performance
| Metric | Target | Typical |
|---|---|---|
| Execution Time | <100ms | 45-80ms |
| Memory Usage | <5MB | ~2MB |
| CPU Impact | Negligible | <1% |
| Dependencies | Minimal | jq only |
Benchmarked on macOS with all features enabled
๐ค Contributing
Contributions are welcome!
Quick Start:
git clone https://github.com/chongdashu/cc-statusline
cd cc-statusline
npm install && npm run buildContribution Areas:
- ๐ Bug Fixes - Help make it more robust
- โจ New Features - Add support for more runtimes/features
- ๐ Documentation - Improve guides and examples
- ๐งช Testing - Add test coverage and edge cases
See our Contributing Guide for detailed information.
๐งช Testing
Locking Mechanism Tests
The ccusage integration includes a robust file-based locking mechanism to prevent concurrent process spawning. Test this functionality:
Single Test:
echo '{}' | ./test/test-statusline-with-lock.shConcurrent Test:
./test/test-concurrent-locking.shManual Concurrent Test:
# Spawn 10 concurrent processes
for i in {1..10}; do
echo '{}' | ./test/test-statusline-with-lock.sh &
doneExpected Behavior:
- โ Only 1 process runs ccusage at a time
- โ Other processes skip gracefully (no pile-up)
- โ Lock files are properly cleaned up
- โ No hanging processes remain
Verification Commands:
# Check for stale locks
ls /tmp/ccusage_statusline.* 2>/dev/null || echo "โ
No locks remain"
# Monitor running processes
ps aux | grep ccusage | grep -v grep๐ Stats
๐ Related Projects
- ccusage - Claude Code usage analytics (would not be possible with it!)
- Claude Code - Official documentation
๐ฅ Contributors
We're grateful for all contributions that make cc-statusline better!
- Jonathan Borgwing (@DevVig) - Critical performance fix for infinite ccusage process spawning (#4)
How to Contribute
Want to see your name here? Check out our Contributing Guide and help make cc-statusline even better!
We welcome:
- ๐ Bug fixes and performance improvements
- โจ New features and enhancements
- ๐ Documentation improvements
- ๐งช Test coverage and quality assurance
๐ Changelog
See CHANGELOG.md for detailed release history.
๐ License
MIT License - see LICENSE file for details.
Made by Chong-U @ AIOriented