Files
antigravity-skills-reference/scripts/update_readme.py
sck_0 f9b6a3b8db fix: refactor update_readme to match current README (counts only, no Full Skill Registry)
- Remove Full Skill Registry and table logic; keep only count substitutions
- Add Browse N+ Skills and TOC link updates
- Always write README after substitutions so chain completes without error
2026-01-29 13:13:34 +01:00

66 lines
1.7 KiB
Python

#!/usr/bin/env python3
import json
import os
import re
def update_readme():
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
readme_path = os.path.join(base_dir, "README.md")
index_path = os.path.join(base_dir, "skills_index.json")
print(f"📖 Reading skills index from: {index_path}")
with open(index_path, "r", encoding="utf-8") as f:
skills = json.load(f)
total_skills = len(skills)
print(f"🔢 Total skills found: {total_skills}")
print(f"📝 Updating README at: {readme_path}")
with open(readme_path, "r", encoding="utf-8") as f:
content = f.read()
# 1. Update Title Count
content = re.sub(
r"(# 🌌 Antigravity Awesome Skills: )\d+(\+ Agentic Skills)",
rf"\g<1>{total_skills}\g<2>",
content,
)
# 2. Update Blockquote Count
content = re.sub(
r"(Collection of )\d+(\+ Universal)",
rf"\g<1>{total_skills}\g<2>",
content,
)
# 3. Update Intro Text Count
content = re.sub(
r"(library of \*\*)\d+( high-performance skills\*\*)",
rf"\g<1>{total_skills}\g<2>",
content,
)
# 4. Update Browse section header
content = re.sub(
r"## Browse \d+\+ Skills",
f"## Browse {total_skills}+ Skills",
content,
)
# 5. Update TOC link for Browse (anchor matches header-derived slug)
content = re.sub(
r"\[📚 Browse \d+\+ Skills\]\(#browse-\d+-skills\)",
f"[📚 Browse {total_skills}+ Skills](#browse-{total_skills}-skills)",
content,
)
with open(readme_path, "w", encoding="utf-8") as f:
f.write(content)
print("✅ README.md updated successfully.")
if __name__ == "__main__":
update_readme()