cli-local-build
$
npx mdskill add kurtosis-tech/kurtosis/cli-local-buildCompile and test the Kurtosis CLI locally for rapid iteration.
- Enables developers to build binaries without creating releases.
- Requires Go 1.23+ and integrates with Docker or Kubernetes engines.
- Executes commands using the full path to prevent system conflicts.
- Outputs command execution logs and test results directly to the console.
SKILL.md
.github/skills/cli-local-buildView on GitHub ↗
---
name: cli-local-build
description: Build and test the Kurtosis CLI from source. Compile the CLI binary locally, run it against Docker or Kubernetes engines, and iterate on CLI changes without creating a release. Use when developing or debugging CLI commands.
compatibility: Requires Go 1.23+.
metadata:
author: ethpandaops
version: "1.0"
---
# CLI Local Build
Build and test the Kurtosis CLI from source for local development.
## Quick build
```bash
# Build the CLI binary
go build -o /tmp/kurtosis ./cli/cli/
# Verify it works
/tmp/kurtosis version
```
## Using the local CLI
The locally built CLI works exactly like the installed one. Use the full path to avoid conflicts with the system-installed `kurtosis`:
```bash
# Start engine
/tmp/kurtosis engine start
# Run a package
/tmp/kurtosis run github.com/ethpandaops/ethereum-package
# Clean up
/tmp/kurtosis clean -a
# Stop engine
/tmp/kurtosis engine stop
```
## Switching between Docker and Kubernetes
```bash
# Check current cluster setting
/tmp/kurtosis cluster get
# Switch to Docker
/tmp/kurtosis cluster set docker
# Switch to Kubernetes (uses current kubectl context)
/tmp/kurtosis cluster set kubernetes
# Restart engine after switching
/tmp/kurtosis engine restart
# Verify engine is running on the expected backend
/tmp/kurtosis engine status
/tmp/kurtosis cluster get
```
## Build with race detector
For debugging concurrency issues:
```bash
go build -race -o /tmp/kurtosis ./cli/cli/
```
## Running tests
```bash
# Run CLI command tests
go test ./cli/cli/commands/...
# Run a specific test
go test -run TestName ./cli/cli/commands/...
# Run with verbose output
go test -v ./cli/cli/commands/...
```
## Key source locations
| Component | Path |
|-----------|------|
| CLI entry point | `cli/cli/main.go` |
| CLI commands | `cli/cli/commands/` |
| Engine launcher | `engine/launcher/` |
| API container launcher | `core/launcher/` |
| Container engine abstraction | `container-engine-lib/` |
| gRPC API definitions | `api/protobuf/` |
| Version constant | `kurtosis_version/kurtosis_version.go` |
## Module dependency order
The monorepo has multiple Go modules. If you change a dependency, rebuild in order:
```
container-engine-lib
→ contexts-config-store
→ grpc-file-transfer
→ name-generator
→ api
→ metrics-library
→ engine
→ core
→ cli
```
Most CLI-only changes just need `go build ./cli/cli/`.
## Common issues
- **`go build` fails with import errors**: Run `go mod tidy` in the failing module directory
- **CLI shows wrong version**: The version comes from `kurtosis_version/kurtosis_version.go` — it's compiled into the binary
- **Engine image mismatch**: The CLI pulls engine images matching its compiled version. For dev testing with custom images, see the `k8s-dev-deploy` skill
More from kurtosis-tech/kurtosis
- cluster-manageManage Kurtosis cluster settings. Switch between Docker and Kubernetes backends, list available clusters, and configure which cluster Kurtosis uses. Use when you need to change where Kurtosis runs enclaves.
- context-manageManage Kurtosis contexts for connecting to different Kurtosis instances. Add, list, switch, and remove contexts. Use when working with multiple Kurtosis environments (local, remote, team shared).
- docker-debugDebug Kurtosis running on local Docker. Inspect engine, API container, and service logs. Diagnose container crashes, port conflicts, and networking issues. Use when kurtosis commands fail or services aren't reachable on Docker.
- docker-local-buildBuild and test Kurtosis from source on local Docker. Compiles all components (engine, core, files-artifacts-expander), builds Docker images, installs the CLI, and restarts the engine. Use when developing Kurtosis and testing changes locally with Docker.
- dumpDump Kurtosis state for debugging and sharing. Export enclave state including service logs, configurations, and file artifacts to a local directory. Use when you need to capture state for offline analysis or to share with others for debugging.
- enclave-inspectInspect and manage Kurtosis enclaves. List enclaves, view services and ports, examine file artifacts, dump enclave state for debugging, and clean up. Use when you need to understand what's running inside an enclave or export its state.
- engine-manageManage the Kurtosis engine server. Start, stop, restart the engine, check status, and view engine logs. Covers both Docker and Kubernetes engine backends. Use when the engine won't start, needs restarting, or you need to check engine health.
- files-inspectInspect, download, upload, and debug Kurtosis file artifacts. View artifacts in an enclave, download them locally for inspection, upload local files, and troubleshoot file mounting issues. Use when services can't find expected files or configs are wrong.
- gatewayStart and manage the Kurtosis gateway for Kubernetes. The gateway forwards local ports to the Kurtosis engine and services running in a k8s cluster. Required when using Kurtosis with Kubernetes. Use when kurtosis engine status shows nothing on k8s or services aren't reachable.
- graflokiStart Grafana and Loki for centralized log collection from Kurtosis enclaves. View aggregated service logs in a Grafana dashboard. Use when you need a UI for browsing logs across multiple services or want persistent log storage.