Skip to content

Add TUI config options, Apps column, and analyzer fixes#189

Merged
mike1858 merged 2 commits into
mainfrom
tui-config-options-apps-column
Jun 14, 2026
Merged

Add TUI config options, Apps column, and analyzer fixes#189
mike1858 merged 2 commits into
mainfrom
tui-config-options-apps-column

Conversation

@basekevin

@basekevin basekevin commented Jun 14, 2026

Copy link
Copy Markdown
Member

Formatting config:

  • currency_symbol: configurable cost prefix (default "$")
  • cost_decimal_places: configurable cost precision (default 2)

TUI config (all backward-compatible via serde defaults):

  • default_view: open in daily/weekly/monthly/yearly
  • default_tab: open on a named tool tab
  • confirm_quit: require a second 'q' to quit
  • hidden_columns: hide individual aggregate-table columns
  • accent_color: recolor title, tabs, and selected row
  • color_costs: tint Cost cells by magnitude (relative to view max)
  • show_header: toggle the title banner

Apps column:

  • Add apps map to DailyStats with ref-counted merge logic
  • Render contributing tools per period in the All Tools view
  • Auto-collapse the column on single-tool tabs where it is empty

Analyzers:

  • claude_code: populate session_name from in-file summary so the live session view shows real titles instead of the upload path
  • copilot: honor a provider-reported cost when present, otherwise price counted tokens via the shared pricing table (matches the other analyzers)

Tests: apps ref-counting, parse_accent, cost_heat, AggregateViewMode::from_config, and Copilot cost coverage.

Summary by CodeRabbit

  • New Features
    • Added configurable TUI appearance: accent color, optional header, hidden columns, cost-cell coloring, currency symbol, and cost decimal precision.
    • Introduced config-driven default startup view/tab selection and optional quit confirmation.
  • Improvements
    • Cost reporting now uses provider-reported cost when available, with accurate fallback calculation; cost/currency display is fully config-driven.
    • Session titles now reflect real per-session names (not upload paths).
    • Aggregate “Apps” information is conditionally shown when relevant.
  • Tests
    • Updated and expanded TUI/config and cost-formatting coverage.

Formatting config:
- currency_symbol: configurable cost prefix (default "$")
- cost_decimal_places: configurable cost precision (default 2)

TUI config (all backward-compatible via serde defaults):
- default_view: open in daily/weekly/monthly/yearly
- default_tab: open on a named tool tab
- confirm_quit: require a second 'q' to quit
- hidden_columns: hide individual aggregate-table columns
- accent_color: recolor title, tabs, and selected row
- color_costs: tint Cost cells by magnitude (relative to view max)
- show_header: toggle the title banner

Apps column:
- Add apps map to DailyStats with ref-counted merge logic
- Render contributing tools per period in the All Tools view
- Auto-collapse the column on single-tool tabs where it is empty

Analyzers:
- claude_code: populate session_name from in-file summary so the
  live session view shows real titles instead of the upload path
- copilot: honor a provider-reported cost when present, otherwise
  price counted tokens via the shared pricing table (matches the
  other analyzers)

Tests: apps ref-counting, parse_accent, cost_heat,
AggregateViewMode::from_config, and Copilot cost coverage.
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds configurable currency symbol and cost decimal places to NumberFormatOptions, config, and TUI rendering. Extends TuiConfig with accent color, hidden columns, cost heatmap, header toggle, default tab/view, and quit confirmation. Refactors draw_aggregate_stats_table to dynamic column rendering. Adds per-app DailyStats tracking, fixes Claude Code session naming, and adds Copilot provider-reported cost support.

Changes

Configurable Currency, TUI Appearance, and Analyzer Cost/Session Improvements

