Skip to content
Β 
Β 

Latest commit

Β 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

cc-statusline

A beautiful, informative statusline for Claude Code

cc-statusline in action

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

npm version License: MIT Node.js

⚑ Quick Start

One command. Two questions. Custom statusline.

npx @chongdashu/cc-statusline@latest init

That's it! Answer 2 simple questions, restart Claude Code, and enjoy your new statusline.

🎯 Simple Setup

Demo of cc-statusline 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.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

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

  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

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_COLOR and 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 configuration

Manual 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

  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

🐌 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) or apt 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 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

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.sh

Concurrent Test:

./test/test-concurrent-locking.sh

Manual Concurrent Test:

# 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:

# 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

GitHub stars GitHub forks npm downloads

πŸ”— 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!

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

About

Transform your Claude Code experience with a beautiful, informative statusline

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages