hemant2747/multi-agent-framework
0
1"""Sync this repo to the Hugging Face Space (code only โ secrets/variables are2configured once in the Space settings). Run by the GitHub Action; the HF token3comes from the HF_TOKEN env var (a GitHub Actions secret), never hardcoded.4 5 HF_TOKEN=... python scripts/deploy_to_hf.py6"""7import os8from pathlib import Path9 10from huggingface_hub import HfApi11 12TOKEN = os.environ.get("HF_TOKEN", "").strip()13if not TOKEN:14 raise SystemExit(15 "ERROR: HF_TOKEN is empty. Add it as a GitHub repo secret:\n"16 " Settings -> Secrets and variables -> Actions -> New repository secret\n"17 " Name: HF_TOKEN Value: <your Hugging Face access token (write)>\n"18 "Then re-run the 'Deploy to Hugging Face' workflow."19 )20SPACE = (os.environ.get("HF_SPACE") or "hemant2747/multi-agent-framework").strip()21ROOT = Path(__file__).resolve().parent.parent22 23api = HfApi(token=TOKEN)24api.create_repo(repo_id=SPACE, repo_type="space", space_sdk="docker", exist_ok=True)25 26# HF Spaces require a README with this YAML metadata header.27readme = """---28title: Multi-Agent Codebase Analyzer29emoji: ๐ค30colorFrom: indigo31colorTo: blue32sdk: docker33app_port: 786034pinned: false35---36 37# Multi-Agent Codebase Analyzer38 39Multi-agent code analysis (MCP + RAG + LangGraph) with a Next.js dashboard,40deployed as a single Docker container. LLM via Hugging Face Inference.41 42Source: https://github.com/hemant2747/Multi-Agent-Framework43"""44api.upload_file(path_or_fileobj=readme.encode("utf-8"), path_in_repo="README.md",45 repo_id=SPACE, repo_type="space")46 47ignore = [48 "**/.git/**", "**/__pycache__/**", "*.pyc", "**/.pytest_cache/**",49 "ui/node_modules/**", "ui/.next/**", "ui/out/**", ".venv/**", "venv/**",50 "logs/*.log", "workspace/**",51 "embeddings-data/v*/**", "embeddings-data/manifest.json",52 ".env", "ui/.env.local", "docs/**", "**/*.pdf", ".github/**", "README.md",53]54api.upload_folder(folder_path=str(ROOT), repo_id=SPACE, repo_type="space",55 ignore_patterns=ignore,56 commit_message="Deploy from GitHub Action")57print(f"Deployed to https://huggingface.co/spaces/{SPACE} (it will rebuild).")58 