# 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 ```bash 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 (dashboard, gameday, stubs) └── widgets/ # reusable UI components (selector) ``` ### Key Patterns - **Async throughout**: tokio runtime, sqlx async, reqwest async - **Message passing**: `mpsc::UnboundedSender` for async task → UI communication - **No global state**: Settings and SqlitePool passed by reference, no singletons - **TOML config** (not YAML): `data/settings.toml` with `SBA_SCOUT_` env var overrides ### Current Screen Status - `dashboard.rs` — Done (roster summary, sync) - `gameday.rs` — Done (matchup table + lineup builder) - `roster.rs` — Stub - `matchup.rs` — Stub - `lineup.rs` — Stub - `settings.rs` — Stub ## Code Style - Run `cargo fmt` and `cargo clippy` before committing - Follow existing patterns in `gameday.rs` for new screens (state struct + handle_key + handle_message + render)