134 lines
4.2 KiB
Markdown
134 lines
4.2 KiB
Markdown
# Sync local xianyu-hunter changes into the Gitea portable package (2026-05)
|
|
|
|
## Trigger
|
|
|
|
BOSS says “同步更新 gitea” after local xianyu-hunter project changes. In this setup the local working clone may still have upstream `origin=https://github.com/Disrush/xianyu-hunter.git`, while the public Gitea repo is the portable package:
|
|
|
|
```text
|
|
https://gitea.chickliu.fun/Hermes/xianyu-hunter-hermes-skill
|
|
```
|
|
|
|
Do **not** push the messy local working clone directly to GitHub/upstream or to a new guessed Gitea repo. Update the existing portable package repo by cloning it to a temp workdir and rsyncing sanitized contents into `project/xianyu-hunter/` plus the skill into `skill/xianyu-hunter-monitor/`.
|
|
|
|
## Proven workflow
|
|
|
|
```bash
|
|
cd /Users/chick/.Hermes/workspace/research/xianyu-hunter
|
|
|
|
set -a
|
|
source ~/.hermes/env/gitea.env
|
|
set +a
|
|
OWNER="${GITEA_OWNER:-Hermes}"
|
|
REPO=xianyu-hunter-hermes-skill
|
|
|
|
rm -rf /tmp/xianyu-hunter-gitea-sync
|
|
git clone "$GITEA_URL/$OWNER/$REPO.git" /tmp/xianyu-hunter-gitea-sync
|
|
|
|
SRC=/Users/chick/.Hermes/workspace/research/xianyu-hunter
|
|
DST=/tmp/xianyu-hunter-gitea-sync/project/xianyu-hunter
|
|
SKILL_SRC=/Users/chick/.hermes/skills/social-media/xianyu-hunter-monitor
|
|
SKILL_DST=/tmp/xianyu-hunter-gitea-sync/skill/xianyu-hunter-monitor
|
|
|
|
rsync -a --delete \
|
|
--exclude='.git/' \
|
|
--exclude='node_modules/' \
|
|
--exclude='browser-data/' \
|
|
--exclude='.runtime/' \
|
|
--exclude='xianyu-server.log' \
|
|
--exclude='*.log' \
|
|
--exclude='data/config.json' \
|
|
--exclude='data/tasks.json' \
|
|
--exclude='data/notify-config.json' \
|
|
--exclude='reports/*.md' \
|
|
"$SRC/" "$DST/"
|
|
|
|
mkdir -p "$DST/reports"
|
|
touch "$DST/reports/.gitkeep"
|
|
rsync -a --delete "$SKILL_SRC/" "$SKILL_DST/"
|
|
```
|
|
|
|
Preserve/restore package examples that should remain committed even if absent locally, e.g. `project/xianyu-hunter/data/notify-config.example.json`:
|
|
|
|
```bash
|
|
cat > /tmp/xianyu-hunter-gitea-sync/project/xianyu-hunter/data/notify-config.example.json <<'EOF'
|
|
{
|
|
"enabled": false,
|
|
"notifyOnlyGood": true,
|
|
"minScore": 75,
|
|
"channels": []
|
|
}
|
|
EOF
|
|
```
|
|
|
|
Refresh the package `.gitignore` so runtime data cannot be committed:
|
|
|
|
```bash
|
|
cat > /tmp/xianyu-hunter-gitea-sync/.gitignore <<'EOF'
|
|
.DS_Store
|
|
node_modules/
|
|
browser-data/
|
|
.runtime/
|
|
*.log
|
|
project/xianyu-hunter/node_modules/
|
|
project/xianyu-hunter/browser-data/
|
|
project/xianyu-hunter/.runtime/
|
|
project/xianyu-hunter/data/config.json
|
|
project/xianyu-hunter/data/tasks.json
|
|
project/xianyu-hunter/data/notify-config.json
|
|
project/xianyu-hunter/reports/*.md
|
|
EOF
|
|
```
|
|
|
|
## Verification before commit
|
|
|
|
```bash
|
|
cd /tmp/xianyu-hunter-gitea-sync
|
|
node --check project/xianyu-hunter/server.mjs
|
|
node --check project/xianyu-hunter/lib/login.mjs
|
|
node --check project/xianyu-hunter/lib/hermes_optimizer.mjs
|
|
node --check project/xianyu-hunter/public/app.js
|
|
|
|
git status --short --ignored
|
|
git ls-files | grep -E 'browser-data|data/(config|tasks|notify-config)\.json|node_modules|\.runtime|reports/.*\.md' || true
|
|
```
|
|
|
|
Expected sensitive-file grep output is empty. Review `git diff --stat` and representative diffs before committing.
|
|
|
|
## Commit and push safely
|
|
|
|
```bash
|
|
cd /tmp/xianyu-hunter-gitea-sync
|
|
git config user.name 'Hermes Agent'
|
|
git config user.email 'Hermes@Hermes.Hermes'
|
|
git add .
|
|
git commit -m 'feat: update xianyu web login and Hermes optimizer'
|
|
|
|
git remote set-url origin "https://${GITEA_USERNAME:-Hermes}:${GITEA_TOKEN}@${GITEA_URL#https://}/$OWNER/$REPO.git"
|
|
git push origin main
|
|
# scrub token immediately
|
|
git remote set-url origin "$GITEA_URL/$OWNER/$REPO.git"
|
|
git remote -v
|
|
```
|
|
|
|
## Post-push verification
|
|
|
|
```bash
|
|
curl -sS -H "Authorization: token $GITEA_TOKEN" \
|
|
-o /tmp/gitea_repo_verify.json \
|
|
-w 'HTTP %{http_code} size=%{size_download}\n' \
|
|
"$GITEA_URL/api/v1/repos/$OWNER/$REPO"
|
|
|
|
git ls-remote "$GITEA_URL/$OWNER/$REPO.git" HEAD refs/heads/main
|
|
|
|
for f in \
|
|
project/xianyu-hunter/lib/hermes_optimizer.mjs \
|
|
project/xianyu-hunter/lib/login.mjs \
|
|
skill/xianyu-hunter-monitor/references/web-qr-source-and-hermes-optimize-2026-05.md; do
|
|
curl -sS -L -o /tmp/gitea_raw_check \
|
|
-w "$f HTTP %{http_code} size=%{size_download}\n" \
|
|
"$GITEA_URL/$OWNER/$REPO/raw/branch/main/$f"
|
|
done
|
|
```
|
|
|
|
Report the repo URL, commit hash, and verification results back to BOSS in the final visible reply. Do not leave an empty response after tool calls.
|