Add consumer server CLI with Typer + Rich and Windows launcher

Introduce production-ready CLI for hosting Commonwealth Online servers in
cloud and on-premises environments.

Features:
- Server orchestration service (server_service.py) wrapping relay lifecycle
- JSON configuration system (config.py) for hosted deployments
- Typer+Rich CLI (consumer_server_cli.py) with serve/status/clients/world commands
- Windows launcher (start.bat) for one-click server startup
- Auto-detection of LAN addresses and dependency installation
- Machine-readable JSON output for monitoring and automation

Cli commands:
  serve - Start server with optional config overrides
  status - Display server stats and packet counters
  clients - List connected players
  world time - Set in-game time for all clients
  world weather - Set weather for all clients
  config init - Generate default configuration file

Documentation:
  - Updated docs/setup.md with CLI quick-start guide
  - Added server/README.md with usage instructions
  - Updated changelog and dev-log with test results

Testing: - Verified config generation and loading
  - Verified server startup banner and LAN detection
  - Verified fake client connection and welcome packet
  - Verified CLI help and command routing
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-09 20:44:40 +12:00
co-authored by Cursor
parent 25e75b5426
commit 7a3e0855b0
9 changed files with 999 additions and 274 deletions
+51
View File
@@ -0,0 +1,51 @@
@echo off
setlocal enabledelayedexpansion
echo.
echo ================================================================================
echo Commonwealth Online Server - Start Script
echo ================================================================================
echo.
REM Check if Python is installed
python --version >nul 2>&1
if errorlevel 1 (
echo ERROR: Python is not installed or not in PATH.
echo Please install Python 3.9+ from https://www.python.org
pause
exit /b 1
)
echo Installing dependencies...
pip install -q typer rich 2>nul
if errorlevel 1 (
echo WARNING: Failed to install dependencies quietly. Retrying with output...
pip install typer rich
if errorlevel 1 (
echo ERROR: Failed to install required packages.
pause
exit /b 1
)
)
echo Dependencies installed.
echo.
REM Check if config file exists
if not exist "commonwealth-server.json" (
echo Generating default configuration file...
python consumer_server_cli.py config init commonwealth-server.json
if errorlevel 1 (
echo ERROR: Failed to generate config file.
pause
exit /b 1
)
echo.
)
echo Starting Commonwealth Online Server...
echo Press Ctrl+C to stop the server.
echo.
python consumer_server_cli.py serve --config commonwealth-server.json
pause