Objective
Standardize the organization of generate*PromptStep functions by moving scattered prompt generators into dedicated files following the existing pattern.
Context
Multiple generate*PromptStep functions are inconsistently organized. Some have dedicated files, while others are scattered in larger files like compiler_yaml.go and pr.go.
Current distribution:
- ✅
generateEditToolPromptStep - has edit_tool_prompt.go
- ✅
generateGitHubContextPromptStep - has github_context.go
- ✅
generatePlaywrightPromptStep - has playwright_prompt.go
- ✅
generateTempFolderPromptStep - has temp_folder.go
- ✅
generateXPIAPromptStep - has xpia.go
- ❌
generateCacheMemoryPromptStep - in compiler_yaml.go
- ❌
generateSafeOutputsPromptStep - in compiler_yaml.go
- ❌
generatePRContextPromptStep - in pr.go
Part of issue #3435.
Approach
1. Analyze existing prompt generation patterns
Review the well-organized prompt files to understand the pattern:
- File naming convention:
{feature}_prompt.go
- Function structure and dependencies
- Testing approach
2. Create dedicated prompt files
Create:
pkg/workflow/cache_memory_prompt.go - Move generateCacheMemoryPromptStep
pkg/workflow/safe_outputs_prompt.go - Move generateSafeOutputsPromptStep
pkg/workflow/pr_prompt.go - Move generatePRContextPromptStep
3. Move prompt generation functions
Move each function to its dedicated file with:
- Function implementation
- Any related helper functions
- Appropriate documentation
4. Update imports
- Update
compiler_yaml.go to remove moved functions
- Update
pr.go to remove moved functions
- Update any files that reference these functions
- Ensure no circular dependencies
Files to Modify
Create:
pkg/workflow/cache_memory_prompt.go
pkg/workflow/safe_outputs_prompt.go
pkg/workflow/pr_prompt.go
Update:
pkg/workflow/compiler_yaml.go (remove moved functions)
pkg/workflow/pr.go (remove moved function)
- Update imports in files that use these functions
- Create/update test files as needed
Acceptance Criteria
AI generated by Plan Command for #3435
Objective
Standardize the organization of
generate*PromptStepfunctions by moving scattered prompt generators into dedicated files following the existing pattern.Context
Multiple
generate*PromptStepfunctions are inconsistently organized. Some have dedicated files, while others are scattered in larger files likecompiler_yaml.goandpr.go.Current distribution:
generateEditToolPromptStep- hasedit_tool_prompt.gogenerateGitHubContextPromptStep- hasgithub_context.gogeneratePlaywrightPromptStep- hasplaywright_prompt.gogenerateTempFolderPromptStep- hastemp_folder.gogenerateXPIAPromptStep- hasxpia.gogenerateCacheMemoryPromptStep- incompiler_yaml.gogenerateSafeOutputsPromptStep- incompiler_yaml.gogeneratePRContextPromptStep- inpr.goPart of issue #3435.
Approach
1. Analyze existing prompt generation patterns
Review the well-organized prompt files to understand the pattern:
{feature}_prompt.go2. Create dedicated prompt files
Create:
pkg/workflow/cache_memory_prompt.go- MovegenerateCacheMemoryPromptSteppkg/workflow/safe_outputs_prompt.go- MovegenerateSafeOutputsPromptSteppkg/workflow/pr_prompt.go- MovegeneratePRContextPromptStep3. Move prompt generation functions
Move each function to its dedicated file with:
4. Update imports
compiler_yaml.goto remove moved functionspr.goto remove moved functionsFiles to Modify
Create:
pkg/workflow/cache_memory_prompt.gopkg/workflow/safe_outputs_prompt.gopkg/workflow/pr_prompt.goUpdate:
pkg/workflow/compiler_yaml.go(remove moved functions)pkg/workflow/pr.go(remove moved function)Acceptance Criteria
generate*PromptStepfunctions have dedicated files{feature}_prompt.gomake test-unit)Related to [refactor] 🔧 Semantic Function Clustering Analysis - Code Organization Opportunities #3435