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