fix(ci): update generate_index.py to support YAML frontmatter and sync skills_index.json

This commit is contained in:
sck_0
2026-01-26 08:30:16 +01:00
parent 699ceabd57
commit 9891cb28ed
2 changed files with 26 additions and 26 deletions

View File

@@ -2,21 +2,21 @@ import os
import json
import re
import yaml
def parse_frontmatter(content):
"""
Simple frontmatter parser using regex (consistent with validate_skills.py).
Parses YAML frontmatter using PyYAML for standard compliance.
"""
fm_match = re.search(r'^---\s*\n(.*?)\n---', content, re.DOTALL)
if not fm_match:
return {}
fm_text = fm_match.group(1)
metadata = {}
for line in fm_text.split('\n'):
if ':' in line:
key, val = line.split(':', 1)
metadata[key.strip()] = val.strip().strip('"').strip("'")
return metadata
try:
return yaml.safe_load(fm_match.group(1)) or {}
except yaml.YAMLError as e:
print(f"⚠️ YAML parsing error: {e}")
return {}
def generate_index(skills_dir, output_file):
print(f"🏗️ Generating index from: {skills_dir}")