MCPcopy Create free account
hub / github.com/github/gh-aw / extractEngineIDFromFrontmatter

Function extractEngineIDFromFrontmatter

pkg/cli/workflows.go:446–458  ·  view source on GitHub ↗

extractEngineIDFromFrontmatter extracts the engine ID from a parsed frontmatter map. Returns "copilot" as the default if no engine is specified.

(frontmatter map[string]any)

Source from the content-addressed store, hash-verified

444// extractEngineIDFromFrontmatter extracts the engine ID from a parsed frontmatter map.
445// Returns "copilot" as the default if no engine is specified.
446func extractEngineIDFromFrontmatter(frontmatter map[string]any) string {
447 // Use the workflow package's ExtractEngineConfig to handle both string and object formats
448 compiler := &workflow.Compiler{}
449 engineSetting, engineConfig := compiler.ExtractEngineConfig(frontmatter)
450
451 if engineConfig != nil && engineConfig.ID != "" {
452 return engineConfig.ID
453 }
454 if engineSetting != "" {
455 return engineSetting
456 }
457 return "copilot" // Default engine
458}
459
460// extractEngineIDFromFile extracts the engine ID from a workflow file's frontmatter
461func extractEngineIDFromFile(filePath string) string {

Callers 2

extractEngineIDFromFileFunction · 0.85

Calls 1

ExtractEngineConfigMethod · 0.95

Tested by

no test coverage detected