release: v0.11.1 — CommandKind taxonomy refactor + scoreboard UX polish #68

Merged
umpire274 merged 4 commits from v0.11.1 into main 2026-04-21 14:48:32 +02:00
umpire274 commented 2026-04-21 14:47:21 +02:00 (Migrated from github.com)

Internal refactor of the command pipeline plus a TUI scoreboard UX
polish. No change to the grammar accepted by the parser, to engine
behaviour, to diagnostic messages, or to on-disk data. Public API via
bs_scoring::* is unchanged.

Command-taxonomy refactor

  • New src/engine/commands/kind.rs: CommandKind enum (flat, 26
    variants, one per lexical verb) + CommandFamily grouping.
    Single source of truth for the question "which verbs does the
    parser accept?". Adding a new command now touches one variant
    instead of four parallel sub-enums across layers.
  • Removed: HitVerbKind, PitchVerbKind, KeywordKind (tokens.rs);
    ControlKind, StatusKind, PitchKind, HitKind (segment.rs).
  • Retained: BatterOutKind — carries fielder identifiers, not just a
    tag — with new .command_kind() helper mapping each variant to
    the corresponding CommandKind (FlyOut { foul: true }
    CommandKind::FoulFlyOut).
  • TokenKind::HitVerb / PitchVerb / StealVerb / Keyword
    collapse into a single TokenKind::Verb(CommandKind).
  • Segment dispatcher in parse_segment routes on
    CommandKind::family() instead of sub-enum variants.
  • Validator Resolved::Pitch / Hit now hold CommandKind; the hit
    coalescer and status_to_game / pitch_to_engine helpers match on
    CommandKind with an unreachable!() catch-all that documents the
    family invariant.
  • Lexer: removed three regexes (RE_HIT_VERB, RE_PITCH_VERB,
    RE_STEAL_VERB). Parameter-less verbs (hit, pitch, steal, control,
    status) now recognised by a single exact-match match on
    lowercased text — faster and more readable. Regexes retained only
    for verbs with numeric parameters (o<n>, f<n>, l<n>,
    if<n>, fielding sequences).

Scoreboard UX polish (src/ui/tui.rs)

  • Batting team row: yellow + bold with subtle left-edge marker.
  • Linescore header: rewritten from flat String to Line / Span
    rendering; current inning emphasised via reversed style.
  • Counts: dynamic styling via new styled_count_span helper — full
    count (3-2) reversed + bold, critical counts (3-1, 2-2) yellow +
    bold.
  • Outs: two dots (○ / ●) instead of three via new
    styled_outs_spans helper; active outs yellow + bold, inactive
    dark gray.
  • Status line: mixed styled spans with proper centring; redundant
    inning indicator ("4↑") removed.
  • Internal helper rename: build_linescore_lines
    build_linescore_header_and_range.
  • All touched TUI helpers are private to the module; no public API
    change.

Documentation

  • CHANGELOG.md: new v0.11.1 entry consolidating both refactors.
  • README.md: new "What's New in v0.11.1" section; tables "Recent
    Versions" and "Features by Version" include the new row; tree
    under engine/commands/ updated to show kind.rs.
  • STRUCTURE.md: new "Vocabulary taxonomy: CommandKind (v0.11.1)"
    subsection under "Key design decisions" with before/after
    per-layer table; tree updated.
  • SCORING_GUIDE.md: header bumped; grammar content unchanged
    (the grammar is unchanged in v0.11.1).
  • RELEASE.md: bumped to v0.11.1, examples, GitHub Release URL,
    rollback, version-bumping checklist, and footer all updated.

Tests

  • All existing command-pipeline tests continue to pass unchanged
    (structural refactor only — same inputs produce the same outputs).
  • 4 new invariant tests in kind.rs verify CommandKind /
    CommandFamily coverage and naming.
  • Total test count: 130+ (command pipeline) + 4 (kind invariants) =
    green on Rust 1.95 stable.
Internal refactor of the command pipeline plus a TUI scoreboard UX polish. No change to the grammar accepted by the parser, to engine behaviour, to diagnostic messages, or to on-disk data. Public API via `bs_scoring::*` is unchanged. Command-taxonomy refactor - New `src/engine/commands/kind.rs`: `CommandKind` enum (flat, 26 variants, one per lexical verb) + `CommandFamily` grouping. Single source of truth for the question "which verbs does the parser accept?". Adding a new command now touches one variant instead of four parallel sub-enums across layers. - Removed: `HitVerbKind`, `PitchVerbKind`, `KeywordKind` (tokens.rs); `ControlKind`, `StatusKind`, `PitchKind`, `HitKind` (segment.rs). - Retained: `BatterOutKind` — carries fielder identifiers, not just a tag — with new `.command_kind()` helper mapping each variant to the corresponding `CommandKind` (`FlyOut { foul: true }` → `CommandKind::FoulFlyOut`). - `TokenKind::HitVerb` / `PitchVerb` / `StealVerb` / `Keyword` collapse into a single `TokenKind::Verb(CommandKind)`. - Segment dispatcher in `parse_segment` routes on `CommandKind::family()` instead of sub-enum variants. - Validator `Resolved::Pitch` / `Hit` now hold `CommandKind`; the hit coalescer and `status_to_game` / `pitch_to_engine` helpers match on `CommandKind` with an `unreachable!()` catch-all that documents the family invariant. - Lexer: removed three regexes (`RE_HIT_VERB`, `RE_PITCH_VERB`, `RE_STEAL_VERB`). Parameter-less verbs (hit, pitch, steal, control, status) now recognised by a single exact-match `match` on lowercased text — faster and more readable. Regexes retained only for verbs with numeric parameters (`o<n>`, `f<n>`, `l<n>`, `if<n>`, fielding sequences). Scoreboard UX polish (src/ui/tui.rs) - Batting team row: yellow + bold with subtle left-edge marker. - Linescore header: rewritten from flat `String` to `Line` / `Span` rendering; current inning emphasised via reversed style. - Counts: dynamic styling via new `styled_count_span` helper — full count (3-2) reversed + bold, critical counts (3-1, 2-2) yellow + bold. - Outs: two dots (○ / ●) instead of three via new `styled_outs_spans` helper; active outs yellow + bold, inactive dark gray. - Status line: mixed styled spans with proper centring; redundant inning indicator ("4↑") removed. - Internal helper rename: `build_linescore_lines` → `build_linescore_header_and_range`. - All touched TUI helpers are private to the module; no public API change. Documentation - CHANGELOG.md: new v0.11.1 entry consolidating both refactors. - README.md: new "What's New in v0.11.1" section; tables "Recent Versions" and "Features by Version" include the new row; tree under `engine/commands/` updated to show `kind.rs`. - STRUCTURE.md: new "Vocabulary taxonomy: CommandKind (v0.11.1)" subsection under "Key design decisions" with before/after per-layer table; tree updated. - SCORING_GUIDE.md: header bumped; grammar content unchanged (the grammar is unchanged in v0.11.1). - RELEASE.md: bumped to v0.11.1, examples, GitHub Release URL, rollback, version-bumping checklist, and footer all updated. Tests - All existing command-pipeline tests continue to pass unchanged (structural refactor only — same inputs produce the same outputs). - 4 new invariant tests in `kind.rs` verify `CommandKind` / `CommandFamily` coverage and naming. - Total test count: 130+ (command pipeline) + 4 (kind invariants) = green on Rust 1.95 stable.
Sign in to join this conversation.
No description provided.