feat(tui): unify visual semantics and interface state - #193
Conversation
Derive contribution grades from visible-window token activity with Log-MAD, restore brighter high-activity ramps, and route client labels through the catalog-backed contrast-aware resolver.
Define all 12 palettes as RGB semantic themes, route interface chrome and state through theme roles, and adapt identity colors to their rendered surfaces. Remove terminal-capability color fallbacks and document the RGB-only theme contract.
|
Warning Review limit reached
Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Walkthrough该 PR 将 TUI 迁移到语义化主题,新增 WCAG 对比度与身份色处理;Usage 获得独立的订阅状态、动作、页脚和刷新生命周期;贡献图从浮点强度改为基于可见 token 的离散等级并更新缓存格式。 Changes订阅 Usage 生命周期
语义主题
贡献图等级与缓存
CLI 与文档契约
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant SubscriptionPresentation
participant ActionSet
participant UsageView
participant Footer
User->>App: open Usage tab
App->>SubscriptionPresentation: classify subscription state
SubscriptionPresentation->>ActionSet: construct scoped actions
SubscriptionPresentation->>UsageView: select subscription content state
SubscriptionPresentation->>Footer: select subscription summary and status
User->>ActionSet: request subscription refresh
ActionSet->>App: start subscription usage fetch
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3516fbd766
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/tokscale-cli/tests/cli_tests.rs`:
- Around line 824-851: Update both CLI integration tests, including
test_tui_accepts_all_legacy_theme_values_before_terminal_validation and the test
covering lines 853–885, to pass the global --no-spinner option when invoking
tokstake via cargo_bin_cmd!. Preserve their existing arguments and assertions;
these tests do not exercise spinner behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 70cabfe8-3384-48c2-b0c2-1a2cea344f1b
📒 Files selected for processing (43)
crates/tokscale-cli/src/cli.rscrates/tokscale-cli/src/tui/actions.rscrates/tokscale-cli/src/tui/app.rscrates/tokscale-cli/src/tui/cache.rscrates/tokscale-cli/src/tui/colors.rscrates/tokscale-cli/src/tui/contrast.rscrates/tokscale-cli/src/tui/mod.rscrates/tokscale-cli/src/tui/presentation.rscrates/tokscale-cli/src/tui/settings.rscrates/tokscale-cli/src/tui/themes.rscrates/tokscale-cli/src/tui/ui/achievements.rscrates/tokscale-cli/src/tui/ui/agents.rscrates/tokscale-cli/src/tui/ui/bar_chart.rscrates/tokscale-cli/src/tui/ui/daily.rscrates/tokscale-cli/src/tui/ui/daily_profile.rscrates/tokscale-cli/src/tui/ui/dialog/client_picker.rscrates/tokscale-cli/src/tui/ui/dialog/group_by_picker.rscrates/tokscale-cli/src/tui/ui/dialog/overlay.rscrates/tokscale-cli/src/tui/ui/empty_state.rscrates/tokscale-cli/src/tui/ui/footer.rscrates/tokscale-cli/src/tui/ui/header.rscrates/tokscale-cli/src/tui/ui/hourly.rscrates/tokscale-cli/src/tui/ui/hourly_profile.rscrates/tokscale-cli/src/tui/ui/loading.rscrates/tokscale-cli/src/tui/ui/mod.rscrates/tokscale-cli/src/tui/ui/models.rscrates/tokscale-cli/src/tui/ui/overview.rscrates/tokscale-cli/src/tui/ui/overview_snapshot.rscrates/tokscale-cli/src/tui/ui/period.rscrates/tokscale-cli/src/tui/ui/portraits.rscrates/tokscale-cli/src/tui/ui/sessions.rscrates/tokscale-cli/src/tui/ui/stats.rscrates/tokscale-cli/src/tui/ui/usage.rscrates/tokscale-cli/src/tui/ui/usage_profile.rscrates/tokscale-cli/src/tui/ui/view_footer.rscrates/tokscale-cli/tests/cli_tests.rscrates/tokscale-core/src/aggregate/tui.rscrates/tokscale-core/src/usage_views.rsdocs/adr/0010-period-views-derive-from-daily.mddocs/adr/0014-explicit-subscription-usage-boundary.mddocs/adr/0028-tui-client-universe-and-view-selection.mddocs/adr/0029-semantic-tui-theme-contract.mddocs/configuration.md
Represent contribution activity as discrete token-derived grades, render empty and active levels with independent glyphs, and validate cache invariants. Replace ambiguous muted and disabled roles with readable secondary text, resolve identity palettes at theme construction, and enforce role-to-surface contrast matrices.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/adr/0010-period-views-derive-from-daily.md`:
- Around line 204-212: Update the contribution-graph activity-grade description
to define deterministic boundary ownership: after handling Empty and MAD=0
cases, map x < center − MAD to Low, center − MAD ≤ x < center to Medium, center
≤ x < center + MAD to High, and x ≥ center + MAD to Peak. Explicitly state that
the maximum active day is assigned Peak as an overriding rule, including when
threshold mapping would produce another grade.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 030b160f-ee9a-4db8-b149-a18d97732c9d
📒 Files selected for processing (34)
crates/tokscale-cli/src/tui/actions.rscrates/tokscale-cli/src/tui/app.rscrates/tokscale-cli/src/tui/cache.rscrates/tokscale-cli/src/tui/colors.rscrates/tokscale-cli/src/tui/contrast.rscrates/tokscale-cli/src/tui/data/mod.rscrates/tokscale-cli/src/tui/model_family.rscrates/tokscale-cli/src/tui/themes.rscrates/tokscale-cli/src/tui/ui/achievements.rscrates/tokscale-cli/src/tui/ui/agents.rscrates/tokscale-cli/src/tui/ui/bar_chart.rscrates/tokscale-cli/src/tui/ui/daily.rscrates/tokscale-cli/src/tui/ui/dialog/client_picker.rscrates/tokscale-cli/src/tui/ui/dialog/group_by_picker.rscrates/tokscale-cli/src/tui/ui/empty_state.rscrates/tokscale-cli/src/tui/ui/footer.rscrates/tokscale-cli/src/tui/ui/header.rscrates/tokscale-cli/src/tui/ui/loading.rscrates/tokscale-cli/src/tui/ui/mod.rscrates/tokscale-cli/src/tui/ui/models.rscrates/tokscale-cli/src/tui/ui/overview.rscrates/tokscale-cli/src/tui/ui/overview_snapshot.rscrates/tokscale-cli/src/tui/ui/period.rscrates/tokscale-cli/src/tui/ui/portraits.rscrates/tokscale-cli/src/tui/ui/radar.rscrates/tokscale-cli/src/tui/ui/sessions.rscrates/tokscale-cli/src/tui/ui/stats.rscrates/tokscale-cli/src/tui/ui/usage.rscrates/tokscale-cli/src/tui/ui/usage_profile.rscrates/tokscale-cli/src/tui/ui/view_footer.rscrates/tokscale-core/src/aggregate/tui.rscrates/tokscale-core/src/usage_views.rsdocs/adr/0010-period-views-derive-from-daily.mddocs/adr/0029-semantic-tui-theme-contract.md
🚧 Files skipped from review as they are similar to previous changes (23)
- crates/tokscale-cli/src/tui/ui/portraits.rs
- crates/tokscale-cli/src/tui/ui/loading.rs
- crates/tokscale-cli/src/tui/ui/overview.rs
- crates/tokscale-cli/src/tui/ui/models.rs
- crates/tokscale-cli/src/tui/ui/agents.rs
- docs/adr/0029-semantic-tui-theme-contract.md
- crates/tokscale-cli/src/tui/ui/dialog/client_picker.rs
- crates/tokscale-cli/src/tui/actions.rs
- crates/tokscale-cli/src/tui/ui/view_footer.rs
- crates/tokscale-cli/src/tui/contrast.rs
- crates/tokscale-cli/src/tui/ui/header.rs
- crates/tokscale-cli/src/tui/ui/usage_profile.rs
- crates/tokscale-core/src/aggregate/tui.rs
- crates/tokscale-cli/src/tui/ui/sessions.rs
- crates/tokscale-cli/src/tui/ui/usage.rs
- crates/tokscale-cli/src/tui/ui/dialog/group_by_picker.rs
- crates/tokscale-cli/src/tui/ui/daily.rs
- crates/tokscale-cli/src/tui/ui/mod.rs
- crates/tokscale-cli/src/tui/ui/period.rs
- crates/tokscale-cli/src/tui/ui/overview_snapshot.rs
- crates/tokscale-cli/src/tui/ui/footer.rs
- crates/tokscale-cli/src/tui/app.rs
- crates/tokscale-cli/src/tui/ui/stats.rs
Summary
Theme contract
colorPalettekey and its 12 accepted valuesEmptyfor zero-token contribution days and reject contradictory cached gradesValidation
cargo test— 2090 passed, 5 ignoredcargo clippy --workspace --all-targets -- -D warningscargo build -p tokscale-clibun run build:corecargo fmt --all -- --checkgit diff --checkSummary by CodeRabbit