INNER CODE UNIT · Python
load_config
teaql/teaql-agent-kit · tools/teaql_workspace.py:17
def load_config(path: Path) -> dict:
try:
data = json.loads(path.read_text(encoding="utf-8"))
except (OSError, json.JSONDecodeError) as exc:
raise ValueError(f"cannot read JSON-compatible YAML config {path}: {exc}") from exc
if not isinstance(data, dict):
raise ValueError("configuration root must be an object")
if data.get("schemaVersion") != 1:
raise ValueError("schemaVersion must be 1")
if data.get("runtimeSource") not in {"workspace", "release"}:
raise ValueError("runtimeSource must be workspace or release")
runtimes = data.get("runtimes")
if not isinstance(runtimes, dict):
raise ValueError("runtimes must be an object")
missing = sorted(set(LANGUAGES) - set(runtimes))
extra = sorted(set(runtimes) - set(LANGUAGES))
if missing or extra:
raise ValueError(f"runtime keys mismatch: missing={missing}, extra={extra}")