Align the brain prompts, graph view, and startup defaults with the latest phase 1 flow so local runs and navigation stay consistent.
116 lines
3.2 KiB
Batchfile
116 lines
3.2 KiB
Batchfile
@echo off
|
|
setlocal
|
|
chcp 65001 >nul
|
|
title Jarvis Start
|
|
|
|
set "ROOT=%~dp0"
|
|
set "BACKEND_DIR=%ROOT%backend"
|
|
set "FRONTEND_DIR=%ROOT%frontend"
|
|
set "LOG_DIR=%ROOT%logs"
|
|
set "PROJECT_ENV=%ROOT%.env"
|
|
if not exist "%LOG_DIR%" mkdir "%LOG_DIR%"
|
|
|
|
echo ==========================================
|
|
echo Jarvis - Quick Start
|
|
echo ==========================================
|
|
echo.
|
|
|
|
where uv >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] uv was not found. Install it first:
|
|
echo pip install uv
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
where npm >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] npm was not found. Install Node.js first.
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
if not exist "%PROJECT_ENV%" (
|
|
echo [INFO] .env was not found in the project root.
|
|
echo [INFO] Create it before first run.
|
|
echo.
|
|
)
|
|
|
|
echo [1/4] Install backend dependencies...
|
|
cd /d "%BACKEND_DIR%"
|
|
uv sync --quiet
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Failed to install backend dependencies.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo [OK] Backend dependencies installed.
|
|
|
|
echo.
|
|
echo [2/4] Install frontend dependencies...
|
|
cd /d "%FRONTEND_DIR%"
|
|
call npm install >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Failed to install frontend dependencies.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo [OK] Frontend dependencies installed.
|
|
|
|
set "BACKEND_HOST=127.0.0.1"
|
|
set "BACKEND_PORT="
|
|
if exist "%PROJECT_ENV%" (
|
|
for /f "usebackq tokens=1,* delims==" %%A in ("%PROJECT_ENV%") do (
|
|
if /I "%%A"=="HOST" set "BACKEND_HOST=%%B"
|
|
if /I "%%A"=="PORT" set "BACKEND_PORT=%%B"
|
|
)
|
|
)
|
|
if "%BACKEND_PORT%"=="" (
|
|
echo [ERROR] PORT was not found in .env.
|
|
echo [ERROR] Set PORT in the project root .env and run start.bat again.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
set "FRONTEND_API_URL=http://%BACKEND_HOST%:%BACKEND_PORT%"
|
|
> "%FRONTEND_DIR%\.env.local" echo VITE_API_URL=%FRONTEND_API_URL%
|
|
set "BACKEND_LOG=%LOG_DIR%\backend-start.log"
|
|
set "FRONTEND_LOG=%LOG_DIR%\frontend-start.log"
|
|
|
|
echo.
|
|
echo [3/4] Start backend in background on %BACKEND_HOST%:%BACKEND_PORT%...
|
|
powershell -NoProfile -WindowStyle Hidden -Command "$wd='%BACKEND_DIR%'; $out='%BACKEND_LOG%'; Start-Process powershell -WindowStyle Hidden -WorkingDirectory $wd -ArgumentList '-NoProfile','-Command',('uv run uvicorn app.main:app --reload --host %BACKEND_HOST% --port %BACKEND_PORT% *>> ''{0}''' -f $out)"
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Failed to start backend.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Waiting for backend...
|
|
ping 127.0.0.1 -n 6 >nul
|
|
|
|
echo.
|
|
echo [4/4] Start frontend in background on port 5173...
|
|
powershell -NoProfile -WindowStyle Hidden -Command "$wd='%FRONTEND_DIR%'; $out='%FRONTEND_LOG%'; Start-Process powershell -WindowStyle Hidden -WorkingDirectory $wd -ArgumentList '-NoProfile','-Command',('npm run dev *>> ''{0}''' -f $out)"
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Failed to start frontend.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo ==========================================
|
|
echo Started
|
|
echo.
|
|
echo Backend: http://%BACKEND_HOST%:%BACKEND_PORT%
|
|
echo Frontend: http://localhost:5173
|
|
echo API docs: http://%BACKEND_HOST%:%BACKEND_PORT%/docs
|
|
echo.
|
|
echo Logs:
|
|
echo - %BACKEND_LOG%
|
|
echo - %FRONTEND_LOG%
|
|
echo ==========================================
|
|
echo.
|
|
pause
|