Skip to content

Development Guide: CLI

Component: cliLanguage: Go

Getting Started

Prerequisites

  • Go 1.24+
  • Access to a running Coder deployment (for API testing)

Build

To build the CLI from source:

bash
cd cli
go mod download
go build -o sptx ./cmd

Running Locally

You can run the CLI directly without building the binary:

bash
go run ./cmd/sptx help

Testing

Run the comprehensive test suite:

bash
go test -v ./...

Project Structure

  • /cmd: Command definitions. Adding a new command? Start here.
  • /pkg: Reusable libraries.
  • /internal: Private implementation logic (config, helpers).

Common Tasks

  • Adding a Command: Create a new file in cmd/, define the Cobra command, and add it to root.go.
  • Updating Dependencies: Run go get <package> and go mod tidy.

Released under the MIT License.