Objective
Refactor pkg/cli/trial_command.go (1,007 lines) to separate the Cobra command setup from the business logic, following the established NewXCommand() + RunX() pattern.
Context
From discussion #23903 (Repository Quality: File Size Discipline). Command files should be thin wrappers; business logic should live in separate helper files. The existing codebase pattern is NewXCommand() (thin) + RunX() (extracted, testable).
Approach
- Identify the
RunE / run function logic and extract it to pkg/cli/trial_runner.go
- Keep
NewTrialCommand() in trial_command.go as a thin wrapper — target under 200 lines
- Move any structs/types specific to trial logic to
pkg/cli/trial_types.go if needed to keep files within limits
- Target:
trial_command.go under 200 lines, trial_runner.go under 400 lines
Rules
- Do NOT change function signatures or exported names
- Run
make fmt after changes
- Run
go test ./pkg/cli/ -run ".*[Tt]rial.*" to validate
- Run
make agent-finish before committing
Acceptance Criteria
Generated by Plan Command for issue #discussion #23903 · ◷
Objective
Refactor
pkg/cli/trial_command.go(1,007 lines) to separate the Cobra command setup from the business logic, following the establishedNewXCommand()+RunX()pattern.Context
From discussion #23903 (Repository Quality: File Size Discipline). Command files should be thin wrappers; business logic should live in separate helper files. The existing codebase pattern is
NewXCommand()(thin) +RunX()(extracted, testable).Approach
RunE/ run function logic and extract it topkg/cli/trial_runner.goNewTrialCommand()intrial_command.goas a thin wrapper — target under 200 linespkg/cli/trial_types.goif needed to keep files within limitstrial_command.gounder 200 lines,trial_runner.gounder 400 linesRules
make fmtafter changesgo test ./pkg/cli/ -run ".*[Tt]rial.*"to validatemake agent-finishbefore committingAcceptance Criteria
pkg/cli/trial_command.goreduced to Cobra command setup and flag definitions — under 200 linespkg/cli/trial_runner.go(or appropriately named files)