Skip to content

Commit d316489

Browse files
Copilotmnkiefer
andcommitted
Move extraction functions from tools.go to frontmatter_extraction.go
Co-authored-by: mnkiefer <[email protected]>
1 parent 97dde5b commit d316489

File tree

7 files changed

+395
-743
lines changed

7 files changed

+395
-743
lines changed

.github/workflows/agent-performance-analyzer.lock.yml

Lines changed: 124 additions & 240 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/campaign-manager.lock.yml

Lines changed: 124 additions & 240 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/workflow-health-manager.lock.yml

Lines changed: 124 additions & 240 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cli/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func InitRepository(verbose bool, mcp bool, campaign bool, tokens bool, engine s
130130

131131
// Configure VSCode settings for YAML schema validation
132132
initLog.Print("Configuring VSCode YAML schema validation")
133-
133+
134134
// Write workflow schema to .github/aw/
135135
if err := ensureWorkflowSchema(verbose); err != nil {
136136
initLog.Printf("Failed to write workflow schema: %v", err)

pkg/cli/vscode_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (s *VSCodeSettings) UnmarshalJSON(data []byte) error {
4747
for k, v := range raw {
4848
s.Other[k] = v
4949
}
50-
50+
5151
return nil
5252
}
5353

pkg/workflow/frontmatter_extraction.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,3 +1067,24 @@ func (c *Compiler) addZizmorIgnoreForWorkflowRun(yamlStr string) string {
10671067

10681068
return strings.Join(result, "\n")
10691069
}
1070+
1071+
// extractMapFromFrontmatter is a generic helper to extract a map[string]any from frontmatter
1072+
// This now uses the structured extraction helper for better error handling
1073+
func extractMapFromFrontmatter(frontmatter map[string]any, key string) map[string]any {
1074+
return ExtractMapField(frontmatter, key)
1075+
}
1076+
1077+
// extractToolsFromFrontmatter extracts tools section from frontmatter map
1078+
func extractToolsFromFrontmatter(frontmatter map[string]any) map[string]any {
1079+
return ExtractMapField(frontmatter, "tools")
1080+
}
1081+
1082+
// extractMCPServersFromFrontmatter extracts mcp-servers section from frontmatter
1083+
func extractMCPServersFromFrontmatter(frontmatter map[string]any) map[string]any {
1084+
return ExtractMapField(frontmatter, "mcp-servers")
1085+
}
1086+
1087+
// extractRuntimesFromFrontmatter extracts runtimes section from frontmatter map
1088+
func extractRuntimesFromFrontmatter(frontmatter map[string]any) map[string]any {
1089+
return ExtractMapField(frontmatter, "runtimes")
1090+
}

pkg/workflow/tools.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -191,27 +191,6 @@ func (c *Compiler) applyDefaults(data *WorkflowData, markdownPath string) {
191191
}
192192
}
193193

194-
// extractMapFromFrontmatter is a generic helper to extract a map[string]any from frontmatter
195-
// This now uses the structured extraction helper for better error handling
196-
func extractMapFromFrontmatter(frontmatter map[string]any, key string) map[string]any {
197-
return ExtractMapField(frontmatter, key)
198-
}
199-
200-
// extractToolsFromFrontmatter extracts tools section from frontmatter map
201-
func extractToolsFromFrontmatter(frontmatter map[string]any) map[string]any {
202-
return ExtractMapField(frontmatter, "tools")
203-
}
204-
205-
// extractMCPServersFromFrontmatter extracts mcp-servers section from frontmatter
206-
func extractMCPServersFromFrontmatter(frontmatter map[string]any) map[string]any {
207-
return ExtractMapField(frontmatter, "mcp-servers")
208-
}
209-
210-
// extractRuntimesFromFrontmatter extracts runtimes section from frontmatter map
211-
func extractRuntimesFromFrontmatter(frontmatter map[string]any) map[string]any {
212-
return ExtractMapField(frontmatter, "runtimes")
213-
}
214-
215194
// mergeToolsAndMCPServers merges tools, mcp-servers, and included tools
216195
func (c *Compiler) mergeToolsAndMCPServers(topTools, mcpServers map[string]any, includedTools string) (map[string]any, error) {
217196
toolsLog.Printf("Merging tools and MCP servers: topTools=%d, mcpServers=%d", len(topTools), len(mcpServers))

0 commit comments

Comments
 (0)