@echo off REM Agent Evolution Dashboard - Docker Management Script (Windows) setlocal enabledelayedexpansion set IMAGE_NAME=apaw-evolution set CONTAINER_NAME=apaw-evolution-dashboard set PORT=3001 set DATA_DIR=.\agent-evolution\data REM Colors (limited in Windows CMD) set RED=[91m set GREEN=[92m set YELLOW=[93m set NC=[0m REM Main logic if "%1"=="" goto help if "%1"=="build" goto build if "%1"=="run" goto run if "%1"=="stop" goto stop if "%1"=="restart" goto restart if "%1"=="logs" goto logs if "%1"=="open" goto open if "%1"=="sync" goto sync if "%1"=="status" goto status if "%1"=="clean" goto clean if "%1"=="dev" goto dev if "%1"=="help" goto help goto unknown :log_info echo %GREEN%[INFO]%NC% %* goto :eof :log_warn echo %YELLOW%[WARN]%NC% %* goto :eof :log_error echo %RED%[ERROR]%NC% %* goto :eof :build call :log_info Building Docker image... docker build -t %IMAGE_NAME%:latest -f agent-evolution/Dockerfile --target production . if errorlevel 1 ( call :log_error Build failed exit /b 1 ) call :log_info Build complete: %IMAGE_NAME%:latest goto :eof :run REM Check if already running docker ps -q --filter "name=%CONTAINER_NAME%" 2>nul | findstr /r . >nul if not errorlevel 1 ( call :log_warn Container %CONTAINER_NAME% is already running call :log_info Use 'docker-run.bat restart' to restart it exit /b 0 ) REM Remove stopped container docker ps -aq --filter "name=%CONTAINER_NAME%" 2>nul | findstr /r . >nul if not errorlevel 1 ( call :log_info Removing stopped container... docker rm %CONTAINER_NAME% >nul 2>nul ) call :log_info Starting container... docker run -d ^ --name %CONTAINER_NAME% ^ -p %PORT%:3001 ^ -v %cd%/%DATA_DIR%:/app/data:ro ^ -v %cd%/.kilo/agents:/app/kilo/agents:ro ^ -v %cd%/.kilo/capability-index.yaml:/app/kilo/capability-index.yaml:ro ^ -v %cd%/.kilo/kilo.jsonc:/app/kilo/kilo.jsonc:ro ^ --restart unless-stopped ^ %IMAGE_NAME%:latest if errorlevel 1 ( call :log_error Failed to start container exit /b 1 ) call :log_info Container started: %CONTAINER_NAME% call :log_info Dashboard available at: http://localhost:%PORT% goto :eof :stop call :log_info Stopping container... docker stop %CONTAINER_NAME% >nul 2>nul docker rm %CONTAINER_NAME% >nul 2>nul call :log_info Container stopped goto :eof :restart call :stop call :build call :run goto :eof :logs docker logs -f %CONTAINER_NAME% goto :eof :open set URL=http://localhost:%PORT% call :log_info Opening dashboard: %URL% start %URL% goto :eof :sync call :log_info Syncing evolution data... where bun >nul 2>nul if not errorlevel 1 ( bun run agent-evolution/scripts/sync-agent-history.ts ) else ( where npx >nul 2>nul if not errorlevel 1 ( npx tsx agent-evolution/scripts/sync-agent-history.ts ) else ( call :log_error Node.js or Bun required for sync exit /b 1 ) ) call :log_info Sync complete goto :eof :status docker ps -q --filter "name=%CONTAINER_NAME%" 2>nul | findstr /r . >nul if not errorlevel 1 ( call :log_info Container status: %GREEN%RUNNING%NC% call :log_info URL: http://localhost:%PORT% REM Health check for /f "tokens=*" %%i in ('docker inspect --format="{{.State.Health.Status}}" %CONTAINER_NAME% 2^>nul') do set HEALTH=%%i call :log_info Health: !HEALTH! REM Started time for /f "tokens=*" %%i in ('docker inspect --format="{{.State.StartedAt}}" %CONTAINER_NAME% 2^>nul') do set STARTED=%%i if defined STARTED call :log_info Started: !STARTED! ) else ( docker ps -aq --filter "name=%CONTAINER_NAME%" 2>nul | findstr /r . >nul if not errorlevel 1 ( call :log_info Container status: %YELLOW%STOPPED%NC% ) else ( call :log_info Container status: %RED%NOT CREATED%NC% ) ) goto :eof :clean call :log_info Cleaning up... call :stop >nul 2>nul docker rmi %IMAGE_NAME%:latest >nul 2>nul call :log_info Cleanup complete goto :eof :dev call :log_info Starting development mode... docker build -t %IMAGE_NAME%:dev -f agent-evolution/Dockerfile --target development . if errorlevel 1 ( call :log_error Build failed exit /b 1 ) docker run --rm ^ --name %CONTAINER_NAME%-dev ^ -p %PORT%:3001 ^ -v %cd%/%DATA_DIR%:/app/data ^ -v %cd%/agent-evolution/index.html:/app/index.html ^ %IMAGE_NAME%:dev goto :eof :help echo Agent Evolution Dashboard - Docker Management (Windows) echo. echo Usage: %~nx0 ^ echo. echo Commands: echo build Build Docker image echo run Run container echo stop Stop container echo restart Restart container (build + run) echo logs View container logs echo open Open dashboard in browser echo sync Sync evolution data echo status Show container status echo clean Remove container and image echo dev Run in development mode (with hot reload) echo help Show this help message goto :eof :unknown call :log_error Unknown command: %1 goto help endlocal