418 Commits

Author SHA1 Message Date
github-actions[bot]
51e6e18ca4 build: compile dist/ [auto] 2026-03-14 00:26:03 +00:00
Jarrod Watts
a089537a11 fix: surface stale usage syncing during rate limits (#207) 2026-03-14 11:25:42 +11:00
github-actions[bot]
768346fb34 build: compile dist/ [auto] 2026-03-14 00:20:44 +00:00
Jarrod Watts
14763584eb feat: add configurable HUD color overrides (#206)
* feat: add configurable HUD color overrides

* docs: preserve manual color overrides in configure flow
2026-03-14 11:20:23 +11:00
github-actions[bot]
e71f578033 build: compile dist/ [auto] 2026-03-14 00:19:57 +00:00
Jarrod Watts
d4abb17a20 fix: prefer account-scoped keychain credentials (#205)
* fix: prefer account-scoped keychain credentials

* test: block generic fallback after empty account-scoped keychain lookup

* test: block generic fallback after account lookup errors

* fix: block cross-service keychain credential fallback
2026-03-14 11:19:35 +11:00
github-actions[bot]
b7306dae0d build: compile dist/ [auto] 2026-03-14 00:15:20 +00:00
Hwang In-wook
603e48f699 feat: show reset time for 7-day usage in text-only mode (#194)
* feat: show reset time for 7-day usage in text-only mode

- When usageBarEnabled is false, 7d usage now displays reset time,
- consistent with the existing 5h usage text-only behavior.

* test: cover text-mode 7-day reset countdown

---------

Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-14 11:14:56 +11:00
github-actions[bot]
202707459f build: compile dist/ [auto] 2026-03-14 00:12:00 +00:00
Paul
e8d64924bc fix: resilient usage display under API rate limiting (#193)
* fix: resilient usage display under API rate limiting

The Anthropic usage API rate-limits to ~1 call per 5 minutes. With the
previous 60s cache TTL, 4 out of 5 API calls returned 429, causing the
HUD to permanently display "(429)" instead of actual usage data.

Three-layer fix:
- Increase cache TTL from 60s to 5 minutes to match rate limit window
- Preserve lastGoodData in cache across rate-limited periods so the HUD
  always shows the best available data instead of errors
- Exponential backoff (60s→120s→240s→5min cap) with Retry-After header
  support for consecutive 429 responses

Also show "syncing..." instead of raw HTTP status on first-run rate limit.

* Update usage-api.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: harden 429 cache fallback behavior

* test: stabilize usage cache suite after rebase

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-14 11:11:36 +11:00
github-actions[bot]
98cde23e48 build: compile dist/ [auto] 2026-03-14 00:06:32 +00:00
Brandon Wie
086603e7ca fix: treat zero-byte lock file as stale to prevent permanent busy state (#203)
* fix: treat zero-byte lock file as stale to prevent permanent busy state

If the HUD process crashes between fs.openSync(lockPath, 'wx') and
fs.writeFileSync(fd, timestamp), a 0-byte .usage-cache.lock remains.
readLockTimestamp() returns null for unparseable content, and the
existing guard (lockTimestamp != null && expired) never fires, leaving
the cache permanently stuck in 'busy' state.

Add a lockTimestamp === null guard that uses fs.statSync().mtimeMs to
distinguish a crash leftover (old mtime → remove and retry) from an
active writer that is between openSync and writeFileSync (recent mtime
→ return busy). The original != null stale-timestamp path is unchanged.

Closes #202

* test: stabilize stale-lock regression coverage

* test: make usage-api suite self-build for source-only PRs

---------

Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-14 11:06:09 +11:00
ruohan.chen
b99ae79764 fix: use version-based sorting instead of mtime for plugin selection (#199)
* fix: use version-based sorting instead of mtime for plugin selection

The statusline command used `ls -td` (sort by modification time) to
select the latest plugin version from the cache directory. When multiple
versions coexist after an upgrade, the older version can have a newer
mtime, causing the statusline to run the wrong version.

This led to a real issue where v0.0.7 (no proxy support) was selected
over v0.0.9, causing persistent 403 errors on the usage API for users
behind a required proxy.

Replace `ls -td | head -1` with `ls -d | sort -V | tail -1` to sort
by version number. Apply the equivalent fix for Windows PowerShell
using `[version]` casting.

Fixes #198

* docs: make setup version lookup portable

* docs: avoid login shell in setup command

---------

Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-14 11:00:37 +11:00
github-actions[bot]
99ef599879 build: compile dist/ [auto] 2026-03-13 23:58:12 +00:00
Xingxing
069f194fb2 fix(context): scale autocompact buffer by raw usage (#190)
* fix(context): scale autocompact buffer by raw usage to avoid inflated percentages at low context

Previously the buffered context percentage applied a flat 22.5% buffer
regardless of actual usage. This caused the HUD to show ~28% context
used immediately after /clear or at session start, when real usage was
only ~5%. The fix scales the buffer linearly: zero buffer at ≤5% raw
usage, ramping to full buffer at ≥50%, matching when autocompact
actually kicks in.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: harden autocompact buffer startup coverage

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-14 10:57:49 +11:00
github-actions[bot]
c02787bf0e build: compile dist/ [auto] 2026-03-09 04:13:43 +00:00
yelo
ce5960dcd8 Add configurable usage cache TTL settings (#175)
* feat(config): add configurable usage cache TTL settings

Add cacheTtlSeconds and failureCacheTtlSeconds to the usage section of
config.json, allowing users to control how often the Anthropic usage API
is fetched (default 60s) and how quickly failures are retried (default 15s).

* docs: document usage cache TTL config options

* refactor(usage): bundle cache TTL params into single CacheTtls object

Replace cacheTtlMs/failureCacheTtlMs pair with a CacheTtls type wherever
they appear together, reducing parameter count in readCacheState, readCache,
waitForFreshCache, and UsageApiDeps.

* chore(build): drop dist changes from pr

---------

Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-09 15:13:22 +11:00
github-actions[bot]
b873caab2d build: compile dist/ [auto] 2026-03-09 03:58:10 +00:00
yelo
8c247a0ab2 Skip usage api for custom provider (#176)
* fix(usage): skip API call when using custom provider

Check ANTHROPIC_BASE_URL / ANTHROPIC_API_BASE_URL env vars and skip
OAuth usage API call when user is configured to use a custom provider
(e.g., via cc-switch). This prevents unnecessary API failures when
the user is not using Anthropic's default endpoint.

* test(usage): add tests for custom API endpoint detection

Cover isUsingCustomApiEndpoint behavior via getUsage integration:
- ANTHROPIC_BASE_URL with custom endpoint returns null without fetch
- ANTHROPIC_API_BASE_URL with custom endpoint returns null without fetch
- Empty ANTHROPIC_BASE_URL proceeds normally (falsy check)
- Default endpoint with/without trailing slash proceeds normally

* docs: note that custom API endpoints skip usage display

* fix(usage): tighten custom endpoint detection

---------

Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-09 14:57:51 +11:00
Jarrod Watts
499ddc881e fix(context): adjust autocompact fallback buffer (#184) 2026-03-09 14:37:25 +11:00
github-actions[bot]
6afe1da971 build: compile dist/ [auto] 2026-03-09 01:15:13 +00:00
dependabot[bot]
90c08bdf00 chore(deps-dev): bump @types/node from 25.3.3 to 25.3.5 (#182)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.3.3 to 25.3.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 25.3.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-09 12:14:41 +11:00
Peter Zerg
46b827a302 fix(usage-api): restore User-Agent to claude-code/2.1 to fix 429 (#177)
PR #174 (67ddceb) accidentally reverted the User-Agent from
'claude-code/2.1' back to 'claude-hud'. Anthropic's /api/oauth/usage
endpoint rejects non-official User-Agent strings with 429.

This was the root cause of issue #173 — not request volume or
failure cache TTL. Same token, same IP:
- User-Agent: claude-hud      → 429 (always)
- User-Agent: claude-code/2.1 → 200 with usage data

Restores the fix from PR #168 (ceb1127).

Fixes #173

Co-authored-by: Peter Yan <yanxiaozerg1997@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 12:14:30 +11:00
github-actions[bot]
d0e294c2ba build: compile dist/ [auto] 2026-03-06 07:05:40 +00:00
Jarrod Watts
67ddceb38a fix(usage): prevent cross-process usage API stampedes (#174)
* fix(usage): dedupe concurrent usage API refreshes

* chore: stop tracking dist artifacts

* chore: restore tracked dist artifacts
2026-03-06 18:05:16 +11:00
github-actions[bot]
daab333f3e build: compile dist/ [auto] 2026-03-05 23:56:08 +00:00
seb
6c8c89cb19 feat(config): repair expanded element ordering (#166)
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-06 10:55:44 +11:00
github-actions[bot]
1e54b40ca3 build: compile dist/ [auto] 2026-03-05 23:55:35 +00:00
xiangboit
ceb112777c fix(usage-api): change User-Agent to avoid Anthropic 429 rate limiting (#168)
* fix(usage-api): change User-Agent to avoid Anthropic 429 rate limiting

Anthropic applies stricter rate limits to non-official User-Agent
strings. The current 'claude-hud/1.0' consistently receives 429
responses while 'claude-code/2.1' succeeds for the same token.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(usage-api): cover user-agent constant

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-06 10:55:11 +11:00
myaiexp
5467f29e50 feat(config): add showSessionName toggle (default off) (#170)
* feat(config): add showSessionName toggle (default off)

Session name display from #155 is now opt-in via display.showSessionName
config. This addresses user feedback requesting the ability to hide the
session name. Added to setup onboarding and configure command flows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(docs): cover session-name default behavior

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-06 10:44:05 +11:00
github-actions[bot]
cf1dbdef64 build: compile dist/ [auto] 2026-03-05 12:14:40 +00:00
xiangboit
9b491d09eb fix(usage-api): proxy CONNECT tunnel broken by premature socket return (#167)
* fix(usage-api): do not return socket from createConnection in proxy tunnel agent

Node.js _http_agent.js calls `oncreate(null, newSocket)` immediately
when createConnection returns a truthy value, which causes the HTTP
request to be written directly to the raw proxy socket before the
CONNECT handshake completes. Proxies like Clash reject this with
400 Bad Request, surfacing as persistent 403/network errors in the
Usage display.

Return undefined instead so the socket is only delivered via the
async callback after the CONNECT tunnel + TLS handshake succeeds.

Fixes proxy CONNECT failures with Clash and similar HTTP proxies.

* test(usage-api): cover proxy CONNECT request ordering

---------

Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-05 23:14:15 +11:00
Jarrod Watts
b10fe59935 ci(release): use changelog notes with explicit token permissions 2026-03-05 18:43:18 +11:00
Jarrod Watts
b57aa1e8fa chore(release): 0.0.9 v0.0.9 2026-03-05 18:40:35 +11:00
github-actions[bot]
b8d6fd3f70 build: compile dist/ [auto] 2026-03-05 07:36:22 +00:00
Jarrod Watts
9141620f45 fix(render): avoid non-breaking space output in status line (#165) 2026-03-05 18:36:06 +11:00
github-actions[bot]
229636f4d9 build: compile dist/ [auto] 2026-03-05 07:33:05 +00:00
Jarrod Watts
a47f5b7905 fix: address Windows setup, Bedrock labels, and usage API reliability (#164)
* docs(setup): handle win32 bash vs powershell command paths

* fix(stdin): normalize bedrock model ids when display_name is missing

* fix(usage): harden proxy oauth fallback and timeout handling
2026-03-05 18:32:44 +11:00
github-actions[bot]
d9c48050f8 build: compile dist/ [auto] 2026-03-03 06:00:48 +00:00
Fredrik Averpil
4d31c33682 feat: add showProject config to hide project name (#136)
* feat: add showProject config to hide project name from statusline

Adds `display.showProject` (default: true) to control whether the
project path is displayed. When set to false, the project name and
its associated git info are hidden from both compact and expanded
layouts.

* fix: keep git status visible when project name is hidden

---------

Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-03-03 17:00:33 +11:00
github-actions[bot]
d373661ef7 build: compile dist/ [auto] 2026-03-03 05:47:32 +00:00
Jarrod Watts
9ae17fb644 fix: consolidate CLAUDE_CONFIG_DIR handling and keychain fallback (#160)
* fix: consolidate CLAUDE_CONFIG_DIR handling and keychain fallback

* chore: remove dist artifacts from this PR

* chore: bump version to 0.0.8

* docs: expand 0.0.8 changelog from post-0.0.7 commits
2026-03-03 16:47:15 +11:00
github-actions[bot]
c1d0583bea build: compile dist/ [auto] 2026-03-03 04:27:11 +00:00
dependabot[bot]
0e96fa8ac7 chore(deps-dev): bump @types/node from 25.2.3 to 25.3.3 (#153)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.2.3 to 25.3.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 25.3.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-03 15:26:48 +11:00
Jarrod Watts
6ff4212238 fix: prevent HUD rows disappearing in narrow terminals (#159)
* fix(render): handle narrow terminals without dropping rows

* chore: drop dist artifacts from issue-151 PR

* fix(render): preserve multiline activity under narrow widths
2026-03-03 15:26:30 +11:00
github-actions[bot]
b3dd713660 build: compile dist/ [auto] 2026-03-03 03:19:36 +00:00
Jarrod Watts
26eddbaec9 fix: prefer subscription plan label over API env var (#158) 2026-03-03 14:19:19 +11:00
github-actions[bot]
a4657530ba build: compile dist/ [auto] 2026-03-03 03:19:18 +00:00
Jarrod Watts
1792060612 feat(config): add contextValue remaining mode (#157) 2026-03-03 14:18:46 +11:00
github-actions[bot]
df61de50b4 build: compile dist/ [auto] 2026-03-03 03:08:33 +00:00