@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 REM Check if the error was port in use if errorlevel 1 ( echo. echo Server failed to start. If you see "Only one usage of each socket address" echo error, the port may already be in use. echo. choice /C YN /N /M "Would you like to fix the port issue? (Y/N): " if !errorlevel!==1 ( echo. call fix-port.bat ) ) pause