Objective
Create dedicated helper files and move generic helper functions from various files to improve code organization and reduce duplication.
Context
Generic helper functions are distributed across multiple files without clear organizational pattern. Examples include configuration parsing helpers in config.go and generic utilities in frontmatter_extraction.go.
Part of issue #3435.
Approach
1. Create helper files
pkg/workflow/config_helpers.go - Configuration parsing helpers
pkg/workflow/frontmatter_helpers.go - Frontmatter extraction utilities
2. Move configuration parsing helpers from config.go
Move these functions to config_helpers.go:
parseLabelsFromConfig(configMap map[string]any) []string
parseTitlePrefixFromConfig(configMap map[string]any) string
parseTargetRepoFromConfig(configMap map[string]any) string
- Any other similar config parsing helper functions
3. Move frontmatter utilities from frontmatter_extraction.go
Move these functions to frontmatter_helpers.go:
extractStringValue(frontmatter map[string]any, key string) string
parseIntValue(value any) (int, bool)
filterMapKeys(m map[string]any, keysToKeep []string) map[string]any
- Any other similar generic utility functions
4. Update imports and references
- Update all files that call these helper functions
- Ensure no circular dependencies
- Verify helper functions are exported (capitalized) if needed across packages
Files to Modify
Create:
pkg/workflow/config_helpers.go
pkg/workflow/frontmatter_helpers.go
Update:
pkg/workflow/config.go (remove moved functions)
pkg/workflow/frontmatter_extraction.go (remove moved functions)
- Any files that import these helper functions
- Update test files as needed
Acceptance Criteria
AI generated by Plan Command for #3435
Objective
Create dedicated helper files and move generic helper functions from various files to improve code organization and reduce duplication.
Context
Generic helper functions are distributed across multiple files without clear organizational pattern. Examples include configuration parsing helpers in
config.goand generic utilities infrontmatter_extraction.go.Part of issue #3435.
Approach
1. Create helper files
pkg/workflow/config_helpers.go- Configuration parsing helperspkg/workflow/frontmatter_helpers.go- Frontmatter extraction utilities2. Move configuration parsing helpers from config.go
Move these functions to
config_helpers.go:parseLabelsFromConfig(configMap map[string]any) []stringparseTitlePrefixFromConfig(configMap map[string]any) stringparseTargetRepoFromConfig(configMap map[string]any) string3. Move frontmatter utilities from frontmatter_extraction.go
Move these functions to
frontmatter_helpers.go:extractStringValue(frontmatter map[string]any, key string) stringparseIntValue(value any) (int, bool)filterMapKeys(m map[string]any, keysToKeep []string) map[string]any4. Update imports and references
Files to Modify
Create:
pkg/workflow/config_helpers.gopkg/workflow/frontmatter_helpers.goUpdate:
pkg/workflow/config.go(remove moved functions)pkg/workflow/frontmatter_extraction.go(remove moved functions)Acceptance Criteria
make test-unit)Related to [refactor] 🔧 Semantic Function Clustering Analysis - Code Organization Opportunities #3435