MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / extractFrontmatterDescription

Function extractFrontmatterDescription

internal/cli/management.go:638–662  ·  view source on GitHub ↗

extractFrontmatterDescription extracts the description from YAML frontmatter. Handles the simple case: a line starting with "description:" between --- delimiters.

(content string)

Source from the content-addressed store, hash-verified

636// extractFrontmatterDescription extracts the description from YAML frontmatter.
637// Handles the simple case: a line starting with "description:" between --- delimiters.
638func extractFrontmatterDescription(content string) string {
639 lines := strings.Split(content, "\n")
640 inFrontmatter := false
641 for _, line := range lines {
642 trimmed := strings.TrimSpace(line)
643 if trimmed == "---" {
644 if !inFrontmatter {
645 inFrontmatter = true
646 continue
647 }
648 break // end of frontmatter
649 }
650 if !inFrontmatter {
651 continue
652 }
653 if strings.HasPrefix(trimmed, "description:") {
654 desc := strings.TrimPrefix(trimmed, "description:")
655 desc = strings.TrimSpace(desc)
656 // Remove surrounding quotes.
657 desc = strings.Trim(desc, `"'`)
658 return desc
659 }
660 }
661 return ""
662}
663
664// resolveGitHubAuth returns a GitHub API auth header by checking, in order:
665// 1. GITHUB_TOKEN env var

Callers 3

enrichGHDescriptionsFunction · 0.85
selectItemsFunction · 0.85
interactiveSelectItemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected