File size: 1,368 Bytes
b2e4883
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
"""Sync local repository to HuggingFace Space (mirrors color-ux-access)."""

import os
import sys

try:
    from huggingface_hub import HfApi
except ImportError:
    print("Error: huggingface_hub not installed. Run: pip install huggingface_hub")
    sys.exit(1)

REPO_ID = "salgadev/jam-buddy"
REPO_TYPE = "space"


def main() -> None:
    token = os.environ.get("HF_SPACES_TOKEN") or os.environ.get("HF_TOKEN")
    if not token:
        print("Error: HF_SPACES_TOKEN or HF_TOKEN environment variable not set")
        sys.exit(1)

    api = HfApi(token=token)

    ignore_patterns = [
        ".git/**",
        ".github/**",
        ".venv/**",
        "__pycache__/**",
        "*.pyc",
        ".DS_Store",
        ".qodo/**",
        ".idea/**",
        ".pytest_cache/**",
        "uv.lock",
        "node_modules/**",
        "stable-audio-3/**",
        "generations/**",
        ".env",
        "*.webp",
        "*.mid",
        "*.wav",
        "*.mp3",
    ]

    sha = os.environ.get("GITHUB_SHA", "manual")[:8]
    commit_message = f"Sync from GitHub {sha}"

    api.upload_folder(
        folder_path=".",
        repo_id=REPO_ID,
        repo_type=REPO_TYPE,
        ignore_patterns=ignore_patterns,
        commit_message=commit_message,
    )
    print(f"✓ Synced {REPO_ID} to Space")


if __name__ == "__main__":
    main()