Files
APAW/agent-evolution/docker-run.bat
Deploy Bot 047a87afb4 feat(agent-models): apply MEDIUM+LOW priority model migrations
- markdown-validator: deepseek-v4-pro-max → nemotron-3-nano (90% cost cut)
- release-manager: glm-5.1 → kimi-k2.6 (+2 matrix, 1M context for diffs)
- capability-analyst: glm-5.1 → deepseek-v4-pro-max (+4 matrix, 1M ctx)
- browser-automation: qwen3-coder → deepseek-v4-flash (3× faster inference)
- history-miner: nemotron-3-super → qwen3.5-122b (+14 IF, 12.4M pulls)
2026-05-25 15:07:17 +01:00

202 lines
5.5 KiB
Batchfile

@echo off
REM Agent Evolution Dashboard - Docker Management Script (Windows)
REM Mount-driven: no rebuild required after file changes.
REM
REM Quick start:
REM 1. docker-run.bat run :: start container once
REM 2. edit files + bun run sync:evolution
REM 3. docker-run.bat reload :: restart container to pick up latest files (no rebuild)
setlocal enabledelayedexpansion
set IMAGE_NAME=apaw-evolution
set CONTAINER_NAME=apaw-evolution-dashboard
set PORT=3001
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"=="reload" goto reload
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"=="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 .
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 reload' to restart with latest host files
call :log_info Use 'docker-run.bat restart' to rebuild image and restart
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 with mount-driven volumes...
docker run -d ^
--name %CONTAINER_NAME% ^
-p %PORT%:3001 ^
-v %cd%\agent-evolution\index.standalone.html:/app/index.html:ro ^
-v %cd%\agent-evolution\data:/app/data:ro ^
-v %cd%\.kilo:/app/kilo: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%
call :log_info Mounted: .\agent-evolution\index.standalone.html -> /app/index.html
call :log_info .\agent-evolution\data -> /app/data
call :log_info .\.kilo -> /app/kilo
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
:reload
call :log_info Reloading container to reflect host file changes...
call :stop
call :run
goto :eof
:restart
call :log_info Full restart: rebuild image + restart container...
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 — run 'docker-run.bat reload' to pick up changes
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
:help
echo Agent Evolution Dashboard - Docker Management (mount-driven, no-rebuild)
echo.
echo Quick start:
echo 1. docker-run.bat run ^:: Start container once
echo 2. edit files + bun run sync:evolution
echo 3. docker-run.bat reload ^:: Container picks up changes immediately
echo.
echo Usage: %~nx0 ^<command^>
echo.
echo Commands:
echo build Build Docker image (rare — only Dockerfile changes)
echo run Start container for the first time
echo stop Stop and remove container
echo reload Restart container to pick up latest host files (no rebuild)
echo restart Rebuild image AND restart container
echo logs View container logs
echo open Open dashboard in browser
echo sync Sync evolution data on host
echo status Show container status
echo clean Remove container AND image
echo help Show this help message
goto :eof
:unknown
call :log_error Unknown command: %1
goto help
endlocal