spark: add Hermes environment validator script
This commit is contained in:
1 parent
5e1394f33e
commit
019cb8f71a
1 file changed
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Hermes Environment Validator
|
||||
Verifies the runtime environment is correctly configured for the Troupe stack.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def validate_environment() -> tuple:
|
||||
"""Run all environment validations and return (results, all_passed)."""
|
||||
results = []
|
||||
all_passed = True
|
||||
|
||||
# 1. Check current working directory
|
||||
cwd = os.getcwd()
|
||||
cwd_pass = cwd == '/root'
|
||||
results.append(('cwd_correct', cwd_pass, cwd))
|
||||
if not cwd_pass:
|
||||
all_passed = False
|
||||
|
||||
# 2. Check scratch directory exists
|
||||
scratch = os.environ.get('TMPDIR', '/tmp')
|
||||
scratch_path = Path(scratch)
|
||||
scratch_pass = scratch_path.exists()
|
||||
results.append(('scratch_exists', scratch_pass, scratch))
|
||||
if not scratch_pass:
|
||||
all_passed = False
|
||||
|
||||
# 3. Check Hermes profile directory
|
||||
profile_dir = Path('/root/.hermes/profiles/spark')
|
||||
profile_pass = profile_dir.exists()
|
||||
results.append(('profile_exists', profile_pass, str(profile_dir)))
|
||||
if not profile_pass:
|
||||
all_passed = False
|
||||
|
||||
# 4. Check skills directory
|
||||
skills_dir = Path('/root/.hermes/skills')
|
||||
skills_pass = skills_dir.exists()
|
||||
results.append(('skills_exists', skills_pass, str(skills_dir)))
|
||||
if not skills_pass:
|
||||
all_passed = False
|
||||
|
||||
# 5. Check Python version (3.x required)
|
||||
python_pass = sys.version_info.major >= 3
|
||||
results.append(('python_version', python_pass, f"Python {sys.version_info.major}.{sys.version_info.minor}"))
|
||||
if not python_pass:
|
||||
all_passed = False
|
||||
|
||||
return results, all_passed
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
results, all_passed = validate_environment()
|
||||
|
||||
print("=" * 60)
|
||||
print("HERMES ENVIRONMENT VALIDATION REPORT")
|
||||
print("=" * 60)
|
||||
|
||||
for name, passed, detail in results:
|
||||
status = "✓ PASS" if passed else "✗ FAIL"
|
||||
print(f"{name:30s}: {status} ({detail})")
|
||||
|
||||
print("=" * 60)
|
||||
|
||||
if all_passed:
|
||||
print("RESULT: ALL VALIDATIONS PASSED")
|
||||
return 0
|
||||
else:
|
||||
print("RESULT: SOME VALIDATIONS FAILED")
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user