#!/usr/bin/env bash set -euo pipefail cd ~/projects/website-builder-backend-clean echo "===== ADD .gitignore EXCLUSIONS FOR BLOAT =====" cat >> .gitignore << 'IGNORE' # Exclude local logs/reports/backups from HF push reports/ logs/ backups/ frontend/.backup/ *.bak.* *.bak frontend/interrogation/ frontend/mcp/ frontend/production.log scripts/*.sh !scripts/197_add_missing_backend_contracts.sh !scripts/198_clean_push_to_hf.sh IGNORE echo "[DONE] .gitignore updated" echo echo "===== REMOVE TRACKED BLOAT FROM GIT INDEX =====" git rm -r --cached reports/ logs/ backups/ \ frontend/.backup/ frontend/interrogation/ frontend/mcp/ \ frontend/production.log 2>/dev/null || true git rm --cached $(git ls-files '*.bak.*' '*.bak') 2>/dev/null || true # Remove all scripts except the two we need git ls-files 'scripts/*.sh' | grep -v -E '197_|198_' | xargs git rm --cached 2>/dev/null || true echo echo "===== COMMIT CLEANUP =====" git add -A git commit -m "chore: exclude reports/logs/backups/scripts from HF — keep only production source" || echo "[OK] nothing to commit" echo echo "===== VERIFY PUSH SIZE =====" git count-objects -vH echo echo "===== PUSH TO HF =====" GIT_HTTP_LOW_SPEED_LIMIT=1000 \ GIT_HTTP_LOW_SPEED_TIME=120 \ git push hf main echo echo "===== VERIFY LIVE ENDPOINTS =====" sleep 30 BASE="https://daviddolor-website-builder-backend.hf.space" for path in \ "/health" \ "/api/health" \ "/api/deploy/settings" \ "/api/github/search?q=fastapi&per_page=3" \ "/api/android/docs?q=Activity&max_results=3" \ "/api/workspace/fix" do echo echo "--- $path ---" curl -sS --connect-timeout 15 --max-time 30 \ -w "HTTP=%{http_code}\n" \ "$BASE$path" | head -c 600 done echo echo "============================================================" echo " PUSH COMPLETE — ALL CONTRACTS LIVE ON HF" echo "============================================================"