Daytona Command Line Interface
Relevant source files
The following files were used as context for generating this wiki page:
The Daytona Command Line Interface (CLI) serves as a primary entry point for managing Daytona's secure and elastic infrastructure. It provides developers with the tools necessary to interact with sandboxes, manage authentication, and automate development workflows directly from their terminal.
The CLI is integrated into the broader Daytona ecosystem, working alongside various SDKs (Go, Python, TypeScript, and Ruby) to provide programmatic and manual control over isolated runtime environments. It is built using the Go programming language and is designed to be distributed via package managers like Homebrew.
Sources: README.md:1-24, libs/sdk-go/README.md:1-10, PUBLISHING.md:58-60
CLI Development and Documentation
The Daytona CLI follows a structured development lifecycle that ensures documentation remains in sync with the command-line implementation. Developers contributing to the CLI are required to run specific scripts to regenerate documentation whenever command-related changes are made.
Documentation Generation
The CLI documentation is automatically generated using a helper script located at apps/cli/hack/generate-cli-docs.sh. This script executes the CLI binary with a specific generate-docs command to produce updated Markdown files.
#!/bin/bash
# Clean up existing documentation files
rm -rf docs hack/docs
# Generate default CLI documentation files in folder "docs"
go run main.go generate-docs
Sources: apps/cli/hack/generate-cli-docs.sh:7-11, CONTRIBUTING.md:46-47
Development Workflow
Contributors must adhere to the following standards when modifying the CLI:
- Linting: Uses
golangci-lintto ensure code quality. - DCO Compliance: All commits must be signed off using
git commit --signoffto comply with the Developer Certificate of Origin v1.1. - Testing: Functional and integration tests are required for new PRs.
Sources: CONTRIBUTING.md:49-51, PREPARING_YOUR_CHANGES.md:23-28, PREPARING_YOUR_CHANGES.md:11-12
Command Structure and Architecture
The CLI is architected to handle complex operations such as sandbox creation, lifecycle management, and environment configuration. It communicates with the Daytona API to perform these actions.
Core Lifecycle Flow
The following diagram illustrates the typical flow of a CLI command from execution to API interaction:
The CLI acts as a wrapper around the core API, facilitating user interaction with the remote infrastructure.
Sources: README.md:65-71, libs/sdk-go/README.md:13-35
Release and Distribution
The CLI is part of an automated CI/CD pipeline that manages versioning and distribution across multiple platforms.
Publishing Pipeline
The publishing process involves building the CLI and updating the Homebrew tap to ensure the latest version is available to users. The workflow is managed via GitHub Actions.
| Component | Responsibility |
|---|---|
| GitHub Actions | Orchestrates the build and publish workflow (sdk_publish.yaml). |
| Homebrew Tap | Updated via GITHUBBOT_TOKEN to provide CLI updates. |
| Nx | Used for managing the build and publication order of related libraries and the CLI. |
Sources: PUBLISHING.md:50-60, libs/sdk-go/project.json:115-130
Versioning Policy
The CLI follows Semantic Versioning (MAJOR.MINOR.PATCH):
- MAJOR: Breaking changes.
- MINOR: New features (backward compatible).
- PATCH: Bug fixes.
Sources: PUBLISHING.md:62-68
Integration with SDKs
While the CLI is a standalone tool, its logic is closely tied to the Go SDK. For example, sandbox parameters used in the CLI often map directly to the types defined in the Go library.
The Go SDK provides the underlying structures that the CLI utilizes to communicate with the Daytona server.
Sources: libs/sdk-go/README.md:16-30, libs/sdk-go/project.json:1-15
Summary
The Daytona Command Line Interface is a critical tool for developers using the Daytona platform. It provides a robust interface for sandbox management and is supported by an automated documentation and publishing system. By enforcing strict contribution guidelines and automated testing, the project ensures the CLI remains a reliable tool for managing secure, AI-ready development environments.