小糯 (Xiaonuo) 281dc7a725 refactor: ~/skills → ~/Code/skills,sync.sh 支持 cursor rules 同步
- 所有引用从 ~/skills 改为 ~/Code/skills(遵循 ~/Code/ 约定)
- sync.sh 新增 cursor/*.mdc → ~/.cursor/rules/ 自动同步
- cfg HERMES_AGENT_CONVENTIONS 同步更新

[小糯]
2026-04-23 20:12:27 +08:00

84 lines
2.6 KiB
Bash

#!/usr/bin/env bash
# 沙洲家族 Agent 快速自检
# 用法: bash self-check.sh
set -euo pipefail
# Load nvm if available
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
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: false' ~/.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. Node.js & nvm"
check "nvm 已安装" "test -d \$HOME/.nvm"
check "node 可用" "command -v node"
check "node 由 nvm 管理" "which node | grep -q .nvm"
echo "02. SSH 密钥对"
check "id_ed25519 存在" "test -f ~/.ssh/id_ed25519.pub"
echo "03. cfg CLI"
check "cfg 已安装" "command -v cfg"
check "GITEA_TOKEN 可用" "cfg get GITEA_TOKEN 2>/dev/null | grep -qv '^$'"
echo "04. 邮箱"
check "MY_EMAIL 已配置" "cfg get MY_EMAIL 2>/dev/null | grep -qv '^$'"
echo "05. Git 身份"
check "user.name 已设置" "git config --global user.name"
check "user.email 已设置" "git config --global user.email"
echo "06. 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 "07. Tailscale"
check "tailscale 已安装" "command -v tailscale"
check "tailscale 在线" "tailscale status"
echo "08. 家族成员"
echo " ℹ️ 请自行确认已了解家族设备和联系方式"
echo "09. Hermes 配置"
check "config.yaml 存在" "test -f ~/.hermes/config.yaml"
check "hermes-har 已安装" "command -v hermes-har"
check "auxiliary models 已配置" "grep -q 'auxiliary' ~/.hermes/config.yaml 2>/dev/null"
echo "10. Cursor Agent"
check "cursor-agent 已安装" "command -v cursor-agent"
check "CURSOR_API_KEY 可用" "test -n \"\$CURSOR_API_KEY\""
echo "11. Skills"
check "skills repo 已克隆" "test -d ~/Code/skills/.git"
check "skills 已同步" "ls ~/.hermes/skills/ | grep -qv '^$'"
echo ""
echo "========================"
echo "结果: $pass 通过, $fail 未通过"
[ "$fail" -eq 0 ] && echo "🎉 全部达标!" || echo "⚠️ 有 $fail 项需要补全,查看对应子文档了解详情"