This guide provides information for developers who want to build, test, and contribute to Tiger CLI.
# Clone the repository
git clone https://github.com/timescale/tiger-cli.git
cd tiger-cli
git checkout <branch>
# Install the CLI
go install ./cmd/tiger
# (Optional) Set up the API endpoint
# For prod (default)
tiger config set console_url https://console.cloud.timescale.com
tiger config set gateway_url https://console.cloud.timescale.com/api
tiger config set api_url https://console.cloud.timescale.com/public/api/v1
# For dev
tiger config set console_url https://console.dev.timescale.com
tiger config set gateway_url https://console.dev.timescale.com/api
tiger config set api_url https://console.dev.timescale.com/public/api/v1
# For development against local Tiger Cloud Console:
tiger config set console_url https://local.dev.timescale.com:8080
# For development against local REST API:
tiger config set api_url http://localhost:8080/public/api/v1There are a handful of configuration options and environment variables that are specifically intended for use during development:
api_url(TIGER_API_URL) - Tiger Cloud API endpoint (default: https://console.cloud.timescale.com/public/api/v1)console_url(TIGER_CONSOLE_URL) - Tiger Cloud Console URL (default: https://console.cloud.timescale.com)gateway_url(TIGER_GATEWAY_URL) - Tiger Cloud Gateway URL (default: https://console.cloud.timescale.com/api)docs_mcp_url(TIGER_DOCS_MCP_URL) - Docs MCP server URL (default: https://mcp.tigerdata.com/docs)
# Run all tests
go test ./...
# Run tests with verbose output
go test -v ./...
# Run tests with coverage
go test -cover ./...Integration tests execute real API calls against a Tiger environment to validate end-to-end functionality. These tests require valid credentials and will create/delete actual resources.
-
Copy the sample environment file:
cp .env.sample .env
-
Edit
.envwith your actual credentials:TIGER_PUBLIC_KEY_INTEGRATION=your-public-key-here TIGER_SECRET_KEY_INTEGRATION=your-secret-key-here TIGER_PROJECT_ID_INTEGRATION=your-project-id-here TIGER_API_URL=http://localhost:8080/public/api/v1 # or production URL
# Load environment variables and run all integration tests
export $(cat .env | xargs) && go test ./internal/tiger/cmd -v -run Integration
# Run specific integration test
export $(cat .env | xargs) && go test ./internal/tiger/cmd -v -run TestServiceLifecycleIntegration
# Integration tests will skip automatically if credentials are not set
go test ./internal/tiger/cmd -v -run Integration- Authentication lifecycle: Login with credentials, verify authentication, logout
- Service management: Create, list, get, and delete database services
- Password management: Update service passwords with keychain storage
- Database connectivity: Generate connection strings and execute psql commands
- Output formats: Validate JSON, YAML, and table output formats
- Error handling: Test authentication failures and resource cleanup
Note: Integration tests create and delete real services, which may incur costs. Use a development environment when possible.
tiger-cli/
├── cmd/tiger/ # Main CLI entry point
├── internal/tiger/ # Internal packages
│ ├── api/ # Generated OpenAPI client (oapi-codegen)
│ │ └── mocks/ # Generated mocks for testing
│ ├── config/ # Configuration management
│ ├── logging/ # Structured logging utilities
│ ├── mcp/ # MCP server implementation
│ ├── password/ # Password storage utilities
│ ├── cmd/ # CLI commands (Cobra)
│ └── util/ # Shared utilities
├── docs/ # Documentation
├── specs/ # CLI specifications and API documentation
├── openapi.yaml # OpenAPI 3.0 specification for Tiger API
└── tools.go # Build-time dependencies
The internal/ directory follows Go conventions to prevent external imports of internal packages.
Tiger CLI is a Go-based command-line interface for managing Tiger resources. The architecture follows standard Go CLI patterns using Cobra and Viper.
- Entry Point:
cmd/tiger/main.go- Simple main that delegates to cmd.Execute() - Command Structure:
internal/tiger/cmd/- Cobra-based command definitionsroot.go- Root command with global flags and configuration initializationauth.go- Authentication commandsservice.go- Service management commandsdb.go- Database operation commandsmcp.go- MCP server commandsconfig.go- Configuration management commandsversion.go- Version command
- Configuration:
internal/tiger/config/config.go- Centralized config with Viper integration - Logging:
internal/tiger/logging/logging.go- Structured logging with zap - API Client:
internal/tiger/api/- Generated OpenAPI client - MCP Server:
internal/tiger/mcp/- Model Context Protocol server implementation
The CLI uses a layered configuration approach (listed from lowest to highest precedence):
- Default values in code
- Configuration file at
~/.config/tiger/config.yaml - Environment variables with
TIGER_prefix - Command-line flags (highest precedence)
Two-mode logging system using zap:
- Production mode: Minimal output, warn level and above, clean formatting
- Debug mode: Full development logging with colors and debug level. Enable with
--debugorTIGER_DEBUG=true.
# Generate OpenAPI client code and mocks from openapi.yaml
go generate ./internal/tiger/api
# Generates:
# - client.go: HTTP client implementation
# - types.go: Type definitions for API models
# - mocks/mock_client.go: Mock implementations for testing- Always use go fmt after making file changes and before committing
- Write tests for new functionality
- Update documentation when adding new features or commands
- Follow the existing code structure and patterns
- Use the pure functional builder pattern for new commands (see CLAUDE.md)
- Test with multiple output formats (json, yaml, table)
- Validate configuration changes don't break existing functionality
- Use CLAUDE.md other guidelines are listed there and you can use it with any AI-enabled coding editor.
- Fork the repository on GitHub
- Create a feature branch from
main - Make your changes following the code style and patterns
- Add tests for new functionality
- Run all tests to ensure nothing breaks:
go test ./... - Run go fmt to format your code:
go fmt ./... - Update documentation if needed
- Submit a pull request with a clear description of changes
- Clear title: Summarize the change in the PR title
- Detailed description: Explain what and why, not just how
- Link issues: Reference any related issues
- Test evidence: Show that tests pass
- Breaking changes: Clearly call out any breaking changes
To trigger the release pipeline, push a new semver tag (e.g. v1.2.3). This is
typically done by creating a new release in the GitHub UI, but it can also be
done at the command line:
VERSION=X.X.X && git tag -a v${VERSION} -m "${VERSION}" && git push origin v${VERSION} && git push- GitHub Issues: Report bugs or request features at https://github.com/timescale/tiger-cli/issues
- Documentation: Check the specs/ directory for detailed specifications
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.