"""Push the working tree to the Hugging Face Space as ONE normal commit (never squash). Mirrors .gitignore: weights, caches, node_modules, dist, runtime cases, and local trace exports stay out; the Docker build compiles llama.cpp and rebuilds the SPA bundle itself. Remote-only files (e.g. partner-committed assets) are preserved - no delete patterns. python scripts/deploy_space.py "commit message" """ from __future__ import annotations import sys from huggingface_hub import HfApi SPACE_ID = "build-small-hackathon/case0" IGNORE = [ ".git/**", ".venv/**", "**/__pycache__/**", "*.pyc", "*.egg-info/**", ".pytest_cache/**", ".mypy_cache/**", ".ruff_cache/**", ".coverage", "htmlcov/**", "models/**", "assets/voices/*.onnx", "assets/voices/*.onnx.json", "cases/runtime/**", ".cache/**", "*.log", ".DS_Store", "Thumbs.db", "assets/sprites/cache/**", ".playwright-mcp/**", "web/node_modules/**", "web/dist/**", "web/.vite/**", ".env", "traces/**", "web/gallery.html", "web/src/gallery-entry.ts", "*.png", ] def main() -> int: message = sys.argv[1] if len(sys.argv) > 1 else "chore: update Space" api = HfApi() info = api.upload_folder( repo_id=SPACE_ID, repo_type="space", folder_path=".", ignore_patterns=IGNORE, commit_message=message, ) print(f"pushed: {info.commit_url}") return 0 if __name__ == "__main__": raise SystemExit(main())