buildSafeOutputsSection generates the safe-outputs section of the workflow template. It uses the JSON schema to derive the valid safe output type names, ensuring the template is always consistent with what the schema accepts.
()
| 144 | // It uses the JSON schema to derive the valid safe output type names, ensuring the |
| 145 | // template is always consistent with what the schema accepts. |
| 146 | func buildSafeOutputsSection() string { |
| 147 | keys, err := parser.GetSafeOutputTypeKeys() |
| 148 | if err != nil { |
| 149 | commandsLog.Printf("Failed to get safe output type keys from schema: %v", err) |
| 150 | // Fallback to a minimal static section |
| 151 | return "# Outputs - what APIs and tools can the AI use?\nsafe-outputs:\n create-issue: # Creates issues (default max: 1)\n" |
| 152 | } |
| 153 | |
| 154 | var sb strings.Builder |
| 155 | sb.WriteString("# Outputs - what APIs and tools can the AI use?\n") |
| 156 | sb.WriteString("safe-outputs:\n") |
| 157 | sb.WriteString(" create-issue: # Creates issues (default max: 1)\n") |
| 158 | sb.WriteString(" max: 5 # Optional: specify maximum number\n") |
| 159 | for _, key := range keys { |
| 160 | if key == "create-issue" { |
| 161 | continue |
| 162 | } |
| 163 | sb.WriteString(" # " + key + ":\n") |
| 164 | } |
| 165 | return sb.String() |
| 166 | } |