Split the six cognitive-complexity hotspots into options → operation → renderer
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1
- Forks
- 0
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 1
Description
Why
Measured cognitive complexity: runNetwork 157, Config.Validate 112, runImage 110, runSetupCommand 100, Manager.Up 97, runPrivateCommand 92. The CLI handlers mix argument checks, host probing, and three output formats in one body, which is why every review finds another bypass of the error layer.
Proposed shape
- Per CLI handler: typed options (mostly present) → one domain call returning a typed result → one renderer per format.
runNetwork: separateinstall/uninstall/statushandlers, per OS.Manager.Up: extract the existing-state branch (diff, phase classification, thestartExistingdecision) into a named function shared withReload.Config.Validateremains one validator; factor the repeated node loops but do not split it to chase a number.
Acceptance
- No function above roughly 40; behaviour and exit codes unchanged with the existing tests as the oracle; one extraction per commit.
- Best done after #6 so each renderer has a typed result to consume.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start after issue #6, then read the existing handlers and the Manager.Up/Reload and Config.Validate entry points. Run the existing tests first and use them as the behavior and exit-code oracle while making one extraction per commit. Done means the proposed options → domain result → renderer structure is in place, functions stay roughly under 40 lines, and behavior is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, linux, macos
- Domain
- cli, operating-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100