| """Simple I/O helpers for A1 bootstrap artifacts.""" | |
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| from typing import Any | |
| def ensure_directory(path: Path) -> Path: | |
| path.mkdir(parents=True, exist_ok=True) | |
| return path | |
| def write_json(path: Path, payload: dict[str, Any]) -> None: | |
| with path.open("w", encoding="utf-8") as handle: | |
| json.dump(payload, handle, indent=2, sort_keys=True) | |