Add league standings with Division and Wild Card tabs, fetched from API with SQLite cache for instant display on screen open. Document 11 new future features in project plan and add cargo check post-edit hook. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
CLAUDE.md — Rust Rewrite
Session Start
Read the rewrite memory file before starting work:
~/.claude/projects/-mnt-NV2-Development-sba-scouting/memory/rust-rewrite.md
It has the phase plan, completion status, architecture decisions, and current file layout.
Project Overview
Rust rewrite of the SBA Scout TUI. Uses ratatui + crossterm for the terminal UI, sqlx + SQLite for data, reqwest for API calls, and figment + TOML for configuration.
Commands
cargo build # compile
cargo run # run TUI
cargo test # run tests
cargo clippy # lint
cargo fmt # format
Architecture
Same layered structure as the Python version, ported to Rust idioms:
src/
├── main.rs # tokio runtime, event loop, file logging
├── app.rs # App struct, screen routing, nav/status bars
├── config.rs # figment-based TOML settings
├── lib.rs # module re-exports
├── api/ # reqwest HTTP client, sync pipeline, CSV importers
├── calc/ # league stats, matchup scoring, score cache, weights
├── db/ # sqlx models, queries, schema
├── screens/ # ratatui screen states (all 6 screens complete)
└── widgets/ # reusable UI components (selector)
Key Patterns
- Async throughout: tokio runtime, sqlx async, reqwest async
- Message passing:
mpsc::UnboundedSender<AppMessage>for async task → UI communication - No global state: Settings and SqlitePool passed by reference, no singletons
- TOML config (not YAML):
data/settings.tomlwithSBA_SCOUT_env var overrides
Screens (all complete)
dashboard.rs— Roster summary, sync triggergameday.rs— Matchup table + lineup builder (opponent/pitcher context)roster.rs— Tabbed roster view (Majors/Minors/IL), batter/pitcher sub-tablesmatchup.rs— Standalone matchup analysis with sort modes, state cached on nav-awaylineup.rs— Standalone lineup builder, save/load/delete with confirmationsettings.rs— Config form with TOML save, live team validation, per-field change indicatorsstandings.rs— League standings with Division and Wild Card tabs, fetched live from API
Code Style
- Run
cargo fmtandcargo clippybefore committing - A
cargo checkhook runs automatically after every.rsfile edit (via.claude/settings.json). Runcargo clippymanually at logical checkpoints (before commits, after finishing a feature, after a batch of edits) to catch lint warnings beyond compile errors. - Screen pattern: state struct →
new()→mount()→handle_key()→handle_message()→render()