@chongdashu/cc-statusline 1.3.2 → 1.4.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/CHANGELOG.md +184 -157
- package/CLAUDE.md +76 -76
- package/CONTRIBUTING.md +207 -207
- package/LICENSE +20 -20
- package/README.md +361 -373
- package/dist/index.js +102 -73
- package/dist/index.js.map +1 -1
- package/package.json +57 -57
- package/test/test-concurrent-locking.sh +54 -54
- package/test/test-installation.sh +335 -335
- package/test/test-statusline-with-lock.sh +67 -67
package/README.md
CHANGED
|
@@ -1,374 +1,362 @@
|
|
|
1
|
-
# cc-statusline
|
|
2
|
-
|
|
3
|
-
<div align="center">
|
|
4
|
-
|
|
5
|
-
**A beautiful, informative statusline for Claude Code**
|
|
6
|
-
|
|
7
|
-
<img src="docs/images/cc-statusline.png" alt="cc-statusline in action" width="600">
|
|
8
|
-
|
|
9
|
-
*Real-time directory, git branch, model info, costs, and session time tracking*
|
|
10
|
-
|
|
11
|
-
[](https://www.npmjs.com/package/@chongdashu/cc-statusline)
|
|
12
|
-
[](https://opensource.org/licenses/MIT)
|
|
13
|
-
[](https://nodejs.org/)
|
|
14
|
-
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
###
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
**
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
**
|
|
307
|
-
```bash
|
|
308
|
-
#
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
See [CHANGELOG.md](CHANGELOG.md) for detailed release history.
|
|
363
|
-
|
|
364
|
-
## 📄 License
|
|
365
|
-
|
|
366
|
-
MIT License - see [LICENSE](LICENSE) file for details.
|
|
367
|
-
|
|
368
|
-
---
|
|
369
|
-
|
|
370
|
-
<div align="center">
|
|
371
|
-
|
|
372
|
-
**Made by [Chong-U](https://github.com/chongdashu) @ [AIOriented](https://aioriented.dev)**
|
|
373
|
-
|
|
1
|
+
# cc-statusline
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**A beautiful, informative statusline for Claude Code**
|
|
6
|
+
|
|
7
|
+
<img src="docs/images/cc-statusline.png" alt="cc-statusline in action" width="600">
|
|
8
|
+
|
|
9
|
+
*Real-time directory, git branch, model info, costs, and session time tracking*
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/@chongdashu/cc-statusline)
|
|
12
|
+
[](https://opensource.org/licenses/MIT)
|
|
13
|
+
[](https://nodejs.org/)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
## ⚡ Quick Start
|
|
18
|
+
|
|
19
|
+
**One command. Three questions. Custom statusline.**
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx @chongdashu/cc-statusline@latest init
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
That's it! Answer a few simple questions, restart Claude Code, and enjoy your new statusline.
|
|
26
|
+
|
|
27
|
+
## 📋 Prerequisites
|
|
28
|
+
|
|
29
|
+
### Required
|
|
30
|
+
- **Node.js 16+** - Required for the CLI tool
|
|
31
|
+
- **Claude Code** - The tool you're already using
|
|
32
|
+
|
|
33
|
+
### Strongly Recommended
|
|
34
|
+
- **jq** - JSON processor for advanced features (see installation guide below)
|
|
35
|
+
- Required for: context tracking, token stats, session timer
|
|
36
|
+
- Without jq: basic features still work with fallback parser
|
|
37
|
+
|
|
38
|
+
> **Without jq, your statusline will have LIMITED functionality:**
|
|
39
|
+
> - ❌ No context remaining percentage
|
|
40
|
+
> - ❌ No token statistics from ccusage
|
|
41
|
+
> - ❌ No session timer
|
|
42
|
+
> - ⚠️ Basic fallback parser is used (less reliable)
|
|
43
|
+
|
|
44
|
+
#### macOS
|
|
45
|
+
```bash
|
|
46
|
+
brew install jq
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### Linux
|
|
50
|
+
```bash
|
|
51
|
+
# Ubuntu/Debian
|
|
52
|
+
sudo apt-get install jq
|
|
53
|
+
|
|
54
|
+
# CentOS/RHEL/Fedora
|
|
55
|
+
sudo yum install jq
|
|
56
|
+
|
|
57
|
+
# Arch Linux
|
|
58
|
+
sudo pacman -S jq
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Windows 10/11
|
|
62
|
+
|
|
63
|
+
**Option 1: Package Manager (Recommended)**
|
|
64
|
+
```bash
|
|
65
|
+
# Chocolatey
|
|
66
|
+
choco install jq
|
|
67
|
+
|
|
68
|
+
# Scoop
|
|
69
|
+
scoop install jq
|
|
70
|
+
|
|
71
|
+
# Winget
|
|
72
|
+
winget install jqlang.jq
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Option 2: Manual Download**
|
|
76
|
+
1. Go to https://github.com/jqlang/jq/releases/latest
|
|
77
|
+
2. Download:
|
|
78
|
+
- **64-bit**: `jq-windows-amd64.exe`
|
|
79
|
+
- **32-bit**: `jq-windows-i386.exe`
|
|
80
|
+
3. Rename to `jq.exe`
|
|
81
|
+
4. Place in `C:\Windows\System32\` (requires admin) or add to PATH
|
|
82
|
+
5. Test: `jq --version`
|
|
83
|
+
|
|
84
|
+
### Verify Installation
|
|
85
|
+
```bash
|
|
86
|
+
jq --version
|
|
87
|
+
# Should output: jq-1.6 or higher
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Optional
|
|
91
|
+
- **git** - For branch display (you probably have this)
|
|
92
|
+
- **ccusage** - For usage stats (works via `npx` - no install needed)
|
|
93
|
+
|
|
94
|
+
## 🎯 Simple Setup
|
|
95
|
+
|
|
96
|
+
<img src="docs/images/cc-statusline-init.gif" alt="Demo of cc-statusline setup" width="500">
|
|
97
|
+
|
|
98
|
+
## ✨ What You Get
|
|
99
|
+
|
|
100
|
+
Enhance your Claude Code terminal with useful information:
|
|
101
|
+
|
|
102
|
+
- **📁 Directory Display** - Current folder with `~` abbreviation
|
|
103
|
+
- **🌿 Git Integration** - Current branch name
|
|
104
|
+
- **🤖 Model Info** - Shows which Claude model you're using plus Claude Code version
|
|
105
|
+
- **🧠 Context Usage** - Real-time context window usage with progress bars **(requires jq)**
|
|
106
|
+
- **💰 Cost Tracking** - Live cost monitoring with burn rates via ccusage **(partial without jq)**
|
|
107
|
+
- **⌛ Session Timer** - Time remaining until usage limit resets **(requires jq)**
|
|
108
|
+
- **📊 Token Analytics** - Token consumption and burn rate metrics **(requires jq)**
|
|
109
|
+
- **🎨 Color Support** - 256-color palette for Claude Code terminals
|
|
110
|
+
- **⚡ Fast Execution** - Optimized bash script with <100ms execution time
|
|
111
|
+
|
|
112
|
+
## 🎛️ Features Overview
|
|
113
|
+
|
|
114
|
+
### 🆕 Installation Options (v1.2.4+)
|
|
115
|
+
- **🏠 Global Installation** (`~/.claude/`) - Use across all your projects
|
|
116
|
+
- **📂 Project Installation** (`./.claude/`) - Keep settings project-specific
|
|
117
|
+
|
|
118
|
+
### 🔥 Default Features (All Pre-selected in v1.2.2+)
|
|
119
|
+
| Feature | Description | Example |
|
|
120
|
+
|---------|-------------|---------|
|
|
121
|
+
| 📁 **Directory** | Current working directory | `~/my-project` |
|
|
122
|
+
| 🌿 **Git Branch** | Active git branch | `feature/statusline` |
|
|
123
|
+
| 🤖 **Model** | Claude model name & version | `Sonnet 4` |
|
|
124
|
+
| 📟 **Claude Code** | Claude Code version | `v1.0.85` |
|
|
125
|
+
| 🎨 **Output Style** | Current output style setting | `default` |
|
|
126
|
+
| 🧠 **Context** | Remaining context with progress bar | `83% [========--]` |
|
|
127
|
+
| 💰 **Cost** | Live costs with highlighted burn rate | `$49.00 ($16.55/h)` |
|
|
128
|
+
| ⌛ **Session** | Time until reset with progress | `3h 7m until reset at 01:00 (37%) [===-------]` |
|
|
129
|
+
|
|
130
|
+
### 🚀 Power Features (Also Pre-selected)
|
|
131
|
+
| Feature | Description | Example |
|
|
132
|
+
|---------|-------------|---------|
|
|
133
|
+
| 📊 **Tokens** | Token consumption with burn rate | `14638846 tok (279900 tpm)` |
|
|
134
|
+
|
|
135
|
+
### 🎨 Example Outputs
|
|
136
|
+
|
|
137
|
+
**New 3-Line Modern Layout (v1.2.2+):**
|
|
138
|
+
```
|
|
139
|
+
📁 ~/Projects/cc-statusline 🌿 feature/context-usage-output-styles 🤖 Sonnet 4 📟 v1.0.85 🎨 default
|
|
140
|
+
🧠 Context Remaining: 83% [========--] ⌛ 3h 7m until reset at 01:00 (37%) [===-------]
|
|
141
|
+
💰 $49.00 ($16.55/h) 📊 14638846 tok (279900 tpm)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Compact Mode:**
|
|
145
|
+
```
|
|
146
|
+
📁 ~/my-app 🌿 main 🤖 Claude Sonnet 📟 v1.0.85
|
|
147
|
+
🧠 Context Remaining: 95% [=========-]
|
|
148
|
+
💰 $2.48 ($12.50/h)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 🛠️ Advanced Usage
|
|
152
|
+
|
|
153
|
+
### Preview Your Statusline
|
|
154
|
+
Test your statusline before restarting Claude Code:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
cc-statusline preview .claude/statusline.sh
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**What preview does:**
|
|
161
|
+
1. 📄 **Loads** your actual statusline script
|
|
162
|
+
2. 🧪 **Runs** it with realistic mock data
|
|
163
|
+
3. 📊 **Shows** exactly what the output will look like
|
|
164
|
+
4. ⚡ **Reports** performance metrics and functionality
|
|
165
|
+
|
|
166
|
+
### Installation Safety Features (v1.2.4+)
|
|
167
|
+
- 🔒 **Safe Updates** - Never overwrites existing statuslines without confirmation
|
|
168
|
+
- 🛡️ **Settings Protection** - Preserves your existing settings.json configurations
|
|
169
|
+
- ⚠️ **Conflict Detection** - Warns when other statuslines are configured
|
|
170
|
+
- ✅ **Smart Defaults** - Project-level installation by default for safety
|
|
171
|
+
|
|
172
|
+
### Custom Installation
|
|
173
|
+
```bash
|
|
174
|
+
# Generate to custom location
|
|
175
|
+
cc-statusline init --output ./my-statusline.sh
|
|
176
|
+
|
|
177
|
+
# Skip auto-installation (manual setup)
|
|
178
|
+
cc-statusline init --no-install
|
|
179
|
+
|
|
180
|
+
# Global installation for convenience
|
|
181
|
+
npm install -g @chongdashu/cc-statusline
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## 🔧 How It Works
|
|
185
|
+
|
|
186
|
+
### How It Works
|
|
187
|
+
|
|
188
|
+
1. **🎯 Configuration** - Two questions configure your preferences
|
|
189
|
+
2. **🏗️ Generation** - Creates optimized bash script tailored to your needs
|
|
190
|
+
3. **⚙️ Installation** - Integrates with Claude Code settings
|
|
191
|
+
4. **🔄 Updates** - Connects to ccusage for live usage statistics
|
|
192
|
+
|
|
193
|
+
### Technical Architecture
|
|
194
|
+
|
|
195
|
+
- **⚡ Bash-First** - Native shell execution for maximum speed
|
|
196
|
+
- **🎨 Claude Code Optimized** - Forces colors for Claude Code terminals (respects NO_COLOR)
|
|
197
|
+
- **🌍 Environment Respect** - Honors `NO_COLOR` and other terminal conventions
|
|
198
|
+
- **📦 Zero Dependencies** - Self-contained script with graceful fallbacks
|
|
199
|
+
- **🔒 Secure** - No network requests except ccusage integration
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
## 📂 File Structure
|
|
204
|
+
|
|
205
|
+
After installation, you'll have a clean setup:
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
.claude/
|
|
209
|
+
├── statusline.sh # 🎯 Your generated statusline script
|
|
210
|
+
└── settings.json # ⚙️ Auto-updated Claude Code configuration
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Manual Configuration (Backup Plan)
|
|
214
|
+
|
|
215
|
+
If auto-configuration fails, simply add this to `.claude/settings.json`:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"statusLine": {
|
|
220
|
+
"type": "command",
|
|
221
|
+
"command": ".claude/statusline.sh",
|
|
222
|
+
"padding": 0
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 🔧 Troubleshooting
|
|
228
|
+
|
|
229
|
+
### 🚫 Statusline Not Showing
|
|
230
|
+
1. **Restart Claude Code** after installation
|
|
231
|
+
2. **Verify settings** - Check `.claude/settings.json` contains the configuration above
|
|
232
|
+
3. **Check permissions** - Ensure script is executable: `chmod +x .claude/statusline.sh`
|
|
233
|
+
|
|
234
|
+
### 🐌 Performance Issues
|
|
235
|
+
- **Test performance**: `cc-statusline preview .claude/statusline.sh`
|
|
236
|
+
- **Optimize features**: Disable heavy features if execution > 500ms
|
|
237
|
+
- **Disable ccusage**: Remove usage tracking if not needed
|
|
238
|
+
|
|
239
|
+
### 🧩 Missing Features
|
|
240
|
+
- **Install jq**: See the jq installation guide below
|
|
241
|
+
- **ccusage setup**: Works automatically via `npx ccusage@latest`
|
|
242
|
+
- **Git not found**: Install git for branch display
|
|
243
|
+
- **Context not showing**: Ensure you're in an active Claude Code session with context usage
|
|
244
|
+
- **Colors not working**: Check that NO_COLOR environment variable is not set
|
|
245
|
+
|
|
246
|
+
## 🚀 Performance
|
|
247
|
+
|
|
248
|
+
| Metric | Target | Typical |
|
|
249
|
+
|--------|--------|---------|
|
|
250
|
+
| **Execution Time** | <100ms | 45-80ms |
|
|
251
|
+
| **Memory Usage** | <5MB | ~2MB |
|
|
252
|
+
| **CPU Impact** | Negligible | <1% |
|
|
253
|
+
| **Dependencies** | Minimal | jq only |
|
|
254
|
+
|
|
255
|
+
*Benchmarked on macOS with all features enabled*
|
|
256
|
+
|
|
257
|
+
## 🤝 Contributing
|
|
258
|
+
|
|
259
|
+
Contributions are welcome!
|
|
260
|
+
|
|
261
|
+
**Quick Start:**
|
|
262
|
+
```bash
|
|
263
|
+
git clone https://github.com/chongdashu/cc-statusline
|
|
264
|
+
cd cc-statusline
|
|
265
|
+
npm install && npm run build
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Contribution Areas:**
|
|
269
|
+
- 🐛 **Bug Fixes** - Help make it more robust
|
|
270
|
+
- ✨ **New Features** - Add support for more runtimes/features
|
|
271
|
+
- 📚 **Documentation** - Improve guides and examples
|
|
272
|
+
- 🧪 **Testing** - Add test coverage and edge cases
|
|
273
|
+
|
|
274
|
+
See our [Contributing Guide](CONTRIBUTING.md) for detailed information.
|
|
275
|
+
|
|
276
|
+
## 🧪 Testing
|
|
277
|
+
|
|
278
|
+
### Locking Mechanism Tests
|
|
279
|
+
|
|
280
|
+
The ccusage integration includes a robust file-based locking mechanism to prevent concurrent process spawning. Test this functionality:
|
|
281
|
+
|
|
282
|
+
**Single Test:**
|
|
283
|
+
```bash
|
|
284
|
+
echo '{}' | ./test/test-statusline-with-lock.sh
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Concurrent Test:**
|
|
288
|
+
```bash
|
|
289
|
+
./test/test-concurrent-locking.sh
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Manual Concurrent Test:**
|
|
293
|
+
```bash
|
|
294
|
+
# Spawn 10 concurrent processes
|
|
295
|
+
for i in {1..10}; do
|
|
296
|
+
echo '{}' | ./test/test-statusline-with-lock.sh &
|
|
297
|
+
done
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Expected Behavior:**
|
|
301
|
+
- ✅ Only 1 process runs ccusage at a time
|
|
302
|
+
- ✅ Other processes skip gracefully (no pile-up)
|
|
303
|
+
- ✅ Lock files are properly cleaned up
|
|
304
|
+
- ✅ No hanging processes remain
|
|
305
|
+
|
|
306
|
+
**Verification Commands:**
|
|
307
|
+
```bash
|
|
308
|
+
# Check for stale locks
|
|
309
|
+
ls /tmp/ccusage_statusline.* 2>/dev/null || echo "✅ No locks remain"
|
|
310
|
+
|
|
311
|
+
# Monitor running processes
|
|
312
|
+
ps aux | grep ccusage | grep -v grep
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## 📊 Stats
|
|
316
|
+
|
|
317
|
+
<div align="center">
|
|
318
|
+
|
|
319
|
+

|
|
320
|
+

|
|
321
|
+

|
|
322
|
+
|
|
323
|
+
</div>
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
## 🔗 Related Projects
|
|
328
|
+
|
|
329
|
+
- **[ccusage](https://github.com/ryoppippi/ccusage)** - Claude Code usage analytics (would not be possible with it!)
|
|
330
|
+
- **[Claude Code](https://docs.anthropic.com/en/docs/claude-code)** - Official documentation
|
|
331
|
+
|
|
332
|
+
## 👥 Contributors
|
|
333
|
+
|
|
334
|
+
We're grateful for all contributions that make cc-statusline better!
|
|
335
|
+
|
|
336
|
+
- **[Jonathan Borgwing (@DevVig)](https://github.com/DevVig)** - Critical performance fix for infinite ccusage process spawning ([#4](https://github.com/chongdashu/cc-statusline/pull/4))
|
|
337
|
+
|
|
338
|
+
### How to Contribute
|
|
339
|
+
|
|
340
|
+
Want to see your name here? Check out our [Contributing Guide](CONTRIBUTING.md) and help make cc-statusline even better!
|
|
341
|
+
|
|
342
|
+
We welcome:
|
|
343
|
+
- 🐛 Bug fixes and performance improvements
|
|
344
|
+
- ✨ New features and enhancements
|
|
345
|
+
- 📚 Documentation improvements
|
|
346
|
+
- 🧪 Test coverage and quality assurance
|
|
347
|
+
|
|
348
|
+
## 📝 Changelog
|
|
349
|
+
|
|
350
|
+
See [CHANGELOG.md](CHANGELOG.md) for detailed release history.
|
|
351
|
+
|
|
352
|
+
## 📄 License
|
|
353
|
+
|
|
354
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
<div align="center">
|
|
359
|
+
|
|
360
|
+
**Made by [Chong-U](https://github.com/chongdashu) @ [AIOriented](https://aioriented.dev)**
|
|
361
|
+
|
|
374
362
|
</div>
|