claude-limit-statusline 0.3.0 β†’ 0.4.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 +43 -41
  2. package/bin/cli.js +52 -135
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,12 +13,11 @@ with a **live reset countdown**.
13
13
  πŸ”— [GitHub](https://github.com/ann0nip/claude-limit-statusline)
14
14
 
15
15
  ```
16
- πŸ€– Opus 4.8 (1M context) | 🧠 42k (4%) | ⏳ Session 17% Β· resets in 0h47m (23:12) | πŸ“… Week 10% Β· resets in 2d 21h (Jun 03 19:54)
16
+ πŸ€– Opus 4.8 | 🧠 42k (4%) | πŸ•” Session 17% Β· resets in 0h47m | πŸ“… Week 10%
17
17
  ```
18
18
 
19
- The line **auto-fits your terminal width** β€” on a narrow window it sheds detail
20
- gracefully (see [Narrow terminals](#narrow-terminals)) while always keeping the
21
- session/week percentages.
19
+ That's the default (`medium`). Pick the [size](#sizes) that fits your terminal β€”
20
+ from `full` (both reset countdowns) down to `bare` (just the two percentages).
22
21
 
23
22
  Unlike tools that estimate the 5‑hour block from local logs, this reads the
24
23
  **official `rate_limits` payload** that Claude Code provides on stdin β€” the same
@@ -48,10 +47,10 @@ for you (merging, never clobbering your other settings). Then open a **new**
48
47
  Claude Code session and send one message β€” `rate_limits` populates after the
49
48
  first API response.
50
49
 
51
- Want only the two limits? Pass your display options straight through:
50
+ Want a different size? Pass your display options straight through:
52
51
 
53
52
  ```bash
54
- cc-limits --install --segments=session,week
53
+ cc-limits --install --size=compact
55
54
  ```
56
55
 
57
56
  To remove it again:
@@ -65,6 +64,12 @@ cc-limits --uninstall
65
64
  > installed command isn't on the `PATH` of the non‑login shell Claude Code uses
66
65
  > for the status line.
67
66
 
67
+ > **Upgrading from 0.3.x / 0.2.x?** The old adaptive‑width behavior is gone β€”
68
+ > replaced by fixed [sizes](#sizes) (default `medium`). Re‑run `cc-limits
69
+ > --install` (optionally with `--size=…`) to refresh the baked‑in command; any
70
+ > leftover `--width` / `--no-adapt` flags are now ignored. The session icon also
71
+ > changed from ⏳ to πŸ•”.
72
+
68
73
  <details>
69
74
  <summary>Manual setup (if you prefer)</summary>
70
75
 
@@ -91,45 +96,44 @@ If the bar stays blank (nvm/Volta `PATH` issue), use absolute paths instead β€”
91
96
  | --- | --- | --- |
92
97
  | `πŸ€– model` | Active model | local |
93
98
  | `🧠 42k (4%)` | Tokens in the current context window | local |
94
- | `⏳ Session 17% Β· resets in 0h47m (23:12)` | **Real** 5‑hour limit used + reset | server |
95
- | `πŸ“… Week 10% Β· resets in 2d 21h (Jun 03 19:54)` | **Real** 7‑day limit used + reset | server |
96
-
97
- The reset countdowns appear when the terminal is wide enough; on narrower
98
- windows they drop out automatically (week first, then session). Use `--reset` to
99
- cap which ones may ever show.
99
+ | `πŸ•” Session 17% Β· resets in 0h47m (23:12)` | **Real** 5‑hour limit used (+ reset) | server |
100
+ | `πŸ“… Week 10% Β· resets in 2d 21h (Jun 03 19:54)` | **Real** 7‑day limit used (+ reset) | server |
100
101
 
101
102
  The percentage **is** your "how close am I to the limit" gauge. Subscription
102
103
  limits are dynamic, so Anthropic does not expose a fixed token cap β€” only a
103
104
  percentage, which is exactly what this surfaces.
104
105
 
105
106
  Before the first API response (and right after `/compact`) the session segment
106
- shows `⏳ Session --` until fresh data arrives.
107
+ shows `πŸ•” Session --` until fresh data arrives.
107
108
 
108
- ### Narrow terminals
109
+ ## Sizes
109
110
 
110
- The line **auto-shrinks to fit your terminal width**, so it stays readable on a
111
- small window and expands again when you make the window bigger β€” no config
112
- needed. It sheds detail in steps, dropping the least important parts first and
113
- **always keeping the session/week percentages**:
111
+ Claude Code shows the status line on a single line and truncates anything past
112
+ the terminal width. So instead of guessing, you **pick the size that fits** β€”
113
+ set it once with `--size` (or `CC_LIMITS_SIZE`). The default is `medium`.
114
114
 
115
115
  ```text
116
- full πŸ€– Opus 4.8 (1M context) | 🧠 42k (4%) | ⏳ Session 17% Β· resets in 0h47m (23:12) | πŸ“… Week 10% Β· resets in 2d 21h (Jun 03 19:54)
117
- ↓ week countdown drops
118
- medium πŸ€– Opus 4.8 (1M context) | 🧠 42k (4%) | ⏳ Session 17% Β· resets in 0h47m (23:12) | πŸ“… Week 10%
119
- ↓ session countdown drops
120
- plain πŸ€– Opus 4.8 (1M context) | 🧠 42k (4%) | ⏳ Session 17% | πŸ“… Week 10%
121
- ↓ labels shorten, model/context trim away
122
- narrow πŸ€– Opus 4.8 | 🧠 42k | ⏳ S 17% | πŸ“… W 10%
123
- tiny ⏳ S 17% | πŸ“… W 10%
116
+ full πŸ€– Opus 4.8 (1M context) | 🧠 42k (4%) | πŸ•” Session 17% Β· resets in 0h47m (23:12) | πŸ“… Week 10% Β· resets in 2d 21h (Jun 03 19:54)
117
+ medium πŸ€– Opus 4.8 | 🧠 42k (4%) | πŸ•” Session 17% Β· resets in 0h47m | πŸ“… Week 10%
118
+ compact πŸ€– Opus 4.8 | 🧠 42k (4%) | πŸ•” Session 17% | πŸ“… Week 10%
119
+ mini πŸ€– Opus 4.8 | 🧠 42k | πŸ•” S 17% | πŸ“… W 10%
120
+ bare πŸ•” S 17% | πŸ“… W 10%
124
121
  ```
125
122
 
126
- The width comes from the terminal itself (read via `/dev/tty`), so it follows
127
- live window resizes. Disable it with `--no-adapt` (or `CC_LIMITS_ADAPT=0`) to
128
- always print the full line, or pin a width with `--width=N` / `CC_LIMITS_WIDTH=N`.
123
+ | Size | Shows |
124
+ | --- | --- |
125
+ | `full` | Model (with context length), tokens + %, both limits with reset countdown & clock |
126
+ | `medium` | Model, tokens + %, session countdown, both percentages *(default)* |
127
+ | `compact` | Model, tokens + %, both percentages β€” no countdowns |
128
+ | `mini` | Model, tokens, short labels |
129
+ | `bare` | Just the two limits |
130
+
131
+ ```bash
132
+ cc-limits --install --size=compact
133
+ ```
129
134
 
130
- > **Upgrading from 0.2.0?** Adaptive width is new and on by default. If you
131
- > preferred the old always-full line (and let Claude Code truncate it), add
132
- > `--no-adapt`.
135
+ You can still fine‑tune any size with [`--segments`](#flags) and
136
+ [`--reset`](#flags) below.
133
137
 
134
138
  ## Configuration
135
139
 
@@ -144,24 +148,23 @@ Pick **which segments** to show (and their order). The four segments are
144
148
  "command": "cc-limits --no-context"
145
149
  ```
146
150
 
147
- Cap **which reset countdowns** may show (they still drop out on narrow
148
- terminals):
151
+ Cap **which reset countdowns** a size may show (this can hide a countdown,
152
+ never add one):
149
153
 
150
154
  ```jsonc
151
- "command": "cc-limits --reset=session" // never show the week countdown
152
- "command": "cc-limits --no-reset" // just percentages, no countdowns
155
+ "command": "cc-limits --size=full --reset=session" // full, but no week countdown
156
+ "command": "cc-limits --no-reset" // just percentages, no countdowns
153
157
  ```
154
158
 
155
159
  ### Flags
156
160
 
157
161
  | Flag | Description |
158
162
  | --- | --- |
163
+ | `--size=full\|medium\|compact\|mini\|bare` | How much detail to show (default `medium`) |
159
164
  | `--segments=a,b,c` | Allowlist + order. Subset of `model,context,session,week` |
160
165
  | `--no-<segment>` | Hide one segment (e.g. `--no-context`). Repeatable |
161
166
  | `--reset=both\|session\|week\|none` | Cap which reset countdowns may show (default `both`) |
162
167
  | `--no-reset` | Shorthand for `--reset=none` |
163
- | `--no-adapt` | Don't shrink to terminal width; always print the full line |
164
- | `--width=N` | Assume `N` columns instead of auto-detecting the terminal width |
165
168
  | `--no-color` | Disable ANSI colors |
166
169
  | `--demo` | Print a sample line (no stdin needed) |
167
170
  | `-h`, `--help` | Show help |
@@ -172,10 +175,9 @@ Equivalent to the flags, handy if you don't want to edit the command string:
172
175
 
173
176
  | Env var | Default | Description |
174
177
  | --- | --- | --- |
178
+ | `CC_LIMITS_SIZE` | `medium` | `full` / `medium` / `compact` / `mini` / `bare` |
175
179
  | `CC_LIMITS_SEGMENTS` | `model,context,session,week` | Segments + order |
176
180
  | `CC_LIMITS_RESET` | `both` | `both` / `session` / `week` / `none` |
177
- | `CC_LIMITS_ADAPT` | `1` | Set to `0` to disable adaptive width (=`--no-adapt`) |
178
- | `CC_LIMITS_WIDTH` | β€” | Force a column width instead of auto-detecting |
179
181
  | `CC_LIMITS_WARN` | `70` | % at/above which a limit turns yellow |
180
182
  | `CC_LIMITS_CRIT` | `90` | % at/above which a limit turns red |
181
183
  | `CC_LIMITS_SEP` | `" \| "` | Separator between segments |
@@ -183,7 +185,7 @@ Equivalent to the flags, handy if you don't want to edit the command string:
183
185
 
184
186
  ```bash
185
187
  cc-limits --demo
186
- cc-limits --segments=session,week --reset=session --demo
188
+ cc-limits --size=compact --demo
187
189
  ```
188
190
 
189
191
  ## How it works
package/bin/cli.js CHANGED
@@ -18,7 +18,6 @@
18
18
  const fs = require("fs");
19
19
  const path = require("path");
20
20
  const os = require("os");
21
- const tty = require("tty");
22
21
 
23
22
  const argv = process.argv.slice(2);
24
23
 
@@ -58,9 +57,19 @@ if (segSel != null && segSel !== "") {
58
57
  SEGMENTS = ALL_SEGMENTS.filter((s) => !argv.includes(`--no-${s}`));
59
58
  }
60
59
 
61
- // Which reset countdowns are *allowed*: both | session | week | none. This is
62
- // a cap β€” the adaptive width logic shows them only while they fit, dropping the
63
- // week countdown before the session one. Default both (full line when wide).
60
+ // Size preset: how much detail to show. The user picks the one that fits their
61
+ // terminal β€” predictable, no width guessing. Default "medium".
62
+ const SIZES = ["full", "medium", "compact", "mini", "bare"];
63
+ let SIZE = (
64
+ getFlagValue("--size") ||
65
+ process.env.CC_LIMITS_SIZE ||
66
+ "medium"
67
+ ).toLowerCase();
68
+ if (!SIZES.includes(SIZE)) SIZE = "medium";
69
+
70
+ // Which reset countdowns are *allowed*: both | session | week | none. This only
71
+ // caps what a preset would show (it can hide a countdown, never add one).
72
+ // Default both (no extra cap on top of the chosen preset).
64
73
  let RESET_MODE = (
65
74
  getFlagValue("--reset") ||
66
75
  process.env.CC_LIMITS_RESET ||
@@ -78,86 +87,6 @@ const NO_COLOR =
78
87
  argv.includes("--no-color") ||
79
88
  (process.env.NO_COLOR != null && process.env.NO_COLOR !== "");
80
89
 
81
- // Adaptive width: progressively shrink the line so it fits the terminal,
82
- // keeping the session/week percentages last to die. On by default; disable
83
- // with --no-adapt or CC_LIMITS_ADAPT=0 to always render the full line.
84
- const ADAPT =
85
- !argv.includes("--no-adapt") &&
86
- process.env.CC_LIMITS_ADAPT !== "0" &&
87
- process.env.CC_LIMITS_ADAPT !== "false";
88
-
89
- // Detect the usable terminal width. The status-line JSON payload does NOT
90
- // carry the width, and Claude Code captures our stdout (so stdout.columns is
91
- // undefined), so we ask the controlling terminal directly via /dev/tty β€” that
92
- // reflects the real width and updates when the user resizes. Falls back
93
- // through stdout/COLUMNS to "unknown" (null => render full line).
94
- function termWidth() {
95
- const override = getFlagValue("--width") || process.env.CC_LIMITS_WIDTH;
96
- if (override != null && override !== "") {
97
- const n = Number(override);
98
- if (Number.isFinite(n) && n > 0) return n;
99
- return null; // explicit but invalid width => skip adaptation, full line
100
- }
101
- if (process.stdout && process.stdout.columns) return process.stdout.columns;
102
- let fd;
103
- try {
104
- fd = fs.openSync("/dev/tty", "r");
105
- if (tty.isatty(fd)) {
106
- // tty.ReadStream takes ownership of fd; destroy() closes it (async).
107
- // Do NOT also closeSync it below, or we double-close / reuse the fd.
108
- const s = new tty.ReadStream(fd);
109
- const c = s.columns;
110
- s.destroy();
111
- fd = undefined;
112
- if (c) return c;
113
- }
114
- } catch (_) {
115
- /* no controlling terminal β€” fall through */
116
- } finally {
117
- if (fd !== undefined) {
118
- try {
119
- fs.closeSync(fd);
120
- } catch (_) {
121
- /* ignore */
122
- }
123
- }
124
- }
125
- const env = Number(process.env.COLUMNS);
126
- if (Number.isFinite(env) && env > 0) return env;
127
- return null;
128
- }
129
-
130
- // Terminal display width of one Unicode code point: emoji / CJK render as 2
131
- // columns, everything else as 1. A small wcwidth-lite so we measure the line
132
- // the way the terminal draws it (e.g. ⏳ is one code unit but two columns).
133
- function isWide(cp) {
134
- return (
135
- cp >= 0x1100 &&
136
- (cp <= 0x115f || // Hangul Jamo
137
- cp === 0x2329 ||
138
- cp === 0x232a ||
139
- cp === 0x231a ||
140
- cp === 0x231b ||
141
- (cp >= 0x23e9 && cp <= 0x23f3) || // ⏳ and clock/hourglass emoji
142
- (cp >= 0x2600 && cp <= 0x27bf) || // misc symbols & dingbats
143
- (cp >= 0x2e80 && cp <= 0xa4cf && cp !== 0x303f) || // CJK
144
- (cp >= 0xac00 && cp <= 0xd7a3) || // Hangul syllables
145
- (cp >= 0xf900 && cp <= 0xfaff) || // CJK compat
146
- (cp >= 0xfe30 && cp <= 0xfe4f) ||
147
- (cp >= 0xff00 && cp <= 0xff60) ||
148
- (cp >= 0xffe0 && cp <= 0xffe6) ||
149
- (cp >= 0x1f000 && cp <= 0x1faff)) // emoji planes (πŸ€– 🧠 πŸ“… …)
150
- );
151
- }
152
-
153
- // Visible display width of a string, ignoring ANSI color escapes.
154
- function visibleLen(s) {
155
- const plain = s.replace(/\x1b\[[0-9;]*m/g, "");
156
- let w = 0;
157
- for (const ch of plain) w += isWide(ch.codePointAt(0)) ? 2 : 1;
158
- return w;
159
- }
160
-
161
90
  // ---------- colors ----------
162
91
  const C = {
163
92
  reset: "\x1b[0m",
@@ -216,13 +145,15 @@ function fmtClock(epochSec, withDate) {
216
145
  }
217
146
 
218
147
  // ---------- segment renderers ----------
219
- // Each renderer takes a `v` (variant) describing how compact to be:
220
- // v.reset 2 = "Β· resets in Xd Yh (clock)", 1 = "Β· resets in Xd Yh", 0 = none
221
- // v.short true => short labels (Session→S, Week→W), trimmed model, no ctx %
148
+ // A `v` (variant) describes how compact to be:
149
+ // v.model "full" = name as-is | "trim" = drop "(…)" suffix | "off" = hide
150
+ // v.ctx "pct" = "🧠 172k (17%)" | "tokens" = "🧠 172k" | "off" = hide
151
+ // v.short true => short limit labels (Session→S, Week→W)
152
+ // v.rs/v.rw reset detail for session/week: 2 = "…Xd Yh (clock)", 1 = "…Xd Yh", 0 = none
222
153
  function renderModel(data, v) {
223
154
  let model = clean(data?.model?.display_name || "Claude");
224
155
  // Drop trailing parenthetical (e.g. "Opus 4.8 (1M context)" β†’ "Opus 4.8").
225
- if (v.short) model = model.replace(/\s*\([^)]*\)\s*$/, "").trim();
156
+ if (v.model === "trim") model = model.replace(/\s*\([^)]*\)\s*$/, "").trim();
226
157
  return paint("πŸ€– " + model, C.cyan);
227
158
  }
228
159
  function renderContext(data, v) {
@@ -231,10 +162,11 @@ function renderContext(data, v) {
231
162
  (Number(cw.total_input_tokens) || 0) +
232
163
  (Number(cw.total_output_tokens) || 0);
233
164
  let s = "🧠 " + humanTokens(tokens);
234
- if (!v.short && cw.used_percentage != null) s += ` (${round(cw.used_percentage)}%)`;
165
+ if (v.ctx === "pct" && cw.used_percentage != null) {
166
+ s += ` (${round(cw.used_percentage)}%)`;
167
+ }
235
168
  return paint(s, C.gray);
236
169
  }
237
- // `reset`: 2 = "Β· resets in Xd Yh (clock)", 1 = "Β· resets in Xd Yh", 0 = none.
238
170
  function renderLimit(limit, { icon, label, shortLabel, withDate }, { short, reset }) {
239
171
  const lbl = short ? shortLabel : label;
240
172
  if (!limit || limit.used_percentage == null) {
@@ -249,23 +181,22 @@ function renderLimit(limit, { icon, label, shortLabel, withDate }, { short, rese
249
181
  return s;
250
182
  }
251
183
 
252
- // Build one full status line at a given compactness variant. The variant gives
253
- // independent reset levels for session (`rs`) and week (`rw`); each is also
254
- // capped by the user's --reset choice.
184
+ // Build one status line at a given variant. Reset levels (rs/rw) are also
185
+ // capped by the user's --reset choice (it can hide a countdown, never add one).
255
186
  function buildLine(data, v) {
256
187
  const rl = data?.rate_limits || {};
257
188
  const cap = (which, level) => (resetAllowed(which) ? level : 0);
258
189
  const out = [];
259
190
  for (const seg of SEGMENTS) {
260
191
  if (seg === "model") {
261
- if (!v.dropModel) out.push(renderModel(data, v));
192
+ if (v.model !== "off") out.push(renderModel(data, v));
262
193
  } else if (seg === "context") {
263
- if (!v.dropContext) out.push(renderContext(data, v));
194
+ if (v.ctx !== "off") out.push(renderContext(data, v));
264
195
  } else if (seg === "session") {
265
196
  out.push(
266
197
  renderLimit(
267
198
  rl.five_hour,
268
- { icon: "⏳", label: "Session", shortLabel: "S", withDate: false },
199
+ { icon: "πŸ•”", label: "Session", shortLabel: "S", withDate: false },
269
200
  { short: v.short, reset: cap("session", v.rs) }
270
201
  )
271
202
  );
@@ -282,32 +213,17 @@ function buildLine(data, v) {
282
213
  return out.join(SEP);
283
214
  }
284
215
 
285
- // Compactness variants, richest β†’ poorest. We pick the richest one that fits
286
- // the terminal. The week countdown is dropped before the session one, and the
287
- // session/week percentages survive every tier.
288
- const VARIANTS = [
289
- { rs: 2, rw: 2, short: false }, // full: both resets + clock
290
- { rs: 2, rw: 1, short: false }, // week loses its clock
291
- { rs: 2, rw: 0, short: false }, // medium: session reset only
292
- { rs: 1, rw: 0, short: false }, // session reset, no clock
293
- { rs: 0, rw: 0, short: false }, // plain %, full labels
294
- { rs: 0, rw: 0, short: true }, // short labels, trim model/ctx
295
- { rs: 0, rw: 0, short: true, dropContext: true }, // drop context
296
- { rs: 0, rw: 0, short: true, dropContext: true, dropModel: true }, // limits only
297
- ];
216
+ // Size presets, richest β†’ smallest. The user picks one with --size / CC_LIMITS_SIZE.
217
+ const PRESETS = {
218
+ full: { model: "full", ctx: "pct", short: false, rs: 2, rw: 2 },
219
+ medium: { model: "trim", ctx: "pct", short: false, rs: 1, rw: 0 },
220
+ compact: { model: "trim", ctx: "pct", short: false, rs: 0, rw: 0 },
221
+ mini: { model: "trim", ctx: "tokens", short: true, rs: 0, rw: 0 },
222
+ bare: { model: "off", ctx: "off", short: true, rs: 0, rw: 0 },
223
+ };
298
224
 
299
225
  function render(data) {
300
- const full = buildLine(data, VARIANTS[0]);
301
- if (!ADAPT) return full;
302
- const w = termWidth();
303
- if (w == null) return full; // width unknown β€” never truncate ourselves
304
- const usable = w - 1; // small safety margin for emoji width rounding
305
- if (visibleLen(full) <= usable) return full;
306
- for (let i = 1; i < VARIANTS.length; i++) {
307
- const line = buildLine(data, VARIANTS[i]);
308
- if (visibleLen(line) <= usable) return line;
309
- }
310
- return buildLine(data, VARIANTS[VARIANTS.length - 1]);
226
+ return buildLine(data, PRESETS[SIZE] || PRESETS.medium);
311
227
  }
312
228
 
313
229
  // ---------- demo payload ----------
@@ -341,37 +257,35 @@ if (argv.includes("--help") || argv.includes("-h")) {
341
257
  "real Pro/Max rate limits (5h session + 7d week) with reset countdowns.",
342
258
  "",
343
259
  "Setup (writes ~/.claude/settings.json for you):",
344
- " cc-limits --install configure the status line",
345
- " cc-limits --install --segments=session,week ...with display options",
346
- " cc-limits --uninstall remove it again",
260
+ " cc-limits --install configure the status line",
261
+ " cc-limits --install --size=compact ...at a chosen size",
262
+ " cc-limits --uninstall remove it again",
347
263
  "",
348
264
  "Or set it manually in ~/.claude/settings.json:",
349
265
  ' "statusLine": { "type": "command", "command": "cc-limits" }',
350
266
  "",
267
+ "Size (pick the one that fits your terminal β€” default medium):",
268
+ " --size=full πŸ€– Opus 4.8 (1M context) | 🧠 172k (17%) | πŸ•” Session 14% Β· resets in 2h55m (04:00) | πŸ“… Week 12% Β· resets…",
269
+ " --size=medium πŸ€– Opus 4.8 | 🧠 172k (17%) | πŸ•” Session 14% Β· resets in 2h55m | πŸ“… Week 12%",
270
+ " --size=compact πŸ€– Opus 4.8 | 🧠 172k (17%) | πŸ•” Session 14% | πŸ“… Week 12%",
271
+ " --size=mini πŸ€– Opus 4.8 | 🧠 172k | πŸ•” S 14% | πŸ“… W 12%",
272
+ " --size=bare πŸ•” S 14% | πŸ“… W 12%",
273
+ "",
351
274
  "Segments (default: all, in this order): model, context, session, week",
352
275
  " --segments=session,week Show only these, in this order",
353
276
  " --no-context Hide a single segment (repeatable)",
354
277
  " --no-model --no-week ...",
355
278
  "",
356
- "Reset countdowns:",
279
+ "Reset countdowns (a preset's countdowns can be hidden, never added):",
357
280
  " --reset=both|session|week|none Which resets MAY show (default both)",
358
281
  " --no-reset Same as --reset=none",
359
282
  "",
360
- "Narrow terminals (on by default):",
361
- " The line auto-shrinks to fit the terminal width: it drops the week",
362
- " countdown first, then the session countdown, then shortens labels β€”",
363
- " always keeping the session/week %. Width is read from the terminal",
364
- " (via /dev/tty) and follows live resizes.",
365
- " --no-adapt Always print the full line (let CC truncate it)",
366
- " --width=N Assume N columns instead of auto-detecting",
367
- "",
368
283
  "Other flags: --demo, --no-color, -h/--help",
369
284
  "",
370
285
  "Env vars:",
286
+ " CC_LIMITS_SIZE=full|medium|compact|mini|bare",
371
287
  " CC_LIMITS_SEGMENTS=model,context,session,week",
372
288
  " CC_LIMITS_RESET=both|session|week|none",
373
- " CC_LIMITS_ADAPT=0 disable adaptive width (=--no-adapt)",
374
- " CC_LIMITS_WIDTH=N force a column width",
375
289
  " CC_LIMITS_WARN=70 yellow threshold (% of a limit)",
376
290
  " CC_LIMITS_CRIT=90 red threshold",
377
291
  " CC_LIMITS_SEP=' | ' segment separator",
@@ -435,7 +349,10 @@ function doUninstall() {
435
349
  }
436
350
 
437
351
  if (argv.includes("--install")) {
438
- const passthrough = argv.filter((a) => a !== "--install" && a !== "--uninstall");
352
+ // Bake only persistent display flags into the command β€” never the one-shot
353
+ // ones (--install/--demo/--help) or the status line would break.
354
+ const TRANSIENT = new Set(["--install", "--uninstall", "--demo", "--help", "-h"]);
355
+ const passthrough = argv.filter((a) => !TRANSIENT.has(a));
439
356
  doInstall(passthrough);
440
357
  process.exit(0);
441
358
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-limit-statusline",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Claude Code status line that shows your REAL Pro/Max subscription limits β€” 5-hour session and 7-day weekly usage with a live reset countdown. Uses the official rate_limits payload, not a local estimate.",
5
5
  "type": "commonjs",
6
6
  "bin": {