Layer / File(s) Summary
Data contracts: NumberFormatOptions, DailyStats, config schema
src/utils.rs, src/types.rs, src/config.rs
NumberFormatOptions gains currency_symbol and cost_decimal_places; DailyStats gains apps: BTreeMap<String, u32> with saturating add/subtract operators; FormattingConfig and TuiConfig extended with new fields and serde defaults; Config::default() updated.
Analyzer fixes: Claude Code session naming and Copilot cost
src/analyzers/claude_code.rs, src/analyzers/copilot.rs
parse_source backfills session_name on messages with None from parsed JSONL summaries; CopilotRequest adds optional cost field; parse_copilot_session_file populates stats.cost from provider value or calculated token cost.
Config display, parsing, and format_options wiring
src/config.rs, src/main.rs
show_config() prints new formatting and TUI fields; set_config_value() parses currency-symbol, cost-decimal-places, and TUI keys including comma-separated hidden-columns; main and run_upload pull currency_symbol and cost_decimal_places into format_options; config tests and help text updated.
TUI state init: view mode, appearance, tab, quit confirmation
src/tui.rs
AggregateViewMode::from_config added; UiState extended with quit_pending, accent, hidden_cols, color_costs, show_header; run_app precomputes appearance, sets default tab by case-insensitive match, implements two-press quit latch; build_display_stats tracks per-period app contributions.
draw_ui: layout, header/tab styling, help text
src/tui.rs
Layout heights conditioned on show_header; header and tab highlight use accent color; help text switches to quit-pending message; draw_aggregate_stats_table receives new arguments.
draw_aggregate_stats_table: dynamic columns and cost heatmap
src/tui.rs
parse_accent and cost_heat helpers added; table header, rows, separator, totals, and column widths built dynamically per visible column; Apps column conditionally shown; cost cells use currency/precision formatting with optional heatmap coloring; session and summary tables updated to same formatting.
Tests
src/types.rs, src/utils/tests.rs, src/tui/tests.rs
DailyStats apps ref-counting test; utils NumberFormatOptions literals updated; TUI tests for from_config, parse_accent, cost_heat; helper constructors updated with apps field; upload test options updated.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly related PRs

  • Piebald-AI/splitrail#158: Introduces the "All Tools" combined period aggregation in build_display_stats that this PR extends with per-analyzer apps counts.
  • Piebald-AI/splitrail#133: Adds AggregateViewMode daily/monthly modes and aggregate table machinery that this PR extends with config-driven initialization and dynamic column rendering.

Suggested reviewers

  • mike1858

Poem

🐰 Hop hop, the dollar signs can change,
From $ to any symbol in range!
The heat glows red when costs run high,
Accent in cyan or green — oh my!
Hidden columns? Poof, they're gone!
The rabbit's TUI hops along. 🎨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main feature additions: TUI config options, Apps column, and analyzer fixes are the primary changes across the 8-file changeset.
Docstring Coverage ✅ Passed Docstring coverage is 82.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tui-config-options-apps-column

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mike1858

Copy link
Copy Markdown
Member

Please verify whether Cloud needs any changes or not.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@src/config.rs`:
- Around line 73-78: The new config fields currency_symbol, cost_decimal_places,
and the tui fields were added to the struct (in the formatting and tui sections
spanning lines 73-78 and 81-127) but the set_config_value function (starting at
line 378) does not yet handle these fields, causing them to be rejected as
unknown keys when users try to set them via CLI. Update the set_config_value
function to add match cases or conditional branches that handle all the new
field names (currency_symbol, cost_decimal_places, and the tui fields) so they
can be properly set through the config set command, ensuring the function routes
values to the correct struct fields using the appropriate setter logic.
🪄 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

Run ID: 69d37cc2-0273-450d-9204-c0832ed5193b

📥 Commits

Reviewing files that changed from the base of the PR and between ccb057a and ae68f67.

📒 Files selected for processing (9)
  • src/analyzers/claude_code.rs
  • src/analyzers/copilot.rs
  • src/config.rs
  • src/main.rs
  • src/tui.rs
  • src/tui/tests.rs
  • src/types.rs
  • src/utils.rs
  • src/utils/tests.rs

Comment thread src/config.rs
The new formatting/tui options were settable only by editing
~/.splitrail.toml directly. Make them first-class CLI options so the
`config set` / `config show` contract is consistent with the existing
fields.

- set_config_value: add arms for currency-symbol, cost-decimal-places,
  default-view, default-tab, confirm-quit, hidden-columns (comma-split),
  accent-color, color-costs, show-header
- show_config: display all new fields; default-tab shows "All Tools"
  when empty, hidden-columns shows "None" when empty
- main.rs: list the new keys (and upload-today-only) in the Set help
- Extend set_config_value_behaviour to round-trip every new key

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@src/config.rs`:
- Around line 459-480: Add validation and normalization for the three enum-like
TUI config fields in the config parsing logic. For `default-view`, normalize the
input by trimming and converting to lowercase, then validate against the set of
allowed view options; reject with an error if the value is unknown. For
`accent-color`, apply the same normalization (trim and lowercase) and validate
against the supported color palette; return an error for invalid colors. For
`hidden-columns`, trim each column name (already done) but also validate that
each column name matches a known/valid column identifier, rejecting the entire
field if any column is unrecognized. This ensures typos and casing differences
are caught immediately during configuration load rather than causing silent
failures later.
🪄 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

Run ID: bccb2a76-fa33-45a5-bb50-eb19591b56b1

📥 Commits

Reviewing files that changed from the base of the PR and between ae68f67 and c80e68f.

📒 Files selected for processing (2)
  • src/config.rs
  • src/main.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main.rs

Comment thread src/config.rs
@mike1858 mike1858 merged commit 6ec3e68 into main Jun 14, 2026
6 checks passed
@mike1858 mike1858 deleted the tui-config-options-apps-column branch June 14, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants