cli/cli
Tooling
The tooling pipeline is small but opinionated.
Build
Makefileis the developer entry point. It delegates toscript/build.goso the same code path runs on Unix and Windows.bin/ghis the canonical output. The script embeds version and build date metadata viainternal/build.make completionsregenerates shell completions intoshare/{bash,zsh,fish}/.make manpagesregenerates man pages from the embedded help text.make installinstallsgh, the manpages, and the completions into a Unix prefix (defaults to/usr/local).
Lint
make lintrunsgolangci-lint run ./....- Configuration lives in
.golangci.yml. Enabled linters includegofmt,goimports,staticcheck,errcheck,gosec,misspell, andforbidigo. Theforbidigorule bans em dashes. lint.yml(.github/workflows/) re-runs the same configuration in CI.
Code generation
- Mocks are generated by
moqand committed (e.g.internal/prompter/prompter_mock.go,pkg/cmd/codespace/mock_api.go). - The Twirp telemetry client at
internal/barista/observability/telemetry.twirp.gois generated from the corresponding.proto. - Run
go generate ./...after touching any interface that has a//go:generate moq ...directive.
Documentation generation
cmd/gen-docs/main.gowalks the Cobra tree and writes per-command Markdown plus manpages. The Makefile uses it formake manpagesand the release pipeline uses it to refreshcli.github.com/manual/.gh help referenceproduces a single paged document via the same machinery (pkg/cmd/root/help_reference.go).
CI workflows
| Workflow | What it does |
|---|---|
go.yml |
Unit tests on Linux, macOS, Windows. |
lint.yml |
golangci-lint. |
govulncheck.yml |
Vulnerability scan against vulndb. |
codeql.yml |
GitHub CodeQL static analysis. |
deployment.yml |
GoReleaser, Sigstore signing, SLSA attestation, package builds. |
bump-go.yml |
Periodic dependency bump for the Go toolchain. |
homebrew-bump.yml |
Bumps the Homebrew formula on release. |
triage-*.yml |
Issue and PR triage automation. |
detect-spam.yml |
Auto-flags spam content. |
Release packaging
.goreleaser.ymldefines per-OS archives, RPM/DEB/MSI builders, and homebrew bottle metadata.script/releaseandscript/pkgmacosbuild local release artefacts.make macospkg VERSION=vX.Y.Zproduces a signed.pkg.script/licenses(and the correspondinglicenses-checktarget) regenerate the license-attribution database underinternal/licenses/.
Acceptance harness
- The
acceptance/tree builds against a realghbinary using a Go test runner. It is gated behind-tags acceptanceso a straygo test ./...does not pull network or credentials. Seeacceptance/README.mdfor prerequisites.
Internal scripts
script/contains release helpers (release,release-deb,release-rpm,release-msi,pkgmacos),licenses, thebuild.gocross-platform builder, and a few CI helpers. They are intentionally Go programs where possible so they run identically on every supported OS.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.