mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
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