strat-gameplay-webapp/backend/terminal_client/__main__.py
Cal Corum 918beadf24 CLAUDE: Add interactive terminal client for game engine testing
Created comprehensive terminal testing tool with two modes:
1. Interactive REPL (recommended) - Persistent in-memory state
2. Standalone CLI commands - Config file persistence

Features:
- Interactive REPL using Python cmd module
- Persistent event loop prevents DB connection issues
- 11 commands for full game control (new_game, defensive, offensive, resolve, etc.)
- Beautiful Rich formatting with colors and panels
- Auto-generated test lineups for rapid testing
- Direct GameEngine access (no WebSocket overhead)
- Config file (~/.terminal_client_config.json) for state persistence

Files added:
- terminal_client/repl.py (525 lines) - Interactive REPL
- terminal_client/main.py (516 lines) - Click standalone commands
- terminal_client/display.py (218 lines) - Rich formatting
- terminal_client/config.py (89 lines) - Persistent config
- terminal_client/__main__.py - Dual mode entry point
- terminal_client/CLAUDE.md (725 lines) - Full documentation

Updated:
- backend/CLAUDE.md - Added terminal client to testing section
- requirements.txt - Added rich==13.9.4

Perfect for rapid iteration on game engine without building frontend!

🚀 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 12:51:01 -05:00

27 lines
903 B
Python

"""
Entry point for running terminal client as a module.
Usage:
python -m terminal_client # Start interactive REPL (recommended)
python -m terminal_client repl # Start interactive REPL
python -m terminal_client <command> # Run standalone command
Standalone commands:
python -m terminal_client start-game --league sba
python -m terminal_client defensive --alignment normal
python -m terminal_client offensive --approach power
python -m terminal_client resolve
python -m terminal_client status
"""
import sys
from terminal_client.repl import start_repl
from terminal_client.main import cli
if __name__ == "__main__":
# If no arguments or 'repl' command, start interactive mode
if len(sys.argv) == 1 or (len(sys.argv) == 2 and sys.argv[1] == 'repl'):
start_repl()
else:
# Run as standalone Click commands
cli()