Files
troupe-standup/wizard-work/spark/verify_hermes.py
T

63 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""Quick verification script for Hermes Agent tools."""
from hermes_tools import json_parse, terminal, search_files
import json
import sys
def main():
results = {
"status": "ok",
"checks": []
}
# Check 1: Verify terminal works
result = terminal("echo 'hermes-verification-ping'")
if result.get("exit_code") == 0 and "hermes-verification-ping" in result.get("output", ""):
results["checks"].append({"name": "terminal", "status": "passed", "output": result["output"].strip()})
else:
results["checks"].append({"name": "terminal", "status": "failed", "output": str(result)})
results["status"] = "error"
# Check 2: Verify search_files works
result = search_files(pattern="*.py", path="/root/.hermes", limit=3)
if "matches" in result and len(result["matches"]) > 0:
results["checks"].append({"name": "search_files", "status": "passed", "hits": len(result["matches"])})
else:
results["checks"].append({"name": "search_files", "status": "failed", "output": str(result)})
results["status"] = "error"
# Check 3: Verify JSON parsing works
test_json = '{"test": "value", "number": 42}'
parsed = json_parse(test_json)
if parsed.get("test") == "value" and parsed.get("number") == 42:
results["checks"].append({"name": "json_parse", "status": "passed", "output": str(parsed)})
else:
results["checks"].append({"name": "json_parse", "status": "failed", "output": str(parsed)})
results["status"] = "error"
# Check 4: Verify we can read files
try:
with open("/root/.hermes/profiles/spark/config.yaml", "r") as f:
content = f.read()[:100]
results["checks"].append({"name": "file_read", "status": "passed", "preview": content[:50]})
except Exception as e:
results["checks"].append({"name": "file_read", "status": "failed", "error": str(e)})
results["status"] = "error"
# Write report
print(json.dumps(results, indent=2))
# Write to output file
with open("/root/.hermes/wizard-outputs/spark/verification_report.json", "w") as f:
json.dump(results, f, indent=2)
if results["status"] == "ok":
print("\nVERIFICATION PASSED: All Hermes tools working correctly")
return 0
else:
print("\nVERIFICATION FAILED: Some checks did not pass")
return 1
if __name__ == "__main__":
sys.exit(main())