policy violation: cmd/*/*.go is not a simple entrypoint but has multiple files and logic #8

Open
opened 2026-09-28 11:19:05 +02:00 by sneak · 2 comments
Owner
No description provided.
sneak self-assigned this 2026-09-28 11:21:08 +02:00

Queued first for the simplexcalc repo-manager. cmd/simplexcalc/ becomes a single main.go that only calls into internal/, and the command setup and run logic in root.go and run.go move into an internal/ 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

Queued first for the simplexcalc repo-manager. `cmd/simplexcalc/` becomes a single `main.go` that only calls into `internal/`, and the command setup and run logic in `root.go` and `run.go` move into an `internal/` package. This lands before the units of [issue 2](https://git.eeqj.de/sneak/simplexcalc/issues/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 next after it lands.

The Go style guide (CODE_STYLEGUIDE_GO.md in the prompts repo) says each cmd/{name}/ holds one main.go whose body is one call into library code, with all command logic in internal/. Today cmd/simplexcalc/ has main.go, root.go (the command tree and the version command) and run.go (the run command: configuration, logger, signals, bot.Run).

Decisions (reversible, taken by the repo-manager):

  • New package internal/cli, the style guide's own example name, holding the command tree and both commands, moved from root.go and run.go with their comments. It exposes func Main(version string) int: it runs the command tree and returns the exit status, printing the error to stderr as main does now.
  • cmd/simplexcalc/main.go keeps only the package comment, var version = "dev" (the linker sets it, so the -X main.version flag in the Dockerfile does not change) and func main() { os.Exit(cli.Main(version)) }. root.go and run.go are deleted.
  • No behaviour changes: same commands, flags, output, log lines and exit status.

Done when:

  • cmd/simplexcalc/ contains only main.go, shaped as above.
  • internal/cli has a test, at least that version prints simplexcalc {version} {os}/{arch} and that an unknown command returns a non-zero status.
  • The Layout block in AGENTS.md and any README mention of cmd/ describe the new layout. docs/TODO.md Completed Steps gets a line.
  • make check is green, and the image still builds and starts (simplexcalc version inside it prints the version passed in VERSION).

Model: opus-5-5

**Brief.** The first unit of this repo's queue; the units of https://git.eeqj.de/sneak/simplexcalc/issues/2 start from `next` after it lands. The Go style guide (`CODE_STYLEGUIDE_GO.md` in the `prompts` repo) says each `cmd/{name}/` holds one `main.go` whose body is one call into library code, with all command logic in `internal/`. Today `cmd/simplexcalc/` has `main.go`, `root.go` (the command tree and the `version` command) and `run.go` (the `run` command: configuration, logger, signals, `bot.Run`). **Decisions** (reversible, taken by the repo-manager): - New package `internal/cli`, the style guide's own example name, holding the command tree and both commands, moved from `root.go` and `run.go` with their comments. It exposes `func Main(version string) int`: it runs the command tree and returns the exit status, printing the error to stderr as `main` does now. - `cmd/simplexcalc/main.go` keeps only the package comment, `var version = "dev"` (the linker sets it, so the `-X main.version` flag in the `Dockerfile` does not change) and `func main() { os.Exit(cli.Main(version)) }`. `root.go` and `run.go` are deleted. - No behaviour changes: same commands, flags, output, log lines and exit status. **Done when:** - `cmd/simplexcalc/` contains only `main.go`, shaped as above. - `internal/cli` has a test, at least that `version` prints `simplexcalc {version} {os}/{arch}` and that an unknown command returns a non-zero status. - The Layout block in `AGENTS.md` and any README mention of `cmd/` describe the new layout. `docs/TODO.md` Completed Steps gets a line. - `make check` is green, and the image still builds and starts (`simplexcalc version` inside it prints the version passed in `VERSION`). Model: opus-5-5
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/simplexcalc#8