Files
antigravity-skills-reference/scripts/fix_yaml_quotes.py
Ares 4a5f1234bb fix: harden registry tooling, make tests hermetic, and restore metadata consistency (#168)
* 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
2026-03-01 09:38:25 +01:00

46 lines
1.8 KiB
Python

import os
import re
import yaml
def fix_yaml_quotes(skills_dir):
print(f"Normalizing YAML frontmatter in {skills_dir}...")
fixed_count = 0
for root, dirs, files in os.walk(skills_dir):
dirs[:] = [d for d in dirs if not d.startswith('.')]
if 'SKILL.md' in files:
file_path = os.path.join(root, 'SKILL.md')
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
except Exception:
continue
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():]
try:
# safe_load and then dump will normalize quoting automatically
metadata = yaml.safe_load(fm_text) or {}
new_fm = yaml.dump(metadata, sort_keys=False, allow_unicode=True, width=1000).strip()
# Check if it actually changed something significant (beyond just style)
# but normalization is good anyway. We'll just compare the fm_text.
if new_fm.strip() != fm_text.strip():
new_content = f"---\n{new_fm}\n---" + body
with open(file_path, 'w', encoding='utf-8') as f:
f.write(new_content)
fixed_count += 1
except yaml.YAMLError as e:
print(f"⚠️ {file_path}: YAML error - {e}")
print(f"Total files normalized: {fixed_count}")
if __name__ == '__main__':
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
fix_yaml_quotes(os.path.join(base_dir, 'skills'))