#!/bin/bash # ============================================================ # U-Claw - OpenClaw Doctor (官方完整体检, 进阶, 英文) # 注意:先启动 U-Claw 再跑本工具,否则 doctor 会卡在探测未启动的 gateway 上。 # 只读:故意不传 --fix/--repair/--force。卡住可按 Ctrl+C 安全中断。 # ============================================================ UCLAW_DIR="$(cd "$(dirname "$0")/.." && pwd)" APP_DIR="$UCLAW_DIR/app" CORE_DIR="$APP_DIR/core" DATA_DIR="$UCLAW_DIR/data" STATE_DIR="$DATA_DIR/.openclaw" OPENCLAW_MJS="$CORE_DIR/node_modules/openclaw/openclaw.mjs" ARCH=$(uname -m) case "$ARCH" in arm64) NODE_BIN="$APP_DIR/runtime/node-mac-arm64/bin/node" ;; x86_64) NODE_BIN="$APP_DIR/runtime/node-mac-x64/bin/node" ;; *) NODE_BIN="" ;; esac if [ ! -x "$NODE_BIN" ]; then NODE_BIN="$(command -v node)"; fi if [ -z "$NODE_BIN" ] || [ ! -x "$NODE_BIN" ]; then echo " Node.js is missing from this drive." read -p " Press Enter to close." exit 1 fi if [ ! -f "$OPENCLAW_MJS" ]; then echo " OpenClaw is missing from this drive." read -p " Press Enter to close." exit 1 fi export OPENCLAW_HOME="$DATA_DIR" export OPENCLAW_STATE_DIR="$STATE_DIR" export OPENCLAW_CONFIG_PATH="$STATE_DIR/openclaw.json" export OPENCLAW_DISABLE_BONJOUR=1 xattr -rd com.apple.quarantine "$UCLAW_DIR" 2>/dev/null || true echo "" echo " ========================================" echo " OpenClaw Doctor — the upstream check. Thorough, and slow." echo " ========================================" echo " U-Claw needs to be running. Ctrl+C is safe at any point — this only reads." echo " For a network-focused check, use Mac-IntranetFix.command instead." echo "" read -p " Press Enter to start." "$NODE_BIN" "$OPENCLAW_MJS" doctor --non-interactive echo "" read -p " Press Enter to close."