74 lines
2.3 KiB
Python
74 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Hermes Skills Inventory Tool
|
|
Lists all available skills with their descriptions and linked files.
|
|
"""
|
|
|
|
import os
|
|
import json
|
|
import sys
|
|
|
|
def get_skills():
|
|
"""Get list of skills from the skills directory."""
|
|
skills_dir = "/root/.hermes/skills"
|
|
if not os.path.exists(skills_dir):
|
|
print("No skills directory found")
|
|
return []
|
|
|
|
skills = []
|
|
for entry in os.listdir(skills_dir):
|
|
skill_path = os.path.join(skills_dir, entry)
|
|
skill_md = os.path.join(skill_path, "SKILL.md")
|
|
if os.path.isdir(skill_path) and os.path.exists(skill_md):
|
|
with open(skill_md, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Parse frontmatter
|
|
lines = content.split('\n')
|
|
description = ""
|
|
for line in lines:
|
|
if line.startswith('description:'):
|
|
description = line.split(':', 1)[1].strip()
|
|
break
|
|
|
|
# Check for linked files
|
|
linked_files = {"references": [], "templates": [], "scripts": [], "assets": []}
|
|
for linked_dir in ["references", "templates", "scripts", "assets"]:
|
|
dir_path = os.path.join(skill_path, linked_dir)
|
|
if os.path.exists(dir_path):
|
|
for f in os.listdir(dir_path):
|
|
linked_files[linked_dir].append(f)
|
|
|
|
skills.append({
|
|
"name": entry,
|
|
"description": description,
|
|
"has_links": any(linked_files.values()),
|
|
"linked_files": linked_files
|
|
})
|
|
|
|
return sorted(skills, key=lambda x: x['name'])
|
|
|
|
def main():
|
|
skills = get_skills()
|
|
|
|
print(f"Hermes Skills Inventory")
|
|
print(f"=" * 50)
|
|
print(f"Total skills found: {len(skills)}")
|
|
print()
|
|
|
|
for skill in skills:
|
|
print(f"• {skill['name']}")
|
|
print(f" {skill['description']}")
|
|
if skill['has_links']:
|
|
has_content = []
|
|
for link_type, files in skill['linked_files'].items():
|
|
if files:
|
|
has_content.append(f"{link_type}({len(files)})")
|
|
if has_content:
|
|
print(f" Linked: {', '.join(has_content)}")
|
|
print()
|
|
|
|
return 0
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main()) |