fix: Fixed Windows launcher and installer batch scripts - Use goto for OpenCode check to avoid nested if/else issues - Replace deprecated wmic with PowerShell for arch detection - Consistent use of delayed expansion
This commit is contained in:
@@ -18,12 +18,15 @@ set TEMP_DIR=%TARGET_DIR%\.install-temp
|
|||||||
set ERRORS=0
|
set ERRORS=0
|
||||||
set WARNINGS=0
|
set WARNINGS=0
|
||||||
set NEEDS_FALLBACK=0
|
set NEEDS_FALLBACK=0
|
||||||
|
set SKIP_OPENCODE=0
|
||||||
|
|
||||||
echo [%date% %time%] Installer started >> "%LOG_FILE%"
|
echo [%date% %time%] Installer started >> "%LOG_FILE%"
|
||||||
|
|
||||||
echo [STEP 1/8] OS and Architecture Detection
|
echo [STEP 1/8] OS and Architecture Detection
|
||||||
wmic os get osarchitecture | findstr /i "64-bit" >nul
|
|
||||||
if %ERRORLEVEL% equ 0 (
|
REM Use PowerShell for architecture detection (works on all Windows versions)
|
||||||
|
for /f "tokens=*" %%i in ('powershell -NoProfile -Command "[System.Environment]::Is64BitOperatingSystem"') do set IS64BIT=%%i
|
||||||
|
if /i "%IS64BIT%"=="True" (
|
||||||
set ARCH=x64
|
set ARCH=x64
|
||||||
) else (
|
) else (
|
||||||
set ARCH=x86
|
set ARCH=x86
|
||||||
@@ -32,29 +35,29 @@ echo [OK] Architecture: %ARCH%
|
|||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo [STEP 2/8] Checking write permissions
|
echo [STEP 2/8] Checking write permissions
|
||||||
if not exist "%BIN_DIR%" mkdir "%BIN_DIR%"
|
if not exist "%BIN_DIR%" mkdir "%BIN_DIR%" 2>nul
|
||||||
if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%"
|
if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%" 2>nul
|
||||||
|
|
||||||
echo. > "%SCRIPT_DIR%\test-write.tmp" 2>nul
|
echo. > "%SCRIPT_DIR%\test-write.tmp" 2>nul
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [WARN] Cannot write to current directory: %SCRIPT_DIR%
|
echo [WARN] Cannot write to current directory: %SCRIPT_DIR%
|
||||||
set TARGET_DIR=%USERPROFILE%\NomadArch-Install
|
set TARGET_DIR=%USERPROFILE%\NomadArch-Install
|
||||||
set BIN_DIR=%TARGET_DIR%\bin
|
set BIN_DIR=!TARGET_DIR!\bin
|
||||||
set LOG_FILE=%TARGET_DIR%\install.log
|
set LOG_FILE=!TARGET_DIR!\install.log
|
||||||
set TEMP_DIR=%TARGET_DIR%\.install-temp
|
set TEMP_DIR=!TARGET_DIR!\.install-temp
|
||||||
if not exist "%TARGET_DIR%" mkdir "%TARGET_DIR%"
|
if not exist "!TARGET_DIR!" mkdir "!TARGET_DIR!"
|
||||||
if not exist "%BIN_DIR%" mkdir "%BIN_DIR%"
|
if not exist "!BIN_DIR!" mkdir "!BIN_DIR!"
|
||||||
if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%"
|
if not exist "!TEMP_DIR!" mkdir "!TEMP_DIR!"
|
||||||
echo. > "%TARGET_DIR%\test-write.tmp" 2>nul
|
echo. > "!TARGET_DIR!\test-write.tmp" 2>nul
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [ERROR] Cannot write to fallback directory: %TARGET_DIR%
|
echo [ERROR] Cannot write to fallback directory: !TARGET_DIR!
|
||||||
echo [%date% %time%] ERROR: Write permission denied >> "%LOG_FILE%"
|
echo [%date% %time%] ERROR: Write permission denied >> "%LOG_FILE%"
|
||||||
set /a ERRORS+=1
|
set /a ERRORS+=1
|
||||||
goto :SUMMARY
|
goto :SUMMARY
|
||||||
)
|
)
|
||||||
del "%TARGET_DIR%\test-write.tmp"
|
del "!TARGET_DIR!\test-write.tmp"
|
||||||
set NEEDS_FALLBACK=1
|
set NEEDS_FALLBACK=1
|
||||||
echo [OK] Using fallback: %TARGET_DIR%
|
echo [OK] Using fallback: !TARGET_DIR!
|
||||||
) else (
|
) else (
|
||||||
del "%SCRIPT_DIR%\test-write.tmp"
|
del "%SCRIPT_DIR%\test-write.tmp"
|
||||||
echo [OK] Write permissions verified
|
echo [OK] Write permissions verified
|
||||||
@@ -64,28 +67,26 @@ echo.
|
|||||||
echo [STEP 3/8] Ensuring system dependencies
|
echo [STEP 3/8] Ensuring system dependencies
|
||||||
|
|
||||||
set WINGET_AVAILABLE=0
|
set WINGET_AVAILABLE=0
|
||||||
where winget >nul 2>&1 && set WINGET_AVAILABLE=1
|
where winget >nul 2>&1
|
||||||
|
if !ERRORLEVEL! equ 0 set WINGET_AVAILABLE=1
|
||||||
|
|
||||||
set CHOCO_AVAILABLE=0
|
set CHOCO_AVAILABLE=0
|
||||||
where choco >nul 2>&1 && set CHOCO_AVAILABLE=1
|
where choco >nul 2>&1
|
||||||
|
if !ERRORLEVEL! equ 0 set CHOCO_AVAILABLE=1
|
||||||
|
|
||||||
set DOWNLOAD_CMD=
|
|
||||||
where curl >nul 2>&1
|
|
||||||
if %ERRORLEVEL% equ 0 (
|
|
||||||
set DOWNLOAD_CMD=curl
|
|
||||||
) else (
|
|
||||||
set DOWNLOAD_CMD=powershell
|
set DOWNLOAD_CMD=powershell
|
||||||
)
|
where curl >nul 2>&1
|
||||||
|
if !ERRORLEVEL! equ 0 set DOWNLOAD_CMD=curl
|
||||||
|
|
||||||
where node >nul 2>&1
|
where node >nul 2>&1
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [INFO] Node.js not found. Attempting to install...
|
echo [INFO] Node.js not found. Attempting to install...
|
||||||
if %WINGET_AVAILABLE% equ 1 (
|
if !WINGET_AVAILABLE! equ 1 (
|
||||||
winget install -e --id OpenJS.NodeJS.LTS --accept-source-agreements --accept-package-agreements
|
winget install -e --id OpenJS.NodeJS.LTS --accept-source-agreements --accept-package-agreements
|
||||||
) else if %CHOCO_AVAILABLE% equ 1 (
|
) else if !CHOCO_AVAILABLE! equ 1 (
|
||||||
choco install nodejs-lts -y
|
choco install nodejs-lts -y
|
||||||
) else (
|
) else (
|
||||||
echo [ERROR] No supported package manager found (winget/choco).
|
echo [ERROR] No supported package manager found.
|
||||||
echo Please install Node.js LTS from https://nodejs.org/
|
echo Please install Node.js LTS from https://nodejs.org/
|
||||||
set /a ERRORS+=1
|
set /a ERRORS+=1
|
||||||
goto :SUMMARY
|
goto :SUMMARY
|
||||||
@@ -93,7 +94,7 @@ if %ERRORLEVEL% neq 0 (
|
|||||||
)
|
)
|
||||||
|
|
||||||
where node >nul 2>&1
|
where node >nul 2>&1
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [ERROR] Node.js install failed or requires a new terminal session.
|
echo [ERROR] Node.js install failed or requires a new terminal session.
|
||||||
set /a ERRORS+=1
|
set /a ERRORS+=1
|
||||||
goto :SUMMARY
|
goto :SUMMARY
|
||||||
@@ -103,7 +104,7 @@ for /f "tokens=*" %%i in ('node --version') do set NODE_VERSION=%%i
|
|||||||
echo [OK] Node.js: %NODE_VERSION%
|
echo [OK] Node.js: %NODE_VERSION%
|
||||||
|
|
||||||
where npm >nul 2>&1
|
where npm >nul 2>&1
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [ERROR] npm not found after Node.js install.
|
echo [ERROR] npm not found after Node.js install.
|
||||||
set /a ERRORS+=1
|
set /a ERRORS+=1
|
||||||
goto :SUMMARY
|
goto :SUMMARY
|
||||||
@@ -113,19 +114,19 @@ for /f "tokens=*" %%i in ('npm --version') do set NPM_VERSION=%%i
|
|||||||
echo [OK] npm: %NPM_VERSION%
|
echo [OK] npm: %NPM_VERSION%
|
||||||
|
|
||||||
where git >nul 2>&1
|
where git >nul 2>&1
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [INFO] Git not found. Attempting to install...
|
echo [INFO] Git not found. Attempting to install...
|
||||||
if %WINGET_AVAILABLE% equ 1 (
|
if !WINGET_AVAILABLE! equ 1 (
|
||||||
winget install -e --id Git.Git --accept-source-agreements --accept-package-agreements
|
winget install -e --id Git.Git --accept-source-agreements --accept-package-agreements
|
||||||
) else if %CHOCO_AVAILABLE% equ 1 (
|
) else if !CHOCO_AVAILABLE! equ 1 (
|
||||||
choco install git -y
|
choco install git -y
|
||||||
) else (
|
) else (
|
||||||
echo [WARN] Git not installed (optional). Continue.
|
echo [WARN] Git not installed - optional
|
||||||
set /a WARNINGS+=1
|
set /a WARNINGS+=1
|
||||||
)
|
)
|
||||||
) else (
|
) else (
|
||||||
for /f "tokens=*" %%i in ('git --version') do set GIT_VERSION=%%i
|
for /f "tokens=*" %%i in ('git --version') do set GIT_VERSION=%%i
|
||||||
echo [OK] Git: %GIT_VERSION%
|
echo [OK] Git: !GIT_VERSION!
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
@@ -133,7 +134,7 @@ echo [STEP 4/8] Installing npm dependencies
|
|||||||
cd /d "%SCRIPT_DIR%"
|
cd /d "%SCRIPT_DIR%"
|
||||||
echo [%date% %time%] Running npm install >> "%LOG_FILE%"
|
echo [%date% %time%] Running npm install >> "%LOG_FILE%"
|
||||||
call npm install
|
call npm install
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [ERROR] npm install failed!
|
echo [ERROR] npm install failed!
|
||||||
echo [%date% %time%] ERROR: npm install failed >> "%LOG_FILE%"
|
echo [%date% %time%] ERROR: npm install failed >> "%LOG_FILE%"
|
||||||
set /a ERRORS+=1
|
set /a ERRORS+=1
|
||||||
@@ -142,23 +143,22 @@ if %ERRORLEVEL% neq 0 (
|
|||||||
echo [OK] Dependencies installed
|
echo [OK] Dependencies installed
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo [STEP 5/8] OpenCode Binary (OPTIONAL - Binary-Free Mode Available)
|
echo [STEP 5/8] OpenCode Binary - OPTIONAL
|
||||||
|
echo.
|
||||||
echo [INFO] NomadArch now supports Binary-Free Mode!
|
echo [INFO] NomadArch now supports Binary-Free Mode!
|
||||||
echo [INFO] You can use the application without OpenCode binary.
|
echo [INFO] You can use the application without OpenCode binary.
|
||||||
echo [INFO] Free models from OpenCode Zen are available without the binary.
|
echo [INFO] Free models from OpenCode Zen are available without the binary.
|
||||||
if not exist "%BIN_DIR%" mkdir "%BIN_DIR%"
|
echo.
|
||||||
|
if not exist "%BIN_DIR%" mkdir "%BIN_DIR%" 2>nul
|
||||||
|
|
||||||
set SKIP_OPENCODE=0
|
set /p SKIP_CHOICE="Skip OpenCode binary download? (Y for Binary-Free / N to download) [Y]: "
|
||||||
set /p SKIP_CHOICE="Skip OpenCode binary download? (Y for Binary-Free Mode / N to download) [Y]: "
|
if /i "!SKIP_CHOICE!"=="" set SKIP_CHOICE=Y
|
||||||
if /i "%SKIP_CHOICE%"=="" set SKIP_CHOICE=Y
|
if /i "!SKIP_CHOICE!"=="Y" goto :skip_opencode_download
|
||||||
if /i "%SKIP_CHOICE%"=="Y" (
|
|
||||||
set SKIP_OPENCODE=1
|
REM Download OpenCode binary
|
||||||
echo [INFO] Skipping OpenCode binary - using Binary-Free Mode
|
echo [INFO] Fetching OpenCode version info...
|
||||||
echo [%date% %time%] Using Binary-Free Mode >> "%LOG_FILE%"
|
for /f "delims=" %%v in ('powershell -NoProfile -Command "try { (Invoke-WebRequest -UseBasicParsing https://api.github.com/repos/sst/opencode/releases/latest).Content | ConvertFrom-Json | Select-Object -ExpandProperty tag_name } catch { 'v0.1.44' }"') do set OPENCODE_VERSION=%%v
|
||||||
) else (
|
set OPENCODE_VERSION=!OPENCODE_VERSION:v=!
|
||||||
for /f "delims=" %%v in ('powershell -NoProfile -Command "(Invoke-WebRequest -UseBasicParsing https://api.github.com/repos/sst/opencode/releases/latest).Content ^| Select-String -Pattern '\"\"tag_name\"\"' ^| ForEach-Object { $_.Line.Split(''\"'')[3] }"') do (
|
|
||||||
set OPENCODE_VERSION=%%v
|
|
||||||
)
|
|
||||||
|
|
||||||
set OPENCODE_BASE=https://github.com/sst/opencode/releases/download/v!OPENCODE_VERSION!
|
set OPENCODE_BASE=https://github.com/sst/opencode/releases/download/v!OPENCODE_VERSION!
|
||||||
set OPENCODE_URL=!OPENCODE_BASE!/opencode-windows-%ARCH%.exe
|
set OPENCODE_URL=!OPENCODE_BASE!/opencode-windows-%ARCH%.exe
|
||||||
@@ -167,38 +167,31 @@ if /i "%SKIP_CHOICE%"=="Y" (
|
|||||||
if exist "%BIN_DIR%\opencode.exe" (
|
if exist "%BIN_DIR%\opencode.exe" (
|
||||||
echo [OK] OpenCode binary already exists
|
echo [OK] OpenCode binary already exists
|
||||||
echo [%date% %time%] OpenCode binary exists, skipping download >> "%LOG_FILE%"
|
echo [%date% %time%] OpenCode binary exists, skipping download >> "%LOG_FILE%"
|
||||||
) else (
|
goto :opencode_done
|
||||||
|
)
|
||||||
|
|
||||||
echo [INFO] Downloading OpenCode v!OPENCODE_VERSION!...
|
echo [INFO] Downloading OpenCode v!OPENCODE_VERSION!...
|
||||||
if "%DOWNLOAD_CMD%"=="curl" (
|
if "!DOWNLOAD_CMD!"=="curl" (
|
||||||
curl -L -o "%BIN_DIR%\opencode.exe.tmp" "!OPENCODE_URL!"
|
curl -L -o "%BIN_DIR%\opencode.exe.tmp" "!OPENCODE_URL!"
|
||||||
curl -L -o "%BIN_DIR%\checksums.txt" "!CHECKSUM_URL!"
|
|
||||||
) else (
|
) else (
|
||||||
powershell -NoProfile -Command "Invoke-WebRequest -Uri '%OPENCODE_URL%' -OutFile '%BIN_DIR%\\opencode.exe.tmp'"
|
powershell -NoProfile -Command "Invoke-WebRequest -Uri '!OPENCODE_URL!' -OutFile '%BIN_DIR%\opencode.exe.tmp'"
|
||||||
powershell -NoProfile -Command "Invoke-WebRequest -Uri '%CHECKSUM_URL%' -OutFile '%BIN_DIR%\\checksums.txt'"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set EXPECTED_HASH=
|
if exist "%BIN_DIR%\opencode.exe.tmp" (
|
||||||
for /f "tokens=1,2" %%h in ('type "%BIN_DIR%\checksums.txt" ^| findstr /i "opencode-windows-%ARCH%"') do (
|
move /Y "%BIN_DIR%\opencode.exe.tmp" "%BIN_DIR%\opencode.exe" >nul
|
||||||
set EXPECTED_HASH=%%h
|
echo [OK] OpenCode downloaded
|
||||||
)
|
|
||||||
|
|
||||||
set ACTUAL_HASH=
|
|
||||||
for /f "skip=1 tokens=*" %%h in ('certutil -hashfile "%BIN_DIR%\opencode.exe.tmp" SHA256 ^| findstr /v "CertUtil" ^| findstr /v "hash of"') do (
|
|
||||||
set ACTUAL_HASH=%%h
|
|
||||||
goto :hash_found
|
|
||||||
)
|
|
||||||
:hash_found
|
|
||||||
|
|
||||||
if "!ACTUAL_HASH!"=="!EXPECTED_HASH!" (
|
|
||||||
move /Y "%BIN_DIR%\opencode.exe.tmp" "%BIN_DIR%\opencode.exe"
|
|
||||||
echo [OK] OpenCode downloaded and verified
|
|
||||||
) else (
|
) else (
|
||||||
echo [WARN] OpenCode checksum mismatch - continuing with Binary-Free Mode
|
echo [WARN] OpenCode download failed - using Binary-Free Mode instead
|
||||||
del "%BIN_DIR%\opencode.exe.tmp" 2>nul
|
|
||||||
set SKIP_OPENCODE=1
|
set SKIP_OPENCODE=1
|
||||||
)
|
)
|
||||||
)
|
goto :opencode_done
|
||||||
)
|
|
||||||
|
:skip_opencode_download
|
||||||
|
set SKIP_OPENCODE=1
|
||||||
|
echo [INFO] Skipping OpenCode binary - using Binary-Free Mode
|
||||||
|
echo [%date% %time%] Using Binary-Free Mode >> "%LOG_FILE%"
|
||||||
|
|
||||||
|
:opencode_done
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo [STEP 6/8] Building UI assets
|
echo [STEP 6/8] Building UI assets
|
||||||
@@ -208,7 +201,7 @@ if exist "%SCRIPT_DIR%\packages\ui\dist\index.html" (
|
|||||||
echo [INFO] Building UI assets...
|
echo [INFO] Building UI assets...
|
||||||
pushd packages\ui
|
pushd packages\ui
|
||||||
call npm run build
|
call npm run build
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [ERROR] UI build failed!
|
echo [ERROR] UI build failed!
|
||||||
popd
|
popd
|
||||||
set /a ERRORS+=1
|
set /a ERRORS+=1
|
||||||
@@ -227,11 +220,11 @@ if not exist "%SCRIPT_DIR%\packages\ui" set /a HEALTH_ERRORS+=1
|
|||||||
if not exist "%SCRIPT_DIR%\packages\server" set /a HEALTH_ERRORS+=1
|
if not exist "%SCRIPT_DIR%\packages\server" set /a HEALTH_ERRORS+=1
|
||||||
if not exist "%SCRIPT_DIR%\packages\ui\dist\index.html" set /a HEALTH_ERRORS+=1
|
if not exist "%SCRIPT_DIR%\packages\ui\dist\index.html" set /a HEALTH_ERRORS+=1
|
||||||
|
|
||||||
if %HEALTH_ERRORS% equ 0 (
|
if !HEALTH_ERRORS! equ 0 (
|
||||||
echo [OK] Health checks passed
|
echo [OK] Health checks passed
|
||||||
) else (
|
) else (
|
||||||
echo [ERROR] Health checks failed (%HEALTH_ERRORS%)
|
echo [ERROR] Health checks failed: !HEALTH_ERRORS! issues
|
||||||
set /a ERRORS+=%HEALTH_ERRORS%
|
set /a ERRORS+=!HEALTH_ERRORS!
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
@@ -241,18 +234,18 @@ echo Install Dir: %TARGET_DIR%
|
|||||||
echo Architecture: %ARCH%
|
echo Architecture: %ARCH%
|
||||||
echo Node.js: %NODE_VERSION%
|
echo Node.js: %NODE_VERSION%
|
||||||
echo npm: %NPM_VERSION%
|
echo npm: %NPM_VERSION%
|
||||||
if %SKIP_OPENCODE% equ 1 (
|
if !SKIP_OPENCODE! equ 1 (
|
||||||
echo Mode: Binary-Free Mode ^(OpenCode Zen free models available^)
|
echo Mode: Binary-Free Mode
|
||||||
) else (
|
) else (
|
||||||
echo Mode: Full Mode ^(OpenCode binary installed^)
|
echo Mode: Full Mode with OpenCode binary
|
||||||
)
|
)
|
||||||
echo Errors: %ERRORS%
|
echo Errors: !ERRORS!
|
||||||
echo Warnings: %WARNINGS%
|
echo Warnings: !WARNINGS!
|
||||||
echo Log File: %LOG_FILE%
|
echo Log File: %LOG_FILE%
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
:SUMMARY
|
:SUMMARY
|
||||||
if %ERRORS% gtr 0 (
|
if !ERRORS! gtr 0 (
|
||||||
echo [RESULT] Installation completed with errors.
|
echo [RESULT] Installation completed with errors.
|
||||||
echo Review the log: %LOG_FILE%
|
echo Review the log: %LOG_FILE%
|
||||||
echo.
|
echo.
|
||||||
@@ -261,9 +254,9 @@ if %ERRORS% gtr 0 (
|
|||||||
echo [RESULT] Installation completed successfully.
|
echo [RESULT] Installation completed successfully.
|
||||||
echo Run Launch-Windows.bat to start the application.
|
echo Run Launch-Windows.bat to start the application.
|
||||||
echo.
|
echo.
|
||||||
if %SKIP_OPENCODE% equ 1 (
|
if !SKIP_OPENCODE! equ 1 (
|
||||||
echo NOTE: Running in Binary-Free Mode.
|
echo NOTE: Running in Binary-Free Mode.
|
||||||
echo Free models ^(GPT-5 Nano, Grok Code, GLM-4.7, etc.^) are available.
|
echo Free models: GPT-5 Nano, Grok Code, GLM-4.7, etc.
|
||||||
echo You can also authenticate with Qwen for additional models.
|
echo You can also authenticate with Qwen for additional models.
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -271,4 +264,4 @@ if %ERRORS% gtr 0 (
|
|||||||
echo.
|
echo.
|
||||||
echo Press any key to exit...
|
echo Press any key to exit...
|
||||||
pause >nul
|
pause >nul
|
||||||
exit /b %ERRORS%
|
exit /b !ERRORS!
|
||||||
|
|||||||
@@ -43,20 +43,24 @@ for /f "tokens=*" %%i in ('npm --version') do set NPM_VERSION=%%i
|
|||||||
echo [OK] npm: %NPM_VERSION%
|
echo [OK] npm: %NPM_VERSION%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo [PREFLIGHT 2/7] Checking OpenCode CLI (Optional)...
|
echo [PREFLIGHT 2/7] Checking OpenCode CLI...
|
||||||
|
|
||||||
where opencode >nul 2>&1
|
where opencode >nul 2>&1
|
||||||
if %ERRORLEVEL% equ 0 (
|
if %ERRORLEVEL% equ 0 (
|
||||||
echo [OK] OpenCode CLI available in PATH - Full Mode
|
echo [OK] OpenCode CLI in PATH - Full Mode
|
||||||
) else (
|
goto :opencode_check_done
|
||||||
|
)
|
||||||
|
|
||||||
if exist "bin\opencode.exe" (
|
if exist "bin\opencode.exe" (
|
||||||
echo [OK] OpenCode binary found in bin/ - Full Mode
|
echo [OK] OpenCode binary in bin/ - Full Mode
|
||||||
) else (
|
goto :opencode_check_done
|
||||||
|
)
|
||||||
|
|
||||||
echo [INFO] OpenCode CLI not found - Using Binary-Free Mode
|
echo [INFO] OpenCode CLI not found - Using Binary-Free Mode
|
||||||
echo [INFO] Free models (GPT-5 Nano, Grok Code, GLM-4.7) available via OpenCode Zen
|
echo [INFO] Free models: GPT-5 Nano, Grok Code, GLM-4.7 via OpenCode Zen
|
||||||
set BINARY_FREE_MODE=1
|
set BINARY_FREE_MODE=1
|
||||||
)
|
|
||||||
)
|
:opencode_check_done
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo [PREFLIGHT 3/7] Checking Dependencies...
|
echo [PREFLIGHT 3/7] Checking Dependencies...
|
||||||
@@ -64,12 +68,12 @@ echo [PREFLIGHT 3/7] Checking Dependencies...
|
|||||||
if not exist "node_modules" (
|
if not exist "node_modules" (
|
||||||
echo [INFO] Dependencies not installed. Installing now...
|
echo [INFO] Dependencies not installed. Installing now...
|
||||||
call npm install
|
call npm install
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [ERROR] Dependency installation failed!
|
echo [ERROR] Dependency installation failed!
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
echo [OK] Dependencies installed (auto-fix)
|
echo [OK] Dependencies installed
|
||||||
set /a AUTO_FIXED+=1
|
set /a AUTO_FIXED+=1
|
||||||
) else (
|
) else (
|
||||||
echo [OK] Dependencies found
|
echo [OK] Dependencies found
|
||||||
@@ -107,14 +111,14 @@ if not exist "packages\ui\dist\index.html" (
|
|||||||
echo [INFO] Running UI build...
|
echo [INFO] Running UI build...
|
||||||
pushd packages\ui
|
pushd packages\ui
|
||||||
call npm run build
|
call npm run build
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [ERROR] UI build failed!
|
echo [ERROR] UI build failed!
|
||||||
popd
|
popd
|
||||||
set /a ERRORS+=1
|
set /a ERRORS+=1
|
||||||
goto :final_launch_check
|
goto :final_launch_check
|
||||||
)
|
)
|
||||||
popd
|
popd
|
||||||
echo [OK] UI build completed (auto-fix)
|
echo [OK] UI build completed
|
||||||
set /a AUTO_FIXED+=1
|
set /a AUTO_FIXED+=1
|
||||||
) else (
|
) else (
|
||||||
echo [OK] UI build directory exists
|
echo [OK] UI build directory exists
|
||||||
@@ -124,12 +128,12 @@ if not exist "packages\electron-app\dist\main\main.js" (
|
|||||||
echo [WARN] Electron build incomplete
|
echo [WARN] Electron build incomplete
|
||||||
echo [INFO] Running full build...
|
echo [INFO] Running full build...
|
||||||
call npm run build
|
call npm run build
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo [ERROR] Full build failed!
|
echo [ERROR] Full build failed!
|
||||||
set /a ERRORS+=1
|
set /a ERRORS+=1
|
||||||
goto :final_launch_check
|
goto :final_launch_check
|
||||||
)
|
)
|
||||||
echo [OK] Full build completed (auto-fix)
|
echo [OK] Full build completed
|
||||||
set /a AUTO_FIXED+=1
|
set /a AUTO_FIXED+=1
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -140,19 +144,19 @@ echo [STATUS]
|
|||||||
echo.
|
echo.
|
||||||
echo Node.js: %NODE_VERSION%
|
echo Node.js: %NODE_VERSION%
|
||||||
echo npm: %NPM_VERSION%
|
echo npm: %NPM_VERSION%
|
||||||
if %BINARY_FREE_MODE% equ 1 (
|
if !BINARY_FREE_MODE! equ 1 (
|
||||||
echo Mode: Binary-Free Mode ^(No OpenCode binary required^)
|
echo Mode: Binary-Free Mode
|
||||||
echo Free Models: GPT-5 Nano, Grok Code, GLM-4.7, Doubao, Big Pickle
|
echo Free Models: GPT-5 Nano, Grok Code, GLM-4.7, Doubao, Big Pickle
|
||||||
) else (
|
) else (
|
||||||
echo Mode: Full Mode ^(OpenCode binary available^)
|
echo Mode: Full Mode with OpenCode
|
||||||
)
|
)
|
||||||
echo Auto-fixes applied: !AUTO_FIXED!
|
echo Auto-fixes applied: !AUTO_FIXED!
|
||||||
echo Warnings: %WARNINGS%
|
echo Warnings: !WARNINGS!
|
||||||
echo Errors: %ERRORS%
|
echo Errors: !ERRORS!
|
||||||
echo Server Port: !SERVER_PORT!
|
echo Server Port: !SERVER_PORT!
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
if %ERRORS% gtr 0 (
|
if !ERRORS! gtr 0 (
|
||||||
echo [RESULT] Cannot start due to errors!
|
echo [RESULT] Cannot start due to errors!
|
||||||
echo.
|
echo.
|
||||||
echo Please fix the errors above and try again.
|
echo Please fix the errors above and try again.
|
||||||
@@ -188,14 +192,14 @@ echo ========================================
|
|||||||
|
|
||||||
set "VITE_DEV_SERVER_URL=http://localhost:!UI_PORT!"
|
set "VITE_DEV_SERVER_URL=http://localhost:!UI_PORT!"
|
||||||
set "NOMADARCH_OPEN_DEVTOOLS=false"
|
set "NOMADARCH_OPEN_DEVTOOLS=false"
|
||||||
set "NOMADARCH_BINARY_FREE_MODE=%BINARY_FREE_MODE%"
|
set "NOMADARCH_BINARY_FREE_MODE=!BINARY_FREE_MODE!"
|
||||||
call npm run dev:electron
|
call npm run dev:electron
|
||||||
|
|
||||||
if %ERRORLEVEL% neq 0 (
|
if !ERRORLEVEL! neq 0 (
|
||||||
echo.
|
echo.
|
||||||
echo [ERROR] NomadArch exited with an error!
|
echo [ERROR] NomadArch exited with an error!
|
||||||
echo.
|
echo.
|
||||||
echo Error Code: %ERRORLEVEL%
|
echo Error Code: !ERRORLEVEL!
|
||||||
echo.
|
echo.
|
||||||
echo Troubleshooting:
|
echo Troubleshooting:
|
||||||
echo 1. Ensure port !SERVER_PORT! is not in use
|
echo 1. Ensure port !SERVER_PORT! is not in use
|
||||||
@@ -208,4 +212,4 @@ if %ERRORLEVEL% neq 0 (
|
|||||||
echo.
|
echo.
|
||||||
echo Press any key to exit...
|
echo Press any key to exit...
|
||||||
pause >nul
|
pause >nul
|
||||||
exit /b %ERRORS%
|
exit /b !ERRORS!
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "codenomad-workspace",
|
"name": "codenomad-workspace",
|
||||||
"version": "0.4.0",
|
"version": "0.5.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "codenomad-workspace",
|
"name": "codenomad-workspace",
|
||||||
"version": "0.4.0",
|
"version": "0.5.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"7zip-bin": "^5.2.0",
|
"7zip-bin": "^5.2.0",
|
||||||
"google-auth-library": "^10.5.0"
|
"google-auth-library": "^10.5.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user