Thanks for your interest in contributing. This guide covers the development setup, project layout, and conventions for pull requests.
Requirements: Go 1.26 or newer, make, and git. Docker, Helm (a reachable cluster), and Terraform are only needed for integration tests.
git clone https://github.com/clouddrove/smurf.git
cd smurf
make # builds ./smurf with version ldflags
make test # unit tests, no daemons required
make vet # go vetRun the CLI during development with go run . <subcommand>, for example go run . sdkr build --help.
Integration tests need a running Docker daemon, a reachable Kubernetes cluster, and the terraform binary:
make test-integrationThree layers, kept strictly separate:
main.gowires the root command and blank-imports the subcommand packages.cmd/holds Cobra command definitions only, one file per subcommand, grouped ascmd/sdkr(Docker),cmd/selm(Helm),cmd/stf(Terraform). No business logic here.internal/holds the SDK-backed implementations (internal/docker,internal/helm,internal/terraform, plusinternal/aiandinternal/utils). Never import Cobra frominternal/.
Shared configuration lives in configs/: the smurf.yaml schema (configs/types.go) and the loader with ${ENV_VAR} interpolation (configs/configs.go). The contract: when a flag or environment variable is missing at runtime, commands fall back to the smurf.yaml value.
- Create the Cobra command in
cmd/<group>/, registered viainit()with the group root. - Put the real logic in
internal/<group>/. - Bind shared flags to package-level vars in
configs/types.goonly if they are read across packages. - Update the group's
provisioncommand if your change affects a step it chains. - Document the command in
docs/<group>/README.mdand, if user-facing behavior changed, the MkDocs pages underdocs/sm/docs/.
- User-facing output goes through
pterm(pterm.Success,pterm.Error,pterm.Info), not barefmt.Println. - Return errors from
RunE; do not callos.Exitinside command bodies. - Wrap errors with
%wso callers can useerrors.Isanderrors.As. - Destructive operations must not run without confirmation or an explicit flag (
--auto-approve,--yes). - New code that can be unit tested without a live daemon should come with tests. Integration tests go under
test/behind theintegrationbuild tag. - Format with
gofmt; CI fails on unformatted code.
- Use conventional commit subjects:
fix(selm): ...,feat(stf): ...,docs: ...,ci: .... - Reference related issues in the commit body or PR description.
- Keep PRs focused; unrelated changes belong in separate PRs.
- Make sure
make test,make vet, andgofmt -l .are clean before opening the PR.
Open an issue at https://github.com/clouddrove/smurf/issues with reproduction steps (for bugs) or the use case (for features). For security vulnerabilities, do not open a public issue; see SECURITY.md.