auto backup 2026-05-11 16:09:19

This commit is contained in:
ai_member_only 2026-05-11 16:09:19 +08:00
parent 1960803f8e
commit c0291eb4da
3 changed files with 126 additions and 1 deletions

30
.shared_skill_hashes Normal file
View File

@ -0,0 +1,30 @@
cron-schedule.vala f206a005383d7668eea6169b6216d0fc630c3e3db6769459a0c6ba0b0f996f61
gpt-image-2-generator 72fefdcbdd3529d75044c4285057a3032981dc13369c2163ae73e0e21a2d1ee5
knowledge-mastery-calculator 61a098cebf90ccca12e918f5bb82fe08d8c2baf576416385b8415e7fbaf77516
lark-action-as-bot 1a5be56632fdca1dbee6bf6f6fbdf7008d2919eadcd29515c26340bd1e9c8d60
lark-base d5fe1c329e616e0130e36759735a094c058e60f14ef1a7b33216f6e3a551f2b0
lark-calendar fad7896009c80db6feab55ba41abe2bcb94654570a147a1289577fb9c5200bf0
lark-contact 5551d4668ea157ebfe04cb02b8214d9a7437293bafa98c032d4f2a14ec33fb9c
lark-doc e98a61aaa8b9fdfb8ee4538283cb1b0980b78497b3ca86f1e7a3e66c63cce791
lark-drive 0c5b0e7cc58cfb3ca93a7877525371830a75a428b0376bd1d968aadac373fa81
lark-event 15854fa72f90ea45d83f9499151bae9df826ba980cf5eb5924b2a6789ad663b1
lark-identify-sender 7cefe73be408f115e0cf7e58b39796c0558cb8364600b74cf8a82c13dbb16331
lark-im 8e47f79e4a80dcd12f3f360aff963cb4f9439436123cfc29219068f7b3ff3809
lark-mail 3e8c294deaf9a4dfd050349f095702daf8d91077e85f3b07d48259bc8ec76c43
lark-minutes bd7c201fd96212e0e8d774657d7d4a51b93ff45287bd9f91d7a243315ef746b9
lark-openapi-explorer 486a53bd6c195783905d78748390adff1f17b4c897c1cfd10b70f0e7c518d66f
lark-send-message-as-bot 4cbd3174ab1c4c772580bb35846cab2f5ae83ee2ff56ada96ef3acbbe5bc03b8
lark-shared 2e5a34ce8404141e3ca245e87471e80d43e900ba7ec22482e6af30dbabb74568
lark-sheets 6739830153f9efc18000dbd9e12b56286dacdd7f158dfb7b73af966574a2ed9e
lark-skill-maker 49c9378c29d3dea20ebcdc22238660510060883bbffbc42d77de7113d94c268c
lark-task 1b6e0108668238b39989edb8971e91b672cb8073427d2f729461f84d61707432
lark-vc 4b2567f55a67e402d56c71609af591541ee6ec27b19f71e394722c76cbc0b93b
lark-whiteboard 94ece69e674383a08942e190bcfee9897f77b8cac8cc7c38e0e972597706114b
lark-wiki 896717177934575e2ee53cbfe4fc78488c3ce23bcbedded788e9e9c644b7a4e5
lark_wiki_operate_as_bot d6d3a696f889b1fa11b2337ad9605ce4bdf8891be69d55900ee49b0af534d139
lark-workflow-meeting-summary 072d4dfa6381affc1ab68c0dc8f757469d67ede8daabc720cbcee57bb3f4a622
lark-workflow-standup-report 9ce2e4fd25195d06e47a2c0e1660fe41e746501fb482020855ca6bb4797d8314
multi-model-assistant ef48bc3385a81f3fac59aafbe263d5fa2916744b7efbe4b3678f4c37ab458156
pua f6a38fdd39c22c81370abd6b979b58c767e41738d43a26fbbc23d1e933cdc701
smart-auto-model-switch bfb3547dcd6029622c7062b49ae7922614a366b6dfe88c7d0fae9dcd85fc2eb3
vala_git_workspace_backup.vala b48ae1fb1d21d0e6a17e1e86c94a7e442f4f44c5b32eea8a737be841002111a6

95
scripts/sync_shared_skills.sh Executable file
View File

