@echo off setlocal ENABLEEXTENSIONS title JimuAI Codex Setup echo ========================================== echo JimuAI Codex One-Click Setup (Windows) echo ========================================== echo. echo This script will: echo 1. Check Node.js / npm echo 2. Install Codex CLI echo 3. Write your JimuAI Codex config echo. where powershell >nul 2>nul if errorlevel 1 ( echo [ERROR] PowerShell not found. echo Please install PowerShell and try again. echo. pause exit /b 1 ) echo [0/3] Preparing PowerShell execution policy... powershell -NoProfile -ExecutionPolicy Bypass -Command "$cur = Get-ExecutionPolicy -Scope CurrentUser; if ($cur -eq 'Undefined' -or $cur -eq 'Restricted' -or $cur -eq 'AllSigned') { try { Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force; Write-Host 'CurrentUser execution policy set to RemoteSigned.' -ForegroundColor Green } catch { Write-Host 'Could not change execution policy automatically. If codex.ps1 is blocked later, run: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser' -ForegroundColor Yellow } } else { Write-Host ('CurrentUser execution policy: ' + $cur) -ForegroundColor DarkGray }" echo [1/3] Checking environment... powershell -NoProfile -ExecutionPolicy Bypass -Command "iwr -useb https://code.jimuxyz.com/env_deploy/codex-install.ps1 | iex" if errorlevel 1 goto :fail echo. echo [2/3] Installing Codex CLI... powershell -NoProfile -ExecutionPolicy Bypass -Command "npm install -g @openai/codex" if errorlevel 1 goto :fail echo. set "JIMU_KEY=" set /p JIMU_KEY=Paste your Codex API Key (sk-...) and press Enter: if "%JIMU_KEY%"=="" ( echo [ERROR] API Key is required. goto :fail ) echo. echo [3/3] Writing Codex config... powershell -NoProfile -ExecutionPolicy Bypass -Command "$env:JIMUXYZ_CODEX_KEY='%JIMU_KEY%'; iwr -useb https://code.jimuxyz.com/env_deploy/codex-deploy.ps1 | iex" if errorlevel 1 goto :fail echo. echo ========================================== echo Setup finished. echo You can now open a new terminal and run: echo codex echo ========================================== echo If PowerShell still blocks codex.ps1, run: echo Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser echo. pause exit /b 0 :fail echo. echo [ERROR] Setup did not finish successfully. echo If needed, use the manual guide: echo https://code.jimuxyz.com/dashboard/codex-installation/windows echo. pause exit /b 1