22 lines
670 B
Python
22 lines
670 B
Python
#!/usr/bin/env python3
|
|
"""Hermes environment diagnostic - verifies key paths and permissions."""
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
diag = {
|
|
"profile": os.environ.get("SPARK_PROFILE", "spark"),
|
|
"home": str(Path.home()),
|
|
"cwd": str(Path.cwd()),
|
|
"scratch": "/root/.hermes/profiles/spark/cache/scratch",
|
|
"forge_token": ("<set>" if os.environ.get("FORGE_TOKEN") else "<unset>"),
|
|
"checks": {}
|
|
}
|
|
|
|
for name, p in [("home", Path.home()), ("scratch", Path(diag["scratch"]))]:
|
|
diag["checks"][name] = {
|
|
"exists": p.exists(),
|
|
"writable": os.access(p, os.W_OK) if p.exists() else False
|
|
}
|
|
|
|
print(json.dumps(diag, indent=2)) |