Files
skillshare/internal/utils
Willie 90f161fef0 perf(utils): keep only the frontmatter block when reading by path
Rebuilding the path readers on the shared locator made them read the
whole SKILL.md into memory, where they used to scan line by line and
stop at the closing delimiter. They run once per skill or agent during
sync and listing, so a large body, or a large file with no frontmatter
at all, now cost its full size on every call.

readHead goes back to a bufio.Scanner and keeps the lines from the
opening delimiter to the closing one, nothing before and nothing after.
Reading through the real Scanner also replaces the code that imitated
its quirks (64 KiB line cap, one \r dropped per line); ReadSkillBody,
which needs the body, takes them from scanLines. An unclosed block is
still kept to the end of the file, as the list and fields readers always
did.

Review follow-ups in the same files: RewriteFrontmatterList no longer
copies the content to a string and back, ParseFrontmatterField's two
loops no longer share an index, and the tests share one file helper.
Results are unchanged for every entry point.

Refs #449
2026-10-07 00:25:32 +08:00
..