You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: decompose parse_frontmatter into focused helpers to flatten nesting
Extract _extract_frontmatter_block (delimiter scanning) and _parse_kv_lines
(key-value parsing) from parse_frontmatter, reducing max nesting from 7 to 3
levels. Type coercion is now data-driven via _FIELD_COERCIONS dict — adding
a new typed field is a one-line dict entry instead of an elif branch.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ Tests are in `tests/` with one file per module. Docs are in `docs/` using MkDocs
41
41
## Traps
42
42
43
43
- Primitive marker filenames (`CHECK.md`, `CONTEXT.md`, `INSTRUCTION.md`, `PROMPT.md`) are defined as constants in `_frontmatter.py` (`CHECK_MARKER`, `CONTEXT_MARKER`, etc.). All modules import from there — change the constant to rename everywhere.
44
-
-`timeout` and `enabled` frontmatter fields have special type coercion in `_frontmatter.py:parse_frontmatter()`. New typed fields need coercion logic added there.
44
+
-`timeout` and `enabled` frontmatter fields have special type coercion via `_FIELD_COERCIONS`in `_frontmatter.py`. To add a new typed field, add an entry to that dict.
45
45
- Both contexts and instructions share `resolver.py:resolve_placeholders()`. Changes affect both.
46
46
- Output is truncated to 5000 chars in `_output.py`. This is intentional.
47
47
- Commands in frontmatter run via `shlex.split()` — no shell features (pipes, redirections, `&&`). Scripts (`run.*`) are the escape hatch.
0 commit comments