Repository navigation
Add optional status-bar quota format template - #108
Conversation
Adds statusBarQuotaFormat (default empty, which keeps the built-in
layout). A template names the quota windows itself:
{5h|wk|7d|model:NAME}.{pct|reset|label}, e.g.
"{5h.pct} | {7d.pct} · {model:Fable.pct}".
Separators come out as typed. A segment whose windows the account does
not report is dropped together with its separator, so one template
works across plans. The warning colour follows the windows the
template shows.
|
🤖 Automated first-pass review The configured analysis model did not return a usable analysis for this pull request. The item has still been received and remains available for maintainer review. To help with review, please ensure the change summary, tests, and any user-facing documentation or localization updates are included. 🤖 Posted automatically by CCU Bot — not a maintainer decision. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Preserve unknown tokens and literal whitespace, and document the setting in all seven README editions.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Adds an opt-in statusBarQuotaFormat setting for customizable quota windows, fields, separators, and localized status-bar rendering.
Changes:
- Adds configuration, parsing, rendering, and status-bar integration.
- Adds localization, tests, and changelog documentation.
- Supports aliases, escaping, missing windows, and warning-color selection.
| File | Description |
|---|---|
src/types.ts |
Adds configuration typing. |
src/test/quotaFormat.test.ts |
Tests template behavior and edge cases. |
src/statusBar.ts |
Applies custom quota formatting. |
src/settings.ts |
Registers the new setting. |
src/quotaFormat.ts |
Implements parsing and rendering. |
src/i18n.ts |
Adds localized setting text. |
src/extension.ts |
Wires configuration changes. |
CHANGELOG.md |
Documents the feature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let named = 0; // window tokens in this segment... | ||
| let reported = 0; // ...and how many of them the account reports | ||
| const endSegment = (nextSep: string): void => { | ||
| const text = segment.replace(/\s+/g, ' ').trim(); |
There was a problem hiding this comment.
Right, fixed in efa9b2c. I only wanted to tidy up the hole a missing window leaves, but I was collapsing the whole segment, so it also ate spaces I typed on purpose. Now only that gap closes and the rest comes out as typed (A B {5h.pct} gives A B 6%). Added tests for both cases.
| const endSegment = (nextSep: string): void => { | ||
| const text = segment.replace(/\s+/g, ' ').trim(); | ||
| if (text && (named === 0 || reported > 0)) { | ||
| out = out ? out + sep + text : text; |
There was a problem hiding this comment.
I couldn't reproduce that exact example: {model:Opus.pct} {5h.pct} without an Opus window gives me 6%, because {5h.pct} keeps the segment alive. But you're right about the underlying issue, it shows up when nothing else in the segment is reported: {nope.pct} {model:Opus.pct} came out empty and hid the typo. Fixed in efa9b2c, a segment with an unknown token is never dropped now. Test added.
| label: 'Quota: status bar format', | ||
| help: 'Empty keeps the built-in layout (5h 6% · wk 1%). Otherwise: {5h.pct}, {wk.pct} (or {7d.pct}) and {model:Fable.pct}, each also taking .reset and .label — e.g. "{5h.pct} | {7d.pct} · {model:Fable.pct}". A window your plan does not report renders empty.', |
There was a problem hiding this comment.
Added it to README.md and README-zh-CN.md. I left the other five on purpose: they don't document any setting at all (no showResetInStatusBar, no resetCountdownFormat...), so this would be the only one in there and it would look odd. If the maintainer wants it in all seven I'll add it, no problem.
Drives setVisibility/updateQuota against the vscode stub so the path from the setting to the bar text and its warning colour is pinned, not only the pure formatter.
Literal text kept its own whitespace collapsed, and a segment naming only windows the account lacks took any typo in it down as well, which contradicted the rule that an unrecognised token stays visible. A missing window now leaves a marker that closes just its own gap. Also documents the setting in the two README editions that carry settings detail.
resetCountdownFormat is one setting for the whole bar, so a template could not
put a countdown for the 5h window beside a wall clock for the week. A reset
token now takes an optional style - {5h.reset:units}, :decimal, :clock or :at -
and falls back to the global format without one. A reset the API left blank
closes its gap the way a missing window does.
|
About the red I also pushed 26c8971: a reset token can now pick its own style ( |


Summary
Adds an opt-in
statusBarQuotaFormatsetting (⚙ Settings > Quota: status bar format) for people who want a different set of quota windows, order or separators in the status bar than the built-in5h 6% · wk 1%.A template names the windows itself:
{5h.FIELD}– the 5-hour session window{wk.FIELD}/{7d.FIELD}– the all-models week{model:NAME.FIELD}– a per-model weekly cap, matched case-insensitively on the API's scope labelFIELDispct,reset(followsresetCountdownFormat) orlabel;{{and}}are literal bracesFor example
{5h.pct} | {7d.pct} · {model:Fable.pct}renders6% | 1% · 12%, and{5h.pct} hasta {5h.reset}with theclockcountdown renders33% hasta 15:25. A reset token can also name its own style —{5h.reset:units},:decimal,:clockor:at(the tooltip's wall clock,Thu 16:59) — so one bar can mix them:{5h.pct} {5h.reset:units} | {wk.pct} {wk.reset:at}renders33% 2h 17m | 30% Thu 16:59whateverresetCountdownFormatsays.Separators and literal spacing come out exactly as typed. A segment whose windows the account doesn't report is dropped together with its separator, so the same template works on a plan with no per-model cap. An unknown token is left verbatim so a typo is visible instead of silently shortening the line. The warning colour follows the windows the template actually shows, same reasoning as the built-in layout.
Empty (the default) keeps today's behaviour untouched. A non-empty template supersedes
quotaFiveHourOnlyandshowScopedWeekly, since it already says which windows to show.The logic is a pure helper in
quotaFormat.ts; it is wired throughstatusBar.ts/extension.tsthe same wayresetCountdownFormatwas in #75.Linked issues
None.
Type of change
feature(minor)How was this tested?
Extension Development Host (F5), on a real account with the 5h window at 33%:
{5h.pct} | {7d.pct} · {model:Fable.pct}A B {5h.pct}A B 33%— internal spacing kept{5h.pct} · opus {model:Opus.pct}33%— no orphaned "opus" on a plan without that cap{5h.pcnt}{5h.pcnt}— typo stays visibleUnit tests.
node --test out/test/quotaFormat.test.js: 64/64, 23 of them new — grammar, aliases, dotted model names likeFable 5.1, all three reset formats, per-token reset styles, separators, literal spacing, dropped segments, brace escaping, typos, toggles being ignored, warning colour.statusBarThresholds.test.tsgains a wiring case that drivessetVisibility/updateQuotaagainst the vscode stub, so the path from the setting to the bar text and its warning colour is pinned, not just the pure formatter. Each new assertion was checked by mutating the compiled output until it failed.Full suite.
npm teston Windows 10: 1058 tests, 1049 pass. The 8 failures are in files this PR doesn't touch and fail identically on a cleanmainhere — mostlyEPERM: operation not permitted, symlink, since Windows needs Developer Mode for symlinks. One of them is not Windows-specific and is what turnsNode Testsred here:claudeIncrementalIndex.test.ts:283stamps its fixture2026-08-21and asks forwindowDays: 30, so it began failing on its own around 2026-09-20, onmaintoo (its last CI run was 2026-09-16).Not run: the Playwright layer (
npm run test:ui) — the visual baseline is chromium-linux only.Checklist
npm run compileis cleanI18nwith all eight UI locales filledCHANGELOG.mdupdated (user-visible changes)README.mdupdated if behaviour/settings changedOn the README box: the setting is documented in
README.mdandREADME-zh-CN.md, the two editions that carry settings detail. The other five (-en,-zh-TW,-ja,-ko,-id) document no settings at all — notshowResetInStatusBar, notresetCountdownFormat, notstatusBarMetric— sostatusBarQuotaFormatwould be the only setting name in those files. Happy to add it to all seven if you'd rather have it.