ccstatusline 2.0.29 → 2.1.1

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.
Files changed (3) hide show
  1. package/README.md +125 -22
  2. package/dist/ccstatusline.js +28253 -27286
  3. package/package.json +1 -2
package/README.md CHANGED
@@ -46,6 +46,12 @@
46
46
 
47
47
  ## 🆕 Recent Updates
48
48
 
49
+ ### v2.1.0 - v2.1.1 - Usage widgets and reliability fixes
50
+
51
+ - **🧩 New Usage widgets (v2.1.0)** - Added **Session Usage**, **Weekly Usage**, **Reset Timer**, and **Context Bar** widgets.
52
+ - **📊 More accurate counts (v2.1.0)** - Usage/context widgets now use new statusline JSON metrics when available for more accurate token and context counts.
53
+ - **🪟 Windows empty file bug fix (v2.1.1)** - Fixed a Windows issue that could create an empty `c:\dev\null` file.
54
+
49
55
  ### v2.0.26 - v2.0.29 - Performance, git internals, and workflow improvements
50
56
 
51
57
  - **🧠 Memory Usage widget (v2.0.29)** - Added a new widget that shows current system memory usage (`Mem: used/total`).
@@ -68,7 +74,7 @@
68
74
 
69
75
  ### v2.0.14 - Add remaining mode toggle to Context Percentage widgets
70
76
 
71
- - **Remaining Mode** - You can now toggle the Context Percentage widgets between usage percentage and remaining percentage when configuring them in the TUI by pressing the 'l' key.
77
+ - **Remaining Mode** - You can now toggle the Context Percentage widgets between usage percentage and remaining percentage when configuring them in the TUI by pressing the 'u' key.
72
78
 
73
79
  ### v2.0.12 - Custom Text widget now supports emojis
74
80
 
@@ -137,6 +143,7 @@
137
143
  - **⚡ Powerline Support** - Beautiful Powerline-style rendering with arrow separators, caps, and custom fonts
138
144
  - **📐 Multi-line Support** - Configure multiple independent status lines
139
145
  - **🖥️ Interactive TUI** - Built-in configuration interface using React/Ink
146
+ - **🔎 Fast Widget Picker** - Add/change widgets by category with search and ranked matching
140
147
  - **⚙️ Global Options** - Apply consistent formatting across all widgets (padding, separators, bold, background)
141
148
  - **🚀 Cross-platform** - Works seamlessly with both Bun and Node.js
142
149
  - **🔧 Flexible Configuration** - Supports custom Claude Code config directory via `CLAUDE_CONFIG_DIR` environment variable
@@ -151,10 +158,10 @@
151
158
 
152
159
  ```bash
153
160
  # Run the configuration TUI with npm
154
- npx ccstatusline@latest
161
+ npx -y ccstatusline@latest
155
162
 
156
163
  # Or with Bun (faster)
157
- bunx ccstatusline@latest
164
+ bunx -y ccstatusline@latest
158
165
  ```
159
166
 
160
167
  ### Configure ccstatusline
@@ -179,6 +186,24 @@ The interactive configuration tool provides a terminal UI where you can:
179
186
  > $env:CLAUDE_CONFIG_DIR="C:\custom\path\.claude"
180
187
  > ```
181
188
 
189
+ ### Claude Code settings.json format
190
+
191
+ When you install from the TUI, ccstatusline writes a `statusLine` command object to your Claude Code settings:
192
+
193
+ ```json
194
+ {
195
+ "statusLine": {
196
+ "type": "command",
197
+ "command": "npx -y ccstatusline@latest",
198
+ "padding": 0
199
+ }
200
+ }
201
+ ```
202
+
203
+ Other supported command values are:
204
+ - `bunx -y ccstatusline@latest`
205
+ - `ccstatusline` (for self-managed/global installs)
206
+
182
207
  ---
183
208
 
184
209
  ## 🪟 Windows Support
@@ -193,13 +218,13 @@ ccstatusline works seamlessly on Windows with full feature compatibility across
193
218
  irm bun.sh/install.ps1 | iex
194
219
 
195
220
  # Run ccstatusline
196
- bunx ccstatusline@latest
221
+ bunx -y ccstatusline@latest
197
222
  ```
198
223
 
199
224
  #### Option 2: Using Node.js
200
225
  ```powershell
201
226
  # Using npm
202
- npx ccstatusline@latest
227
+ npx -y ccstatusline@latest
203
228
 
204
229
  # Or with Yarn
205
230
  yarn dlx ccstatusline@latest
@@ -260,7 +285,7 @@ winget install Git.Git
260
285
  **Issue**: Permission errors during installation
261
286
  ```powershell
262
287
  # Use non-global installation (recommended)
263
- npx ccstatusline@latest
288
+ npx -y ccstatusline@latest
264
289
 
265
290
  # Or run PowerShell as Administrator for global install
266
291
  ```
@@ -288,7 +313,7 @@ ccstatusline works perfectly in WSL environments:
288
313
  # Install in WSL Ubuntu/Debian
289
314
  curl -fsSL https://bun.sh/install | bash
290
315
  source ~/.bashrc
291
- bunx ccstatusline@latest
316
+ bunx -y ccstatusline@latest
292
317
  ```
