Lock asset pipeline to free sources

This commit is contained in:
2026-05-21 22:21:16 +00:00
parent f0713c6c46
commit fc74a7b129
4 changed files with 94 additions and 3 deletions
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env python3
"""Fail if tracked Agrarian assets include paid or unclear costs."""
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
REGISTER = ROOT / "Docs" / "Art" / "AssetLicenses.md"
ALLOWED_COSTS = {"free", "$0", "0", "n/a", "na"}
BLOCKED_WORDS = {
"paid",
"purchased",
"purchase",
"subscription",
"unknown",
"unclear",
"tbd",
"marketplace bundle",
}
def parse_markdown_table_rows(text: str) -> list[list[str]]:
rows: list[list[str]] = []
for line in text.splitlines():
stripped = line.strip()
if not stripped.startswith("|") or "---" in stripped:
continue
cells = [cell.strip() for cell in stripped.strip("|").split("|")]
if cells and cells[0] != "Asset":
rows.append(cells)
return rows
def main() -> None:
if not REGISTER.exists():
raise SystemExit(f"Missing asset license register: {REGISTER}")
rows = parse_markdown_table_rows(REGISTER.read_text(encoding="utf-8"))
failures: list[str] = []
for row in rows:
if len(row) < 5:
failures.append(f"Malformed asset license row: {' | '.join(row)}")
continue
asset = row[0]
cost = row[4].strip().lower()
full_row = " ".join(row).lower()
if not cost:
failures.append(f"{asset}: cost is blank")
elif cost not in ALLOWED_COSTS:
failures.append(f"{asset}: cost {row[4]!r} is not free-only")
for blocked in BLOCKED_WORDS:
if blocked in full_row:
failures.append(f"{asset}: blocked free-only word found: {blocked!r}")
if failures:
raise SystemExit("\n".join(failures))
print(f"Asset license free-only verification complete: {len(rows)} entries.")
if __name__ == "__main__":
main()
+4
View File
@@ -12,12 +12,16 @@ REQUIRED = {
"CC0 or public-domain",
"/home/nathan/AssetStaging/Agrarian",
"Do not import random internet images",
"Free-Only Acquisition Gate",
"Paid Fab assets are blocked",
"Native Ground Zero proxy vegetation",
],
"Docs/Art/AgrarianAssetPipeline.md": [
"realistic modern post-collapse frontier survival",
"Old abandoned equipment",
"Do not scrape random internet images or models",
"Free-Only Lockdown",
"Do not click purchase",
"LicenseEvidence",
"Run visual and placeholder verifiers",
"Water should be handled as a shader/system problem",