feat(tui): show CLI version and plan usage in the footer#2044
feat(tui): show CLI version and plan usage in the footer#2044yichensunjoe wants to merge 1 commit into
Conversation
Add an opt-in [footer] section to tui.toml: - show_version renders the CLI version next to the model name. - show_plan_usage renders managed-plan quota (weekly summary plus rolling windows, with reset hints and severity-colored progress bars) left of the context readout, refreshed every plan_usage_refresh_seconds (default 60). Polling stays silent when signed out or on non-managed providers, retries quickly until the first successful fetch, keeps the last good data on errors, and yields the slot to the transient exit hint. The managed-usage fetch logic previously inline in the /usage and /status commands is extracted to tui/utils/managed-usage.ts and shared with the footer. /reload-tui picks up config changes. Refs MoonshotAI#1171 MoonshotAI#1835
🦋 Changeset detectedLatest commit: 4617ecf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4617ecfb55
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const key = String(config.planUsageRefreshSeconds); | ||
| if (key === this.planUsageTimerKey) return; |
There was a problem hiding this comment.
Refresh quota when provider state changes
When a user logs out of the managed provider or switches /model to a non-managed provider after a successful footer fetch, setAppState changes model/availableModels but the footer config key is still just the refresh interval, so this early return skips both clearing and refetching planUsageReport. The footer therefore keeps rendering the stale managed quota until the next scheduled poll (60s by default), even though the feature is supposed to hide for signed-out/non-managed providers; include provider/model applicability in the key or clear/refetch on those state changes.
Useful? React with 👍 / 👎.
Related Issue
Resolve #1171. Refs #1835 (implements the plan-usage portion of that proposal).
Problem
Weekly / rolling-window quota and reset times are only visible by interrupting
the flow to run
/usage. Heavy users want them at a glance (see linked issues).What changed
[footer]section intui.toml(all defaults off, so existingusers see zero change):
show_version,show_plan_usage,plan_usage_refresh_seconds(default 60).vX.Y.Zafter the model label whenshow_versionis on.
show_plan_usageis on(e.g.
Weekly limit ██████░░ 70% (resets in 6d 2h) · 5h limit …), reusing themanaged-usage data behind
/usagewith severity-colored bars. Transient hintstake precedence; narrow terminals drop rolling-window rows before the weekly
summary; the segment hides for non-managed providers / signed-out users /
before the first successful fetch, and keeps last good data on errors.
interval, after failure it retries in 5s so the first paint is fast.
/reload-tuiapplies changes live.both
/usageand the footer (no behavior change in/usage).Docs (en/zh) and changeset (minor) included.
Checklist