sba-scouting/rust/CLAUDE.md
Cal Corum 3e736442c7 Redesign dashboard with roster health, card coverage, and sync refresh
- Add position coverage, IL players, missing card warnings, and detailed
  sync status sections to the dashboard
- Fix team sync to include IL/MiL teams (active_only=false), matching
  Python behavior so get_my_roster() finds WVIL/WVMiL teams
- Re-fetch all dashboard data after successful sync so changes reflect
  immediately without navigating away
- Add sWAR budget bar (90-100% range) with color thresholds from
  Team.salary_cap
- Add team-scoped missing card queries and bulk sync status query
- Mark Phase 2 and Phase 3 project plans as complete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 11:52:38 -06:00

2.1 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 (dashboard, gameday, stubs)
└── 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.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)