cc-api-statusline 0.1.3 → 0.1.9

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
@@ -9,10 +9,11 @@ A high-performance TUI statusline tool that polls API usage data from Claude API
9
9
  - ⚡ **Fast piped mode** — <25ms warm cache, <100ms p95
10
10
  - 🎨 **Highly configurable** — Layouts, colors, bar styles, display modes
11
11
  - 🔌 **Provider autodetection** — Works with sub2api, claude-relay-service, custom providers
12
- - 💾 **Smart caching** — Disk cache with atomic writes, TTL validation
12
+ - 💾 **Smart caching** — Disk cache with atomic writes, TTL validation, automatic garbage collection
13
13
  - 🎯 **Claude Code integration** — Auto-setup with `--install` command
14
14
  - 📊 **Multiple components** — Daily/weekly/monthly quotas, balance, tokens, rate limits
15
15
  - 🐛 **Debug logging** — Detailed execution logs for troubleshooting
16
+ - 🔒 **Reliability** — No stale data display, race-condition-free writes, auto cache cleanup
16
17
 
17
18
  ## Installation
18
19
 
@@ -418,9 +419,16 @@ Cache validation:
418
419
  - Version match
419
420
  - Token hash match
420
421
 
422
+ Cache garbage collection:
423
+ - Automatic cleanup after successful cache writes
424
+ - Deletes cache files older than 7 days
425
+ - Maintains maximum of 20 cache files (deletes oldest)
426
+ - Removes orphaned temporary files older than 1 hour
427
+ - Best-effort operation (never blocks or throws)
428
+
421
429
  Exit code behavior:
422
- - Returns `0` when stale cache is shown with error indicators (output is still useful)
423
- - Returns `1` only when no data can be shown (prevents confusing `[Exit: 1]` in widgets)
430
+ - Returns `0` for all error states (stale data is never shown, only error messages)
431
+ - Ensures clean widget display without `[Exit: 1]` indicators
424
432
 
425
433
  ## Troubleshooting
426
434
 
@@ -521,9 +529,16 @@ bun run check
521
529
 
522
530
  ```
523
531
  ┌─────────────┐
524
- │ main.ts │ ← Entry point, CLI orchestration, install/uninstall
532
+ │ main.ts │ ← Thin router: parse args → dispatch
525
533
  └──────┬──────┘
526
534
 
535
+ ┌──────▼────────┐
536
+ │ src/cli/ │ ← Argument parsing, install/uninstall, piped-mode
537
+ │ - args.ts │
538
+ │ - commands.ts│
539
+ │ - piped-mode │
540
+ └──────┬────────┘
541
+
527
542
  ├──────────────────────────────────────┐
528
543
  │ │
529
544
  ┌──────▼────────┐ ┌────────▼────────┐
@@ -532,22 +547,28 @@ bun run check
532
547
  │ - cache │ │ - relay │
533
548
  │ - config │ │ - custom │
534
549
  │ - settings │ ← settings.json │ - autodetect │
535
- │ - logger │ ← debug logging └────────┬────────┘
550
+ │ - logger │ ← debug logging │ - quota-window │
551
+ │ - atomic-write│← atomic writes │ - custom-mapping│
552
+ │ - cache-gc │ ← auto cleanup │ │
553
+ │ - ensure-dir │← dir creation └────────┬────────┘
536
554
  └──────┬────────┘ │
537
555
  │ │
538
556
  ├──────────────────────────────────────┘
539
557
 
540
558
  ┌──────▼────────┐
559
+ │ src/core/ │
541
560
  │ execute-cycle │ ← Unified execution (Path A/B/C/D)
561
+ │ constants.ts │ ← Shared constants
542
562
  └──────┬────────┘
543
563
 
544
564
  ┌──────▼────────┐
545
565
  │ renderer/ │
546
- │ - component │ ← Per-component rendering
566
+ │ - component │ ← Per-component rendering (RenderContext)
547
567
  │ - bar │ ← Progress bars
548
568
  │ - colors │ ← ANSI color system
549
569
  │ - countdown │ ← Time-to-reset
550
570
  │ - error │ ← Error states
571
+ │ - transition │ ← Transition state detection
551
572
  │ - icons │ ← Nerd-font glyphs
552
573
  │ - truncate │ ← Terminal width
553
574
  │ - index │ ← Main pipeline
@@ -556,11 +577,12 @@ bun run check
556
577
 
557
578
  ## Testing
558
579
 
559
- - **356 tests** across **21 test files**
560
- - Unit tests for all services and renderers
580
+ - **550 tests** across **34 test files**
581
+ - Unit tests for all services, renderers, and shared utilities
561
582
  - Core execution path tests (A/B/C/D)
562
583
  - E2E smoke tests with isolated environments
563
584
  - Performance tests (p95 < 600ms verification)
585
+ - Cache garbage collection tests
564
586
  - CI/CD via GitHub Actions
565
587
 
566
588
  Run: `bun run check`
@@ -576,4 +598,4 @@ MIT
576
598
  - [TUI Style Spec](docs/spec-tui-style.md)
577
599
  - [API Polling Spec](docs/spec-api-polling.md)
578
600
  - [Custom Providers Spec](docs/spec-custom-providers.md)
579
- - [AGENTS.md](AGENTS.md) - Development handoff guide
601
+ - [AGENTS.md](AGENTS.md) - Development handoff guide