Setup, testing, and contribution workflow for Kairo.
- Go 1.26+
- Git
- just
git clone https://github.com/dkmnx/kairo.git
cd kairo
go mod downloadjust build # Build binary to dist/
just test # Run tests, then race-enabled tests
just test-coverage # Generate coverage report in dist/
just lint # Run gofmt checks, go vet, golangci-lint
just format # Format code with gofmt
just pre-release # Format, lint, pre-commit, test
just install # Install to ~/.local/bin/Manual commands:
go build -o dist/kairo .
go test -v ./...
go test -race ./...
go test -coverprofile=dist/coverage.out ./...
go tool cover -func=dist/coverage.out
gofmt -w .
go vet ./...kairo/
├── cmd/ # Cobra command layer
├── internal/ # Business logic
│ ├── config/ # Config loading, migration, caching, paths
│ ├── crypto/ # age/X25519 key management and encryption
│ ├── errors/ # Typed errors
│ ├── providers/ # Built-in provider registry
│ ├── ui/ # Terminal output and prompts
│ ├── validate/ # Validation helpers
│ ├── version/ # Build metadata
│ └── wrapper/ # Secure wrapper scripts for token passing
├── docs/ # Project documentation
├── scripts/ # Install and utility scripts
├── main.go # Application entry point
└── justfile # Development commands
- Add the provider definition in
internal/providers/registry.go:
var BuiltInProviders = map[string]ProviderDefinition{
"newprovider": {
Name: "New Provider",
BaseURL: "https://api.newprovider.com/anthropic",
Model: "new-model",
RequiresAPIKey: true,
},
}-
Add the provider key to
providerOrderin the same file so it appears in setup menus. -
If needed, add provider-specific API key validation in
internal/validate/api_key.go. -
Update user and reference docs.
-
Run targeted tests:
go test ./internal/providers/... ./internal/validate/...# All tests
go test -v ./...
go test -race ./...
# Specific package
go test ./cmd/...
go test ./internal/providers/...
# With coverage
go test -coverprofile=dist/coverage.out ./...
go tool cover -func=dist/coverage.outCommon test patterns used in this project:
- Table-driven tests
t.TempDir()for filesystem isolation- Mocked command execution for CLI integration points
- Race detector coverage for concurrency-sensitive code
- Follow Effective Go
- Use
gofmtfor formatting - Add godoc comments for exported functions
- Return typed errors from internal packages
- Keep internal packages free of Cobra/CLI dependencies
pip install pre-commit
pre-commit install- Fork repository
- Create a branch:
git checkout -b feature/name - Make changes and test them
- Run
just pre-release - Submit a PR
See Contributing Guide for PR format and commit guidance.