* fix: treat enabled extra usage without a monthly limit as complete usage data
Accounts with extra usage enabled but no monthly limit configured
(monthly_limit: null) never receive extraUsageLimit/extraUsageUtilization
from the usage API. hasRequiredUsageField treated those absent fields as
incomplete data on every fetch - including successful ones - so cached
data was never accepted, the fetch loop re-fetched each cycle, and the
extra usage widgets surfaced the cached lock error as a permanent
[Timeout].
Extend the existing extraUsageEnabled === false special case to any
response where the extra usage state is known: once the API has told us
whether extra usage is enabled, absent detail fields are conclusive and
refetching cannot produce them.
Fixes#413
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test: drop currency from no-limit fixture to stay order-independent of #418
Once #418 teaches the parser about extra_usage.currency, a fixture
carrying the field would add extraUsageCurrency to the parsed result
and break this test's expectation depending on merge order. The field
is irrelevant to what this test covers (monthly_limit: null handling).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* fix: keep usage-fetch tests from touching the real user cache
The probe subprocesses overrode HOME but inherited the real USERPROFILE,
which os.homedir() prefers on Windows, so every test run read and wrote
the developer's live ~/.cache/ccstatusline: fixture data and stale locks
ended up in the running statusline, which showed [Timeout] until the
lock expired and fixture percentages until the cache aged out.
- Pin USERPROFILE alongside HOME in the probe environment
- Pin CLAUDE_CONFIG_DIR and both proxy variables so inherited developer
settings never reach probes
- Report os.homedir() from every probe and assert it matches the sandbox
home, so any future isolation escape fails loudly
- Make the lowercase https_proxy assertion platform-aware: Windows
environment variables are case-insensitive, so it is indistinguishable
from HTTPS_PROXY there
On Windows this takes the file from 0/11 passing to 11/11.
Co-authored-by: Claude <noreply@anthropic.com>
* fix(test): preserve lowercase proxy env in usage probes
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat: line-spanning foreground gradients via overrideForegroundColor
Add a `gradient:<stop>,<stop>,...` form for `overrideForegroundColor` that
paints the whole status line with a continuous gradient — each visible
character is colored by its column position, so the gradient spans the line
rather than restarting per widget. Applies to standard (non-powerline) lines;
powerline separators derive their color from adjacent backgrounds, so a
foreground gradient is intentionally not applied there.
- src/utils/gradient.ts: parse hex stops (`hex:RRGGBB` / `#RRGGBB` / bare),
interpolate in OKLab for perceptually even, non-muddy blends, and map to
truecolor or the nearest ansi256 index.
- src/utils/ansi.ts: applyLineGradient walks the assembled line with the
existing escape/cluster tokenizer, so SGR styling and OSC-8 hyperlinks pass
through untouched and visible width is unchanged (flex layout unaffected).
- src/utils/renderer.ts: applied after assembly and before truncation in the
standard path. `overrideForegroundColor` accepts the new `gradient:` form
alongside the existing `hex:` / `ansi256:` / named tagged-string forms; a
gradient spec is not treated as a per-widget solid color and degrades to a
no-op at ansi16 (keeping widgets' own colors).
Tests cover spec parsing, OKLab sampling, ansi256 quantization,
width-invariance, OSC-8 passthrough, and a renderer integration case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat: add per-widget gradients + presets + TUI picker on the line-span core
Converges the two same-day gradient PRs into one coherent feature. #406
added line-spanning gradients via overrideForegroundColor (OKLab, zero-dep);
#404 (@akkaz) added gradient as a per-widget color with named presets and a
ColorMenu picker. Both created src/utils/gradient.ts and would conflict, so
this meshes them onto a single shared OKLab engine:
- gradient.ts: GRADIENT_PRESETS (akkaz's stops, gradient-string MIT;
rainbow/pastel re-expressed as multi-stop hue wheels for OKLab); unified
parseGradientSpec accepting presets, dash (RRGGBB-RRGGBB), and comma
(hex:..,..) forms; applyGradientToText for the per-widget sweep.
- colors.ts: per-widget gradient hook in applyColors; getColorAnsiCode
collapses a gradient to its first stop (powerline / ansi16 degrade).
- ColorMenu.tsx: 'g' opens a gradient picker (preset list + custom hex),
foreground-only, colorLevel >= 2.
- No new dependency (tinygradient dropped in favor of OKLab).
Precedence: overrideForegroundColor gradient (line-span) > widget.color
gradient (per-widget) > solid. Gradients self-degrade at render time, so
color-sanitize leaves them untouched at every level.
Builds on the per-widget design from #404 by @akkaz.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: akkaz <giomarco@cleversoft.it>
* refactor: polish gradient feature — fix truncation reset-leak, tighten, document
Pre-PR polish pass over the gradient feature.
Fix (correctness):
- renderStatusLine now applies the line-span gradient AFTER truncation, not
before. truncateStyledText cuts from the right and appends a raw "..." with no
trailing reset, so a gradient applied earlier had its closing \x1b[39m sliced
off, leaking the last color past the status line. Gradient codes are zero-width,
so the truncation measurement is unaffected by deferring. Regression test added.
Simplify:
- Add exported isGradientSpec(); reuse it across colors.ts and renderer.ts instead
of duplicating the 'gradient:' startsWith check. Drop the redundant prefix guard
in applyColors (parseGradientSpec already self-guards).
Docs:
- Document applyGradientToText's code-point (vs grapheme-cluster) iteration as a
known limitation, with the ZWJ/variation-selector consequence and the
circular-import reason it isn't unified with applyLineGradient yet.
- Note that hex:/# /bare stops are valid in both comma and dash parse forms.
- Note getColorAnsiCode's ansi16 branch intentionally emits a truecolor first-stop
escape (caller-degraded; never reached at a true ansi16 terminal).
- README + docs/USAGE.md: gradient color options (both scopes, presets, forms).
bun test 1433 pass / 0 fail; lint + tsc clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(gradient): preserve escape sequences in widget gradients
Keep ANSI and OSC control sequences byte-for-byte intact when applying per-widget gradients so hyperlinks and pre-styled widget output are not corrupted by inserted SGR codes.
Count and color only visible non-whitespace characters while passing escape sequences through unchanged. Add a regression covering styled OSC 8 link output.
* fix(colors): suppress gradient fallback at ansi16
Prevent stored gradient color specs from emitting 24-bit SGR codes when the active terminal color level has been reduced to Basic or No Color.
Leave gradient settings intact, but return no gradient ANSI fallback at ansi16 and cover the behavior in per-widget and raw-code regression tests.
* fix(renderer): detect truncated gradient lines visibly
Preserve truncation reporting after whole-line gradients insert SGR codes between the ellipsis characters.
Check the visible text for the truncation marker instead of the raw styled bytes, and add a regression where the rendered line no longer contains a literal contiguous ellipsis.
* feat(tui): add gradients to foreground overrides
Let Global Overrides assign a whole-line foreground gradient through the same preset/custom selector used by the color screen.
Move (g) to gradient selection, add (x) as the foreground override clear key, show gradient override values in the menu, and update usage docs for the new controls and Basic/No Color degradation behavior.
In Powerline mode, carry global gradient position continuously across widget text while leaving separators and caps under Powerline contrast rules. Surface an active foreground override warning on the Powerline Setup screen so theme masking is visible.
---------
Co-authored-by: Cameron Sjo <cameronsjo@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: akkaz <giomarco@cleversoft.it>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat: add remote control status widget
Adds a widget that reads ~/.claude/sessions/<pid>.json and shows whether
the current session has a remote-control bridge attached, matched by
session_id from the Claude Code status payload.
Claude Code sets bridgeSessionId to null on disconnect and rewrites the
session file within ~1s, so the widget reflects connect/disconnect
transitions at the next status-line refresh.
* feat: add label-check format to remote control status widget
Renders "remote ✅" when connected and "remote ❌" when disconnected, so
the bar can be parsed by shape/color at a glance instead of reading "on"
or "off". Slots into the existing format cycle after word.
* feat: add label-mark format using text-mode check/cross
Renders "remote ✓" / "remote ✗" using U+2713 and U+2717. Unlike the
label-check emoji variant these are text-mode glyphs, so they stay
single-cell and pick up the widget color instead of drawing in the OS
emoji palette — less visually invasive while still parseable by shape.
* fix(extra-usage): correct unit assumptions for usage API response
The Anthropic usage API returns `extra_usage.used_credits` in cents (not
dollars) and `extra_usage.utilization` as a percent 0-100 (not a 0-1
fraction). The current widget code assumed the inverse, which made:
- ExtraUsageUtilization always clamp to 100.0% (multiplying a percent
by 100 and clamping to [0,100])
- ExtraUsageRemaining always show $0.00 (subtracting cents from dollars
goes negative, clamped to 0)
Drop the `* 100` in ExtraUsageUtilization and divide `extraUsageUsed`
by 100 in ExtraUsageRemaining so both widgets render real values.
Verified locally against a live API response where util=6.74 and
used=27087/limit=400000 — now renders "Overage: 6.8% | Overage Left:
\$3,728.54" instead of "Overage: 100.0% | Overage Left: \$0.00".
* test(extra-usage): update fixtures for corrected unit assumptions
Adjust extraUsageUsed fixtures to cents and extraUsageUtilization
fixtures to 0-100 percentages so they exercise the corrected widget
math.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test(extra-usage): align API unit fixtures
Update fetch and prefetch fixtures to reflect used credits as cents and extra usage utilization as a 0-100 percentage. Clarify the UsageData comments to match the widget contract.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
Add a (w)eekday toggle to the Weekly Reset Timer widget in date mode.
When enabled, renders "Sun 11:00 PM GMT+9" instead of the full ISO date,
matching Claude web's weekly usage display style.
Co-authored-by: mm-aranda <aranda@macromill.com>
* feat(terminal): honor CCSTATUSLINE_WIDTH env var to override probe
Provide an explicit width override so users can bypass the TTY probe
entirely when both ancestor-walk and `tput cols` fall through.
This is the fallback case the existing probe cannot solve on its own:
Claude Code >= 2.1.139 spawns statusline/hooks without terminal access,
and in some configurations (IDE integrations, nested shells, certain
agent-mode spawn paths) no ancestor process owns a TTY either. The
ancestor walk fails, `tput cols` returns 80, and the multi-line layout
truncates regardless of the actual iTerm2/terminal width.
PR #377 (`stty -F`/`stty -f`) covers the case where an ancestor does
hold a TTY but the legacy `< /dev/tty` form errors with ENOTTY. This
patch is complementary -- it handles the case where the ancestor walk
finds no TTY at all -- and gives users a knob today while upstream
work on passing `terminalWidth` via stdin JSON (#308) lands.
Change
------
`src/utils/terminal.ts` -- `probeTerminalWidth` now reads
`CCSTATUSLINE_WIDTH` before any platform check or probe. A valid
positive integer short-circuits with that value; anything else
(missing, empty, non-numeric, zero, negative) falls through to the
existing probe logic.
Usage
-----
Set the env var on the statusLine command in `~/.claude/settings.json`:
```json
"statusLine": {
"type": "command",
"command": "CCSTATUSLINE_WIDTH=200 ccstatusline"
}
```
Tests
-----
Four new cases in `src/utils/__tests__/terminal.test.ts`:
- override short-circuits probing entirely
- non-positive override (`0`) falls back to probing
- non-numeric override falls back to probing
- override applies on Windows where probing is otherwise disabled
`bunx vitest run src/utils/__tests__/terminal.test.ts` -> 12/12 pass.
Full-suite delta vs `main`: 4 new passing tests, zero new failures
(the pre-existing 105 env-specific failures in other suites are
unchanged on both branches).
`bun run lint` -> clean.
* docs: document terminal width override
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
Add persistent git command caching under ~/.cache/ccstatusline/git-cache with command-only entries, cwd metadata, repo mtimes, and configurable TTL.
Expose Git Cache TTL in Configure Status Line, default it to 5s, and pass it through the real render context.
Make pinned global install the top/default option, clarify install wording, and add windowsHide to runtime child process options.
Closes#384.
* fix(git): use compatible git commands for older git versions
This commit updates git commands to be compatible with older versions of Git (e.g. 2.10.1). Specifically, it replaces branch --show-current with rev-parse --abbrev-ref HEAD and uses the GIT_OPTIONAL_LOCKS environment variable instead of the --no-optional-locks flag.
* fix(git): address review compatibility regressions
Use symbolic-ref --short HEAD for branch detection in the GitBranch widget and review cache so unborn branches keep rendering their branch name while detached HEAD still resolves as no branch.
Update git command assertions after replacing --no-optional-locks argv usage with GIT_OPTIONAL_LOCKS=0 in the exec environment, including shared coverage for widgets and git remote helpers.
Add a small test helper for asserting git exec options without depending on the full process environment.
Verification: bun test; bun run lint; git diff --check
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
When the statusline refreshes while another git process is writing
.git/index.lock (e.g. a concurrent `git restore --staged`), commands
like `git diff --shortstat` fail with "Unable to create index.lock"
because diff tries to refresh the stat cache and races on the lock.
`runGitArgs` now prepends `--no-optional-locks` to every git
invocation so read-only commands cannot interfere with the user's
working git operations. The two call sites that already prefixed the
flag manually are simplified.
* feat: add extra usage widgets and fix null rate-limit buckets for pay-as-you-go plans
Add two new widgets for Anthropic pay-as-you-go (extra usage) plans:
- `extra-usage-utilization` — shows overage utilization as a percentage
- `extra-usage-remaining` — shows remaining monthly overage budget in dollars
Fix a Zod schema bug that caused all usage widgets to time out on PAYG plans.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: handle disabled extra usage widgets
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
The TTY-width probe walked ancestor processes to find a controlling
PTY and ran `stty size < /dev/${tty}` to read its dimensions. That
form fails with ENOTTY on Linux when the calling process has no
controlling terminal — which is now the case under Claude Code
>= 2.1.139, whose changelog reads "hooks now run without terminal
access". The statusLine spawn is hardened the same way. Probe falls
back to `tput cols` (= 80), flexMode "full-minus-40" collapses to
40 columns, and the statusline truncates regardless of the real
terminal width.
GNU coreutils `stty -F <path>` and BSD `stty -f <path>` open the
device themselves (with O_NOCTTY semantics) and succeed regardless
of controlling-tty status. Try `-F` then `-f` then the historical
redirect form so we keep working on every stty variant.
Verified: on a Linux+ptyxis spawn under Claude Code 2.1.140 the probe
goes from returning null to returning the real width (159 cols here)
without restarting the session.
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
Use widget-specific requirements to fetch missing usage fields and merge rate_limits data with API results.
Preserve API errors alongside available usage data so widgets with fulfilled fields still render while missing fields surface fetch failures.
Adds a "Integration Example: AIWatch" section to docs/USAGE.md mirroring
the existing ccusage section, plus a Related Projects link in README, per
the placement the maintainer chose in #362.
AIWatch (ai-watch.dev) monitors live status for 30+ AI APIs/apps; the
Custom Command one-liner surfaces degraded providers in the status line
and renders empty when everything's operational.
Co-authored-by: Bentley <bentley@naemomlab.com>
* feat: add voice status widget showing Claude Code voice input state
* Fix voice status workspace config lookup
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat(jj): add jj utility functions and shared hide-no-jj feature
Add jj VCS utility module mirroring the existing git utilities with
workspace detection, command execution, and diff stat parsing. Add
shared jj-no-jj toggle for hiding 'no jj' messages in jj widgets.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(jj): add JjChange and JjBookmark widgets
Add two new Jujutsu VCS widgets mirroring the GitBranch pattern:
- JjChange: displays current jj change ID with `jj:` prefix
- JjBookmark: displays current jj bookmark name(s) with `@` prefix,
showing `(none)` when no bookmarks are set
- Add `runJjRaw` utility to distinguish empty output from errors
Both widgets support raw value mode, hide-no-jj configuration,
and include full test coverage (17 tests).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(jj): add JjChanges, JjInsertions, JjDeletions, JjRootDir, and JjDescription widgets
Add five new Jujutsu VCS widgets with full test coverage:
- JjChanges: combined insertions/deletions count (+ins,-del)
- JjInsertions: insertion count from jj diff --stat
- JjDeletions: deletion count from jj diff --stat
- JjRootDir: workspace root directory name extraction
- JjDescription: current change description via jj log
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(jj): add JjWorkspace widget for displaying current workspace name
Add getJjCurrentWorkspace() utility that parses `jj workspace list` output
to extract the current workspace name from the first line. Implement
JjWorkspaceWidget with blue color, W: prefix, raw value support, and
hide-no-jj toggle. Include tests for both the utility function and widget.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(jj): register all jj widgets in manifest and add shared behavior tests
Add all 8 jj widgets (JjChange, JjBookmark, JjChanges, JjInsertions,
JjDeletions, JjRootDir, JjDescription, JjWorkspace) to the widget
exports and manifest registry. Add shared behavior test suite validating
hide-no-jj keybind, metadata toggling, editor display, and Jujutsu
category across all jj widgets.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(jj): consolidate runJj/runJjRaw, fix double subprocess and hideNoJj invariant
- Merge runJjRaw into runJj with allowEmpty parameter to eliminate
duplication while preserving semantic distinction between empty
output and command failure
- Fix JjRootDir calling jj workspace root twice per render by
removing redundant isInsideJjWorkspace guard
- Extract getRootDirName to module-level function (matches project
convention of no private helper methods)
- Fix JjDescription ignoring hideNoJj flag when command fails after
workspace check passes
- Fix JjDescription preview string inconsistency ('(no description
set)' vs '(no description)')
- Add tests for allowEmpty behavior and JjDescription hideNoJj
command failure case
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(git): add hideWhenJj toggle to suppress git widgets in jj workspaces
Add a new per-widget toggle that hides git widgets when a jj workspace
is detected, enabling clean colocated repo support. Users can press 'j'
in the TUI items editor to enable this on any git widget.
- Add git-hide-when-jj.ts shared module with metadata flag, keybind,
and editor display helpers
- Update all 6 git widgets (Branch, Changes, Insertions, Deletions,
RootDir, Worktree) with the new toggle
- Compose modifier text from both hideNoGit and hideWhenJj flags
- Chain action handlers via nullish coalescing
- Add shared behavior tests for toggle, keybind, and modifier display
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(jj): remove git widget jj hide keybind
* chore(git): restore git modifier helper usage
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
Previously the Context % and Context % (usable) widgets always
rendered the static label "Ctx: " / "Ctx(u): ", so a user looking
at "Ctx: 9.3%" could not tell whether 9.3% was used or remaining
without opening the editor to check the inverse toggle.
Now the label reflects the current state:
- default (used): "Ctx Used: X%" / "Ctx(u) Used: X%"
- inverse (left): "Ctx Left: X%" / "Ctx(u) Left: X%"
The existing (u) keybind "(u)sed/remaining" and modifier text
"(remaining)" already named these states; this just surfaces the
same distinction in the rendered status line output. Tests updated
to match.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat: add time cursor to usage progress bars
The old progress bar showed only how much of the usage limit had been
consumed. The new makeTimerProgressBar adds an optional cursor marker
that shows the elapsed time position within the current usage window.
Users can toggle the cursor on and off with the t keybind when in
progress display mode.
* fix: show time cursor in short usage bars
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat: add compaction-counter widget
Tracks context compaction events per session. When Claude Code compacts
the conversation, used_percentage drops; this widget detects the drop
and displays ↻N.
Detection: any drop in used_percentage > 2 points between consecutive
renders counts as one compaction. The threshold filters rounding noise
on both 200K and 1M context windows. State stored per-session in
~/.cache/ccstatusline/compaction/ as JSON.
Related: #92
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: sanitize session ID in cache path and handle write failures
- Sanitize session ID to prevent path traversal via crafted StatusJSON
- Wrap cache writes in try/catch — failures no longer crash status line
- Add persistence tests: round-trip, path traversal regression, write failure
- Clarify threshold doc (drop must exceed 2 points)
Co-Authored-By: Claude <noreply@anthropic.com>
* style: align compaction files with project conventions
- Restore EOF newlines (eol-last flipped 'never' → 'always' in 9f779db)
- Use bare module names ('fs', 'os', 'path') with namespace imports
- Use safeParse for cache file parsing
- Refactor test to use a render(options) helper
- Strip @param/@returns from detectCompaction JSDoc
- Collapse trivial single-property object literals to one-line form
- Split guard clause across two lines in CompactionCounter.render
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(widget): harden compaction-counter against bad input and symlinks
Correctness:
- Pass raw used_percentage to detectCompaction; Math.round was missing
real drops between rounded points (40.4 → 37.6 is a 2.8 drop but
rounds to 40 → 38 = 2, failing the > 2 threshold).
- Sentinel prevCtxPct=-1 for fresh state so sessions starting at 0%
are detected correctly (prior prevCtxPct>0 guard excluded that case).
- Guard detectCompaction against NaN/Infinity/negative input; NaN
silently poisoned prevCtxPct and disabled detection forever.
- Always load the persisted count so the widget keeps showing the
historical value when a status update has no used_percentage; only
run detection+save when a current percentage is present.
- Skip the save when state is unchanged, avoiding a redundant fsync
per refreshInterval tick.
Security:
- Atomic save via temp file + rename defeats a planted symlink at the
cache path that would otherwise be written through. Orphan temp
files are cleaned up if rename fails after write succeeded.
- Open with O_NOFOLLOW + fstat on the open fd: rejects symlinks and
non-regular files on read, and closes the TOCTOU window that would
otherwise let the path be swapped between stat and read.
- 4 KiB cache file size cap on read prevents DoS via oversized file.
- Hash session IDs that are empty or contain disallowed characters so
distinct sessions can't collide in the same cache file.
Tests added for NaN/Infinity/negative input, non-integer drops, 0%
session start, sequential compactions, threshold 0, corrupted JSON,
oversized cache file, symlink rejection on read, atomic save replacing
a planted symlink, session-ID collision, and preview ignoring live data.
Symlink tests are skipped on Windows where fs.symlinkSync requires
elevated privileges.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(compaction): harden counter detection and display
fix(compaction): derive usage from shared context percentage metrics when raw used_percentage is missing.
fix(compaction): reset persisted baselines when context window sizes change to avoid false compaction counts.
refactor(context): reuse shared percentage metrics in the context percentage widget.
feat(compaction-counter): add format cycling for icon-space, text label, and number-only displays.
feat(compaction-counter): add Nerd Font icon support only for the icon-space format.
feat(compaction-counter): show zero by default and add an opt-in hide-when-zero toggle.
test(compaction): cover window-size changes, derived percentages, display modes, Nerd Font behavior, and zero visibility.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
In layouts with explicit `{type: "separator"}` items, when a widget
between two separators renders empty, both surrounding separators
still emit — producing "A | | B" instead of "A | B". The walkback
in renderStatusLine that gates each separator was looking for ANY
prior widget with content, not the immediately-prior one. That's
correct for hiding a leading separator (nothing before it) but
wrong when the immediate-prior widget is empty in the middle of a
line.
Fix: stop the walkback at the first non-separator widget and emit
only when that widget actually rendered content. The leading-edge
case still hides correctly (no prior widget → no orphan), and a
merge:'no-padding' chain across a collapsed separator now reaches
the next visible widget as expected. Affects any hide-capable
widget (git-changes with hideNoGit, etc.). The auto-separator
(defaultSeparator) path already filters empty widgets out of its
element chain and isn't touched.
New tests cover:
- empty widget between two separators (the canonical case)
- consecutive empty widgets between content widgets
- leading empty widget (regression — already worked, locks behavior)
- merge:'no-padding' interaction across a collapsed separator
- defaultSeparator path independence (the fix doesn't couple to it)
- all-content happy path (regression guard)
Co-authored-by: Claude <noreply@anthropic.com>