(frontmatter map[string]any, key string)
| 26 | var ErrFrontmatterNameRequired = xerrors.New("frontmatter missing required 'name' field") |
| 27 | |
| 28 | func frontmatterStringField(frontmatter map[string]any, key string) (string, bool, error) { |
| 29 | value, ok := frontmatter[key] |
| 30 | if !ok { |
| 31 | return "", false, nil |
| 32 | } |
| 33 | stringValue, ok := value.(string) |
| 34 | if !ok { |
| 35 | return "", true, xerrors.Errorf("frontmatter field %q must be a string", key) |
| 36 | } |
| 37 | return strings.TrimRight(stringValue, "\r\n"), true, nil |
| 38 | } |
| 39 | |
| 40 | // ParseSkillFrontmatter extracts name, description, and the |
| 41 | // remaining body from a skill meta file. The expected format is |
no test coverage detected