Move the CLI into a ./cli leaf module and distribute via Homebrew - #95
Merged
Conversation
Closed
22 tasks
Split the goblog CLI out of the root module into a leaf module at ./cli so CLI dependencies are no longer inherited by library consumers. - cmd/goblog -> cli/cmd/goblog - internal/ -> cli/internal/ (already CLI-only; no pkg/ importers) - cli/go.mod replaces github.com/harrydayexe/GoBlog/v2 => ../, so the CLI always builds against the library at the same commit. The root module sheds urfave/cli/v3, fatih/color, mattn/go-colorable and mattn/go-isatty. pkg/... is untouched. The CLI generator tests loaded templates through a relative os.DirFS path into pkg/templates/default; they now use the embedded templates.Default, which does not depend on the tree layout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- Dockerfile: download deps and build from ./cli; both go.mod files are copied up front so the `replace ../` resolves in the cached layer. - justfile: build/install/run recipes target the CLI module; test, vet, fmt, vulncheck and mod-tidy now iterate every module instead of stopping at the root module's `./...`. Coverage is reported per module because `go tool cover` resolves sources through its own module. - .goreleaser.yaml: `dir: cli`, shell completions generated in a before hook and shipped in every archive, and a `homebrew_casks` block that pushes to harrydayexe/homebrew-tap (`brews` is deprecated upstream). The matching CI workflow changes are held back in a separate commit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- README: the `## CLI` section now covers `brew install harrydayexe/tap/goblog` and release archives; `go install` no longer works because the CLI module is not published. Adds fish completion and notes that Homebrew and the archives ship completions. - CONTRIBUTING: describe the three-module layout and why per-module commands are needed. - CLAUDE.md: record the module boundary and the new install channels. - version.go: the go install fallback path no longer applies. - justfile: `run-gen` invoked a `gen` subcommand that does not exist. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
harrydayexe
force-pushed
the
93-refactorcli-move-cli-into-a-cli-leaf-module-distribute-via-homebrew-drop-go-install
branch
from
September 16, 2026 23:03
c47a8cc to
80edf99
Compare
Owner
Author
CI workflow changes to apply separatelyThese could not be pushed from the sandbox (the token lacks Without them the CLI module is not vetted, tested or race-tested at all, since
|
harrydayexe
deleted the
93-refactorcli-move-cli-into-a-cli-leaf-module-distribute-via-homebrew-drop-go-install
branch
September 16, 2026 23:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #93. Targets
v3-changes.Moves the
goblogCLI out of the root Go module into a leaf module at./cli/, and switches its distribution to a Homebrew tap plus release archives and Docker.go installis no longer a supported install path.What changed
Module split
internal/was already CLI-only — nothing underpkg/imported it — so the whole tree moved rather than being reached across the module boundary.The root module sheds
urfave/cli/v3,fatih/color,mattn/go-colorableandmattn/go-isatty.pkg/...is untouched:git diff v3-changes -- pkg/is empty.Build and release
.goreleaser.yamlbuilds withdir: cli, generates bash/zsh/fish completions in a before hook, ships them in every archive, and publishes ahomebrew_casksblock toharrydayexe/homebrew-tap. The issue suggestedbrews:, but that is fully deprecated upstream as of GoReleaser v2.16 and makesgoreleaser checkfail, so this useshomebrew_casksinstead.Dockerfilebuilds from./cli/cmd/goblog. Bothgo.modfiles are copied beforego mod downloadso thereplace ../resolves in the cached layer.justfilerecipes target the CLI module, andtest/test-race/vet/fmt/vulncheck/mod-tidynow iterate every module instead of stopping at the root module's./.... Coverage is reported per module, becausego tool coverresolves sources through the module it runs in.Docs
README's
## CLIsection now documentsbrew install harrydayexe/tap/goblogand release archives. CONTRIBUTING describes the three-module layout; CLAUDE.md records the module boundary and the new install channels.Follow-up needed
HOMEBREW_TAP_GITHUB_TOKEN.harrydayexe/homebrew-taprepo and its release token still need creating, andHOMEBREW_TAP_GITHUB_TOKENadding as a repository secret. Until then thehomebrew_casksstep will fail at release time.go install-capable release with a deprecation notice, if you want one, as the issue suggests.Verification
just test,just test-race,just vet,just fmt-checkandaddlicense -checkpass across all three modules.goreleaser checkpasses;goreleaser release --snapshotproduces archives containing the binary, LICENSE, README andcompletions/, and a cask with correctbinaryand*_completionstanzas../cli/cmd/goblogfrom a cleangit archiveof the tree, and runninggo mod downloadincli/with only the twogo.mod/go.sumpairs present.Note
README.mdclaims GPL-3.0 in its badge and License section, butLICENSEis MPL 2.0 and every source header says MPL 2.0. Left alone as out of scope, but worth fixing.🤖 Generated with Claude Code
Changelog (#95)
📚 Documentation
♻️ Refactoring
🏗️ Build System
🤖 CI