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

Method ToMap

pkg/workflow/frontmatter_serialization.go:63–233  ·  view source on GitHub ↗

ToMap converts FrontmatterConfig back to map[string]any for backward compatibility This allows gradual migration from map[string]any to strongly-typed config

()

Source from the content-addressed store, hash-verified

61// ToMap converts FrontmatterConfig back to map[string]any for backward compatibility
62// This allows gradual migration from map[string]any to strongly-typed config
63func (fc *FrontmatterConfig) ToMap() map[string]any {
64 frontmatterTypesLog.Printf("Converting FrontmatterConfig to map: name=%s", fc.Name)
65 result := make(map[string]any)
66
67 // Core fields
68 if fc.Name != "" {
69 result["name"] = fc.Name
70 }
71 if fc.Description != "" {
72 result["description"] = fc.Description
73 }
74 if fc.Engine != nil {
75 result["engine"] = fc.Engine
76 }
77 if fc.Source != "" {
78 result["source"] = fc.Source
79 }
80 if fc.Redirect != "" {
81 result["redirect"] = fc.Redirect
82 }
83 if fc.TrackerID != "" {
84 result["tracker-id"] = fc.TrackerID
85 }
86 if fc.Version != "" {
87 result["version"] = fc.Version
88 }
89 if fc.TimeoutMinutes != nil {
90 result["timeout-minutes"] = fc.TimeoutMinutes.ToValue()
91 }
92 if fc.Strict != nil {
93 result["strict"] = *fc.Strict
94 }
95 if len(fc.Labels) > 0 {
96 result["labels"] = fc.Labels
97 }
98
99 // Configuration sections
100 if fc.Tools != nil {
101 result["tools"] = fc.Tools.ToMap()
102 }
103 if fc.MCPServers != nil {
104 result["mcp-servers"] = fc.MCPServers
105 }
106 // Prefer RuntimesTyped over Runtimes for conversion
107 if fc.RuntimesTyped != nil {
108 result["runtimes"] = runtimesConfigToMap(fc.RuntimesTyped)
109 } else if fc.Runtimes != nil {
110 result["runtimes"] = fc.Runtimes
111 }
112 if fc.Jobs != nil {
113 result["jobs"] = fc.Jobs
114 }
115 if fc.SafeOutputs != nil {
116 // Convert SafeOutputsConfig to map - would need a ToMap method
117 result["safe-outputs"] = fc.SafeOutputs
118 }
119 if fc.MCPScripts != nil {
120 // Convert MCPScriptsConfig to map - would need a ToMap method

Callers 2

Calls 6

runtimesConfigToMapFunction · 0.85
permissionsConfigToMapFunction · 0.85
isNilValueFunction · 0.85
isEmptyRunsOnValueFunction · 0.85
ToValueMethod · 0.80
PrintfMethod · 0.45

Tested by 2