Skip to content

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:

  1. Setup—set up your development environment, install prerequisites, and clone the repository.
  2. Building—learn how to build the CLI from source, understand the build process, and explore available development tasks.
  3. 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; the internal/config/viperx wrapper; 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 for validator/v10 tags 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

  1. Clone the repository and run task dev-init
  2. Create a feature branch
  3. Make your changes
  4. Run task lint to format and lint code
  5. Run task test to verify tests pass
  6. Commit and push your changes
  7. 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-lint with 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

See also