INNER CODE UNIT · Python
_read_manifest
faridrashidi/cnsplots · src/cnsplots/_cli.py:127
def _read_manifest(destination: Path) -> _Manifest | None:
path = _checked_path(destination, _MANIFEST)
if not path.exists():
return None
try:
data = json.loads(path.read_text(encoding="utf-8"))
except ValueError as exc:
raise ValueError(f"invalid skill manifest: {path}") from exc
if (
not isinstance(data, dict)
or data.get("schema_version") != 1
or not isinstance(data.get("version"), str)
or not isinstance(data.get("files"), dict)
):
raise ValueError(f"invalid skill manifest: {path}")
files = data["files"]
for name, digest in files.items():
_validate_name(name)