Extract 22 YAML generation functions from compiler.go to yaml_generation.go #2282
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR extracts 22 YAML generation functions from the oversized
pkg/workflow/compiler.go(3,472 lines) into a new dedicated filepkg/workflow/yaml_generation.goto improve code organization and maintainability.Changes
Files Created
pkg/workflow/yaml_generation.go(910 lines) - New file containing all YAML generation logicFiles Modified
pkg/workflow/compiler.go- Reduced from 3,472 to 2,594 lines (878 lines removed, 25.3% reduction)Functions Extracted
All 22 functions were successfully moved as receiver methods on the
*Compilertype:Core Generation Functions:
generateJobName- Converts workflow names to valid YAML job identifiersgenerateYAML- Generates complete GitHub Actions YAML contentgenerateMainJobSteps- Generates steps section for the main jobUpload and Logging Functions:
generateUploadAgentLogs- Uploads agent stdio logsgenerateUploadAssets- Uploads safe outputs assetsgenerateUploadAwInfo- Uploads agentic run infogenerateUploadPrompt- Uploads prompt filegenerateUploadAccessLogs- Uploads network access logsgenerateUploadMCPLogs- Uploads MCP server logsLog Processing Functions:
generateLogParsing- Parses agent logs for step summarygenerateErrorValidation- Validates agent logs for errorsgenerateExtractAccessLogs- Extracts network access logsPattern Conversion Functions:
convertGoPatternToJavaScript- Converts Go regex patterns to JavaScript formatconvertErrorPatternsToJavaScript- Converts error pattern slicesPrompt Generation Functions:
generatePrompt- Generates the main prompt stepgenerateCacheMemoryPromptStep- Generates cache memory prompt sectiongenerateSafeOutputsPromptStep- Generates safe outputs prompt sectionEngine Execution Functions:
generateEngineExecutionSteps- Generates engine execution stepsgenerateAgentVersionCapture- Captures agent version informationgenerateCreateAwInfo- Creates aw_info.json with metadatagenerateOutputCollectionStep- Reads output file and sets GitHub Actions outputPost-Processing Functions:
generatePostSteps- Generates post-steps that run after AI executionTesting
make test-unitmake build*CompilertypeRelated Issues
Part of #2273 - Refactor oversized compiler.go file
This extraction improves code organization by separating YAML generation concerns from the main compilation logic, making the codebase more maintainable and easier to navigate.
Original prompt
Fixes #2275
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.