INNER CODE UNIT · Python
_read_project_config_for_listing
tomascupr/sandstorm · src/sandstorm/cli.py:108
def _read_project_config_for_listing() -> tuple[dict | None, str | None]:
"""Read sandstorm.json for informational status output."""
config_path = _get_config_path()
if not config_path.exists():
return None, None
try:
raw = json.loads(config_path.read_text(encoding="utf-8"))
except (json.JSONDecodeError, OSError) as exc:
return None, str(exc)
if not isinstance(raw, dict):
return None, f"expected a JSON object, got {type(raw).__name__}"
return raw, None
def _load_project_config_for_editing() -> tuple[Path, dict]:
"""Load sandstorm.json as a mutable JSON object for CLI edits."""
config_path = _get_config_path()
if not config_path.exists():