feat: v1.1 portable architecture (app/data separation)
New directory structure: - app/core/ = OpenClaw program - app/runtime/ = Node.js - data/ = user config, memory, backups (never overwritten on upgrade) - system/ = migration scripts Features: - Auto port detection (18789-18799) - macOS Gatekeeper auto-fix (xattr quarantine removal) - Windows UTF-8 BOM + CRLF encoding - Config auto-migration on startup - Platform-specific packages (Mac ARM64 + Windows x64)
This commit is contained in:
102
portable/start.bat
Normal file
102
portable/start.bat
Normal file
@@ -0,0 +1,102 @@
|
||||
@echo off
|
||||
chcp 65001 >/dev/null 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"
|
||||
set "DATA_DIR=%UCLAW_DIR%data"
|
||||
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=%DATA_DIR%"
|
||||
set "OPENCLAW_CONFIG_PATH=%DATA_DIR%\config.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 "%DATA_DIR%\memory" mkdir "%DATA_DIR%\memory"
|
||||
if not exist "%DATA_DIR%\backups" mkdir "%DATA_DIR%\backups"
|
||||
|
||||
REM Default config
|
||||
if not exist "%DATA_DIR%\config.json" (
|
||||
echo First run - creating default config...
|
||||
echo {"gateway":{"mode":"local","auth":{"token":"uclaw"}}} > "%DATA_DIR%\config.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.
|
||||
)
|
||||
|
||||
if not exist "%CORE_DIR%\dist" (
|
||||
echo First run - building...
|
||||
cd /d "%CORE_DIR%"
|
||||
call "%NPM_BIN%" run build
|
||||
echo.
|
||||
)
|
||||
|
||||
REM Find available port
|
||||
set PORT=18789
|
||||
:check_port
|
||||
netstat -an | findstr ":%PORT% " | findstr "LISTENING" >/dev/null 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.
|
||||
echo ----------------------------------------
|
||||
echo Browser will open automatically.
|
||||
echo First time setup in web console:
|
||||
echo 1. Choose AI model (DeepSeek / Kimi / Qwen)
|
||||
echo 2. Enter API Key
|
||||
echo 3. Connect chat platform (QQ / Feishu / DingTalk)
|
||||
echo ----------------------------------------
|
||||
echo.
|
||||
|
||||
cd /d "%CORE_DIR%"
|
||||
start "" http://127.0.0.1:%PORT%/#token=uclaw
|
||||
"%NODE_BIN%" openclaw.mjs gateway run --allow-unconfigured --force --port %PORT%
|
||||
|
||||
echo.
|
||||
echo OpenClaw stopped.
|
||||
pause
|
||||
Reference in New Issue
Block a user