oclaw/runtime/operations/scripts/start_ops.sh
oliver 4a23b715a2 重构仓库目录为统一的 runtime 分层并清理历史 openclaw 残留。
本次迁移将网关/通道/工具/技能/脚本与协议资源集中到新结构,统一路径常量与脚本转发机制,减少顶层噪音并保证运行与测试行为一致。

Made-with: Cursor
2026-04-25 01:24:23 +08:00

81 lines
1.8 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
CHANNEL="wecom"
SKIP_INSTALL=0
SKIP_CONFIG_HINT=0
while [[ $# -gt 0 ]]; do
case "$1" in
--no-ui)
# Kept for compatibility; stack no longer starts Streamlit.
shift
;;
--channel)
CHANNEL="${2:-wecom}"
shift 2
;;
--skip-install)
SKIP_INSTALL=1
shift
;;
--skip-config-hint)
SKIP_CONFIG_HINT=1
shift
;;
*)
echo "Unknown arg: $1"
echo "Usage: $0 [--no-ui] [--channel wecom] [--skip-install] [--skip-config-hint]"
echo "Note: --no-ui is legacy; stack does not start Streamlit. Chat: http://127.0.0.1:8787/chat"
exit 1
;;
esac
done
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
step() { printf '\n==> %s\n' "$1"; }
if ! command -v python >/dev/null 2>&1; then
echo "[ERROR] python not found in PATH." >&2
exit 1
fi
step "Project root: $ROOT_DIR"
step "Python: $(command -v python)"
if [[ "$SKIP_INSTALL" -eq 0 ]]; then
step "Installing dependencies"
python -m pip install -r requirements.txt
else
step "Skip dependency install"
fi
if [[ "$SKIP_CONFIG_HINT" -eq 0 ]]; then
step "Current WeCom status"
python -m oclaw.runtime.operations channel wecom status || true
cat <<'EOF'
If WeCom is not configured yet, run:
python -m oclaw.runtime.operations channel wecom config --help
EOF
fi
step "Stopping previous stack"
python -m oclaw.runtime.operations stack down || true
step "Starting stack"
python -m oclaw.runtime.operations stack up --channel "$CHANNEL"
cat <<'EOF'
Started successfully.
Admin: http://127.0.0.1:8787/admin
Chat: http://127.0.0.1:8787/chat
Useful commands:
python -m oclaw.runtime.operations stack status
python -m oclaw.runtime.operations stack down
EOF