File size: 431 Bytes
8c5a642 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | """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)
|