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: separate install / uninstall / status handlers, per OS.
Manager.Up: extract the existing-state branch (diff, phase classification, the startExisting decision) into a named function shared with Reload.
Config.Validate remains one validator; factor the repeated node loops but do not split it to chase a number.
Acceptance
Why
Measured cognitive complexity:
runNetwork157,Config.Validate112,runImage110,runSetupCommand100,Manager.Up97,runPrivateCommand92. 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
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