From cfdfbca508a48e41d01b0d142f9e6e6f3964e629 Mon Sep 17 00:00:00 2001 From: Horus Date: Fri, 1 May 2026 00:38:14 +0200 Subject: [PATCH] chore: horus sync 2026-04-30T22:38:14Z --- sync-vault.sh | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/sync-vault.sh b/sync-vault.sh index cb297e7..5387716 100755 --- a/sync-vault.sh +++ b/sync-vault.sh @@ -1,8 +1,4 @@ #!/bin/bash -#=============================================== -# obsidian-vault sync script -# All 3 agents run this every 5 minutes -#=============================================== set -euo pipefail AGENT="${1:-horus}" @@ -12,49 +8,40 @@ LOG_FILE="$VAULT_DIR/agent-shared/daily/$(date +%Y-%m-%d).md" cd "$VAULT_DIR" -# Update daily log mkdir -p "$VAULT_DIR/agent-shared/daily" if [ ! -f "$LOG_FILE" ]; then cat > "$LOG_FILE" << EOF # Daily Log — $(date +%Y-%m-%d) - -## Agents Active Today -- Horus -- Amun -- Cleo - ## Session Activity - EOF fi -# Check if dirty if [ -n "$(git status --porcelain)" ]; then - echo "[$AGENT] Vault has changes — committing..." + echo "[$AGENT] Committing changes..." git add -A git commit -m "chore: $AGENT sync $(date -u +%Y-%m-%dT%H:%M:%SZ)" - # Push if remote exists - if git remote get-url origin &>/dev/null; then - git pull --rebase origin master 2>/dev/null || true - git push origin master 2>/dev/null || echo "[$AGENT] Push failed (offline?)" - fi + # Push to local Gitea first (always works) + git push gitea main 2>/dev/null && echo "[$AGENT] Pushed to Gitea" || echo "[$AGENT] Gitea push failed" + + # Push to GitHub (if account not suspended) + git push origin main 2>/dev/null && echo "[$AGENT] Pushed to GitHub" || echo "[$AGENT] GitHub push failed (account suspended?)" - # Update vault state python3 -c " import json +from datetime import datetime with open('$STATE_FILE', 'r') as f: s = json.load(f) s['agents']['$AGENT']['last_commit'] = '$(git rev-parse HEAD)' s['agents']['$AGENT']['dirty'] = False -s['last_sync'] = '$(date -u +%Y-%m-%dT%H:%M:%SZ)' +s['last_sync'] = datetime.utcnow().isoformat() + 'Z' +s['git_remote'] = 'gitea' with open('$STATE_FILE', 'w') as f: json.dump(s, f, indent=2) " echo "[$AGENT] Sync complete" else - # Pull latest from others - if git remote get-url origin &>/dev/null; then - git pull origin master 2>/dev/null && echo "[$AGENT] Pulled latest" || echo "[$AGENT] Pull failed or no remote" - fi + # Pull latest + git pull gitea main 2>/dev/null && echo "[$AGENT] Pulled from Gitea" || echo "[$AGENT] Pull from Gitea failed" + git pull origin main 2>/dev/null && echo "[$AGENT] Pulled from GitHub" || true fi