Snapshot before the quality program (relevance gates, tiered mapping, QA linter). v1 is the immutable before/after reference; evidence crawl was at ~175/3039 occupations when tagged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PDKeXvpT6tENSvyQGLV1Uq
25 lines
888 B
Python
25 lines
888 B
Python
"""One-shot: replace backtick file references with Markdown links in SKILL.md files."""
|
|
import os, re
|
|
|
|
SKILLS_DIR = os.path.join(os.path.dirname(__file__), "..", "skills")
|
|
|
|
# Pattern: `references/some.md` or `evals/` → [references/some.md](references/some.md)
|
|
BACKTICK_REF = re.compile(r'`((?:references/[\w.-]+\.md|evals/))`')
|
|
|
|
fixed = skipped = 0
|
|
for slug in os.listdir(SKILLS_DIR):
|
|
skill_md = os.path.join(SKILLS_DIR, slug, "SKILL.md")
|
|
if not os.path.isfile(skill_md):
|
|
continue
|
|
with open(skill_md, encoding="utf-8") as f:
|
|
text = f.read()
|
|
new_text = BACKTICK_REF.sub(lambda m: f"[{m.group(1)}]({m.group(1)})", text)
|
|
if new_text != text:
|
|
with open(skill_md, "w", encoding="utf-8", newline="\n") as f:
|
|
f.write(new_text)
|
|
fixed += 1
|
|
else:
|
|
skipped += 1
|
|
|
|
print(f"Fixed: {fixed} Already OK / no match: {skipped}")
|