293
318
 
294
319
  **WSL Benefits**:
@@ -325,14 +350,22 @@ Configure ccstatusline in your Claude Code settings:
325
350
  **For Bun users**:
326
351
  ```json
327
352
  {
328
- "statusLine": "bunx ccstatusline@latest"
353
+ "statusLine": {
354
+ "type": "command",
355
+ "command": "bunx -y ccstatusline@latest",
356
+ "padding": 0
357
+ }
329
358
  }
330
359
  ```
331
360
 
332
361
  **For npm users**:
333
362
  ```json
334
363
  {
335
- "statusLine": "npx ccstatusline@latest"
364
+ "statusLine": {
365
+ "type": "command",
366
+ "command": "npx -y ccstatusline@latest",
367
+ "padding": 0
368
+ }
336
369
  }
337
370
  ```
338
371
 
@@ -340,11 +373,10 @@ Configure ccstatusline in your Claude Code settings:
340
373
 
341
374
  ### Performance on Windows
342
375
 
343
- ccstatusline is optimized for Windows performance:
344
- - **Bun runtime**: Significantly faster startup times on Windows
345
- - **Caching**: Intelligent caching of git status and file operations
346
- - **Async operations**: Non-blocking command execution
347
- - **Memory efficient**: Minimal resource usage
376
+ ccstatusline includes Windows-specific runtime behavior:
377
+ - **UTF-8 piped output fix**: In piped mode, it attempts to set code page `65001` for reliable symbol rendering
378
+ - **Path compatibility**: Git and CWD widgets handle both `/` and `\` separators
379
+ - **Block timer cache**: Cached block metrics reduce repeated JSONL scanning
348
380
 
349
381
  ### Windows-Specific Widget Behavior
350
382
 
@@ -361,17 +393,35 @@ Some widgets have Windows-specific optimizations:
361
393
 
362
394
  Once configured, ccstatusline automatically formats your Claude Code status line. The status line appears at the bottom of your terminal during Claude Code sessions.
363
395
 
396
+ ### Runtime Modes
397
+
398
+ - **Interactive mode (TUI)**: Launches when there is no stdin input
399
+ - **Piped mode (renderer)**: Parses Claude Code status JSON from stdin and prints one or more formatted lines
400
+
401
+ ```bash
402
+ # Interactive TUI
403
+ bun run start
404
+
405
+ # Piped mode with example payload
406
+ bun run example
407
+ ```
408
+
364
409
  ### 📊 Available Widgets
365
410
 
366
411
  - **Model Name** - Shows the current Claude model (e.g., "Claude 3.5 Sonnet")
367
412
  - **Git Branch** - Displays current git branch name
368
413
  - **Git Changes** - Shows uncommitted insertions/deletions (e.g., "+42,-10")
414
+ - **Git Root Dir** - Shows the git repository root directory name
369
415
  - **Git Worktree** - Shows the name of the current git worktree
370
416
  - **Session Clock** - Shows elapsed time since session start (e.g., "2hr 15m")
417
+ - **Session Usage** - Shows current 5-hour/session API usage percentage
418
+ - **Weekly Usage** - Shows rolling 7-day API usage percentage
371
419
  - **Session Cost** - Shows total session cost in USD (e.g., "$1.23")
372
420
  - **Session Name** - Shows the session name set via `/rename` command in Claude Code
421
+ - **Claude Session ID** - Shows the current Claude Code session ID from status JSON
373
422
  - **Block Timer** - Shows time elapsed in current 5-hour block or progress bar
374
- - **Current Working Directory** - Shows current working directory with configurable path segments
423
+ - **Reset Timer** - Shows time remaining until the current 5-hour block resets
424
+ - **Current Working Directory** - Shows current working directory with segment limit, fish-style abbreviation, and optional `~` home abbreviation
375
425
  - **Version** - Shows Claude Code version
376
426
  - **Output Style** - Shows the currently set output style in Claude Code
377
427
  - **Tokens Input** - Shows input tokens used
@@ -379,14 +429,15 @@ Once configured, ccstatusline automatically formats your Claude Code status line
379
429
  - **Tokens Cached** - Shows cached tokens used
380
430
  - **Tokens Total** - Shows total tokens used
381
431
  - **Context Length** - Shows current context length in tokens
382
- - **Context Percentage** - Shows percentage of context limit used (dynamic: 1M for Sonnet 4.5 with `[1m]` suffix, 200k otherwise)
383
- - **Context Percentage (usable)** - Shows percentage of usable context (dynamic: 800k for Sonnet 4.5 with `[1m]` suffix, 160k otherwise, accounting for auto-compact at 80%)
432
+ - **Context Percentage** - Shows percentage of context limit used (dynamic: 1M for model IDs with `[1m]` suffix, 200k otherwise)
433
+ - **Context Percentage (usable)** - Shows percentage of usable context (dynamic: 800k for model IDs with `[1m]` suffix, 160k otherwise, accounting for auto-compact at 80%)
434
+ - **Context Bar** - Shows context usage as a progress bar with short/full display modes
384
435
  - **Terminal Width** - Shows detected terminal width (for debugging)
385
436
  - **Memory Usage** - Shows system memory usage (used/total, e.g., "Mem: 12.4G/16.0G")
386
437
  - **Custom Text** - Add your own custom text to the status line
387
438
  - **Custom Command** - Execute shell commands and display their output (refreshes whenever the statusline is updated by Claude Code)
388
- - **Separator** - Visual divider between widgets (customizable: |, -, comma, space)
389
- - **Flex Separator** - Expands to fill available space
439
+ - **Separator** - Visual divider between widgets (customizable: |, -, comma, space; available when Powerline mode is off and no default separator is configured)
440
+ - **Flex Separator** - Expands to fill available space (available when Powerline mode is off)
390
441
 
391
442
  ---
392
443
 
@@ -456,6 +507,23 @@ Some widgets support "raw value" mode which displays just the value without a la
456
507
  - Normal: `Block: 3hr 45m` → Raw: `3hr 45m`
457
508
  - Normal: `Ctx: 18.6k` → Raw: `18.6k`
458
509
 
510
+ ### ⌨️ Widget Editor Keybinds
511
+
512
+ Common controls in the line editor:
513
+ - `a` add widget
514
+ - `i` insert widget
515
+ - `Enter` enter/exit move mode
516
+ - `d` delete selected widget
517
+ - `r` toggle raw value (supported widgets)
518
+ - `m` cycle merge mode (`off` → `merge` → `merge no padding`)
519
+
520
+ Widget-specific shortcuts:
521
+ - **Git widgets**: `h` toggle hide `no git` output
522
+ - **Context % widgets**: `u` toggle used vs remaining display
523
+ - **Block Timer**: `p` cycle display mode (time/full bar/short bar)
524
+ - **Current Working Dir**: `h` home abbreviation, `s` segment editor, `f` fish-style path
525
+ - **Custom Command**: `e` command, `w` max width, `t` timeout, `p` preserve ANSI colors
526
+
459
527
  ---
460
528
 
461
529
  ### 🔧 Custom Widgets
@@ -472,6 +540,8 @@ Execute shell commands and display their output dynamically:
472
540
  - Receives the full Claude Code JSON data via stdin (model info, session ID, transcript path, etc.)
473
541
  - Displays command output inline in your status line
474
542
  - Configurable timeout (default: 1000ms)
543
+ - Optional max-width truncation
544
+ - Optional ANSI color preservation (`preserve colors`)
475
545
  - Examples:
476
546
  - `pwd | xargs basename` - Show current directory name
477
547
  - `node -v` - Display Node.js version
@@ -543,7 +613,7 @@ The documentation will be generated in the `docs/` directory and can be viewed b
543
613
 
544
614
  - [Bun](https://bun.sh) (v1.0+)
545
615
  - Git
546
- - Node.js 18+ (optional, for npm publishing)
616
+ - Node.js 14+ (optional, for running the built `dist/ccstatusline.js` binary or npm publishing)
547
617
 
548
618
  ### Setup
549
619
 
@@ -559,13 +629,38 @@ bun install
559
629
  ### Development Commands
560
630
 
561
631
  ```bash
562
- # Run in TUI mode (configuration)
563
- bun run src/ccstatusline.ts
632
+ # Run in TUI mode
633
+ bun run start
634
+
635
+ # Test piped mode with example payload
636
+ bun run example
637
+
638
+ # Run tests
639
+ bun test
640
+
641
+ # Run typecheck + eslint autofix
642
+ bun run lint
564
643
 
565
644
  # Build for distribution
566
645
  bun run build
646
+
647
+ # Generate TypeDoc documentation
648
+ bun run docs
567
649
  ```
568
650
 
651
+ ### Configuration Files
652
+
653
+ - `~/.config/ccstatusline/settings.json` - ccstatusline UI/render settings
654
+ - `~/.claude/settings.json` - Claude Code settings (`statusLine` command object)
655
+ - `~/.cache/ccstatusline/block-cache-*.json` - block timer cache (keyed by Claude config directory hash)
656
+
657
+ If you use a custom Claude config location, set `CLAUDE_CONFIG_DIR` and ccstatusline will read/write that path instead of `~/.claude`.
658
+
659
+ ### Build Notes
660
+
661
+ - Build target is Node.js 14+ (`dist/ccstatusline.js`)
662
+ - During install, `ink@6.2.0` is patched to fix backspace handling on macOS terminals
663
+
569
664
  ### 📁 Project Structure
570
665
 
571
666
  ```
@@ -616,6 +711,14 @@ Contributions are welcome! Please feel free to submit a Pull Request.
616
711
 
617
712
  ---
618
713
 
714
+ ## Support
715
+
716
+ If ccstatusline is useful to you, consider buying me a coffee:
717
+
718
+ <a href="https://www.buymeacoffee.com/sirmalloc" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
719
+
720
+ ---
721
+
619
722
  ## 📄 License
620
723
 
621
724
  [MIT](LICENSE) © Matthew Breedlove