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

52 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""
Verification script for skills_inventory.json
Confirms inventory matches actual skill files on disk.
"""
import json
import os
def verify_inventory():
inventory_path = "/root/.hermes/wizard-outputs/spark/skills_inventory.json"
with open(inventory_path, 'r') as f:
inventory = json.load(f)
# Check that all listed skills exist on disk
errors = []
for skill in inventory['skills']:
# Construct expected path
name = skill['name']
expected_path = f"/root/.hermes/profiles/spark/skills/{name}/SKILL.md"
# Handle category-skill naming (e.g., apple-findmy -> apple/findmy)
if '-' in name:
parts = name.split('-', 1)
expected_path = f"/root/.hermes/profiles/spark/skills/{parts[0]}/{parts[1]}/SKILL.md"
if not os.path.exists(expected_path):
errors.append(f"Missing: {name} (expected at {expected_path})")
# Check total count
actual_skill_count = sum(inventory['categories'].values())
print("=" * 60)
print("SKILLS INVENTORY VERIFICATION")
print("=" * 60)
print(f"Total skills in inventory: {inventory['total_skills']}")
print(f"Sum of category counts: {actual_skill_count}")
print(f"Categories: {len(inventory['categories'])}")
print()
if errors:
print("ERRORS FOUND:")
for e in errors:
print(f" ✗ {e}")
return False
else:
print("✓ All skills verified on disk")
return True
if __name__ == "__main__":
result = verify_inventory()
exit(0 if result else 1)