* chore: upgrade maintenance scripts to robust PyYAML parsing - Replaces fragile regex frontmatter parsing with PyYAML/yaml library - Ensures multi-line descriptions and complex characters are handled safely - Normalizes quoting and field ordering across all maintenance scripts - Updates validator to strictly enforce description quality * fix: restore and refine truncated skill descriptions - Recovered 223+ truncated descriptions from git history (6.5.0 regression) - Refined long descriptions into concise, complete sentences (<200 chars) - Added missing descriptions for brainstorming and orchestration skills - Manually fixed imagen skill description - Resolved dangling links in competitor-alternatives skill * chore: sync generated registry files and document fixes - Regenerated skills index with normalized forward-slash paths - Updated README and CATALOG to reflect restored descriptions - Documented restoration and script improvements in CHANGELOG.md * fix: restore missing skill and align metadata for full 955 count - Renamed SKILL.MD to SKILL.md in andruia-skill-smith to ensure indexing - Fixed risk level and missing section in andruia-skill-smith - Synchronized all registry files for final 955 skill count * chore(scripts): add cross-platform runners and hermetic test orchestration * fix(scripts): harden utf-8 output and clone target writeability * fix(skills): add missing date metadata for strict validation * chore(index): sync generated metadata dates * fix(catalog): normalize skill paths to prevent CI drift * chore: sync generated registry files * fix: enforce LF line endings for generated registry files
51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
import os
|
|
import re
|
|
import yaml
|
|
|
|
def fix_skills(skills_dir):
|
|
for root, dirs, files in os.walk(skills_dir):
|
|
dirs[:] = [d for d in dirs if not d.startswith('.')]
|
|
if "SKILL.md" in files:
|
|
skill_path = os.path.join(root, "SKILL.md")
|
|
with open(skill_path, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
fm_match = re.search(r'^---\s*\n(.*?)\n---', content, re.DOTALL)
|
|
if not fm_match:
|
|
continue
|
|
|
|
fm_text = fm_match.group(1)
|
|
body = content[fm_match.end():]
|
|
folder_name = os.path.basename(root)
|
|
|
|
try:
|
|
metadata = yaml.safe_load(fm_text) or {}
|
|
except yaml.YAMLError as e:
|
|
print(f"⚠️ {skill_path}: YAML error - {e}")
|
|
continue
|
|
|
|
changed = False
|
|
|
|
# 1. Fix Name
|
|
if metadata.get('name') != folder_name:
|
|
metadata['name'] = folder_name
|
|
changed = True
|
|
|
|
# 2. Fix Description length
|
|
desc = metadata.get('description', '')
|
|
if isinstance(desc, str) and len(desc) > 200:
|
|
metadata['description'] = desc[:197] + "..."
|
|
changed = True
|
|
|
|
if changed:
|
|
new_fm = yaml.dump(metadata, sort_keys=False, allow_unicode=True, width=1000).strip()
|
|
new_content = f"---\n{new_fm}\n---" + body
|
|
with open(skill_path, 'w', encoding='utf-8') as f:
|
|
f.write(new_content)
|
|
print(f"Fixed {skill_path}")
|
|
|
|
if __name__ == "__main__":
|
|
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
skills_path = os.path.join(base_dir, "skills")
|
|
fix_skills(skills_path)
|