extractEngineIDFromFrontmatter extracts the engine ID from a parsed frontmatter map. Returns "copilot" as the default if no engine is specified.
(frontmatter map[string]any)
| 444 | // extractEngineIDFromFrontmatter extracts the engine ID from a parsed frontmatter map. |
| 445 | // Returns "copilot" as the default if no engine is specified. |
| 446 | func 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 |
| 461 | func extractEngineIDFromFile(filePath string) string { |
no test coverage detected