67 lines
2.0 KiB
Python
67 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Analyze Hermes skills and produce a verified report."""
|
|
import os
|
|
import json
|
|
from pathlib import Path
|
|
|
|
# Directories to analyze
|
|
SKILLS_DIRS = [
|
|
"/root/.hermes/skills",
|
|
"/root/.hermes/profiles/spark/skills"
|
|
]
|
|
|
|
def count_python_files(directory):
|
|
"""Count Python files in a directory tree."""
|
|
count = 0
|
|
files = []
|
|
for root, dirs, filenames in os.walk(directory):
|
|
for f in filenames:
|
|
if f.endswith('.py') or f == 'SKILL.md':
|
|
count += 1
|
|
files.append(os.path.join(root, f))
|
|
return count, files
|
|
|
|
def main():
|
|
report = {
|
|
"directories": {},
|
|
"total_python_files": 0,
|
|
"total_skilldocs": 0,
|
|
"verification_hash": ""
|
|
}
|
|
|
|
all_files = []
|
|
|
|
for d in SKILLS_DIRS:
|
|
if os.path.exists(d):
|
|
count, files = count_python_files(d)
|
|
py_count = len([f for f in files if f.endswith('.py')])
|
|
md_count = len([f for f in files if f.endswith('.md')])
|
|
report["directories"][d] = {
|
|
"files": py_count,
|
|
"skilldocs": md_count,
|
|
"total": count
|
|
}
|
|
report["total_python_files"] += py_count
|
|
report["total_skilldocs"] += md_count
|
|
all_files.extend(files)
|
|
|
|
# Create a deterministic hash for verification
|
|
import hashlib
|
|
sorted_files = sorted(all_files)
|
|
file_list_str = "\n".join(sorted_files)
|
|
report["verification_hash"] = hashlib.sha256(file_list_str.encode()).hexdigest()[:16]
|
|
report["total_files"] = len(sorted_files)
|
|
|
|
# Write report
|
|
output_path = "/root/.hermes/wizard-outputs/spark/skills_report.json"
|
|
with open(output_path, 'w') as f:
|
|
json.dump(report, f, indent=2)
|
|
|
|
print(f"Report written to {output_path}")
|
|
print(f"Total Python files: {report['total_python_files']}")
|
|
print(f"Total SKILL.md files: {report['total_skilldocs']}")
|
|
print(f"Verification hash: {report['verification_hash']}")
|
|
return report
|
|
|
|
if __name__ == "__main__":
|
|
main() |