cc-statusline-pro 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/QUICK_START.md +190 -0
- package/README.md +118 -0
- package/cli.js +476 -0
- package/install.ps1 +92 -0
- package/install.sh +106 -0
- package/package.json +23 -0
- package/statusline-template.js +458 -0
package/QUICK_START.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Quick Start - Claude Code Statusline
|
|
2
|
+
|
|
3
|
+
Cài đặt statusline đẹp mắt cho Claude Code chỉ bằng 1 lệnh!
|
|
4
|
+
|
|
5
|
+
## 🚀 Cài đặt nhanh
|
|
6
|
+
|
|
7
|
+
### Cách 1: Sử dụng Node.js (Đa nền tảng)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd your-project
|
|
11
|
+
node /path/to/statusline-installer/cli.js init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Ví dụ cụ thể:**
|
|
15
|
+
```bash
|
|
16
|
+
cd "D:\my-awesome-project"
|
|
17
|
+
node "T:\My Downloads\exness-eafree-web\.claude\statusline-installer\cli.js" init
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Cách 2: PowerShell (Windows)
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
cd your-project
|
|
24
|
+
powershell -ExecutionPolicy Bypass -File "\path\to\statusline-installer\install.ps1"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Ví dụ cụ thể:**
|
|
28
|
+
```powershell
|
|
29
|
+
cd "D:\my-awesome-project"
|
|
30
|
+
powershell -ExecutionPolicy Bypass -File "T:\My Downloads\exness-eafree-web\.claude\statusline-installer\install.ps1"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Cách 3: Bash (Linux/macOS)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd your-project
|
|
37
|
+
bash /path/to/statusline-installer/install.sh
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 📦 Tạo alias để sử dụng dễ dàng
|
|
43
|
+
|
|
44
|
+
### Windows (PowerShell Profile)
|
|
45
|
+
|
|
46
|
+
Thêm vào PowerShell profile (`$PROFILE`):
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
function Install-ClaudeStatusline {
|
|
50
|
+
node "T:\My Downloads\exness-eafree-web\.claude\statusline-installer\cli.js" init
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Set-Alias -Name ccsl -Value Install-ClaudeStatusline
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Sau đó sử dụng:
|
|
57
|
+
```powershell
|
|
58
|
+
cd your-project
|
|
59
|
+
ccsl
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Linux/macOS (Bash/Zsh)
|
|
63
|
+
|
|
64
|
+
Thêm vào `~/.bashrc` hoặc `~/.zshrc`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
alias ccsl='node /path/to/statusline-installer/cli.js init'
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Sau đó sử dụng:
|
|
71
|
+
```bash
|
|
72
|
+
cd your-project
|
|
73
|
+
ccsl
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 🎯 Sau khi cài đặt
|
|
79
|
+
|
|
80
|
+
Statusline sẽ tự động xuất hiện trong Claude Code với format:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Sonnet 4.5 | ▓▓░░░░░░░░ 18% | ⏱ 45m 30s | Plan: 37% used | Resets in 4h 12m | $1.0792 | +247 -15 | ⎇ main
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Thông tin hiển thị:
|
|
87
|
+
|
|
88
|
+
✅ **Model name** - Claude model đang sử dụng (Bold Cyan)
|
|
89
|
+
✅ **Context usage** - Thanh tiến trình + % (Green/Yellow/Red)
|
|
90
|
+
✅ **Session time** - Thời gian session (Blue)
|
|
91
|
+
✅ **Plan usage** - Mức sử dụng plan từ API (Green/Yellow/Red)
|
|
92
|
+
✅ **Reset time** - Thời gian reset (Magenta)
|
|
93
|
+
✅ **Cost** - Chi phí session (Yellow)
|
|
94
|
+
✅ **Code changes** - Dòng thêm/xóa (Green/Red)
|
|
95
|
+
✅ **Git branch** - Nhánh hiện tại (Cyan)
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 🔧 Cấu trúc files sau khi cài đặt
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
your-project/
|
|
103
|
+
├── .claude/
|
|
104
|
+
│ ├── statusline.js # Script statusline
|
|
105
|
+
│ └── settings.json # Cấu hình Claude Code
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**`.claude/settings.json`:**
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"statusLine": {
|
|
112
|
+
"type": "command",
|
|
113
|
+
"command": "node \"T:\\absolute\\path\\to\\project\\.claude\\statusline.js\"",
|
|
114
|
+
"padding": 0
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Lưu ý**: Installer tự động sử dụng đường dẫn tuyệt đối để đảm bảo statusline hoạt động chính xác.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 📚 Tính năng nâng cao
|
|
124
|
+
|
|
125
|
+
### 1. Plan Usage Limits
|
|
126
|
+
|
|
127
|
+
Hiển thị usage limits thời gian thực từ Anthropic API. Yêu cầu:
|
|
128
|
+
- Đã đăng nhập Claude Code
|
|
129
|
+
- Credentials tồn tại tại:
|
|
130
|
+
- **Windows**: `C:\Users\YourName\.claude\.credentials.json`
|
|
131
|
+
- **Linux/macOS**: `~/.claude/.credentials.json`
|
|
132
|
+
|
|
133
|
+
### 2. Dynamic Colors
|
|
134
|
+
|
|
135
|
+
Màu sắc thay đổi dựa trên giá trị:
|
|
136
|
+
- **Context < 40%**: Green (an toàn)
|
|
137
|
+
- **Context 40-70%**: Yellow (cảnh báo)
|
|
138
|
+
- **Context > 70%**: Red (nguy hiểm)
|
|
139
|
+
|
|
140
|
+
### 3. Caching
|
|
141
|
+
|
|
142
|
+
Usage limits được cache trong 5 phút để:
|
|
143
|
+
- Tránh gọi API quá nhiều
|
|
144
|
+
- Giảm latency
|
|
145
|
+
- Tiết kiệm API quota
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 🐛 Troubleshooting
|
|
150
|
+
|
|
151
|
+
### Statusline không hiển thị
|
|
152
|
+
|
|
153
|
+
1. Kiểm tra `.claude/statusline.js` tồn tại
|
|
154
|
+
2. Kiểm tra `.claude/settings.json` có config đúng
|
|
155
|
+
3. Restart Claude Code
|
|
156
|
+
|
|
157
|
+
### Plan usage không hiển thị
|
|
158
|
+
|
|
159
|
+
1. Kiểm tra đã đăng nhập Claude Code
|
|
160
|
+
2. Kiểm tra credentials file:
|
|
161
|
+
```bash
|
|
162
|
+
# Windows
|
|
163
|
+
type "%USERPROFILE%\.claude\.credentials.json"
|
|
164
|
+
|
|
165
|
+
# Linux/macOS
|
|
166
|
+
cat ~/.claude/.credentials.json
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Màu sắc không hiển thị
|
|
170
|
+
|
|
171
|
+
Đảm bảo terminal hỗ trợ ANSI colors (hầu hết terminal hiện đại đều hỗ trợ).
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 📖 Tài liệu thêm
|
|
176
|
+
|
|
177
|
+
- [README.md](./README.md) - Tài liệu đầy đủ
|
|
178
|
+
- [Claude Code Docs](https://code.claude.com/docs) - Tài liệu chính thức
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 💡 Tips
|
|
183
|
+
|
|
184
|
+
1. **Backup settings**: Installer tự động backup file cũ nếu đã tồn tại
|
|
185
|
+
2. **Multiple projects**: Chạy lại lệnh install cho mỗi project mới
|
|
186
|
+
3. **Update**: Chạy lại lệnh install để cập nhật lên version mới
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
**Enjoy your beautiful statusline! 🎨**
|
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Claude Code Statusline
|
|
2
|
+
|
|
3
|
+
Beautiful, feature-rich statusline for Claude Code with real-time usage limits, context tracking, and colorful display.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Beautiful colors** - ANSI colors for better readability
|
|
8
|
+
- 📊 **Usage limits** - Real-time plan usage from Anthropic API
|
|
9
|
+
- 📈 **Context tracking** - Visual progress bar for context window
|
|
10
|
+
- ⏱️ **Session time** - Track how long you've been coding
|
|
11
|
+
- 💰 **Cost tracking** - Monitor your session costs
|
|
12
|
+
- 📝 **Code changes** - Lines added and removed
|
|
13
|
+
- 🌿 **Git branch** - Current branch display
|
|
14
|
+
|
|
15
|
+
## Quick Install
|
|
16
|
+
|
|
17
|
+
### Method 1: Using npx (Recommended)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd your-project
|
|
21
|
+
npx claude-code-statusline init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Method 2: Using local path
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cd your-project
|
|
28
|
+
node /path/to/statusline-installer/cli.js init
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Method 3: Simple curl install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cd your-project
|
|
35
|
+
curl -o .claude/statusline.js https://raw.githubusercontent.com/your-repo/statusline.js
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## What you'll see
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Sonnet 4.5 | ▓▓░░░░░░░░ 18% | ⏱ 45m 30s | Plan: 37% used | Resets in 4h 12m | $1.0792 | +247 -15 | ⎇ main
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Color Breakdown
|
|
45
|
+
|
|
46
|
+
- **Model name**: Bold Cyan
|
|
47
|
+
- **Context bar**: Green (< 40%) / Yellow (40-70%) / Red (> 70%)
|
|
48
|
+
- **Session time**: Blue
|
|
49
|
+
- **Plan usage**: Green (< 50%) / Yellow (50-80%) / Red (> 80%)
|
|
50
|
+
- **Reset time**: Magenta
|
|
51
|
+
- **Cost**: Yellow
|
|
52
|
+
- **Lines added**: Green
|
|
53
|
+
- **Lines removed**: Red
|
|
54
|
+
- **Git branch**: Cyan
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
- Node.js >= 14.0.0
|
|
59
|
+
- Claude Code CLI installed
|
|
60
|
+
- Logged in to Claude Code (for usage limits feature)
|
|
61
|
+
|
|
62
|
+
## How it works
|
|
63
|
+
|
|
64
|
+
1. Reads session data from Claude Code via stdin (JSON format)
|
|
65
|
+
2. Fetches usage limits from Anthropic API (with 5-minute cache)
|
|
66
|
+
3. Formats everything with beautiful ANSI colors
|
|
67
|
+
4. Outputs a single-line statusline
|
|
68
|
+
|
|
69
|
+
## Configuration
|
|
70
|
+
|
|
71
|
+
After installation, your `.claude/settings.json` will contain:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"statusLine": {
|
|
76
|
+
"type": "command",
|
|
77
|
+
"command": "node \"T:\\absolute\\path\\to\\project\\.claude\\statusline.js\"",
|
|
78
|
+
"padding": 0
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Note**: The installer automatically uses absolute paths to ensure the statusline works correctly across all projects.
|
|
84
|
+
|
|
85
|
+
## Troubleshooting
|
|
86
|
+
|
|
87
|
+
### Statusline not showing
|
|
88
|
+
|
|
89
|
+
1. Check that `.claude/statusline.js` exists
|
|
90
|
+
2. Check that `.claude/settings.json` has the statusLine config
|
|
91
|
+
3. Restart Claude Code
|
|
92
|
+
|
|
93
|
+
### Usage limits not showing
|
|
94
|
+
|
|
95
|
+
1. Check that you're logged in to Claude Code
|
|
96
|
+
2. Check that credentials exist in `~/.claude/.credentials.json` (Linux/macOS) or `%USERPROFILE%\.claude\.credentials.json` (Windows)
|
|
97
|
+
3. The feature requires authentication with Anthropic API
|
|
98
|
+
|
|
99
|
+
### Colors not working
|
|
100
|
+
|
|
101
|
+
Make sure your terminal supports ANSI colors. Most modern terminals do.
|
|
102
|
+
|
|
103
|
+
## Uninstall
|
|
104
|
+
|
|
105
|
+
Remove the statusline configuration from `.claude/settings.json`:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Or manually edit .claude/settings.json to remove statusLine config
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
MIT
|
|
114
|
+
|
|
115
|
+
## Credits
|
|
116
|
+
|
|
117
|
+
- Inspired by [codelynx.dev's statusline](https://codelynx.dev/posts/claude-code-usage-limits-statusline)
|
|
118
|
+
- Built for the Claude Code community
|