Skip to content

Add cross-platform terminal console (ratatui TUI) - #1

Merged
jsgrrchg merged 15 commits into
mainfrom
zeron/swift-console-ratatui-port
Oct 6, 2026
Merged

jsgrrchg merged 15 commits into
mainfrom
zeron/swift-console-ratatui-port

Conversation

@jsgrrchg

@jsgrrchg jsgrrchg commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Summary

Adds solverlab-tui/, a cross-platform copy of the SwiftUI simulation console built with ratatui 0.30. It links solver_core directly (no UniFFI), so the solvers can be exercised on Linux, Windows and macOS with the same controls, metrics, results table and CSV export as the macOS app.

What's included

  • Domain + logic ports (1:1 with Swift): SimGameType, SimConfig, SimResult, per-game runners (scoring, timeouts and stop-reason rules), batched parallel runtime with auto-parallelism, countdown/ETA, CSV format (byte-for-byte compatible).
  • TUI: controls bar, progress gauge, 11 metrics in 3 groups (responsive layout), sortable results table (always descending, last 1500 rows), help popup, CSV export dialog with overwrite confirmation.
  • Config persistence as JSON in the platform config dir (same keys as the Swift Codable).
  • CLI flags: --game, --sims, --parallel, --auto, --timeout, --seed, --config, --no-persist, --ascii.
  • Headless mode (--headless [--csv out.csv]) for CI and remote machines.
  • Reproducible decks with --seed (ChaCha8 per game id) so results can be compared across platforms.
  • CI workflow (.github/workflows/tui.yml): fmt/clippy/tests on ubuntu, macos and windows, plus a seeded headless run on each OS whose CPU-independent CSV columns are diffed across platforms.
  • README section and make tui, make tui-run, make tui-test.

Differences from the SwiftUI app

  • Config fields are locked while a run is active.
  • --seed is optional; without it decks are random, as in the app.
  • CSV export asks for a path in the terminal instead of a save panel.
  • Stopping a run does not interrupt in-flight solves (same as the app); their results are discarded.
  • A panicking game is recorded as stalled instead of aborting the process.

Testing

  • cargo fmt --check and cargo clippy --all-targets -- -D warnings clean.
  • cargo test: 79 unit tests (including ports of SimulationTests.swift) + 4 headless end-to-end tests against the binary.
  • cargo test --release -- --ignored: Klondike/Spider smoke tests and seeded determinism.
  • Manually exercised the real TUI on Linux (runs, stop, quit, config persistence, CSV export).
  • macOS and Windows not tested locally yet; the CI matrix in this PR covers them.

Notes

  • solver-core-rs/ is untouched.
  • Possible Windows risk to watch in CI: solver_core declares crate-type = ["lib", "staticlib", "cdylib"], which also builds static/dynamic artifacts when used as a dependency.
  • Seeded cross-platform comparisons can differ for games that hit the solver's time budget (15s FreeCell, 5s TriPeaks, 100s Klondike) on slower machines.

@jsgrrchg
jsgrrchg merged commit 78bb4e7 into main Oct 6, 2026
6 checks passed
@jsgrrchg
jsgrrchg deleted the zeron/swift-console-ratatui-port branch October 6, 2026 04:04
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.

1 participant