From e93cd11af9dfe63f1eaa38dcad01618f923826dc Mon Sep 17 00:00:00 2001 From: spark Date: Wed, 28 Oct 2026 00:44:05 +0000 Subject: [PATCH] spark: validate Hermes profile structure and generate status report --- wizard-work/spark/validate_hermes_profile.py | 69 ++++++ wizard-work/spark/validation_report.json | 226 +++++++++++++++++-- 2 files changed, 271 insertions(+), 24 deletions(-) create mode 100644 wizard-work/spark/validate_hermes_profile.py diff --git a/wizard-work/spark/validate_hermes_profile.py b/wizard-work/spark/validate_hermes_profile.py new file mode 100644 index 0000000..d4a4694 --- /dev/null +++ b/wizard-work/spark/validate_hermes_profile.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +"""Validate Hermes profile structure and output status report.""" + +import os +import json +from pathlib import Path + +PROFILE_DIR = Path("/root/.hermes/profiles/spark") +WIZARD_OUTPUT = Path("/root/.hermes/wizard-outputs/spark") +VALID_CATEGORIES = { + "notes", "projects", "research", "skills", "tools", + "skills", "templates", "scripts", "config", "cache", + "memories", "plugins", "cron", "scratch" +} + +def validate_profile(): + """Validate profile directory structure.""" + results = { + "profile_exists": PROFILE_DIR.exists(), + "profile_is_dir": PROFILE_DIR.is_dir() if PROFILE_DIR.exists() else False, + "stats": {}, + "valid_structure": True, + "issues": [] + } + + if not results["profile_exists"]: + results["issues"].append("Profile directory does not exist") + results["valid_structure"] = False + return results + + # List contents + contents = [] + for item in PROFILE_DIR.iterdir(): + item_type = "dir" if item.is_dir() else "file" + contents.append({"name": item.name, "type": item_type}) + + results["stats"]["item_count"] = len(contents) + results["stats"]["contents"] = sorted(contents, key=lambda x: x["name"]) + + # Check for expected subdirectories + expected_dirs = {"skills", "memories", "cache"} + found_dirs = {c["name"] for c in contents if c["type"] == "dir"} + + missing = expected_dirs - found_dirs + if missing: + results["issues"].append(f"Missing expected dirs: {missing}") + results["valid_structure"] = False + + results["stats"]["found_dirs"] = list(found_dirs) + results["valid_structure"] = results["valid_structure"] and len(results["issues"]) == 0 + + return results + +def main(): + results = validate_profile() + + # Output as JSON to stdout + print(json.dumps(results, indent=2)) + + # Also write to wizard output + output_file = WIZARD_OUTPUT / "validation_report.json" + with open(output_file, "w") as f: + json.dump(results, f, indent=2) + + # Return exit code based on validation + return 0 if results["valid_structure"] else 1 + +if __name__ == "__main__": + exit(main()) \ No newline at end of file diff --git a/wizard-work/spark/validation_report.json b/wizard-work/spark/validation_report.json index e5e00a6..5787d58 100644 --- a/wizard-work/spark/validation_report.json +++ b/wizard-work/spark/validation_report.json @@ -1,27 +1,205 @@ { - "timestamp": "2024-01-01T00:00:00Z", - "task": "JSON file validation", - "directory": "/root/.hermes/wizard-outputs/spark", - "files_validated": [ - { - "filename": "valid.json", - "status": "valid", - "type": "dict", - "keys": 3, - "size_bytes": 77, - "line_count": 8 - }, - { - "filename": "invalid.json", - "status": "invalid", - "error": "Line 1, Column 13: Expecting value" - } - ], - "summary": { - "total": 2, - "valid_count": 1, - "invalid_count": 1 + "profile_exists": true, + "profile_is_dir": true, + "stats": { + "item_count": 42, + "contents": [ + { + "name": ".env", + "type": "file" + }, + { + "name": ".env.bak-20261014T165714Z", + "type": "file" + }, + { + "name": ".env.lock", + "type": "file" + }, + { + "name": ".skills_prompt_snapshot.json", + "type": "file" + }, + { + "name": "SOUL.md", + "type": "file" + }, + { + "name": "audio_cache", + "type": "dir" + }, + { + "name": "auth.json", + "type": "file" + }, + { + "name": "auth.lock", + "type": "file" + }, + { + "name": "backups", + "type": "dir" + }, + { + "name": "bin", + "type": "dir" + }, + { + "name": "cache", + "type": "dir" + }, + { + "name": "config.yaml", + "type": "file" + }, + { + "name": "config.yaml.bak-20261014T165714Z", + "type": "file" + }, + { + "name": "context_length_cache.yaml", + "type": "file" + }, + { + "name": "cron", + "type": "dir" + }, + { + "name": "home", + "type": "dir" + }, + { + "name": "hooks", + "type": "dir" + }, + { + "name": "image_cache", + "type": "dir" + }, + { + "name": "keys", + "type": "dir" + }, + { + "name": "logs", + "type": "dir" + }, + { + "name": "lsp", + "type": "dir" + }, + { + "name": "memories", + "type": "dir" + }, + { + "name": "models_dev_cache.etag", + "type": "file" + }, + { + "name": "models_dev_cache.json", + "type": "file" + }, + { + "name": "pairing", + "type": "dir" + }, + { + "name": "plans", + "type": "dir" + }, + { + "name": "platforms", + "type": "dir" + }, + { + "name": "plugin-update-checks", + "type": "dir" + }, + { + "name": "plugins", + "type": "dir" + }, + { + "name": "runtime", + "type": "dir" + }, + { + "name": "sandboxes", + "type": "dir" + }, + { + "name": "sessions", + "type": "dir" + }, + { + "name": "skills", + "type": "dir" + }, + { + "name": "skins", + "type": "dir" + }, + { + "name": "source-checks", + "type": "dir" + }, + { + "name": "state.db", + "type": "file" + }, + { + "name": "state.db-shm", + "type": "file" + }, + { + "name": "state.db-wal", + "type": "file" + }, + { + "name": "state.db.auto-maintenance.lock", + "type": "file" + }, + { + "name": "state.db.fts_rebuild.lock", + "type": "file" + }, + { + "name": "state.db.quarantine.lock", + "type": "file" + }, + { + "name": "workspace", + "type": "dir" + } + ], + "found_dirs": [ + "runtime", + "sessions", + "cron", + "plugins", + "keys", + "workspace", + "hooks", + "sandboxes", + "audio_cache", + "cache", + "source-checks", + "platforms", + "plans", + "bin", + "skills", + "memories", + "lsp", + "plugin-update-checks", + "skins", + "backups", + "home", + "logs", + "pairing", + "image_cache" + ] }, - "validator_exit_code": 1, - "test_passed": true + "valid_structure": true, + "issues": [] } \ No newline at end of file