Blocker: no. Do not fix these items separately. Include them in the capability refactor.
Defect
internal/utils contains unrelated code. internal/utils/version.go and internal/version have similar names but different functions.
- The commands are package-level
*cobra.Command variables, and init() registers them. This makes tests difficult.
- The command logic and the output (
color.*) are in the same functions.
RunCompose connects directly to os.Stdin, os.Stdout and os.Stderr. Thus, other code cannot capture the output.
- The
exec calls and the HTTP calls do not use context.Context. Thus, other code cannot cancel them.
cmd/base.go and cmd/global.go contain the fixed path /home/fly. FindComposeFile uses $HOME. Thus, the configuration has two sources.
--domain is a persistent root flag. base, sites, status and version accept it, but they ignore it.
- The root check compares
cmd.Name() with "update".
- The code uses
yaml.v2 only to get the service names. yaml.v2 gets no more updates.
- The directory checks in
status belong in the monitoring capability.
- Small items:
startAllSites and stopAllSites contain the same code.
cmd/base.go:24-25 contains code that cannot run.
interface{} can be any.
cmd/root.go contains scaffold comments.
- The CLI does not show
CommitHash and BuildDate. Use rootCmd.Version.
Cost
- The control plane needs operations that return results and errors. The current structure does not supply them.
- An agent that operates for a long time needs cancellation and timeouts. The current calls do not have them.
- Two configuration sources can give different paths on the same server.
- The agent will operate as a service. The current root check does not support a privilege model for a service.
Benefit of the fix
- Each capability gets operations that it can test, cancel and connect to the control plane.
- One configuration source gives the same paths everywhere.
docker compose config --services can replace yaml.v2. This command also reads override files and environment variables.
Blocker: no. Do not fix these items separately. Include them in the capability refactor.
Defect
internal/utilscontains unrelated code.internal/utils/version.goandinternal/versionhave similar names but different functions.*cobra.Commandvariables, andinit()registers them. This makes tests difficult.color.*) are in the same functions.RunComposeconnects directly toos.Stdin,os.Stdoutandos.Stderr. Thus, other code cannot capture the output.execcalls and the HTTP calls do not usecontext.Context. Thus, other code cannot cancel them.cmd/base.goandcmd/global.gocontain the fixed path/home/fly.FindComposeFileuses$HOME. Thus, the configuration has two sources.--domainis a persistent root flag.base,sites,statusandversionaccept it, but they ignore it.cmd.Name()with"update".yaml.v2only to get the service names.yaml.v2gets no more updates.statusbelong in the monitoring capability.startAllSitesandstopAllSitescontain the same code.cmd/base.go:24-25contains code that cannot run.interface{}can beany.cmd/root.gocontains scaffold comments.CommitHashandBuildDate. UserootCmd.Version.Cost
Benefit of the fix
docker compose config --servicescan replaceyaml.v2. This command also reads override files and environment variables.