idea176-goc-synth-automated/idea176_goc_synth_automated/registry.py

21 lines
537 B
Python

"""Simple on-disk registry interface for MVP GoC entries."""
import json
from pathlib import Path
from typing import Dict, Any
REG_PATH = Path("registry/registry.json")
def load_registry() -> Dict[str, Any]:
if not REG_PATH.exists():
return {}
with REG_PATH.open("r", encoding="utf-8") as f:
return json.load(f)
def save_registry(entry: Dict[str, Any]) -> None:
REG_PATH.parent.mkdir(parents=True, exist_ok=True)
with REG_PATH.open("w", encoding="utf-8") as f:
json.dump(entry, f, indent=2)