ccstatusline-usage 2.3.1 → 2.3.2

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
@@ -34,13 +34,14 @@ This fork adds API-based usage widgets beyond the upstream:
34
34
  - **Weekly Pace** - Pendulum bar showing if you're ahead or behind expected usage pace
35
35
  - **Reset Timer** - Time until 5-hour session window resets
36
36
  - **Context Window Display** - Visual bar showing context usage
37
+ - **Off Peak** - Shows peak/off-peak 2x status during Anthropic usage promotions
37
38
  - **Two-line Layout** - Session info on line 1, context on line 2
38
39
 
39
40
  ### Enhanced Status Line Preview
40
41
 
41
42
  ```
42
43
  Session: [████░░░░░░░░░░░] 27.0% | Weekly: [███████████████] 100.0% | Extra: €2.50/€50.00 | Model: Opus 4.6 | Session ID: 0109b99d...
43
- Context: [███████░░░░░░░░] 103k/200k (51%) | Pace: [░░░░░░░|██░░░░░] D5/7 +12%
44
+ Context: [███████░░░░░░░░] 103k/200k (51%) | Pace: [░░░░░░░|██░░░░░] D5/7 +12% | Off peak: Off-peak 2x
44
45
  ```
45
46
 
46
47
  ![Demo](https://raw.githubusercontent.com/sirmalloc/ccstatusline/main/screenshots/demo.gif)
@@ -65,6 +66,12 @@ Session: [████░░░░░░░░░░░] 27.0% | Weekly: [██
65
66
 
66
67
  ## 🆕 Recent Updates
67
68
 
69
+ ### [v2.3.2](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.3.2) - Off Peak widget + WeeklyPace compact fix
70
+
71
+ - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Off Peak widget** — New widget showing `Off peak: Off-peak 2x` or `Off peak: Peak` during the Anthropic March 2026 Spring Break promotion (off-peak = weekdays outside 8 AM–2 PM ET, weekends all day). Widget automatically hides after March 28, 2026 23:59 PT.
72
+ - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **WeeklyPace compact fix** — Pendulum bar now falls back to text mode (`D6/7: -18%`) on narrow terminals (< 80 chars)
73
+ - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Sonnet [1m] extra usage fix** — Extra usage spending now shown when a charged `[1m]` model (e.g. Sonnet) is active, regardless of weekly limit status
74
+
68
75
  ### [v2.3.1](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.3.1) - Weekly Pace widget
69
76
 
70
77
  - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Weekly Pace widget** — New widget showing if weekly usage pace is on track, with pendulum bar or text display mode (PR #1 by @BenIsLegit)
@@ -550,6 +557,7 @@ bun run example
550
557
  - **Skills** - Shows skill activity as last used, total count, or unique list (with optional list limit and hide-when-empty toggle)
551
558
  - **Thinking Effort** - Shows the current Claude Code thinking effort level
552
559
  - **Vim Mode** - Displays current vim editor mode
560
+ - **Off Peak** *(ccstatusline-usage)* - Shows `Off peak: Off-peak 2x` or `Off peak: Peak` during Anthropic usage promotions (auto-hides when promotion ends)
553
561
  - **Separator** - Visual divider between widgets (available when Powerline mode is off and no default separator is configured)
554
562
  - **Flex Separator** - Expands to fill available space (available when Powerline mode is off)
555
563
 
@@ -52428,7 +52428,9 @@ var init_Settings = __esm(() => {
52428
52428
  { id: "session-id", type: "claude-session-id", color: "cyan" }
52429
52429
  ],
52430
52430
  [
52431
- { id: "context-bar", type: "context-bar", color: "blue" }
52431
+ { id: "context-bar", type: "context-bar", color: "blue" },
52432
+ { id: "sep-off-peak", type: "separator" },
52433
+ { id: "off-peak", type: "off-peak", color: "green" }
52432
52434
  ],
52433
52435
  []
52434
52436
  ]),
@@ -54069,7 +54071,7 @@ function getTerminalWidth() {
54069
54071
  function canDetectTerminalWidth() {
54070
54072
  return probeTerminalWidth() !== null;
54071
54073
  }
54072
- var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils", PACKAGE_VERSION = "2.3.1";
54074
+ var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils", PACKAGE_VERSION = "2.3.2";
54073
54075
  var init_terminal = () => {};
54074
54076
 
54075
54077
  // src/utils/renderer.ts
@@ -61743,7 +61745,11 @@ class ResetTimerWidget {
61743
61745
  const data = fetchApiData();
61744
61746
  if (data.error)
61745
61747
  return getErrorMessage(data.error);
61746
- if (data.extraUsageEnabled && data.weeklyUsage !== undefined && data.weeklyUsage >= 100 && data.extraUsageUsed !== undefined && data.extraUsageLimit !== undefined) {
61748
+ const modelId = context.data?.model?.id ?? "";
61749
+ const is1mModel = modelId.includes("[1m]");
61750
+ const isOpus = modelId.includes("opus");
61751
+ const isChargedModel = is1mModel && !isOpus;
61752
+ if (data.extraUsageEnabled && data.extraUsageUsed !== undefined && data.extraUsageLimit !== undefined && (data.weeklyUsage !== undefined && data.weeklyUsage >= 100 || isChargedModel)) {
61747
61753
  const used = formatCents(data.extraUsageUsed);
61748
61754
  const displayLimit = settings.extraUsageBalance ?? data.extraUsageLimit;
61749
61755
  const limit = formatCents(displayLimit);
@@ -62569,7 +62575,8 @@ class WeeklyPaceWidget {
62569
62575
  return null;
62570
62576
  const actualPercent = Math.max(0, Math.min(100, data.weeklyUsage));
62571
62577
  const { delta, dayOfWeek, status } = computePace(actualPercent, window2.elapsedPercent);
62572
- if (displayMode === "pendulum") {
62578
+ const mobile = (context.terminalWidth ?? 0) > 0 && (context.terminalWidth ?? 0) < MOBILE_THRESHOLD3;
62579
+ if (displayMode === "pendulum" && !mobile) {
62573
62580
  const sign = delta >= 0 ? "+" : "";
62574
62581
  const barDisplay = `${makePendulumBar(delta)} D${dayOfWeek}/7 ${sign}${Math.round(delta)}%`;
62575
62582
  return formatRawOrLabeledValue(item, "Pace: ", barDisplay);
@@ -62588,10 +62595,68 @@ class WeeklyPaceWidget {
62588
62595
  return true;
62589
62596
  }
62590
62597
  }
62598
+ var MOBILE_THRESHOLD3 = 80;
62591
62599
  var init_WeeklyPace = __esm(() => {
62592
62600
  init_usage();
62593
62601
  });
62594
62602
 
62603
+ // src/widgets/OffPeak.ts
62604
+ function isOffPeak(now2) {
62605
+ const ms = now2.getTime();
62606
+ if (ms < PROMO_START_MS || ms >= PROMO_END_MS) {
62607
+ return null;
62608
+ }
62609
+ const dayOfWeek = now2.getUTCDay();
62610
+ const isWeekend = dayOfWeek === 0 || dayOfWeek === 6;
62611
+ if (isWeekend)
62612
+ return true;
62613
+ const utcHour = now2.getUTCHours();
62614
+ const isPeak = utcHour >= PEAK_START_UTC_HOUR && utcHour < PEAK_END_UTC_HOUR;
62615
+ return !isPeak;
62616
+ }
62617
+
62618
+ class OffPeakWidget {
62619
+ getDefaultColor() {
62620
+ return "green";
62621
+ }
62622
+ getDescription() {
62623
+ return "Shows peak / off-peak 2x status during the March 2026 Anthropic usage promotion";
62624
+ }
62625
+ getDisplayName() {
62626
+ return "Off Peak";
62627
+ }
62628
+ getCategory() {
62629
+ return "Usage";
62630
+ }
62631
+ getEditorDisplay(_item) {
62632
+ return { displayText: this.getDisplayName() };
62633
+ }
62634
+ render(item, context, _settings) {
62635
+ if (context.isPreview) {
62636
+ return item.rawValue ? "Off-peak 2x" : "Off peak: Off-peak 2x";
62637
+ }
62638
+ const result2 = isOffPeak(new Date);
62639
+ if (result2 === null)
62640
+ return null;
62641
+ const value = result2 ? "Off-peak 2x" : "Peak";
62642
+ const mobile = (context.terminalWidth ?? 0) > 0 && (context.terminalWidth ?? 0) < 80;
62643
+ if (item.rawValue || mobile)
62644
+ return value;
62645
+ return `Off peak: ${value}`;
62646
+ }
62647
+ supportsRawValue() {
62648
+ return true;
62649
+ }
62650
+ supportsColors(_item) {
62651
+ return true;
62652
+ }
62653
+ }
62654
+ var PROMO_START_MS, PROMO_END_MS, PEAK_START_UTC_HOUR = 12, PEAK_END_UTC_HOUR = 18;
62655
+ var init_OffPeak = __esm(() => {
62656
+ PROMO_START_MS = Date.UTC(2026, 2, 13, 7, 0, 0);
62657
+ PROMO_END_MS = Date.UTC(2026, 2, 29, 6, 59, 0);
62658
+ });
62659
+
62595
62660
  // src/widgets/index.ts
62596
62661
  var init_widgets = __esm(async () => {
62597
62662
  init_GitBranch();
@@ -62611,6 +62676,7 @@ var init_widgets = __esm(async () => {
62611
62676
  init_Battery();
62612
62677
  init_VimMode();
62613
62678
  init_WeeklyPace();
62679
+ init_OffPeak();
62614
62680
  await __promiseAll([
62615
62681
  init_TokensInput(),
62616
62682
  init_TokensOutput(),
@@ -62671,7 +62737,8 @@ var init_widget_manifest = __esm(async () => {
62671
62737
  { type: "thinking-effort", create: () => new ThinkingEffortWidget },
62672
62738
  { type: "battery", create: () => new BatteryWidget },
62673
62739
  { type: "vim-mode", create: () => new VimModeWidget },
62674
- { type: "weekly-pace", create: () => new WeeklyPaceWidget }
62740
+ { type: "weekly-pace", create: () => new WeeklyPaceWidget },
62741
+ { type: "off-peak", create: () => new OffPeakWidget }
62675
62742
  ];
62676
62743
  LAYOUT_WIDGET_MANIFEST = [
62677
62744
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",