Skip to content

Architecture: CLI Tool

Component: cliType: Command Line Interface Language: Go

Design

The CLI (sptx) is built using the Cobra framework for command structure and Viper for configuration management. It communicates with the Coder API to manage workspaces and users.

Key Modules

  • cmd/: Contains the command hierarchy.
    • root.go: Base command definition.
    • up.go: Deploys/starts workspaces.
    • ssh.go: Handles SSH connections to workspaces.
  • pkg/coder/: (Inferred) Wrapper around the Coder SDK for API interactions.
  • internal/config/: Configuration loading and validation.

Data Flow

  1. User Input: User executes sptx <command>.
  2. Config Loading: Viper loads configuration from disk/env.
  3. Command Execution: Cobra routes to the specific handler.
  4. API Interaction: Handler calls Coder API or executes local system calls (e.g., for SSH).
  5. Output: Results displayed to stdout/stderr.

Released under the MIT License.