Skip to content

fix(skillfrontmatter): handle colons in unquoted description values (moclaw-dev) - #25

Open
travelliu wants to merge 1 commit into
moclaw-devfrom
fix/issue-23-frontmatter-colon-dev
Open

fix(skillfrontmatter): handle colons in unquoted description values (moclaw-dev)#25
travelliu wants to merge 1 commit into
moclaw-devfrom
fix/issue-23-frontmatter-colon-dev

Conversation

@travelliu

Copy link
Copy Markdown
Collaborator

Summary

Fixes #23 on moclaw-dev — the YAML frontmatter parser now handles colons inside unquoted description values.

Changes

  • Add FrontmatterBody and HasFrontmatter for cleaner separation of concerns
  • Add extractFromRaw fallback when yaml.Unmarshal fails on unquoted colons
  • Add tests for colon-containing descriptions and new helper functions

Test plan

  • go test ./internal/skillfrontmatter/... passes
  • Standard YAML (no colons) still works
  • Quoted descriptions with colons still work
  • Unquoted descriptions with colons now work (fallback)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the frontmatter parsing logic in server/internal/skillfrontmatter/frontmatter.go to fallback to a raw text extraction method (extractFromRaw) when strict YAML parsing fails, such as when unquoted colons are present in descriptions. It also introduces helper functions HasFrontmatter and FrontmatterBody along with corresponding unit tests. However, a bug was identified in extractFromRaw where nested YAML keys can incorrectly overwrite top-level fields like name or description because lines are trimmed of leading whitespace before parsing. A fix is suggested to skip indented lines.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread server/internal/skillfrontmatter/frontmatter.go Outdated
- Add FrontmatterBody and HasFrontmatter for cleaner separation of concerns
- Add extractFromRaw fallback when yaml.Unmarshal fails on unquoted colons
- Skip indented lines in extractFromRaw to avoid nested key misinterpretation
- Restore ParseBody so consumers still receive body without frontmatter block
- Update cmd_skill_scan.go to use restored ParseBody with TrimSpace
- Add tests for colon-containing descriptions and nested key handling

Closes #23
@travelliu
travelliu force-pushed the fix/issue-23-frontmatter-colon-dev branch from 1fac1c8 to 9031fa4 Compare June 3, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant