sync: auto-sync from DESKTOP-0O8A1RL at 2026-04-22 12:31:55

Author: Mike Swanson
Machine: DESKTOP-0O8A1RL
Timestamp: 2026-04-22 12:31:55
This commit is contained in:
2026-04-22 12:31:56 -07:00
parent db5395ebe9
commit d5db062136

View File

@@ -197,7 +197,72 @@ if [ "$INCOMING_COUNT" -gt 0 ] && [ -n "$LOCAL_BEFORE" ]; then
fi
fi
# Phase 6: Summary
# Phase 6: Vault sync
echo ""
echo "=== Phase 6: Vault sync ==="
VAULT_PATH=""
if [ -f ".claude/identity.json" ]; then
VAULT_PATH=$($PYTHON -c "import json; d=json.load(open('.claude/identity.json')); print(d.get('vault_path',''))" 2>/dev/null || echo "")
fi
if [ -z "$VAULT_PATH" ]; then
echo -e "${YELLOW}[INFO]${NC} vault_path not set in identity.json — skipping vault sync."
elif [ ! -d "$VAULT_PATH/.git" ]; then
echo -e "${YELLOW}[WARNING]${NC} Vault path '$VAULT_PATH' is not a git repo — skipping."
else
CLAUDETOOLS_DIR=$(pwd)
cd "$VAULT_PATH"
echo -e "${GREEN}[OK]${NC} Vault: $VAULT_PATH"
# Commit any local vault changes
if ! git diff-index --quiet HEAD -- 2>/dev/null; then
echo -e "${YELLOW}[INFO]${NC} Local vault changes detected — committing..."
git add -A
git commit -m "sync: auto-sync vault from $MACHINE at $TIMESTAMP"
echo -e "${GREEN}[OK]${NC} Vault committed."
else
echo -e "${GREEN}[OK]${NC} No local vault changes."
fi
VAULT_LOCAL_BEFORE=$(git rev-parse HEAD)
git fetch origin --quiet
VAULT_REMOTE_BRANCH="origin/main"
if ! git rev-parse origin/main >/dev/null 2>&1; then
VAULT_REMOTE_BRANCH="origin/master"
fi
VAULT_INCOMING=$(git rev-list --count HEAD..$VAULT_REMOTE_BRANCH 2>/dev/null || echo 0)
VAULT_OUTGOING=$(git rev-list --count $VAULT_REMOTE_BRANCH..HEAD 2>/dev/null || echo 0)
if [ "$VAULT_INCOMING" -gt 0 ]; then
echo -e "${CYAN}--- Vault: $VAULT_INCOMING incoming commit(s) ---${NC}"
git log --oneline --format=' %C(yellow)%h%Creset %C(cyan)%an%Creset %s %C(dim)(%ar)%Creset' HEAD..$VAULT_REMOTE_BRANCH | head -10
if git pull origin main --rebase; then
echo -e "${GREEN}[OK]${NC} Vault pulled."
else
echo -e "${RED}[ERROR]${NC} Vault pull failed — resolve conflicts manually in $VAULT_PATH."
fi
else
echo -e "${GREEN}[OK]${NC} Vault: no incoming changes."
fi
VAULT_OUTGOING_AFTER=$(git rev-list --count $VAULT_REMOTE_BRANCH..HEAD 2>/dev/null || echo 0)
if [ "$VAULT_OUTGOING_AFTER" -gt 0 ]; then
if git push origin main; then
echo -e "${GREEN}[OK]${NC} Vault pushed ($VAULT_OUTGOING_AFTER commit(s))."
else
echo -e "${RED}[ERROR]${NC} Vault push failed."
fi
else
echo -e "${GREEN}[OK]${NC} Vault: nothing to push."
fi
cd "$CLAUDETOOLS_DIR"
fi
# Phase 7: Summary
echo ""
echo "=== Sync Summary ==="