(filePath string, content []byte)
| 193 | } |
| 194 | |
| 195 | func 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 | |
| 212 | func extractIncludedFrontmatter(filePath string, content []byte) (*FrontmatterResult, error) { |
| 213 | if strings.HasPrefix(filePath, BuiltinPathPrefix) { |
no test coverage detected