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
{{ message }}
Repository navigation
frontmatter: readers in internal/utils locate the delimiters under five different rules #449
internal/utils has several frontmatter readers, each locating the --- delimiters itself, under five different rules. The same SKILL.md can therefore yield a different name, or a different answer to "has frontmatter", depending on the entry point — for example sync (ParseSkillName) versus mcp serve (ParseFrontmatterMap).
Evidence (v0.25.0, aeaea40e)
Function
Delimiter rule
ParseSkillName (frontmatter.go:16)
TrimSpace == "---"; may be indented, need not be the first line; splits name: by hand, no YAML
extractFrontmatterRaw (:182)
TrimSpace, line scan of the file
extractFrontmatterRawFromBytes (:155)
byte-slice copy of the above
ParseFrontmatterMap (:218)
must be the first line, exactly ---, must be closed
ParseFrontmatterList and ParseFrontmatterListFromBytes are whole-body copies. About 20 call sites exist outside the package.
The mcp serve fixes 64898e1, 78857ad, 69f7dfa and 76a49ad all landed on the strict reader; the lenient ones were not updated.
Proposed change
One function that locates frontmatter under an explicit strict or lenient policy, with every Parse* built on it. Add a test asserting that all entry points agree on the same input.
Risks
The lenient rules may exist for compatibility with users' existing files; unifying them changes discovery behaviour. This needs a decision before any code change.
Low-risk subset: merge only the two extractFrontmatterRaw* and the two ParseFrontmatterList* copies.
Activity
fix(utils): stream ParseSkillName and ParseFrontmatterField to their key
test(utils): pin what each frontmatter entry point returns today
refactor(utils): locate frontmatter in one place under a named policy
perf(utils): keep only the frontmatter block when reading by path