@echo off
chcp 65001 >nul
title ComfyUI ve Custom Nodes Guncelleme

set "COMFY_DIR=D:\__sistem__\ProgramFiles\ComfyUi\ComfyUI"

echo.
echo ================================================================
echo       ComfyUI + tum Custom Nodes guncelleniyor
echo ================================================================
echo.

cd /d "%COMFY_DIR%"
echo [1/3] ComfyUI ana kod guncelleniyor...
git pull

echo.
echo [2/3] Custom nodelar guncelleniyor...
for /d %%D in ("%COMFY_DIR%\custom_nodes\*") do (
    if exist "%%D\.git" (
        echo  -^> %%~nxD
        cd /d "%%D" && git pull
    )
)

echo.
echo [3/3] Python bagimliliklari guncelleniyor...
cd /d "%COMFY_DIR%"
call venv\Scripts\activate.bat
pip install -r requirements.txt --upgrade

for /d %%D in ("%COMFY_DIR%\custom_nodes\*") do (
    if exist "%%D\requirements.txt" (
        pip install -r "%%D\requirements.txt" --upgrade >nul 2>&1
    )
)

echo.
echo ================================================================
echo [TAMAMLANDI] Guncelleme bitti!
echo ================================================================
pause
