@echo off
where uv >nul 2>nul || (
	powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
	exit /b 1
)
uv self update
set PYTHON_VER=3.12
set VENV=venv-win-%PYTHON_VER%
set OPTIONS=--enable-manager
set OPTIONS=%OPTIONS% --preview-method auto
set OPTIONS=%OPTIONS% --listen
rem set OPTIONS=%OPTIONS% --lowvram
rem set OPTIONS=%OPTIONS% --cpu
echo Options enabled: %OPTIONS%
:start
git pull --rebase
if not exist %VENV%\nul (uv venv %VENV% -p %PYTHON_VER%) else (uv venv %VENV% -p %PYTHON_VER% --allow-existing)
call %VENV%\Scripts\activate.bat
uv pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
rem uv pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu130
uv pip install -r requirements.txt
uv pip install -r manager_requirements.txt
uv pip install matrix-nio
for /d %%c in (custom_nodes\*) do (
 echo Processing %%c
 cd %%c
 if exist .git/nul (git pull --rebase)
 if exist requirements.txt (uv pip install -r requirements.txt)
 cd %~dp0
)
python main.py %OPTIONS%
goto start
