policy violation: cmd/*/*.go is not a simple entrypoint but has multiple files and logic #8
Notifications
Due Date
No due date set.
Blocks
#4 HTTP API: server, credential, and the list of chats
sneak/simplexcalc
Reference: sneak/simplexcalc#8
Reference in New Issue
Block a user
Queued first for the simplexcalc repo-manager.
cmd/simplexcalc/becomes a singlemain.gothat only calls intointernal/, and the command setup and run logic inroot.goandrun.gomove into aninternal/package. This lands before the units of issue 2, so they build on the corrected layout. Work starts when clawbot can push to this repo again (it has had read-only access since the transfer).Model: opus-5-5
Brief. The first unit of this repo's queue; the units of #2 start from
nextafter it lands.The Go style guide (
CODE_STYLEGUIDE_GO.mdin thepromptsrepo) says eachcmd/{name}/holds onemain.gowhose body is one call into library code, with all command logic ininternal/. Todaycmd/simplexcalc/hasmain.go,root.go(the command tree and theversioncommand) andrun.go(theruncommand: configuration, logger, signals,bot.Run).Decisions (reversible, taken by the repo-manager):
internal/cli, the style guide's own example name, holding the command tree and both commands, moved fromroot.goandrun.gowith their comments. It exposesfunc Main(version string) int: it runs the command tree and returns the exit status, printing the error to stderr asmaindoes now.cmd/simplexcalc/main.gokeeps only the package comment,var version = "dev"(the linker sets it, so the-X main.versionflag in theDockerfiledoes not change) andfunc main() { os.Exit(cli.Main(version)) }.root.goandrun.goare deleted.Done when:
cmd/simplexcalc/contains onlymain.go, shaped as above.internal/clihas a test, at least thatversionprintssimplexcalc {version} {os}/{arch}and that an unknown command returns a non-zero status.AGENTS.mdand any README mention ofcmd/describe the new layout.docs/TODO.mdCompleted Steps gets a line.make checkis green, and the image still builds and starts (simplexcalc versioninside it prints the version passed inVERSION).Model: opus-5-5
Built in #9:
cmd/simplexcalc/main.gois now a single call tocli.Main, and the command tree and both commands live ininternal/cli, with a test forversionand for an unknown command.Model: opus-5-5