ccstatusline-usage 2.0.42 → 2.0.44

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
@@ -29,6 +29,7 @@
29
29
  This fork adds API-based usage widgets beyond the upstream:
30
30
 
31
31
  - **Session/Weekly Usage** - Real utilization from Anthropic API with progress bars
32
+ - **Extra Usage** - When weekly limit is reached, shows extra usage spending (e.g. `Extra: €41.24/€47.00`)
32
33
  - **Reset Timer** - Time until 5-hour session window resets
33
34
  - **Context Window Display** - Visual bar showing context usage
34
35
  - **Two-line Layout** - Session info on line 1, context on line 2
@@ -36,7 +37,7 @@ This fork adds API-based usage widgets beyond the upstream:
36
37
  ### Enhanced Status Line Preview
37
38
 
38
39
  ```
39
- Session: [████░░░░░░░░░░░] 27.0% | Weekly: [████████████░░░] 86.0% | 1:56 hr | Model: Opus 4.5 | Session ID: 714aa815-8a...
40
+ Session: [████░░░░░░░░░░░] 27.0% | Weekly: [████████████░░░] 86.0% | 1:56 hr | Extra: $41.24/$47.00 | Model: Opus 4.6 | Session ID: 714aa815-8a...
40
41
  Context: [███████░░░░░░░░] 103k/200k (51%)
41
42
  ```
42
43
 
@@ -64,6 +65,17 @@ These widgets are enabled by default. Just install and run!
64
65
 
65
66
  ## 🆕 Recent Updates
66
67
 
68
+ ### [v2.0.43](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.0.43) - Extra usage spending display
69
+
70
+ - Show extra usage spending in Reset Timer widget when weekly limit is reached (e.g. `Extra: €41.24/€47.00`)
71
+ - Auto-detect currency from timezone (Europe/* = €, else $)
72
+ - Updated README release notes
73
+
74
+ ### [v2.0.42](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.0.42) - Fix reset timer API field
75
+
76
+ - Fixed API field name from `reset_at` to `resets_at` — reset timer now displays correctly
77
+ - Merged latest changes from upstream ccstatusline
78
+
67
79
  ### v2.0.16 - Add fish style path abbreviation toggle to Current Working Directory widget
68
80
 
69
81
  ### v2.0.15 - Block Timer calculation fixes
@@ -369,10 +381,10 @@ Once configured, ccstatusline automatically formats your Claude Code status line
369
381
 
370
382
  ### 📊 Available Widgets
371
383
 
372
- #### API Usage Widgets (Fork Enhancement)
384
+ #### API Usage Widgets ([pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage))
373
385
  - **Session Usage** - 5-hour session utilization with progress bar (e.g., "Session: [████░░░░░░░░░░░] 29.0%")
374
386
  - **Weekly Usage** - 7-day utilization with progress bar (e.g., "Weekly: [█░░░░░░░░░░░░░░] 7.0%")
375
- - **Reset Timer** - Time until 5-hour session window resets (e.g., "2:59 hr")
387
+ - **Reset Timer / Extra Usage** - Time until 5-hour session window resets (e.g., "2:59 hr"), or extra usage spending when weekly limit is reached (e.g., "Extra: €41.24/€47.00")
376
388
  - **Context Bar** - Visual context window usage with bar (e.g., "Context: [███████░░░░░░░░] 103k/200k (51%)")
377
389
 
378
390
  #### Standard Widgets
@@ -51450,7 +51450,7 @@ import { execSync as execSync3 } from "child_process";
51450
51450
  import * as fs5 from "fs";
51451
51451
  import * as path4 from "path";
51452
51452
  var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
51453
- var PACKAGE_VERSION = "2.0.42";
51453
+ var PACKAGE_VERSION = "2.0.44";
51454
51454
  function getPackageVersion() {
51455
51455
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51456
51456
  return PACKAGE_VERSION;
@@ -54404,7 +54404,10 @@ class ClaudeSessionIdWidget {
54404
54404
  }
54405
54405
  }
54406
54406
  // src/widgets/ApiUsage.tsx
54407
- import { execSync as execSync8, spawnSync } from "child_process";
54407
+ import {
54408
+ execSync as execSync8,
54409
+ spawnSync
54410
+ } from "child_process";
54408
54411
  import * as fs6 from "fs";
54409
54412
  import * as path5 from "path";
54410
54413
  var CACHE_FILE = path5.join(process.env.HOME ?? "", ".cache", "ccstatusline-api.json");
@@ -54549,6 +54552,12 @@ function fetchApiData() {
54549
54552
  if (data.seven_day) {
54550
54553
  apiData.weeklyUsage = data.seven_day.utilization;
54551
54554
  }
54555
+ if (data.extra_usage) {
54556
+ apiData.extraUsageEnabled = data.extra_usage.is_enabled === true;
54557
+ apiData.extraUsageLimit = data.extra_usage.monthly_limit;
54558
+ apiData.extraUsageUsed = data.extra_usage.used_credits;
54559
+ apiData.extraUsageUtilization = data.extra_usage.utilization;
54560
+ }
54552
54561
  if (apiData.sessionUsage === undefined && apiData.weeklyUsage === undefined) {
54553
54562
  const stale = readStaleCache();
54554
54563
  if (stale && !stale.error)
@@ -54659,7 +54668,7 @@ class ResetTimerWidget {
54659
54668
  return "brightBlue";
54660
54669
  }
54661
54670
  getDescription() {
54662
- return "Shows time until daily limit reset";
54671
+ return "Shows extra usage spending or time until limit reset";
54663
54672
  }
54664
54673
  getDisplayName() {
54665
54674
  return "Reset Timer";
@@ -54673,6 +54682,11 @@ class ResetTimerWidget {
54673
54682
  const data = fetchApiData();
54674
54683
  if (data.error)
54675
54684
  return getErrorMessage(data.error);
54685
+ if (data.extraUsageEnabled && data.extraUsageUsed !== undefined && data.extraUsageLimit !== undefined) {
54686
+ const used = formatCents(data.extraUsageUsed);
54687
+ const limit = formatCents(data.extraUsageLimit);
54688
+ return `Extra: ${used}/${limit}`;
54689
+ }
54676
54690
  if (!data.sessionResetAt)
54677
54691
  return null;
54678
54692
  try {
@@ -54695,6 +54709,18 @@ class ResetTimerWidget {
54695
54709
  return true;
54696
54710
  }
54697
54711
  }
54712
+ function getCurrencySymbol() {
54713
+ try {
54714
+ const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
54715
+ if (tz.startsWith("Europe/"))
54716
+ return "€";
54717
+ } catch {}
54718
+ return "$";
54719
+ }
54720
+ function formatCents(cents) {
54721
+ const symbol2 = getCurrencySymbol();
54722
+ return `${symbol2}${(cents / 100).toFixed(2)}`;
54723
+ }
54698
54724
 
54699
54725
  class ContextBarWidget {
54700
54726
  getDefaultColor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.0.42",
3
+ "version": "2.0.44",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",