@ -0,0 +1,95 @@
#!/bin/bash
set -e
SKILLS_DIR="/root/.openclaw/skills"
WORKSPACE_DIR="$HOME/.hermes/workspace"
cd "$WORKSPACE_DIR"
source ./.vala_skillhub_config
HASH_FILE=./.shared_skill_hashes
touch "${HASH_FILE}"
compute_skill_hash() {
local skill_dir="$1"
(cd "${skill_dir}" && find . -type f -not -path '*/\\.*' | LC_ALL=C sort | while read f; do echo "FILE:$f"; cat "$f"; done | sha256sum | awk '{print $1}')
}
pushed=0
skipped=0
pushed_names=""
# Only process directories (skill dirs, not top-level files)
for skill_dir in "${SKILLS_DIR}"/*/; do
[ -d "${skill_dir}" ] || continue
skill_name=$(basename "${skill_dir}")
# Determine repo name: must end with .vala
if [[ "${skill_name}" == *.vala ]]; then
repo_name="${skill_name}"
else
repo_name="${skill_name}.vala"
fi
current_hash=$(compute_skill_hash "${skill_dir}")
stored_hash=$(grep "^${skill_name} " "${HASH_FILE}" 2>/dev/null | awk '{print $2}')
if [ "${current_hash}" = "${stored_hash}" ] && [ -n "${stored_hash}" ]; then
echo "[skip] ${skill_name} — 无变更"
skipped=$((skipped + 1))
continue
fi
echo "[sync] ${skill_name} — 检测到变更,开始推送..."
# Check if remote repo exists
http_code=$(curl -s -o /dev/null -w "%{http_code}" \
"${GITEA_URL}/api/v1/repos/${GITEA_OWNER}/${repo_name}" \
-H "Authorization: token ${GITEA_TOKEN}")
# Create repo if not exists
if [ "${http_code}" = "404" ]; then
echo " → 仓库不存在,创建中..."
curl -s -X POST "${GITEA_URL}/api/v1/orgs/${GITEA_OWNER}/repos" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"name\": \"${repo_name}\", \"private\": false, \"auto_init\": false}" > /dev/null
echo " → 仓库已创建"
fi
# Copy to temp dir and push
tmp_dir="/tmp/shared_skill_push/${repo_name}"
rm -rf "${tmp_dir}"
mkdir -p "${tmp_dir}"
cp -r "${skill_dir}." "${tmp_dir}/" 2>/dev/null || true
pushd "${tmp_dir}" > /dev/null
git init -q
git checkout -B main -q
git add -A
git commit -m "auto-sync: ${skill_name} $(date +%Y-%m-%d_%H:%M)" -q || true
git remote add origin "https://oauth2:${GITEA_TOKEN}@${GITEA_URL#https://}/${GITEA_OWNER}/${repo_name}.git" 2>/dev/null || true
git push -u origin main --force -q 2>&1 | tail -1
popd > /dev/null
# Cleanup
rm -rf "${tmp_dir}"
# Update hash
grep -v "^${skill_name} " "${HASH_FILE}" > "${HASH_FILE}.tmp" 2>/dev/null || true
echo "${skill_name} ${current_hash}" >> "${HASH_FILE}.tmp"
mv "${HASH_FILE}.tmp" "${HASH_FILE}"
echo "[done] ${skill_name} — 推送完成"
pushed=$((pushed + 1))
pushed_names="${pushed_names} ${skill_name}"
done
summary="[shared-sync] $(date +%Y-%m-%d_%H:%M) — 推送 ${pushed} 个 skill:${pushed_names} | 跳过 ${skipped} 个(无变更)"
echo "${summary}"
if [ "${pushed}" -gt 0 ]; then
echo "RESULT:pushed=${pushed}"
else
echo "RESULT:no_changes"
fi

View File

@ -67,7 +67,7 @@ for skill_dir in ./skills/*/; do
pushd ./tmp/skill_push/${repo_name} > /dev/null pushd ./tmp/skill_push/${repo_name} > /dev/null
git init -q git init -q
git checkout -b main -q git checkout -B main -q
git add -A git add -A
git commit -m "auto-sync: ${skill_name} $(date +%Y-%m-%d_%H:%M)" -q || true git commit -m "auto-sync: ${skill_name} $(date +%Y-%m-%d_%H:%M)" -q || true
git remote add origin "https://oauth2:${GITEA_TOKEN}@${GITEA_URL#https://}/${GITEA_OWNER}/${repo_name}.git" 2>/dev/null || true git remote add origin "https://oauth2:${GITEA_TOKEN}@${GITEA_URL#https://}/${GITEA_OWNER}/${repo_name}.git" 2>/dev/null || true