Interactive CLI tool for generating custom Claude Code statuslines
npm install @chongdashu/cc-statuslineA beautiful, informative statusline for Claude Code

Real-time directory, git branch, model info, costs, and session time tracking



One command. Three questions. Custom statusline.
``bash`
npx @chongdashu/cc-statusline@latest init
That's it! Answer a few simple questions, restart Claude Code, and enjoy your new statusline.
> Without jq, your statusline will have LIMITED functionality:
> - โ No context remaining percentage
> - โ No token statistics from ccusage
> - โ No session timer
> - โ ๏ธ Basic fallback parser is used (less reliable)
#### macOS
`bash`
brew install jq
#### Linux
`bashUbuntu/Debian
sudo apt-get install jq
#### Windows 10/11
Option 1: Package Manager (Recommended)
`bash
Chocolatey
choco install jqScoop
scoop install jqWinget
winget install jqlang.jq
`Option 2: Manual Download
1. Go to https://github.com/jqlang/jq/releases/latest
2. Download:
- 64-bit:
jq-windows-amd64.exe
- 32-bit: jq-windows-i386.exe
3. Rename to jq.exe
4. Place in C:\Windows\System32\ (requires admin) or add to PATH
5. Test: jq --version$3
`bash
jq --version
Should output: jq-1.6 or higher
`$3
- git - For branch display (you probably have this)
- ccusage - For usage stats (works via npx - no install needed)๐ฏ 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 (requires jq)
- ๐ฐ Cost Tracking - Live cost monitoring with burn rates via ccusage (partial without jq)
- โ Session Timer - Time remaining until usage limit resets (requires jq)
- ๐ Token Analytics - Token consumption and burn rate metrics (requires jq)
- ๐จ Color Support - 256-color palette for Claude Code terminals
- โก Fast Execution - Optimized bash script with <100ms execution time๐๏ธ Features Overview
$3
- ๐ Global Installation (~/.claude/) - Use across all your projects
- ๐ Project Installation (./.claude/) - Keep settings project-specific$3
| 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%) [===-------] |$3
| Feature | Description | Example |
|---------|-------------|---------|
| ๐ Tokens | Token consumption with burn rate | 14638846 tok (279900 tpm) |$3
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
$3
Test your statusline before restarting Claude Code:`bash
cc-statusline preview .claude/statusline.sh
`What preview does:
1. ๐ Loads your actual statusline script
2. ๐งช Runs it with realistic mock data
3. ๐ Shows exactly what the output will look like
4. โก Reports performance metrics and functionality
$3
- ๐ 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$3
`bash
Generate to custom location
cc-statusline init --output ./my-statusline.shSkip auto-installation (manual setup)
cc-statusline init --no-installGlobal installation for convenience
npm install -g @chongdashu/cc-statusline
`๐ง How It Works
$3
1. ๐ฏ Configuration - Two questions configure your preferences
2. ๐๏ธ Generation - Creates optimized bash script tailored to your needs
3. โ๏ธ Installation - Integrates with Claude Code settings
4. ๐ Updates - Connects to ccusage for live usage statistics
$3
- โก Bash-First - Native shell execution for maximum speed
- ๐จ Claude Code Optimized - Forces colors for Claude Code terminals (respects NO_COLOR)
- ๐ Environment Respect - Honors
NO_COLOR and other terminal conventions
- ๐ฆ Zero Dependencies - Self-contained script with graceful fallbacks
- ๐ Secure - No network requests except ccusage integration๐ File Structure
After installation, you'll have a clean setup:
`
.claude/
โโโ statusline.sh # ๐ฏ Your generated statusline script
โโโ settings.json # โ๏ธ Auto-updated Claude Code configuration
`$3
If auto-configuration fails, simply add this to
.claude/settings.json:`json
{
"statusLine": {
"type": "command",
"command": ".claude/statusline.sh",
"padding": 0
}
}
`๐ง Troubleshooting
$3
1. Restart Claude Code after installation
2. Verify settings - Check .claude/settings.json contains the configuration above
3. Check permissions - Ensure script is executable: chmod +x .claude/statusline.sh$3
- Test performance: cc-statusline preview .claude/statusline.sh
- Optimize features: Disable heavy features if execution > 500ms
- Disable ccusage: Remove usage tracking if not needed$3
- Install jq: See the jq installation guide below
- 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:
`bash
git clone https://github.com/chongdashu/cc-statusline
cd cc-statusline
npm install && npm run build
`Contribution 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
$3
The ccusage integration includes a robust file-based locking mechanism to prevent concurrent process spawning. Test this functionality:
Single Test:
`bash
echo '{}' | ./test/test-statusline-with-lock.sh
`Concurrent Test:
`bash
./test/test-concurrent-locking.sh
`Manual Concurrent Test:
`bash
Spawn 10 concurrent processes
for i in {1..10}; do
echo '{}' | ./test/test-statusline-with-lock.sh &
done
`Expected 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:
`bash
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
``- ccusage - Claude Code usage analytics (would not be possible with it!)
- Claude Code - Official documentation
We're grateful for all contributions that make cc-statusline better!
- Jonathan Borgwing (@DevVig) - Critical performance fix for infinite ccusage process spawning (#4)
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
See CHANGELOG.md for detailed release history.
MIT License - see LICENSE file for details.
---
Made by Chong-U @ AIOriented