spark: analyze Hermes skills directory structure
This commit is contained in:
1 parent
36a29ce77b
commit
8c67a8a540
2 files changed
+85
No files matched your search
@@ -0,0 +1,67 @@
|
||||
#!/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()
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"directories": {
|
||||
"/root/.hermes/skills": {
|
||||
"files": 218,
|
||||
"skilldocs": 221,
|
||||
"total": 439
|
||||
},
|
||||
"/root/.hermes/profiles/spark/skills": {
|
||||
"files": 50,
|
||||
"skilldocs": 58,
|
||||
"total": 108
|
||||
}
|
||||
},
|
||||
"total_python_files": 268,
|
||||
"total_skilldocs": 279,
|
||||
"verification_hash": "910536ea31ebc566",
|
||||
"total_files": 547
|
||||
}
|
||||
Reference in new issue
Block a user