CodeGuard/setup-opencode-config.bat

57 lines
1.7 KiB
Batchfile

@echo off
setlocal
echo ========================================
echo OpenCode Configuration Setup
echo ========================================
echo.
set OPENCODE_DIR=%USERPROFILE%\.config\opencode
set SCRIPT_DIR=%~dp0
set SOURCE_CONFIG=%SCRIPT_DIR%installations\opencode-cli\opencode.json
if not exist "%OPENCODE_DIR%" (
echo [1/2] Creating opencode config directory...
mkdir "%OPENCODE_DIR%"
)
if exist "%SOURCE_CONFIG%" (
echo [2/2] Copying opencode.json to %OPENCODE_DIR%...
echo Source: %SOURCE_CONFIG%
echo Target: %OPENCODE_DIR%\opencode.json
copy /Y "%SOURCE_CONFIG%" "%OPENCODE_DIR%\opencode.json"
echo.
echo ========================================
echo Setup Complete!
echo ========================================
echo.
echo Configuration copied successfully!
echo Note: Existing config file has been overwritten.
echo.
echo [Additional Setup] Setting environment for offline mode...
setx OPENCODE_OFFLINE 1 >nul
setx OPENCODE_DISABLE_MODELS_FETCH 1 >nul
set OPENCODE_OFFLINE=1
set OPENCODE_DISABLE_MODELS_FETCH=1
echo.
echo [Additional Setup] Adding opencode to PATH...
setx PATH "%PATH%;%SCRIPT_DIR%installations\opencode-cli" >nul
set PATH=%PATH%;%SCRIPT_DIR%installations\opencode-cli
echo.
echo ========================================
echo Offline Mode Enabled!
echo ========================================
echo.
echo Environment variable set: OPENCODE_OFFLINE=1
echo This hides OpenCode Zen models and uses local model only.
echo.
echo Your local model will be used automatically.
echo.
) else (
echo Error: Source config not found at %SOURCE_CONFIG%
echo Please check the installation directory.
pause
exit /b 1
)
pause