Thank you for your interest in contributing to terrakube-cli! This document outlines the guidelines for submitting bug reports, feature requests, code modifications, and adding new CLI subcommands.
We expect all contributors to adhere to standard open-source community standards. Be respectful, inclusive, and collaborative.
Before opening a new issue, please search existing issues to see if it has already been reported. When filing an issue, include:
- A clear, descriptive title.
- Steps to reproduce the bug.
- Expected behavior vs. actual behavior.
- Terrakube CLI version (
terrakube --version) and OS environment details.
- Fork & Clone: Fork the repository on GitHub and clone it locally.
- Create a Feature Branch:
git checkout -b feature/my-new-feature
- Make Code Changes: Ensure code adheres to Go best practices and standard formatting.
- Run Formatters & Linters:
gofmt -w . - Run Tests:
go test ./... - Commit Changes: Follow clear commit message conventions.
- Submit a Pull Request: Push your branch to GitHub and submit a PR against the
mainbranch.
All CLI commands in terrakube-cli follow a generic resource registration pattern. Avoid writing hand-written Cobra subcommands from scratch.
New resources are registered using the resource.Register[T]() framework:
package myresource
import (
"terrakube-cli/cmd/resource"
)
type MyResource struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}
func init() {
resource.Register[MyResource](resource.Config{
Name: "my-resource",
Description: "Manage custom resources in Terrakube",
Endpoint: "/api/v1/my-resource",
})
}Integration tests use BATS.
To run the end-to-end test suite locally:
- Ensure a local test server instance is running (e.g.
https://terrakube-api.platform.local). - Export your credentials:
export TERRAKUBE_API_URL="https://terrakube-api.platform.local" export TERRAKUBE_PAT="XXXXXXXXXXXXX" # Terrakube Admin Personal Access Token
- Execute the tests:
bats tests/e2e_operations.bats