@echo off REM Tiny Workshop - Development Runner (Windows) REM Builds backend and runs the full application setlocal enabledelayedexpansion echo. echo Tiny Workshop Dev Runner echo ========================== echo. REM Parse arguments set BUILD_BACKEND=1 set BUILD_RUST=1 set RUN=1 set DEBUG_SERVER=0 :parse_args if "%~1"=="" goto :main if "%~1"=="--skip-backend" ( set BUILD_BACKEND=0 shift goto :parse_args ) if "%~1"=="--skip-rust" ( set BUILD_RUST=0 shift goto :parse_args ) if "%~1"=="--build-only" ( set RUN=0 shift goto :parse_args ) if "%~1"=="--debug-server" ( set DEBUG_SERVER=1 shift goto :parse_args ) if "%~1"=="--help" goto :help if "%~1"=="-h" goto :help echo Unknown option: %~1 exit /b 1 :help echo Usage: dev.bat [options] echo. echo Options: echo --skip-backend Skip building the backend executable echo --skip-rust Skip building the Rust frontend echo --build-only Build everything but don't run echo --debug-server Enable debug HTTP server (port 8765) echo --help, -h Show this help message exit /b 0 :main REM Step 1: Build backend if %BUILD_BACKEND%==1 ( echo [1/3] Building backend standalone executable... REM Check if bun is installed where bun >nul 2>nul if errorlevel 1 ( echo Error: bun is not installed or not in PATH echo Install bun: https://bun.sh exit /b 1 ) REM Install dependencies if needed if not exist "backend\node_modules" ( echo Installing backend dependencies... cd backend call pnpm install cd .. ) REM Build the standalone executable echo Compiling TypeScript to standalone exe... cd backend\packages\adapter call bun run build cd ..\..\.. echo [OK] Backend built: backend\packages\adapter\dist\tiny-workshop-backend.exe ) else ( echo [1/3] Skipping backend build ) echo. REM Step 2: Build Rust frontend if %BUILD_RUST%==1 ( echo [2/3] Building Rust frontend... cd tiny-workshop if %DEBUG_SERVER%==1 ( echo Building with debug server enabled... cargo build --package executor --features debug_server ) else ( cargo build --package executor ) cd .. echo [OK] Rust frontend built ) else ( echo [2/3] Skipping Rust build ) echo. REM Step 3: Run the application if %RUN%==1 ( echo [3/3] Starting Tiny Workshop... REM Clear old log file if exist "tiny-workshop\tiny-workshop.log" ( del "tiny-workshop\tiny-workshop.log" echo Cleared old log file ) echo. echo ======================================== echo Tiny Workshop is starting up! if %DEBUG_SERVER%==1 ( echo Debug server: http://localhost:8765 ) echo ======================================== echo. cd tiny-workshop if %DEBUG_SERVER%==1 ( cargo run --package executor --features debug_server ) else ( cargo run --package executor ) ) else ( echo [3/3] Build complete! Run with: cd tiny-workshop ^&^& cargo run --package executor ) endlocal