ccstatusline-usage 2.4.0 → 2.4.1

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
@@ -1,5 +1,3 @@
1
- <div align="center">
2
-
3
1
  <pre>
4
2
  _ _ _ _
5
3
  ___ ___ ___| |_ __ _| |_ _ _ ___| (_)_ __ ___
@@ -82,7 +80,6 @@ Session: [████░░░░░░░░░░░] 27.0% | Weekly: [██
82
80
 
83
81
  ![Demo](https://raw.githubusercontent.com/sirmalloc/ccstatusline/main/screenshots/demo.gif)
84
82
 
85
- </div>
86
83
  <br />
87
84
 
88
85
  ## 📚 Table of Contents
@@ -103,6 +100,13 @@ Session: [████░░░░░░░░░░░] 27.0% | Weekly: [██
103
100
 
104
101
  ## 🆕 Recent Updates
105
102
 
103
+ ### [v2.4.1](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.4.1) - Weekly Pace: showPercent toggle + decimal precision
104
+
105
+ - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **`%` keybind — always show delta on `On Pace`** — Previously `On Pace` was the only pace band that hid its delta. Toggle `showPercent` in the editor to render `D4/7: On Pace +3%` (or `-2%`, or `+0%`) so you can see how close to a band edge you are.
106
+ - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **`.` keybind — decimal precision** — Cycles 0 → 1 → 2 → 3 → 0 decimal places for all deltas (Warm/Cool/Overcooking/Underusing, `On Pace` when `showPercent` is on, and the pendulum bar). Replaces `Math.round()` with `toFixed(decimals)` in a shared `formatDelta` helper.
107
+ - Both toggles are metadata-gated and orthogonal — omitted keys behave identically to before.
108
+ - Thanks to @BenIsLegit ([#3](https://github.com/pcvelz/ccstatusline-usage/pull/3)).
109
+
106
110
  ### [v2.4.0](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.4.0) - Multi-provider router for usage widgets
107
111
 
108
112
  - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Provider pattern end-to-end** — Usage widgets now dispatch through `resolveProvider(modelId)` in `src/utils/usage/resolver.ts`. Anthropic models (`opus`/`sonnet`/`haiku`) fetch from the usage API; opencode/local models (`glm`, `kimi`, `minimax`, `mm-`, `qwen`, `owen`, `mimo`) skip the fetch entirely so heavy local-model sessions no longer trigger needless Anthropic API calls or rate-limiting.
@@ -55471,7 +55471,7 @@ function getTerminalWidth() {
55471
55471
  function canDetectTerminalWidth() {
55472
55472
  return probeTerminalWidth() !== null;
55473
55473
  }
55474
- var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils", PACKAGE_VERSION = "2.4.0";
55474
+ var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils", PACKAGE_VERSION = "2.4.1";
55475
55475
  var init_terminal = () => {};
55476
55476
 
55477
55477
  // src/utils/renderer.ts
@@ -64055,18 +64055,28 @@ var init_VimMode = __esm(() => {
64055
64055
  function getPaceDisplayMode(item) {
64056
64056
  return item.metadata?.display === "pendulum" ? "pendulum" : "text";
64057
64057
  }
64058
- function computePace(actualPercent, expectedPercent) {
64058
+ function getDecimalPrecision(item) {
64059
+ const val = Number(item.metadata?.decimals);
64060
+ return val === 1 || val === 2 || val === 3 ? val : 0;
64061
+ }
64062
+ function formatDelta(delta, decimals) {
64063
+ return delta.toFixed(decimals);
64064
+ }
64065
+ function computePace(actualPercent, expectedPercent, showPercent = false, decimals = 0) {
64059
64066
  const delta = actualPercent - expectedPercent;
64060
64067
  const dayOfWeek = Math.max(1, Math.min(7, Math.ceil(expectedPercent * 7 / 100)));
64061
64068
  let status;
64062
64069
  if (delta > 15) {
64063
- status = `Overcooking +${Math.round(delta)}%`;
64070
+ status = `Overcooking +${formatDelta(delta, decimals)}%`;
64064
64071
  } else if (delta > 5) {
64065
- status = `Warm +${Math.round(delta)}%`;
64072
+ status = `Warm +${formatDelta(delta, decimals)}%`;
64066
64073
  } else if (delta < -15) {
64067
- status = `Underusing ${Math.round(delta)}%`;
64074
+ status = `Underusing ${formatDelta(delta, decimals)}%`;
64068
64075
  } else if (delta < -5) {
64069
- status = `Cool ${Math.round(delta)}%`;
64076
+ status = `Cool ${formatDelta(delta, decimals)}%`;
64077
+ } else if (showPercent) {
64078
+ const sign = delta >= 0 ? "+" : "";
64079
+ status = `On Pace ${sign}${formatDelta(delta, decimals)}%`;
64070
64080
  } else {
64071
64081
  status = "On Pace";
64072
64082
  }
@@ -64092,24 +64102,52 @@ class WeeklyPaceWidget {
64092
64102
  if (mode === "pendulum") {
64093
64103
  modifiers.push("pendulum bar");
64094
64104
  }
64105
+ if (item.metadata?.showPercent === "true") {
64106
+ modifiers.push("always %");
64107
+ }
64108
+ const decimals = getDecimalPrecision(item);
64109
+ if (decimals > 0) {
64110
+ modifiers.push(`.${"0".repeat(decimals)}`);
64111
+ }
64095
64112
  return {
64096
64113
  displayText: this.getDisplayName(),
64097
64114
  modifierText: makeModifierText(modifiers)
64098
64115
  };
64099
64116
  }
64100
64117
  handleEditorAction(action, item) {
64101
- if (action !== "toggle-pendulum") {
64102
- return null;
64118
+ if (action === "toggle-pendulum") {
64119
+ const currentMode = getPaceDisplayMode(item);
64120
+ const nextMode = currentMode === "text" ? "pendulum" : "text";
64121
+ return {
64122
+ ...item,
64123
+ metadata: {
64124
+ ...item.metadata ?? {},
64125
+ display: nextMode
64126
+ }
64127
+ };
64103
64128
  }
64104
- const currentMode = getPaceDisplayMode(item);
64105
- const nextMode = currentMode === "text" ? "pendulum" : "text";
64106
- return {
64107
- ...item,
64108
- metadata: {
64109
- ...item.metadata ?? {},
64110
- display: nextMode
64111
- }
64112
- };
64129
+ if (action === "toggle-show-percent") {
64130
+ const current = item.metadata?.showPercent === "true";
64131
+ return {
64132
+ ...item,
64133
+ metadata: {
64134
+ ...item.metadata ?? {},
64135
+ showPercent: current ? "false" : "true"
64136
+ }
64137
+ };
64138
+ }
64139
+ if (action === "cycle-decimals") {
64140
+ const current = getDecimalPrecision(item);
64141
+ const next = current >= 3 ? 0 : current + 1;
64142
+ return {
64143
+ ...item,
64144
+ metadata: {
64145
+ ...item.metadata ?? {},
64146
+ decimals: String(next)
64147
+ }
64148
+ };
64149
+ }
64150
+ return null;
64113
64151
  }
64114
64152
  render(item, context, settings) {
64115
64153
  const displayMode = getPaceDisplayMode(item);
@@ -64131,21 +64169,25 @@ class WeeklyPaceWidget {
64131
64169
  if (!window2)
64132
64170
  return null;
64133
64171
  const actualPercent = Math.max(0, Math.min(100, data.weeklyUsage));
64134
- const { delta, dayOfWeek, status } = computePace(actualPercent, window2.elapsedPercent);
64172
+ const showPercent = item.metadata?.showPercent === "true";
64173
+ const decimals = getDecimalPrecision(item);
64174
+ const { delta, dayOfWeek, status } = computePace(actualPercent, window2.elapsedPercent, showPercent, decimals);
64135
64175
  const width = context.terminalWidth ?? 0;
64136
64176
  const mobile = width > 0 && width < MOBILE_THRESHOLD2;
64137
64177
  const medium = width >= MOBILE_THRESHOLD2 && width < MEDIUM_THRESHOLD3;
64138
64178
  if (displayMode === "pendulum" && !mobile) {
64139
64179
  const halfWidth = medium ? 4 : 7;
64140
64180
  const sign = delta >= 0 ? "+" : "";
64141
- const barDisplay = `${makePendulumBar(delta, halfWidth)} D${dayOfWeek}/7 ${sign}${Math.round(delta)}%`;
64181
+ const barDisplay = `${makePendulumBar(delta, halfWidth)} D${dayOfWeek}/7 ${sign}${formatDelta(delta, decimals)}%`;
64142
64182
  return formatRawOrLabeledValue(item, "Pace: ", barDisplay);
64143
64183
  }
64144
64184
  return formatRawOrLabeledValue(item, "", `D${dayOfWeek}/7: ${status}`);
64145
64185
  }
64146
64186
  getCustomKeybinds() {
64147
64187
  return [
64148
- { key: "p", label: "(p)endulum toggle", action: "toggle-pendulum" }
64188
+ { key: "p", label: "(p)endulum toggle", action: "toggle-pendulum" },
64189
+ { key: "%", label: "(%) always show percent", action: "toggle-show-percent" },
64190
+ { key: ".", label: "(.) decimal precision", action: "cycle-decimals" }
64149
64191
  ];
64150
64192
  }
64151
64193
  supportsRawValue() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",