Return the YAML body between the first two ``---`` lines, or ``None``. Canonical parser for SKILL.md frontmatter — every consumer in this package should route through here so edge cases (CRLF, missing close, body containing ``---``) behave identically across the validator, evaluator
(text: str)
| 50 | |
| 51 | |
| 52 | def extract_frontmatter(text: str) -> str | None: |
| 53 | """Return the YAML body between the first two ``---`` lines, or ``None``. |
| 54 | |
| 55 | Canonical parser for SKILL.md frontmatter — every consumer in this |
| 56 | package should route through here so edge cases (CRLF, missing close, |
| 57 | body containing ``---``) behave identically across the validator, |
| 58 | evaluator, marketplace, and workspace modules. |
| 59 | """ |
| 60 | lines = text.splitlines() |
| 61 | if not lines or lines[0].strip() != "---": |
| 62 | return None |
| 63 | try: |
| 64 | end = lines.index("---", 1) |
| 65 | except ValueError: |
| 66 | return None |
| 67 | return "\n".join(lines[1:end]) |
| 68 | |
| 69 | |
| 70 | def extract_body(text: str) -> str: |
no outgoing calls
no test coverage detected