From 5b33e436f7c8a6d0616aefbeae70b2d79b26ff40 Mon Sep 17 00:00:00 2001 From: spark Date: Sun, 25 Oct 2026 03:11:36 +0000 Subject: [PATCH] spark: add hermes environment validator script --- wizard-work/spark/env_validator.py | 96 ++++++++++++++++++++++++++++++ wizard-work/spark/verify_env.py | 36 +++++++++++ 2 files changed, 132 insertions(+) create mode 100644 wizard-work/spark/env_validator.py create mode 100644 wizard-work/spark/verify_env.py diff --git a/wizard-work/spark/env_validator.py b/wizard-work/spark/env_validator.py new file mode 100644 index 0000000..93231cf --- /dev/null +++ b/wizard-work/spark/env_validator.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +"""Hermes Environment Validator - validates key paths and directory structure.""" + +import os +import json +from pathlib import Path + +def validate_hermes_environment(): + """Validate Hermes Agent environment structure.""" + + hermes_root = Path("/root/.hermes") + results = { + "hermes_root": { + "path": str(hermes_root), + "exists": hermes_root.exists(), + "is_dir": hermes_root.is_dir() if hermes_root.exists() else False + }, + "required_paths": [], + "scratch_dir": None, + "profile_paths": {} + } + + # Define required paths + required_paths = [ + "profiles/spark", # spark profile + "skills", # skills directory + "plugins", # plugins directory + "cron", # cron directory + "memories", # memories directory + "cache/scratch" # scratch (TMPDIR) + ] + + for rel_path in required_paths: + full_path = hermes_root / rel_path + results["required_paths"].append({ + "path": rel_path, + "full_path": str(full_path), + "exists": full_path.exists(), + "is_dir": full_path.is_dir() if full_path.exists() else False, + "item_count": len(list(full_path.iterdir())) if full_path.exists() and full_path.is_dir() else 0 + }) + + # Check scratch directory + scratch = hermes_root / "profiles/spark/cache/scratch" + results["scratch_dir"] = { + "path": str(scratch), + "exists": scratch.exists(), + "is_dir": scratch.is_dir() if scratch.exists() else False + } + + # Check TMPDIR + tmpdir = Path(os.environ.get("TMPDIR", "/tmp")) + results["tmpdir"] = { + "path": str(tmpdir), + "exists": tmpdir.exists(), + "is_dir": tmpdir.is_dir() if tmpdir.exists() else False + } + + # Profile paths + profile_root = hermes_root / "profiles" + if profile_root.exists(): + for profile in profile_root.iterdir(): + if profile.is_dir(): + results["profile_paths"][profile.name] = { + "exists": True, + "is_dir": True, + "item_count": len(list(profile.iterdir())) + } + + # Overall status + all_required_exist = all(p["exists"] and p["is_dir"] for p in results["required_paths"]) + results["valid"] = results["hermes_root"]["is_dir"] and all_required_exist + + return results + +def main(): + results = validate_hermes_environment() + + # Print JSON output + print(json.dumps(results, indent=2)) + + # Print summary + print("\n--- SUMMARY ---") + print(f"Hermes root valid: {results['hermes_root']['is_dir']}") + print(f"All required paths exist: {results['valid']}") + + missing = [p for p in results["required_paths"] if not p["exists"]] + if missing: + print(f"Missing paths: {[p['path'] for p in missing]}") + else: + print("All required paths present") + + return 0 if results["valid"] else 1 + +if __name__ == "__main__": + exit(main()) \ No newline at end of file diff --git a/wizard-work/spark/verify_env.py b/wizard-work/spark/verify_env.py new file mode 100644 index 0000000..d28af1c --- /dev/null +++ b/wizard-work/spark/verify_env.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +"""Quick verification of Hermes environment paths.""" + +import os +import json + +# Key paths to verify +paths = [ + "/root/.hermes", + "/root/.hermes/profiles/spark", + "/root/.hermes/skills", + "/root/.hermes/plugins", + "/root/.hermes/cron", + "/root/.hermes/memories", + "/root/.hermes/cache/scratch" +] + +results = [] +all_valid = True + +for path in paths: + exists = os.path.isdir(path) + results.append({"path": path, "valid": exists}) + if not exists: + all_valid = False + +# Output result +output = { + "valid": all_valid, + "checked_paths": len(paths), + "all_present": all_valid, + "results": results +} + +print(json.dumps(output, indent=2)) +exit(0 if all_valid else 1) \ No newline at end of file