Development
This section provides comprehensive documentation for contributors and developers working on the DataRobot CLI.
Getting started
If you're new to developing the CLI, start here:
- Setup—set up your development environment, install prerequisites, and clone the repository.
- Building—learn how to build the CLI from source, understand the build process, and explore available development tasks.
- Structure—understand the codebase organization, key packages, and design patterns used throughout the project.
Development guides
Core concepts
- Project structure—understand the codebase organization, command structure, internal packages, and key design patterns.
- Building—detailed guide on building the CLI, available tasks, and build configuration.
- Authentication—learn about the OAuth authentication implementation, token management, and API integration.
- Configuration—how viper,
drconfig.yaml, flags, and env vars compose; theinternal/config/viperxwrapper; rules for adding new flags or persisted keys.
Advanced topics
- Plugins—develop and test CLI plugins, understand the plugin system architecture.
- Remote plugins—create and distribute remote plugins, plugin registry management.
- Workload
.wapi/validation—reference forvalidator/v10tags and cross-field rules for workload local state. - Releasing—release process, versioning strategy, and GoReleaser configuration.
- Telemetry—how anonymous usage analytics are collected, how to add events, and how to opt out.
Quick reference
Essential commands
# Setup development environment
task dev-init
# Build the CLI
task build
# Run tests
task test
# Run linters
task lint
# Run CLI without building
task run -- templates list
Development workflow
- Clone the repository and run
task dev-init - Create a feature branch
- Make your changes
- Run
task lintto format and lint code - Run
task testto verify tests pass - Commit and push your changes
- Open a pull request
See Building for detailed workflow documentation.
Prerequisites
Before you begin development:
- Go 1.26.4 or later—required for building the CLI.
- Git—version control.
- Task—task runner for development commands.
- golangci-lint—installed automatically via
task dev-init.
See Setup for detailed installation instructions.
Project structure overview
cli/
├── cmd/ # Command implementations
│ ├── auth/ # Authentication commands
│ ├── component/ # Component management
│ ├── dotenv/ # Environment variable management
│ ├── plugin/ # Plugin management
│ ├── self/ # CLI utility commands
│ ├── start/ # Quickstart command
│ ├── task/ # Task execution
│ └── templates/ # Template management
├── internal/ # Private packages
│ ├── auth/ # Authentication logic
│ ├── config/ # Configuration management
│ ├── drapi/ # DataRobot API client
│ ├── envbuilder/ # Environment configuration
│ └── task/ # Task runner integration
├── tui/ # Terminal UI components
├── docs/ # Documentation
├── main.go # Application entry point
├── Taskfile.yaml # Task definitions
└── goreleaser.yaml # Release configuration
See Structure for comprehensive documentation.
Coding standards
All code must:
- Pass
golangci-lintwith zero errors - Follow Go whitespace rules (wsl linter)
- Include tests for new functionality
- Use the Taskfile for build operations
See Building for detailed requirements.
Command naming conventions
All CLI commands must use singular names for consistency (e.g., template, dependency, plugin).
Plural aliases should be added to commands that are renamed from plural to singular for backward compatibility.
Example:
cmd := &cobra.Command{
Use: "template", // Singular primary name
Aliases: []string{"templates"}, // Plural as alias
// ...
}
Testing
# Run all tests
task test
# Run tests with coverage
task test-coverage
# Run specific package tests
go test ./cmd/auth/...
# Run with race detection (included in task test)
go test -race ./...
See Building for comprehensive testing documentation.
Getting help
- Documentation: Review the guides linked above
- Issues: Check existing GitHub issues
- Discussions: Ask questions in GitHub discussions
- Contributing: Read the contributing guide
See also
- Contributing guide—contribution guidelines and code of conduct.
- User guide—end-user documentation.
- Command reference—detailed command documentation.