Skip to content

Development workflow

Toolchain

  • Go 1.20+
  • make
  • golangci-lint (optional but recommended)
  • Terraformer + kubectl for manual testing

Common tasks

# Format code
go fmt ./...

# Lint
go vet ./...

# Run unit tests
make test

# Run the whole suite (fmt + lint + test)
make check

# Build the CLI
make build

# Clean build artifacts
make clean

Running the API server locally

mkdir -p ~/.babyctl
cp -r examples/api-definitions/apis ~/.babyctl/

babyctl api-server --port 8080

You can now point kubectl at http://localhost:8080 as described in the kubectl integration guide.

Repository layout

  • cmd/babyctl – main entry point. Keep it thin.
  • pkg/cmd – home of all Cobra commands. Add a new file per command and register it with the root command.
  • pkg/apiresources – collects resource info from kubectl + Terraformer.
  • pkg/terraformer – helper functions for shelling out to Terraformer.
  • pkg/printers – output helpers shared by get, apply, and convert.
  • examples/ – sample API definitions for demos and integration tests.

Testing tips

  • Unit test packages in isolation where possible. For CLI behaviour, test the helper functions that power commands instead of the Cobra plumbing.
  • Use the provided test-api-server.sh script to exercise discovery endpoints end-to-end.
  • Validate HCL/YAML conversions with golden files to catch formatting regressions.

Releasing

CI is handled by GitHub Actions. release-please opens release PRs based on Conventional Commits and, once merged, publishes binaries and changelogs automatically. See Contributing for details on commit hygiene.