cmd/pixad/main.go holds logic that belongs under internal/ #206

Closed
opened 2026-10-04 22:29:51 +02:00 by clawbot · 2 comments
Collaborator

The canonical REPO_POLICIES.md, re-vendored under #196, now requires cmd/ to be thin: one main.go per binary whose body is a single call into internal/ or pkg/, with no project logic in cmd/.

cmd/pixad/main.go builds the cobra command and its --config flag, sets PIXA_CONFIG_PATH from that flag, ignores SIGPIPE, and wires the fx application. All of that belongs in a package under internal/, which main calls once. Version is set at build time through -X main.Version in the Dockerfile and the Makefile: it can stay in main and be passed to that call, or move, with both -X paths changed.

Model: opus-5-5

The canonical `REPO_POLICIES.md`, re-vendored under https://git.eeqj.de/sneak/pixa/issues/196, now requires `cmd/` to be thin: one `main.go` per binary whose body is a single call into `internal/` or `pkg/`, with no project logic in `cmd/`. `cmd/pixad/main.go` builds the cobra command and its `--config` flag, sets `PIXA_CONFIG_PATH` from that flag, ignores `SIGPIPE`, and wires the fx application. All of that belongs in a package under `internal/`, which `main` calls once. `Version` is set at build time through `-X main.Version` in the `Dockerfile` and the Makefile: it can stay in `main` and be passed to that call, or move, with both `-X` paths changed. Model: opus-5-5
clawbot self-assigned this 2026-10-04 22:29:51 +02:00
Author
Collaborator

Plan, checked against next at 708a9be:

  • Move what cmd/pixad/main.go does (the cobra command and its --config flag, setting PIXA_CONFIG_PATH, ignoring SIGPIPE, building and running the fx app) into a package under internal/ (for example internal/app with a Run(version string); use an existing package if one already fits). main becomes one call into it.
  • Version stays in main, set by -X main.Version as now, and is passed to that call, so the Dockerfile and Makefile build flags do not change.
  • Behaviour is unchanged: same flags, same exit codes (fx's Run from #86), same version log line first. Existing tests of what moved move with it; say so in the PR.

Model: opus-5-5

Plan, checked against `next` at `708a9be`: - Move what `cmd/pixad/main.go` does (the cobra command and its `--config` flag, setting `PIXA_CONFIG_PATH`, ignoring `SIGPIPE`, building and running the fx app) into a package under `internal/` (for example `internal/app` with a `Run(version string)`; use an existing package if one already fits). `main` becomes one call into it. - `Version` stays in `main`, set by `-X main.Version` as now, and is passed to that call, so the `Dockerfile` and Makefile build flags do not change. - Behaviour is unchanged: same flags, same exit codes (fx's `Run` from https://git.eeqj.de/sneak/pixa/issues/86), same version log line first. Existing tests of what moved move with it; say so in the PR. Model: opus-5-5
Author
Collaborator

Built in #215: what cmd/pixad/main.go did moves unchanged to Run in a new internal/app package, and main is now app.Run(Version), with the build flags unchanged.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/pixa/pulls/215: what `cmd/pixad/main.go` did moves unchanged to `Run` in a new `internal/app` package, and `main` is now `app.Run(Version)`, with the build flags unchanged. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#206