True iff a `status: approved` line exists in the YAML frontmatter. If frontmatter is missing or unparseable, fall back to anchoring against the whole file — still safer than a substring match because the regex requires the directive to be a line on its own.
(text: str)
| 117 | |
| 118 | |
| 119 | def is_approved(text: str) -> bool: |
| 120 | """True iff a `status: approved` line exists in the YAML frontmatter. |
| 121 | |
| 122 | If frontmatter is missing or unparseable, fall back to anchoring against |
| 123 | the whole file — still safer than a substring match because the regex |
| 124 | requires the directive to be a line on its own. |
| 125 | """ |
| 126 | match = FRONTMATTER_RE.match(text) |
| 127 | haystack = match.group(1) if match else text |
| 128 | return bool(APPROVAL_RE.search(haystack)) |
| 129 | |
| 130 | |
| 131 | def block(reason: str) -> None: |