提交

提交图

480 次代码提交

作者 SHA1 备注 提交日期
Jarrod Watts aa1185e0bb chore: drop generated dist artifacts 2026-04-21 10:05:54 +10:00
Jarrod Watts 98dee8b401 fix(usage): bound external snapshot reads 2026-04-21 10:05:27 +10:00
amis ebc7615414 feat: add external usage snapshot fallback
Allow the HUD to show usage from an opt-in local snapshot when Claude Code omits rate limits, while rejecting stale or malformed data and documenting the fallback.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 10:04:40 +10:00
xiaoye5200 1953de9df7 feat(provider): add Vertex AI detection and disable cost estimation (#479)
* feat(provider): add Vertex AI detection and disable cost estimation

Add `isVertexModelId()` to detect Vertex AI model IDs (which use `@`
as a version separator, e.g. `claude-3-5-sonnet@20241022`), and check
`CLAUDE_CODE_USE_VERTEX=1` in `getProviderLabel()` to show "Vertex"
label alongside the existing Bedrock/Enterprise labels.

Disable cost estimation for Vertex AI users in both `estimateSessionCost`
and `getNativeCostUsd`, matching the existing Bedrock exclusion, since
Vertex pricing differs from Anthropic direct pricing.

* docs: add Vertex AI to provider label examples and cost notes

---------

Co-authored-by: mikzz xia <mikzzz@mikzzdeMacBook-Pro.local>
2026-04-21 10:03:51 +10:00
github-actions[bot] 1480712651 build: compile dist/ [auto] 2026-04-20 13:55:43 +00:00
Jarrod Watts 2649ccfd2e feat(cache): add prompt cache countdown (#477)
* feat(cache): add prompt cache countdown

* fix(cache): localize prompt cache and bust stale transcript cache

---------

Co-authored-by: Jarrod Watts <jarrod@Jarrods-MacBook-Pro.local>
2026-04-20 23:55:25 +10:00
github-actions[bot] 7ee2f4bad4 build: compile dist/ [auto] 2026-04-20 13:52:54 +00:00
Jarrod Watts 9739abc914 feat(layout): add configurable expanded merge groups (#476)
Co-authored-by: Jarrod Watts <jarrod@Jarrods-MacBook-Pro.local>
2026-04-20 23:52:34 +10:00
Jarrod Watts 02a25b3c8d fix(setup): harden Windows runtime guidance (#473)
Co-authored-by: Jarrod Watts <jarrod@Jarrods-MacBook-Pro.local>
2026-04-20 23:50:47 +10:00
github-actions[bot] a4cd9d134e build: compile dist/ [auto] 2026-04-20 13:50:43 +00:00
Jarrod Watts 7610fde8da feat(git): support wrapped branch display (#474)
Co-authored-by: Jarrod Watts <jarrod@Jarrods-MacBook-Pro.local>
2026-04-20 23:50:27 +10:00
Jarrod Watts 4d2a023863 release: bump version to 0.1.0 2026-04-20 21:09:34 +10:00
github-actions[bot] 6e146239ce build: compile dist/ [auto] 2026-04-20 11:05:40 +00:00
Jarrod Watts 0a6ef27a99 fix: tighten context cache fallback trigger 2026-04-20 21:05:25 +10:00
梁康达 c39811d605 fix(context): add session-scoped cache fallback for zero-usage frames
Claude Code occasionally reports context window usage as 0 despite
accumulated tokens, causing the statusline to display incorrect data.
Cache the last known-good context snapshot per session and restore it
when a suspicious zero frame is detected, with TTL-throttled writes
and periodic stale-entry cleanup.
2026-04-20 21:05:25 +10:00
github-actions[bot] 9dd73a0f6a build: compile dist/ [auto] 2026-04-20 10:59:27 +00:00
Jarrod Watts 1fc7086061 docs: document compact usage display 2026-04-20 20:59:09 +10:00
macworld b79bc02f51 feat(config): add usageCompact option for shorter usage display
Adds `display.usageCompact` (boolean, default false) that renders
usage stats in a shorter format:

  Default:  Usage 5h 25% (resets in 3h 45m) | Weekly 8% (resets in 2d)
  Compact:  5h: 25% (3h 45m) | 7d: 8% (2d)

When enabled: drops the "Usage" label, uses "5h:"/"7d:" prefixes
with a colon, and shortens "(resets in X)" to "(X)".

Also fixes the Usage Style Mapping table in configure.md — the
"Text style" description previously showed `5h: 25% (1h 30m)` which
did not match the actual output. The table now accurately documents
all three styles (bar, text, compact).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 20:59:09 +10:00
github-actions[bot] 96d6a1f7cd build: compile dist/ [auto] 2026-04-20 10:53:02 +00:00
zviehrman13 118bf874e4 feat: make usage reset label configurable 2026-04-20 20:52:47 +10:00
github-actions[bot] 77a1007dd2 build: compile dist/ [auto] 2026-04-20 10:49:42 +00:00
Jarrod Watts 7bfcc73a92 docs: document maxWidth fallback config 2026-04-20 20:49:22 +10:00
macworld bdac46b257 feat(config): add maxWidth fallback for terminal width detection
When all terminal width detection methods fail (stdout.columns,
stderr.columns, COLUMNS env), the renderer falls back to the
hardcoded UNKNOWN_TERMINAL_WIDTH (40). This new `maxWidth` config
option lets users replace that fallback with a value suited to
their device — useful on mobile clients, piped subprocesses, or
terminals where auto-detection is unreliable.

When the terminal reports a real width, maxWidth is ignored.

Closes #385, closes #404

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 20:49:22 +10:00
github-actions[bot] 857ab61143 build: compile dist/ [auto] 2026-04-20 10:46:43 +00:00
zane a5fa6ffe86 feat: add effort level display in model bracket
Displays the current reasoning effort level inside the model bracket
(e.g., [Opus 4.6 ●max]) when `display.showEffortLevel` is enabled.

Data source priority:
1. stdin.effort field (future-proof — ready for when Claude Code
   exposes effort in statusline JSON, per issues #39399, #50060)
2. Parent process CLI args (detects --effort flag at session start)

Supports all known levels with progressive fill symbols:
  ○ low | ◔ medium | ◑ high | ◕ xhigh | ● max

Unknown future levels display as plain text (no symbol), ensuring
forward compatibility as Claude Code adds/removes effort levels.

Also fixes: version selector in setup.md bash templates now filters
non-semver directories (e.g., .bak, -old) via grep before sort,
matching the existing PowerShell behavior.

Closes #201, relates to anthropics/claude-code#39399
2026-04-20 20:46:24 +10:00
Jarrod Watts 1759a75472 docs: sync zh translation with reset time settings 2026-04-20 19:02:22 +10:00
liupengfei fb38180582 docs: add Chinese README translation with mutual language links
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 19:02:22 +10:00
github-actions[bot] 7eb6afcfab build: compile dist/ [auto] 2026-04-20 09:00:40 +00:00
joel.gh 6af3504561 fix: show usage and cost for enterprise plan model aliases
Enterprise Claude Code accounts use model IDs like opusplan,
sonnetplan, and haikuplan instead of standard model names.
Previously getProviderLabel() returned 'Enterprise' for these,
causing usage and cost displays to be hidden via the same code
path used for Bedrock (which legitimately cannot show usage).

- Narrow the usage/cost hide condition to isBedrockModelId() only
- Add enterprise alias pricing to ANTHROPIC_MODEL_PRICING
- Add isEnterpriseModelId() helper and readable label mapping
  (opusplan → Claude Opus, sonnetplan → Claude Sonnet, etc.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 19:00:24 +10:00
github-actions[bot] 3cc9021716 build: compile dist/ [auto] 2026-04-20 08:58:43 +00:00
Jarrod Watts 5983d44dcf docs: document timeFormat and harden locale-sensitive tests 2026-04-20 18:58:23 +10:00
Wojciech Pędzimąż 3287adc786 test: add integration tests for timeFormat modes and limit-reached preposition 2026-04-20 18:58:23 +10:00
Wojciech Pędzimąż 01a6129593 fix: use preposition format for absolute/both modes in compact bar display
The upstream compact-layout bar format shows "(2h 30m / 5h)" for relative
time — the slash reads naturally as "duration / window". But for absolute
or both modes, this produces "(at 14:30 / 5h)" or "(2h 30m, at 14:30 / 5h)"
where the slash is incoherent.

Preserve upstream relative-mode behavior. Switch to the preposition form
(e.g. "resets at 14:30" / "resets in 2h 30m, at 14:30") when timeFormat
is absolute or both.
2026-04-20 18:58:23 +10:00
Wojciech Pędzimąż 01b436cefb fix: correct limit-reached preposition and i18n-ify the absolute "at" prefix
Two bugs caught in review:

1. Limit-reached path hardcoded t("format.resets") = "resets" for ALL
   timeFormat modes, so relative mode (the default) produced "Limit reached
   (resets 2h 30m)" instead of the correct "resets in 2h 30m". Applied the
   same resetsKey selection logic used in formatUsageWindowPart to both
   usage.ts and session-line.ts.

2. formatAbsolute hardcoded the English word "at", breaking zh locale:
   t("format.resets") = "重置于" (resets at) + "at 14:30" = "重置于 at 14:30"
   (doubled preposition). Added "format.at" i18n key (en: "at", zh: "" — zh
   omits the prefix since its "format.resets" already encodes the preposition).

Also updates the render.test.js assertion that was written against the old
incorrect behavior.
2026-04-20 18:58:23 +10:00
Wojciech Pędzimąż 0e97f91a6d feat: add display.timeFormat config for absolute/relative reset times
Adds a `display.timeFormat` configuration option (`'relative'` | `'absolute'` | `'both'`,
default `'relative'`) that controls how usage-window reset timestamps are shown in the HUD.

- `relative` (default) – unchanged behavior: "resets in 2h 30m"
- `absolute` – wall-clock time: "resets at 14:30" (or "at Jan 5 14:30" for next-day resets)
- `both`     – combined: "resets in 2h 30m, at 14:30"

Implementation:
- New shared `src/render/format-reset-time.ts` utility (locale-aware, eliminates
  duplicate private implementations in usage.ts and session-line.ts)
- `src/config.ts`: `TimeFormatMode` type + `timeFormat` field with validation
- `src/render/lines/usage.ts` + `src/render/session-line.ts`: thread `timeFormat`
  through `formatUsageWindowPart`; select correct i18n preposition
  (`format.resets` vs `format.resetsIn`) when mode is `absolute`
- 18 new tests in `tests/format-reset-time.test.js`

Closes #432
2026-04-20 18:58:23 +10:00
github-actions[bot] 40c8f79f93 build: compile dist/ [auto] 2026-04-20 08:54:39 +00:00
Jarrod Watts 84b74d419b fix(render): only pad progress labels when lines stack 2026-04-20 18:54:14 +10:00
dependabot[bot] f6862cb8ba chore(deps-dev): bump @types/node from 25.5.2 to 25.6.0
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.5.2 to 25.6.0.
- [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.6.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 18:49:02 +10:00
dependabot[bot] 6114b68be1 chore(deps-dev): bump typescript from 6.0.2 to 6.0.3
Bumps [typescript](https://github.com/microsoft/TypeScript) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Commits](https://github.com/microsoft/TypeScript/compare/v6.0.2...v6.0.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 6.0.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 18:48:41 +10:00
github-actions[bot] 26776cfeda build: compile dist/ [auto] 2026-04-20 08:48:26 +00:00
Nandana Dileep 4b4506997b fix: show initial context tokens when used_percentage is 0
On a fresh session Claude Code emits used_percentage=0 before any user
input, while current_usage already holds the real initial-context tokens
(system prompt, tools, memory files — ~9% on a 200k model).  The HUD
was treating 0 as a valid native value and skipping the token-based
fallback, so the context bar stayed at 0% even though /context showed 9%.

Treat used_percentage=0 the same as null: fall through to the manual
calculation from current_usage.  When tokens are present the bar now
reflects the true initial usage; when both are zero it still shows 0%.

Fixes #417
2026-04-20 18:48:07 +10:00
github-actions[bot] 3139961220 build: compile dist/ [auto] 2026-04-20 08:46:22 +00:00
kagura-agent 2233a8537c test: update assertions for paddedLabel alignment padding
Adjust two test expectations to account for the trailing spaces
that paddedLabel() adds when aligning shorter labels (Usage, Weekly)
to the width of the longest label (Context = 7 chars).
2026-04-20 18:46:07 +10:00
kagura-agent 8e771def92 fix: align progress-bar labels to equal visual width (fixes #437)
When Context, Usage, and Weekly lines wrap to separate rows on narrow
terminals, their progress bars now align vertically. A shared
paddedLabel() helper pads each label with spaces to the maximum visual
width across the three labels, accounting for CJK double-width chars.

- Add src/render/lines/label-align.ts with paddedLabel() utility
- Update identity.ts and usage.ts to use paddedLabel()
- Add tests for English and Chinese label alignment
2026-04-20 18:46:07 +10:00
github-actions[bot] e7c0cb9ef3 build: compile dist/ [auto] 2026-04-20 08:45:13 +00:00
Wei Zheng eeca878a20 fix(render): move speed field after cost to stabilize HUD layout
The output speed (`out: N tok/s`) only renders while stdin is actively
streaming and disappears once output ends. Placing it between git and
duration causes the surrounding elements (duration, cost) to reflow
horizontally every time speed appears or disappears — jarring visual
churn on every turn.

Moving speed to the end of the line (after cost, before customLine)
means the transient field only appends/disappears at the tail, leaving
all stable elements in place.

Applied to both renderProjectLine (expanded layout) and
renderSessionLine (compact layout) for consistency.
2026-04-20 18:44:54 +10:00
Jarrod Watts 169ef0e810 fix(setup): keep Git Bash quoting fix on current command template 2026-04-20 18:39:05 +10:00
YuGe-Git 82aae32145 fix(setup): use sort -V for Windows Git Bash to avoid awk quoting breakage
The macOS/Linux awk-based version sorting command uses '"'"' to nest
single quotes inside bash -c '...'. After JSON encoding/decoding in
settings.json, this quoting breaks on Windows Git Bash, causing a
silent syntax error that prevents the HUD statusline from starting.

Replace awk with sort -V (GNU version sort, included with Git for
Windows) in the Windows + Git Bash section, which avoids nested
single quotes entirely.

Fixes #326

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 18:39:05 +10:00
Martijn van Elferen 83fe73dfa3 fix(setup): support marketplace install paths
Widen glob from cache/claude-hud/claude-hud/*/ to cache/*/claude-hud/*/
so setup detects the plugin regardless of install method.

Fixes #398
2026-04-20 18:37:03 +10:00
github-actions[bot] b554fc2a0c build: compile dist/ [auto] 2026-04-20 08:35:04 +00:00