ccstatusline 2.0.28 → 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 +127 -23
  2. package/dist/ccstatusline.js +28239 -27194
  3. package/package.json +1 -2
package/README.md CHANGED
@@ -46,8 +46,14 @@
46
46
 
47
47
  ## 🆕 Recent Updates
48
48
 
49
- ### v2.0.26 - v2.0.28 - Performance, git internals, and workflow improvements
49
+ ### v2.1.0 - Usage widgets and reliability fixes
50
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
+
54
+ ### v2.0.26 - v2.0.29 - Performance, git internals, and workflow improvements
55
+
56
+ - **🧠 Memory Usage widget (v2.0.29)** - Added a new widget that shows current system memory usage (`Mem: used/total`).
51
57
  - **⚡ Block timer cache (v2.0.28)** - Cache block timer metrics to reduce JSONL parsing on every render, with per-config hashed cache files and automatic 5-hour block invalidation.
52
58
  - **🧱 Git widget command refactor (v2.0.28)** - Refactored git widgets to use shared git command helpers and expanded coverage for failure and edge-case tests.
53
59
  - **🪟 Windows UTF-8 piped output fix (v2.0.28)** - Sets the Windows UTF-8 code page for piped status line rendering.
@@ -67,7 +73,7 @@
67
73
 
68
74
  ### v2.0.14 - Add remaining mode toggle to Context Percentage widgets
69
75
 
70
- - **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.
71
77
 
72
78
  ### v2.0.12 - Custom Text widget now supports emojis
73
79
 
@@ -136,6 +142,7 @@
136
142
  - **⚡ Powerline Support** - Beautiful Powerline-style rendering with arrow separators, caps, and custom fonts
137
143
  - **📐 Multi-line Support** - Configure multiple independent status lines
138
144
  - **🖥️ Interactive TUI** - Built-in configuration interface using React/Ink
145
+ - **🔎 Fast Widget Picker** - Add/change widgets by category with search and ranked matching
139
146
  - **⚙️ Global Options** - Apply consistent formatting across all widgets (padding, separators, bold, background)
140
147
  - **🚀 Cross-platform** - Works seamlessly with both Bun and Node.js
141
148
  - **🔧 Flexible Configuration** - Supports custom Claude Code config directory via `CLAUDE_CONFIG_DIR` environment variable
@@ -150,10 +157,10 @@
150
157
 
151
158
  ```bash
152
159
  # Run the configuration TUI with npm
153
- npx ccstatusline@latest
160
+ npx -y ccstatusline@latest
154
161
 
155
162
  # Or with Bun (faster)
156
- bunx ccstatusline@latest
163
+ bunx -y ccstatusline@latest
157
164
  ```
158
165
 
159
166
  ### Configure ccstatusline
@@ -178,6 +185,24 @@ The interactive configuration tool provides a terminal UI where you can:
178
185
  > $env:CLAUDE_CONFIG_DIR="C:\custom\path\.claude"
179
186
  > ```
180
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
+
181
206
  ---
182
207
 
183
208
  ## 🪟 Windows Support
@@ -192,13 +217,13 @@ ccstatusline works seamlessly on Windows with full feature compatibility across
192
217
  irm bun.sh/install.ps1 | iex
193
218
 
194
219
  # Run ccstatusline
195
- bunx ccstatusline@latest
220
+ bunx -y ccstatusline@latest
196
221
  ```
197
222
 
198
223
  #### Option 2: Using Node.js
199
224
  ```powershell
200
225
  # Using npm
201
- npx ccstatusline@latest
226
+ npx -y ccstatusline@latest
202
227
 
203
228
  # Or with Yarn
204
229
  yarn dlx ccstatusline@latest
@@ -259,7 +284,7 @@ winget install Git.Git
259
284
  **Issue**: Permission errors during installation
260
285
  ```powershell
261
286
  # Use non-global installation (recommended)
262
- npx ccstatusline@latest
287
+ npx -y ccstatusline@latest
263
288
 
264
289
  # Or run PowerShell as Administrator for global install
265
290
  ```
@@ -287,7 +312,7 @@ ccstatusline works perfectly in WSL environments:
287
312
  # Install in WSL Ubuntu/Debian
288
313
  curl -fsSL https://bun.sh/install | bash
289
314
  source ~/.bashrc
290
- bunx ccstatusline@latest
315
+ bunx -y ccstatusline@latest
291
316
  ```
292
317
 
293
318
  **WSL Benefits**:
@@ -324,14 +349,22 @@ Configure ccstatusline in your Claude Code settings:
324
349
  **For Bun users**:
325
350
  ```json
326
351
  {
327
- "statusLine": "bunx ccstatusline@latest"
352
+ "statusLine": {
353
+ "type": "command",
354
+ "command": "bunx -y ccstatusline@latest",
355
+ "padding": 0
356
+ }
328
357
  }
329
358
  ```
330
359
 
