Files
u-claw/portable/Mac-OpenClaw-CLI.command
hfshfg 01ed1348ef feat(portable): 交互式 CLI 启动器 + 3 个办公技能(采纳自 PR #36)
基于最新 main 重做 PR #36(fanjiazhen)中有价值的部分:
- OpenClaw-CLI.bat / Mac-OpenClaw-CLI.command:进阶用户双击打开一个配好
  便携环境(盘内 Node + 盘内数据 + .bin 入 PATH)的命令行,可直接敲
  openclaw 命令(chat/configure/doctor/gateway status 等)。
- skills-cn/ 新增 word-writer / excel-helper / ppt-designer 三个办公文本
  技能,与现有 10 个本地化技能(小红书/知乎等)互补,frontmatter 格式一致。

未采纳 PR #36 的其余部分:HTML 品牌改动、skill_zip 二进制、删充值.html。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 12:27:13 +08:00

64 lines
2.3 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# ============================================================
# U-Claw - Interactive CLI (macOS)
# 进阶用户:双击打开一个配置好环境的终端,可直接敲 openclaw 命令。
# 复用与 Mac-Start.command 一致的便携环境(盘内 Node + 盘内数据)。
# ============================================================
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"
RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m'; NC='\033[0m'
# Detect CPU & set runtime与 Mac-Start.command 一致)
ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
NODE_DIR="$APP_DIR/runtime/node-mac-arm64"
elif [ "$ARCH" = "x86_64" ]; then
NODE_DIR="$APP_DIR/runtime/node-mac-x64"
else
echo -e " ${RED}Unsupported architecture: $ARCH${NC}"
read -p " Press Enter to exit..."
exit 1
fi
NODE_BIN="$NODE_DIR/bin/node"
if [ ! -f "$NODE_BIN" ]; then
echo -e " ${RED}Node.js runtime not found.${NC} Run Mac-Start.command once first."
read -p " Press Enter to exit..."
exit 1
fi
if [ ! -x "$CORE_DIR/node_modules/.bin/openclaw" ]; then
echo -e " ${RED}OpenClaw not installed yet.${NC} Run Mac-Start.command once first."
read -p " Press Enter to exit..."
exit 1
fi
export OPENCLAW_HOME="$DATA_DIR"
export OPENCLAW_STATE_DIR="$STATE_DIR"
export OPENCLAW_CONFIG_PATH="$STATE_DIR/openclaw.json"
# 盘内 node 和 .bin 放到 PATH 最前,让 openclaw 命令可直接调用
export PATH="$NODE_DIR/bin:$CORE_DIR/node_modules/.bin:$PATH"
echo ""
echo -e "${CYAN}========================================${NC}"
echo -e "${CYAN} U-Claw Interactive CLI${NC}"
echo -e "${CYAN}========================================${NC}"
echo ""
echo " You can now run the 'openclaw' command directly. Examples:"
echo " openclaw --help Show all commands"
echo " openclaw chat Open the terminal chat UI"
echo " openclaw configure Interactive setup (models, channels)"
echo " openclaw doctor Diagnose and repair"
echo " openclaw gateway status Check the running gateway"
echo ""
echo -e " Type ${GREEN}exit${NC} to close."
echo -e "${CYAN}========================================${NC}"
echo ""
# 开一个继承上述环境的交互 shell
exec "$SHELL" -i