File size: 5,887 Bytes
a6a5d8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/env python3
"""Prepare the Hugging Face payload directory from tracked source files."""

from __future__ import annotations

import json
import shutil
import subprocess
from pathlib import Path


REPO_ROOT = Path.cwd()
OUT_DIR = REPO_ROOT / "dist" / "huggingface" / "a11oy"


def git_value(*args: str, fallback: str = "unknown") -> str:
    try:
        return subprocess.check_output(
            ["git", *args],
            cwd=REPO_ROOT,
            text=True,
            stderr=subprocess.DEVNULL,
        ).strip()
    except (subprocess.CalledProcessError, FileNotFoundError):
        return fallback


def copy_text(source: str, target: str) -> None:
    destination = OUT_DIR / target
    destination.parent.mkdir(parents=True, exist_ok=True)
    destination.write_text((REPO_ROOT / source).read_text(encoding="utf-8"), encoding="utf-8")


def copy_tree(source: str, target: str) -> None:
    destination = OUT_DIR / target
    if destination.exists():
        shutil.rmtree(destination)
    shutil.copytree(REPO_ROOT / source, destination)


def main() -> int:
    if OUT_DIR.exists():
        shutil.rmtree(OUT_DIR)
    OUT_DIR.mkdir(parents=True)

    files = [
        ("huggingface/README.md", "README.md"),
        ("huggingface/SHOWCASE.md", "SHOWCASE.md"),
        ("huggingface/INVESTOR_BRIEF.md", "INVESTOR_BRIEF.md"),
        ("huggingface/VERIFICATION.md", "VERIFICATION.md"),
        ("huggingface/INNOVATIONS_DEEP_DIVE.md", "INNOVATIONS_DEEP_DIVE.md"),
        ("huggingface/INTEGRATION_QUICKSTART.md", "INTEGRATION_QUICKSTART.md"),
        ("huggingface/DEMO_RECEIPT_SAMPLE.jsonl", "DEMO_RECEIPT_SAMPLE.jsonl"),
        ("LICENSE", "LICENSE"),
        ("CITATION.cff", "CITATION.cff"),
        ("README.md", "source/README.md"),
        ("ROADMAP.md", "source/ROADMAP.md"),
        ("CHANGELOG.md", "source/CHANGELOG.md"),
        ("docs/org-repo-map.md", "source/docs/org-repo-map.md"),
        ("docs/regulatory_to_lambda.md", "source/docs/regulatory_to_lambda.md"),
        ("docs/huggingface.md", "source/docs/huggingface.md"),
        ("docs/huggingface-ecosystem-manifest.json", "source/docs/huggingface-ecosystem-manifest.json"),
        ("docs/huggingface-ecosystem-manifest.schema.json", "source/docs/huggingface-ecosystem-manifest.schema.json"),
        ("docs/ecosystem-registry.json", "source/docs/ecosystem-registry.json"),
        ("docs/PROVENANCE.md", "source/docs/PROVENANCE.md"),
        ("docs/SERIES_A_DILIGENCE.md", "source/docs/SERIES_A_DILIGENCE.md"),
        ("docs/SERIES_A_MARKET_EVIDENCE.md", "source/docs/SERIES_A_MARKET_EVIDENCE.md"),
        ("docs/SUBSTRATE_REALITY_MAP.md", "source/docs/SUBSTRATE_REALITY_MAP.md"),
        ("docs/INVESTOR_DEMO.md", "source/docs/INVESTOR_DEMO.md"),
        ("docs/WARHACKER_UDS_PROOF_POINT.md", "source/docs/WARHACKER_UDS_PROOF_POINT.md"),
        ("docs/PERPLEXITY_BRIEF.md", "source/docs/PERPLEXITY_BRIEF.md"),
        ("docs/ECOSYSTEM.md", "source/docs/ECOSYSTEM.md"),
        ("docs/ecosystem-readiness-report.json", "source/docs/ecosystem-readiness-report.json"),
        ("deploy/MANIFEST.json", "payloads/deploy/MANIFEST.json"),
        ("deploy/zarf.yaml", "payloads/deploy/zarf.yaml"),
        ("deploy/attestations.jsonl", "payloads/deploy/attestations.jsonl"),
        ("docs/huggingface-ecosystem-manifest.json", "HF_ECOSYSTEM_MANIFEST.json"),
        ("package.json", "build/package.json"),
        ("pnpm-lock.yaml", "build/pnpm-lock.yaml"),
        ("pnpm-workspace.yaml", "build/pnpm-workspace.yaml"),
        ("tsconfig.base.json", "build/tsconfig.base.json"),
    ]

    for source, target in files:
        copy_text(source, target)

    if (REPO_ROOT / "NOTICE").exists():
        copy_text("NOTICE", "NOTICE")

    copy_tree("deploy/manifests", "payloads/deploy/manifests")
    copy_tree("huggingface/test-results", "test-results")

    metadata = {
        "name": "a11oy",
        "owner": "szl-holdings",
        "sourceRepository": "https://github.com/szl-holdings/a11oy",
        "sourceCommit": git_value("rev-parse", "HEAD"),
        "sourceBranch": git_value("rev-parse", "--abbrev-ref", "HEAD"),
        "doctrineCommands": [
            "pnpm test:doctrine",
            "pnpm typecheck:doctrine",
            "pnpm build:doctrine",
            "pnpm ecosystem:audit",
            "pnpm ecosystem:readiness",
            "pnpm hf:ecosystem:audit",
            "pnpm payload:verify",
            "pnpm payload:huggingface",
            "pnpm payload:bundle",
            "pnpm payload:bundle:verify",
        ],
        "activeShowcaseRepos": [
            "a11oy",
            "amaru",
            "sentra",
            "rosie",
            "ouroboros",
            "lutar-lean",
            "ouroboros-thesis",
            "uds-mesh",
            "vsp-otel",
            "vessels",
            "agi-forecast",
            "szl-trust",
            "szl-brand",
            "szl-cookbook",
            ".github",
            "platform",
        ],
        "excludedUntilFunded": ["carlota-jo", "counsel", "terra"],
        "retiredOrDisallowedNames": ["KORA", "LUMINA", "PARAGON", "Lyte"],
        "payloads": [
            {
                "name": "deploy",
                "manifest": "payloads/deploy/MANIFEST.json",
                "zarf": "payloads/deploy/zarf.yaml",
                "kubernetesManifests": "payloads/deploy/manifests/",
            }
        ],
        "demoReceiptSample": "DEMO_RECEIPT_SAMPLE.jsonl",
        "publishHygiene": {
            "deleteStaleRemoteFiles": True,
            "staleLegacyFiles": ["EVAL_TRACE_SAMPLE.jsonl"],
        },
    }

    (OUT_DIR / "a11oy-metadata.json").write_text(
        json.dumps(metadata, indent=2) + "\n",
        encoding="utf-8",
    )
    print(f"Prepared Hugging Face payload at {OUT_DIR.relative_to(REPO_ROOT)}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())