You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[task] Move misplaced functions from add_command.go to appropriate files #3744
Improve file cohesion by relocating misplaced functions from pkg/cli/add_command.go to their appropriate domain files.
Context
The add_command.go file contains several functions that don't belong there, violating separation of concerns and making code harder to find and reuse. These functions handle setup, git operations, and PR creation - responsibilities that should live in dedicated files.
Related to #3713 - Outlier Functions Issues #1, #2, and #3.
Approach
Move setup functions (Lines 819-907):
ensureCopilotInstructions
ensureAgenticWorkflowPrompt
ensureAgenticWorkflowAgent
ensureSharedAgenticWorkflowAgent
ensureSetupAgenticWorkflowsAgent
Create new file pkg/cli/agent_setup.go or add to pkg/cli/copilot_setup.go
Move git operation (Line 912):
checkCleanWorkingDirectory
Move to pkg/cli/git.go (existing file)
Move PR operation (Line 934):
createPR
Move to pkg/cli/pr_command.go or create pkg/cli/pr_helpers.go
Refactor compilation logic:
compileWorkflow and compileWorkflowWithTracking
Extract shared utilities to avoid duplication with compile_command.go
Update all references to moved functions
Files to Create
pkg/cli/agent_setup.go (or decide to use existing copilot_setup.go)
Possibly pkg/cli/pr_helpers.go if PR operations need dedicated file
Activity