MCPcopy Index your code
hub / github.com/github/gh-aw / parseAndValidateIncludedFrontmatter

Function parseAndValidateIncludedFrontmatter

pkg/parser/include_processor.go:195–210  ·  view source on GitHub ↗
(filePath string, content []byte)

Source from the content-addressed store, hash-verified

193}
194
195func parseAndValidateIncludedFrontmatter(filePath string, content []byte) (*FrontmatterResult, error, bool, bool, error) {
196 result, err := extractIncludedFrontmatter(filePath, content)
197 if err != nil {
198 return nil, nil, false, false, fmt.Errorf("failed to extract frontmatter from included file %s: %w", filePath, err)
199 }
200
201 isWorkflowFile := isUnderWorkflowsDirectory(filePath)
202 isAgentFile := isCustomAgentFile(filePath)
203 validationErr := validateIncludedFrontmatterWithFallback(filePath, result.Frontmatter, isWorkflowFile, isAgentFile)
204 if validationErr != nil && isWorkflowFile {
205 includeLog.Printf("Validation failed for workflow file %s: %v", filePath, validationErr)
206 return nil, nil, false, false, fmt.Errorf("invalid frontmatter in included file %s: %w", filePath, validationErr)
207 }
208
209 return result, validationErr, isWorkflowFile, isAgentFile, nil
210}
211
212func extractIncludedFrontmatter(filePath string, content []byte) (*FrontmatterResult, error) {
213 if strings.HasPrefix(filePath, BuiltinPathPrefix) {

Callers 1

Calls 6

isCustomAgentFileFunction · 0.70
ErrorfMethod · 0.45
PrintfMethod · 0.45

Tested by

no test coverage detected