Add support for parsing frontmatter into custom structs#119
Merged
Conversation
Contributor
|
@copilot try again |
- Added Result.ParseTaskFrontmatter() method to parse task frontmatter into custom structs - Added comprehensive tests for parsing into custom structs - Added example code demonstrating library usage - Updated .gitignore to exclude test binaries - All tests pass, code lints successfully Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
- Added validation to check for nil target parameter - Added test case for nil target - Added comment explaining why marshal-unmarshal approach is used - All tests pass Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Contributor
Author
I've implemented support for parsing task frontmatter into custom structs. The implementation includes:
Users can now parse task frontmatter like this: type TaskMeta struct {
TaskName string `yaml:"task_name"`
Resume bool `yaml:"resume"`
Priority string `yaml:"priority"`
}
var meta TaskMeta
err := result.ParseTaskFrontmatter(&meta)All tests pass, code lints successfully, and no security vulnerabilities were found. (commits: 7248707, 7614126) |
Copilot
AI
changed the title
[WIP] Add support for front-matter in user struct
Add support for parsing task frontmatter into custom structs
Nov 21, 2025
alexec
requested changes
Nov 21, 2025
- Moved ParseFrontmatter method from Result to Markdown type - Renamed from ParseTaskFrontmatter to ParseFrontmatter for generality - Updated all tests to use markdown.ParseFrontmatter() - Updated examples to demonstrate parsing both task and rule frontmatter - Method now works on any Markdown instance, not just tasks - All tests pass, code lints successfully Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot
AI
changed the title
Add support for parsing task frontmatter into custom structs
Add support for parsing frontmatter into custom structs
Nov 21, 2025
alexec
approved these changes
Nov 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables library users to parse frontmatter from both tasks and rules into their own custom structs with strongly-typed fields.
Changes Made
Markdown.ParseFrontmatter(target any) errormethod that allows users to parse frontmatter into custom structs with YAML tagsExample Usage
Implementation Details
Markdowntype for better reusability across tasks and rulesTesting
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.