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