@echo off
REM CMD Integration Script for fnva
REM Add this to your startup script

REM Check and apply fnva environments
set "env_file=%USERPROFILE%\.fnva\current_env"
if exist "%env_file%" (
    set /p current_env=<"%env_file%"
    set "current_env=%current_env: =%"
    if defined current_env (
        if not "%FNVA_CURRENT_ENV%"=="%current_env%" (
            REM Apply environment using fnva command
            where fnva >nul 2>&1
            if %errorlevel% equ 0 (
                for /f "tokens=*" %%i in ('fnva env current --shell cmd 2^>nul') do (
                    %%i
                )
                set "FNVA_CURRENT_ENV=%current_env%"
            )
        )
    )
)

echo 🚀 fnva CMD integration loaded