Major fixes for Windows portable version: 1. **Fixed critical bugs:** - Replace Unix /dev/null with Windows nul in all .bat files - Unified config path to data/.openclaw/openclaw.json - Fixed cross-platform node_modules compatibility issue 2. **Implemented separated core directories:** - app/core-mac/ for Mac dependencies - app/core-win/ for Windows dependencies - Prevents cross-platform file system conflicts - Shared data/ directory for configs and memory 3. **Enhanced setup.sh:** - Now downloads both Mac and Windows Node.js runtimes - Ensures U-Claw works on both platforms after setup 4. **Added diagnostic tools:** - Windows-Diagnose.bat for troubleshooting - Mac-Diagnose.command for troubleshooting - Auto-generates diagnostic-log.txt 5. **Improved user experience:** - Added Welcome.html - Simple 3-step guide in Chinese - All scripts updated to use platform-specific core directories - Better error messages and user guidance Files modified: - portable/Windows-Start.bat: Use core-win, fix syntax - portable/Windows-Menu.bat: Use core-win, fix syntax - portable/Mac-Start.command: Use core-mac - portable/Mac-Menu.command: Use core-mac - portable/setup.sh: Download both platforms, use core-mac Files added: - portable/Windows-Diagnose.bat: Diagnostic tool - portable/Mac-Diagnose.command: Diagnostic tool - portable/Welcome.html: User-friendly welcome page 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
107 lines
2.9 KiB
Batchfile
107 lines
2.9 KiB
Batchfile
@echo off
|
|
chcp 65001 >nul 2>&1
|
|
title U-Claw - Portable AI Agent
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo U-Claw v1.1 - Portable AI Agent
|
|
echo ========================================
|
|
echo.
|
|
|
|
set "UCLAW_DIR=%~dp0"
|
|
set "APP_DIR=%UCLAW_DIR%app"
|
|
set "CORE_DIR=%APP_DIR%\core-win"
|
|
set "DATA_DIR=%UCLAW_DIR%data"
|
|
set "STATE_DIR=%DATA_DIR%\.openclaw"
|
|
set "NODE_DIR=%APP_DIR%\runtime\node-win-x64"
|
|
set "NODE_BIN=%NODE_DIR%\node.exe"
|
|
set "NPM_BIN=%NODE_DIR%\npm.cmd"
|
|
|
|
set "OPENCLAW_HOME=%DATA_DIR%"
|
|
set "OPENCLAW_STATE_DIR=%STATE_DIR%"
|
|
set "OPENCLAW_CONFIG_PATH=%STATE_DIR%\openclaw.json"
|
|
|
|
REM Check runtime
|
|
if not exist "%NODE_BIN%" (
|
|
echo [ERROR] Node.js runtime not found
|
|
echo Please ensure app\runtime\node-win-x64 is complete
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
for /f "tokens=*" %%v in ('"%NODE_BIN%" --version') do set NODE_VER=%%v
|
|
echo Node.js: %NODE_VER%
|
|
echo.
|
|
|
|
set "PATH=%NODE_DIR%;%NODE_DIR%\node_modules\.bin;%PATH%"
|
|
|
|
REM Init data
|
|
if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
|
|
if not exist "%STATE_DIR%" mkdir "%STATE_DIR%"
|
|
if not exist "%DATA_DIR%\memory" mkdir "%DATA_DIR%\memory"
|
|
if not exist "%DATA_DIR%\backups" mkdir "%DATA_DIR%\backups"
|
|
|
|
REM Default config
|
|
if not exist "%STATE_DIR%\openclaw.json" (
|
|
echo First run - creating default config...
|
|
echo {"gateway":{"mode":"local","auth":{"token":"uclaw"}}} > "%STATE_DIR%\openclaw.json"
|
|
echo Config created
|
|
echo.
|
|
)
|
|
|
|
REM Check dependencies
|
|
if not exist "%CORE_DIR%\node_modules" (
|
|
echo First run - installing dependencies...
|
|
echo Using China mirror, please wait...
|
|
echo.
|
|
cd /d "%CORE_DIR%"
|
|
call "%NPM_BIN%" install --registry=https://registry.npmmirror.com
|
|
echo.
|
|
echo Dependencies installed!
|
|
echo.
|
|
)
|
|
|
|
REM OpenClaw doesn't need a separate build step when installed via npm
|
|
|
|
REM Find available port
|
|
set PORT=18789
|
|
:check_port
|
|
netstat -an | findstr ":%PORT% " | findstr "LISTENING" >nul 2>&1
|
|
if %errorlevel%==0 (
|
|
echo Port %PORT% in use, trying next...
|
|
set /a PORT+=1
|
|
if %PORT% gtr 18799 (
|
|
echo No available port 18789-18799
|
|
pause
|
|
exit /b 1
|
|
)
|
|
goto :check_port
|
|
)
|
|
|
|
echo Starting OpenClaw on port %PORT%...
|
|
echo DO NOT close this window!
|
|
echo.
|
|
|
|
cd /d "%CORE_DIR%"
|
|
|
|
REM Check if model is configured - open Config.html for first time, dashboard for returning users
|
|
set "HAS_MODEL=no"
|
|
if exist "%STATE_DIR%\openclaw.json" (
|
|
findstr /c:"agent" "%STATE_DIR%\openclaw.json" >nul 2>&1 && set "HAS_MODEL=yes"
|
|
)
|
|
|
|
if "%HAS_MODEL%"=="yes" (
|
|
echo Opening dashboard...
|
|
start "" http://127.0.0.1:%PORT%/#token=uclaw
|
|
) else (
|
|
echo First time - opening Config page...
|
|
start "" "%UCLAW_DIR%Config.html?port=%PORT%"
|
|
)
|
|
|
|
set "OPENCLAW_MJS=%CORE_DIR%\node_modules\openclaw\openclaw.mjs"
|
|
"%NODE_BIN%" "%OPENCLAW_MJS%" gateway run --allow-unconfigured --force --port %PORT%
|
|
|
|
echo.
|
|
echo OpenClaw stopped.
|
|
pause
|