MCPcopy Index your code
hub / github.com/coder/coder / frontmatterStringField

Function frontmatterStringField

codersdk/workspacesdk/frontmatter.go:28–38  ·  view source on GitHub ↗
(frontmatter map[string]any, key string)

Source from the content-addressed store, hash-verified

26var ErrFrontmatterNameRequired = xerrors.New("frontmatter missing required 'name' field")
27
28func 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

Callers 1

ParseSkillFrontmatterFunction · 0.70

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected