@echo off
setlocal EnableExtensions EnableDelayedExpansion
chcp 65001 >nul
rem ===== Auto-generated by scripts/gen-pack-installers.mjs — do not edit =====
rem Pack: ANIMA 1.0 (Anime Base)
rem Run from your ComfyUI root (the folder containing custom_nodes\ and models\).
if not exist "custom_nodes" ( echo [ERROR] Run from your ComfyUI root ^(custom_nodes\ not found^). & pause & exit /b 1 )
where git >nul 2>&1 || ( echo [ERROR] git not found in PATH. & pause & exit /b 1 )
where curl >nul 2>&1 || ( echo [ERROR] curl not found in PATH. & pause & exit /b 1 )
rem Resolve the ComfyUI python: venv first, then portable embed, then PATH python.
set "PY=%CD%\.venv\Scripts\python.exe"
if not exist "%PY%" set "PY=%CD%\venv\Scripts\python.exe"
if not exist "%PY%" set "PY=%CD%\..\python_embeded\python.exe"
if not exist "%PY%" set "PY=python"
echo using python: %PY%

echo -------- custom nodes --------
call :clone "ComfyUI-Impact-Pack" "https://github.com/ltdrdata/ComfyUI-Impact-Pack"
call :clone "ComfyUI-Impact-Subpack" "https://github.com/ltdrdata/ComfyUI-Impact-Subpack"
call :clone "rgthree-comfy" "https://github.com/rgthree/rgthree-comfy"
call :clone "ComfyUI-KJNodes" "https://github.com/kijai/ComfyUI-KJNodes"
call :clone "ComfyUI_UltimateSDUpscale" "https://github.com/ssitu/ComfyUI_UltimateSDUpscale"
call :clone "ComfyUI_tinyterraNodes" "https://github.com/TinyTerra/ComfyUI_tinyterraNodes"
call :clone "comfyui_controlnet_aux" "https://github.com/Fannovel16/comfyui_controlnet_aux"
call :clone "ComfyUI-Anima-LLLite" "https://github.com/kohya-ss/ComfyUI-Anima-LLLite"

echo -------- models --------
call :grab "models\diffusion_models\anima-base-v1.0.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-base-v1.0.safetensors"
call :grab "models\text_encoders\qwen_3_06b_base.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/qwen_3_06b_base.safetensors"
call :grab "models\vae\qwen_image_vae.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/qwen_image_vae.safetensors"
call :grab "models\controlnet\anima-lllite-inpainting-v1.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-lllite-inpainting-v1.safetensors"
call :grab "models\controlnet\anima-lllite-depth-1.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-lllite-depth-1.safetensors"
call :grab "models\controlnet\anima-lllite-lineart-1.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-lllite-lineart-1.safetensors"
call :grab "models\controlnet\anima-lllite-pose-1.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-lllite-pose-1.safetensors"
call :grab "models\controlnet\anima-lllite-any-test-like-1-step2000.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-lllite-any-test-like-1-step2000.safetensors"
call :grab "models\loras\anima-turbo-lora-v0.1.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-turbo-lora-v0.1.safetensors"
call :grab "models\loras\anima-highres-aesthetic-boost.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-highres-aesthetic-boost.safetensors"
call :grab "models\loras\anima-preview-3-masterpieces-v5.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima-preview-3-masterpieces-v5.safetensors"
call :grab "models\loras\anima_p3_rdbt_v0.29.b.122.safetensors" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/anima_p3_rdbt_v0.29.b.122.safetensors"
call :grab "models\upscale_models\4x_foolhardy_Remacri.pth" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/4x_foolhardy_Remacri.pth"
call :grab "models\upscale_models\4x-ClearRealityV1.pth" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/4x-ClearRealityV1.pth"
call :grab "models\ultralytics\bbox\face_yolov9c.pt" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/face_yolov9c.pt"
call :grab "models\ultralytics\bbox\hand_yolov9c.pt" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/hand_yolov9c.pt"
call :grab "models\ultralytics\bbox\Eyeful_v2-Paired.pt" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/Eyeful_v2-Paired.pt"
call :grab "models\ultralytics\segm\ntd11_anime_nsfw_segm_v5-variant1.pt" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/ntd11_anime_nsfw_segm_v5-variant1.pt"
call :grab "models\ultralytics\segm\yolo11m-seg.pt" "https://huggingface.co/Ultralytics/YOLO11/resolve/main/yolo11m-seg.pt"
call :grab "models\sams\sam_vit_b_01ec64.pth" "https://huggingface.co/Aitrepreneur/FLX/resolve/main/sam_vit_b_01ec64.pth"

echo DONE. Restart ComfyUI, then load workflow.json.
pause
exit /b

:clone
if not exist "custom_nodes\%~1" (
  echo   cloning %~1
  git clone --depth 1 "%~2" "custom_nodes\%~1"
  if exist "custom_nodes\%~1\requirements.txt" ( echo   installing %~1 requirements.txt & "%PY%" -m pip install -r "custom_nodes\%~1\requirements.txt" )
) else ( echo   %~1 present - skip )
goto :eof

:grab
if not exist "%~dp1" mkdir "%~dp1"
if not exist "%~1" ( echo   downloading %~nx1 & curl -L --ssl-no-revoke -o "%~1" "%~2" ) else ( echo   %~nx1 present - skip )
goto :eof