331
360
  **For npm users**:
332
361
  ```json
333
362
  {
334
- "statusLine": "npx ccstatusline@latest"
363
+ "statusLine": {
364
+ "type": "command",
365
+ "command": "npx -y ccstatusline@latest",
366
+ "padding": 0
367
+ }
335
368
  }
336
369
  ```
337
370
 
@@ -339,11 +372,10 @@ Configure ccstatusline in your Claude Code settings:
339
372
 
340
373
  ### Performance on Windows
341
374
 
342
- ccstatusline is optimized for Windows performance:
343
- - **Bun runtime**: Significantly faster startup times on Windows
344
- - **Caching**: Intelligent caching of git status and file operations
345
- - **Async operations**: Non-blocking command execution
346
- - **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
347
379
 
348
380
  ### Windows-Specific Widget Behavior
349
381
 
@@ -360,17 +392,35 @@ Some widgets have Windows-specific optimizations:
360
392
 
361
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.
362
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
+
363
408
  ### 📊 Available Widgets
364
409
 
365
410
  - **Model Name** - Shows the current Claude model (e.g., "Claude 3.5 Sonnet")
366
411
  - **Git Branch** - Displays current git branch name
367
412
  - **Git Changes** - Shows uncommitted insertions/deletions (e.g., "+42,-10")
413
+ - **Git Root Dir** - Shows the git repository root directory name
368
414
  - **Git Worktree** - Shows the name of the current git worktree
369
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
370
418
  - **Session Cost** - Shows total session cost in USD (e.g., "$1.23")
371
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
372
421
  - **Block Timer** - Shows time elapsed in current 5-hour block or progress bar
373
- - **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
374
424
  - **Version** - Shows Claude Code version
375
425
  - **Output Style** - Shows the currently set output style in Claude Code
376
426
  - **Tokens Input** - Shows input tokens used
@@ -378,13 +428,15 @@ Once configured, ccstatusline automatically formats your Claude Code status line
378
428
  - **Tokens Cached** - Shows cached tokens used
379
429
  - **Tokens Total** - Shows total tokens used
380
430
  - **Context Length** - Shows current context length in tokens
381
- - **Context Percentage** - Shows percentage of context limit used (dynamic: 1M for Sonnet 4.5 with `[1m]` suffix, 200k otherwise)
382
- - **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
383
434
  - **Terminal Width** - Shows detected terminal width (for debugging)
435
+ - **Memory Usage** - Shows system memory usage (used/total, e.g., "Mem: 12.4G/16.0G")
384
436
  - **Custom Text** - Add your own custom text to the status line
385
437
  - **Custom Command** - Execute shell commands and display their output (refreshes whenever the statusline is updated by Claude Code)
386
- - **Separator** - Visual divider between widgets (customizable: |, -, comma, space)
387
- - **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)
388
440
 
389
441
  ---
390
442
 
@@ -454,6 +506,23 @@ Some widgets support "raw value" mode which displays just the value without a la
454
506
  - Normal: `Block: 3hr 45m` → Raw: `3hr 45m`
455
507
  - Normal: `Ctx: 18.6k` → Raw: `18.6k`
456
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
+
457
526
  ---
458
527
 
459
528
  ### 🔧 Custom Widgets
@@ -470,6 +539,8 @@ Execute shell commands and display their output dynamically:
470
539
  - Receives the full Claude Code JSON data via stdin (model info, session ID, transcript path, etc.)
471
540
  - Displays command output inline in your status line
472
541
  - Configurable timeout (default: 1000ms)
542
+ - Optional max-width truncation
543
+ - Optional ANSI color preservation (`preserve colors`)
473
544
  - Examples:
474
545
  - `pwd | xargs basename` - Show current directory name
475
546
  - `node -v` - Display Node.js version
@@ -541,7 +612,7 @@ The documentation will be generated in the `docs/` directory and can be viewed b
541
612
 
542
613
  - [Bun](https://bun.sh) (v1.0+)
543
614
  - Git
544
- - Node.js 18+ (optional, for npm publishing)
615
+ - Node.js 14+ (optional, for running the built `dist/ccstatusline.js` binary or npm publishing)
545
616
 
546
617
  ### Setup
547
618
 
@@ -557,13 +628,38 @@ bun install
557
628
  ### Development Commands
558
629
 
559
630
  ```bash
560
- # Run in TUI mode (configuration)
561
- 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
562
642
 
563
643
  # Build for distribution
564
644
  bun run build
645
+
646
+ # Generate TypeDoc documentation
647
+ bun run docs
565
648
  ```
566
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
+
567
663
  ### 📁 Project Structure
568
664
 
569
665
  ```
@@ -614,6 +710,14 @@ Contributions are welcome! Please feel free to submit a Pull Request.
614
710
 
615
711
  ---
616
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
+
617
721
  ## 📄 License
618
722
 
619
723
  [MIT](LICENSE) © Matthew Breedlove