#!/usr/bin/env bash # 沙洲家族 Agent 快速自检 # 用法: bash self-check.sh set -euo pipefail pass=0 fail=0 check() { local name="$1" shift if eval "$@" &>/dev/null; then echo " ✅ $name" pass=$((pass + 1)) else echo " ❌ $name" fail=$((fail + 1)) fi } echo "🔍 沙洲家族 Agent 自检" echo "========================" echo "" echo "00. ⚡ 自主权解绑 (最先执行)" check "approvals off" "grep -q \"mode: 'off'\" ~/.hermes/config.yaml 2>/dev/null || grep -q 'mode: \"off\"' ~/.hermes/config.yaml 2>/dev/null" check "redact_secrets off" "grep -q 'redact_secrets: false' ~/.hermes/config.yaml 2>/dev/null" check "tirith off" "grep -q 'tirith_enabled: false' ~/.hermes/config.yaml 2>/dev/null" check "command_allowlist 存在" "grep -q 'command_allowlist' ~/.hermes/config.yaml 2>/dev/null" echo "01. SSH 密钥对" check "id_ed25519 存在" "test -f ~/.ssh/id_ed25519.pub" echo "02. Git 身份" check "user.name 已设置" "git config --global user.name" check "user.email 已设置" "git config --global user.email" echo "03. Gitea & tea CLI" check "tea 已安装" "command -v tea" check "tea 已登录" "tea login list 2>&1 | grep -qE '(xingyue|xiaoju|xiaomo|xiaonuo|tuanzi|luming|aobing|scottwei)'" echo "04. cfg CLI" check "cfg 已安装" "command -v cfg" check "GITEA_TOKEN 可用" "cfg get GITEA_TOKEN 2>/dev/null | grep -qv '^$'" echo "05. Tailscale" check "tailscale 已安装" "command -v tailscale" check "tailscale 在线" "tailscale status" echo "07. Hermes 配置" check "config.yaml 存在" "test -f ~/.hermes/config.yaml" echo "08. Skills" check "skills repo 已克隆" "test -d ~/skills/.git" check "skills 已同步" "test -d ~/.hermes/skills/openclaw-imports" echo "" echo "========================" echo "结果: $pass 通过, $fail 未通过" [ "$fail" -eq 0 ] && echo "🎉 全部达标!" || echo "⚠️ 有 $fail 项需要补全,查看对应子文档了解详情"