cmd

package
v0.67.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 77 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DetailedOutput bool
View Source
var DryRun bool
View Source
var Experimental bool

Experimental is set by --experimental; together with the DEVX_EXPERIMENTAL env var it unlocks the Tier-3 / alpha commands that ride brittle third-party tools, so the GA core's reliability isn't diluted by them being invoked by accident. See docs/analysis/feature_maturity_analysis.md.

View Source
var NonInteractive bool

Functions

func Execute

func Execute()

func GenerateMermaid added in v0.25.0

func GenerateMermaid(cfg DevxConfig) string

GenerateMermaid produces a Mermaid flowchart string from a DevxConfig.

func GetRootCmd added in v0.35.0

func GetRootCmd() *cobra.Command

Types

type DevxConfig added in v0.2.4

type DevxConfig struct {
	Name          string                            `yaml:"name"`                 // Project name
	Domain        string                            `yaml:"domain"`               // Custom domain (BYOD)
	Kubeconfig    string                            `yaml:"kubeconfig,omitempty"` // KUBECONFIG to inject into run/action child commands
	Env           []string                          `yaml:"env"`                  // Vault sources for secret injection
	Include       []DevxConfigInclude               `yaml:"include"`              // External devx.yaml files to compose (Idea 44)
	Tunnels       []DevxConfigTunnel                `yaml:"tunnels"`              // List of ports to expose
	Databases     []DevxConfigDatabase              `yaml:"databases"`            // List of databases to provision
	Services      []DevxConfigService               `yaml:"services"`             // List of applications to orchestrate
	Test          DevxConfigTest                    `yaml:"test"`                 // Test configuration
	Mocks         []DevxConfigMock                  `yaml:"mocks"`                // List of OpenAPI mock servers to provision
	Profiles      map[string]DevxConfigProfile      `yaml:"profiles"`             // Named environment overlays
	Pipeline      *DevxConfigPipeline               `yaml:"pipeline"`             // Explicit pipeline stages (Idea 45.2)
	CustomActions map[string]DevxConfigCustomAction `yaml:"customActions"`        // Named tasks (scaffolded for Idea 45.3)
	Bridge        *DevxConfigBridge                 `yaml:"bridge"`               // Hybrid edge-to-local routing (Idea 46.1)
	State         *DevxConfigState                  `yaml:"state"`                // State replication settings (Idea 56)
	Telemetry     *DevxConfigTelemetry              `yaml:"telemetry"`            // Telemetry export endpoints
	Cron          []DevxConfigCron                  `yaml:"cron"`                 // Named cron jobs runnable via `devx cron run` (Idea 66)
	Logs          *bool                             `yaml:"logs,omitempty"`       // default log-streaming opt-in for all services
}

DevxConfig is the root devx.yaml schema.

type DevxConfigBridge added in v0.32.0

type DevxConfigBridge struct {
	Kubeconfig string                      `yaml:"kubeconfig"`  // Path to kubeconfig (default: ~/.kube/config)
	Context    string                      `yaml:"context"`     // Kube context to use
	Namespace  string                      `yaml:"namespace"`   // Default namespace for targets
	AgentImage string                      `yaml:"agent_image"` // Override agent container image (Idea 46.2)
	Targets    []DevxConfigBridgeTarget    `yaml:"targets"`     // Outbound: remote services to bridge (46.1)
	Intercepts []DevxConfigBridgeIntercept `yaml:"intercepts"`  // Inbound: traffic intercept targets (46.2)
}

DevxConfigBridge defines the hybrid edge-to-local routing configuration (Idea 46). Enables developers to connect their local environment to remote K8s services via kubectl port-forward, following the "Client-Driven Architecture" principle.

type DevxConfigBridgeIntercept added in v0.32.0

type DevxConfigBridgeIntercept struct {
	Service   string `yaml:"service"`    // K8s service to intercept
	Namespace string `yaml:"namespace"`  // Override namespace (default: bridge.namespace)
	Port      int    `yaml:"port"`       // Remote service port to intercept
	LocalPort int    `yaml:"local_port"` // Local port to route traffic to (default: same as port)
	Mode      string `yaml:"mode"`       // "steal" or "mirror" (required)
}

DevxConfigBridgeIntercept defines an inbound traffic intercept target (Idea 46.2).

type DevxConfigBridgeTarget added in v0.32.0

type DevxConfigBridgeTarget struct {
	Service   string `yaml:"service"`    // K8s service name (e.g., "payments-api")
	Namespace string `yaml:"namespace"`  // K8s namespace (default: from bridge.namespace)
	Port      int    `yaml:"port"`       // Remote service port to forward
	LocalPort int    `yaml:"local_port"` // Local port to bind (0 = auto)
}

DevxConfigBridgeTarget defines a remote K8s service to bridge locally (Idea 46.1).

type DevxConfigContainerBuild added in v0.56.0

type DevxConfigContainerBuild struct {
	Context    string   `yaml:"context,omitempty"`    // build context dir (default ".")
	Dockerfile string   `yaml:"dockerfile,omitempty"` // Dockerfile path relative to context (default "Dockerfile")
	Tag        string   `yaml:"tag,omitempty"`        // image tag (default "dev")
	Platforms  []string `yaml:"platforms,omitempty"`  // target platforms; empty = builder default
}

DevxConfigContainerBuild describes how to build a runtime: container image from a local build context (compose-style `build:`). Reuses the same shape as kubernetes.images but without a Name (the image is local, tagged after the service).

type DevxConfigCron added in v0.46.0

type DevxConfigCron struct {
	Name        string            `yaml:"name"`                  // Unique identifier (e.g. "nightly-cleanup")
	Schedule    string            `yaml:"schedule"`              // Cron expression (informational in v1)
	Command     []string          `yaml:"command"`               // Argv to execute (e.g. ["node", "scripts/cleanup.js"])
	Description string            `yaml:"description,omitempty"` // Free-text purpose; surfaced in `devx cron list`
	Timeout     string            `yaml:"timeout,omitempty"`     // Go-duration string (e.g. "5m"); empty = no timeout
	Env         map[string]string `yaml:"env,omitempty"`         // Per-job env vars, merged on top of project env
}

DevxConfigCron defines a named scheduled task. The Schedule field is informational in v1 — `devx cron run <name>` is one-shot and does not start a long-running scheduler. Use it to document the production cadence so the local-test environment stays grounded in reality.

type DevxConfigCustomAction added in v0.30.0

type DevxConfigCustomAction struct {
	Command  []string   `yaml:"command,omitempty"`
	Commands [][]string `yaml:"commands,omitempty"`
}

DevxConfigCustomAction defines a named, on-demand task (scaffolded for Idea 45.3).

func (*DevxConfigCustomAction) Cmds added in v0.31.0

func (ca *DevxConfigCustomAction) Cmds() [][]string

Cmds returns the resolved command list, preferring 'commands' over 'command'.

type DevxConfigDatabase added in v0.4.1

type DevxConfigDatabase struct {
	Engine string                 `yaml:"engine"`
	Port   int                    `yaml:"port"`
	Pull   DevxConfigDatabasePull `yaml:"pull"`
	Seed   DevxConfigDatabaseSeed `yaml:"seed"`
	Dir    string                 `yaml:"-"` // Internal: set by include resolver to the included project's dir
}

DevxConfigDatabase defines a local database to provision.

type DevxConfigDatabasePull added in v0.29.0

type DevxConfigDatabasePull struct {
	Command string `yaml:"command"` // Command that writes a dump to stdout
	Format  string `yaml:"format"`  // "custom" for pg_restore binary format (postgres only)
	Jobs    int    `yaml:"jobs"`    // Parallel workers for pg_restore (default: num CPUs)
}

DevxConfigDatabasePull defines how to pull production data into the local database.

type DevxConfigDatabaseSeed added in v0.29.0

type DevxConfigDatabaseSeed struct {
	Command string `yaml:"command"` // Command to run on the host to seed the database
}

DevxConfigDatabaseSeed defines the seed command for a database.

type DevxConfigDependsOn added in v0.25.0

type DevxConfigDependsOn struct {
	Name      string `yaml:"name"`
	Condition string `yaml:"condition"` // "service_healthy", "service_started", or "service_completed_successfully" (one-shot tasks)
}

DevxConfigDependsOn references a service/database dependency with a gating condition.

type DevxConfigHealthcheck added in v0.25.0

type DevxConfigHealthcheck struct {
	HTTP     string `yaml:"http"`     // HTTP endpoint to poll (e.g., "http://localhost:8080/health")
	TCP      string `yaml:"tcp"`      // TCP address to probe (e.g., "localhost:5432")
	Interval string `yaml:"interval"` // Duration string (e.g., "1s", "500ms")
	Timeout  string `yaml:"timeout"`  // Duration string (e.g., "30s")
	Retries  int    `yaml:"retries"`  // Number of consecutive successes required
}

DevxConfigHealthcheck defines how to verify a service is ready.

type DevxConfigInclude added in v0.29.0

type DevxConfigInclude struct {
	Path    string `yaml:"path"`     // Path to devx.yaml file (relative to the parent devx.yaml)
	EnvFile string `yaml:"env_file"` // Optional: override .env for this sub-project
}

DevxConfigInclude defines an external devx.yaml to compose into this project (Idea 44).

type DevxConfigKubernetesImage added in v0.49.0

type DevxConfigKubernetesImage struct {
	Name       string   `yaml:"name"`                 // image name (becomes localhost:<port>/<name>:<tag>)
	Context    string   `yaml:"context,omitempty"`    // build context dir (default ".")
	Dockerfile string   `yaml:"dockerfile,omitempty"` // Dockerfile path relative to context (default "Dockerfile")
	Tag        string   `yaml:"tag,omitempty"`        // image tag (default "dev")
	Platforms  []string `yaml:"platforms,omitempty"`  // target platforms, e.g. [linux/amd64, linux/arm64]; empty = builder default
}

DevxConfigKubernetesImage declares an image devx builds and loads into the cluster's in-cluster registry before applying manifests (runtime: kubernetes). The built image is pushed as localhost:<NodePort>/<name>:<tag> — reference exactly that in your manifests, with imagePullPolicy: Always.

type DevxConfigKubernetesSync added in v0.51.0

type DevxConfigKubernetesSync struct {
	Src       string `yaml:"src"`                 // local source dir (relative to the service dir)
	Dest      string `yaml:"dest"`                // destination path inside the pod
	Selector  string `yaml:"selector"`            // pod label selector, e.g. "app=brms-offer"
	Container string `yaml:"container,omitempty"` // container in the pod (default: first)
}

DevxConfigKubernetesSync maps a local directory to a path inside the deployed pod for live-reload: devx copies it in after deploy and re-copies on change, so an in-pod watcher (tsx watch, nodemon, ...) hot-reloads.

type DevxConfigMock added in v0.23.0

type DevxConfigMock struct {
	Name string `yaml:"name"` // Friendly name (becomes env var MOCK_<NAME>_URL)
	URL  string `yaml:"url"`  // Remote OpenAPI spec URL (must be http:// or https://)
	Port int    `yaml:"port"` // Host port (0 = auto-assign a free port)
}

DevxConfigMock defines a remote OpenAPI-backed mock server entry.

type DevxConfigPipeline added in v0.30.0

type DevxConfigPipeline struct {
	Test   *DevxConfigPipelineStage `yaml:"test,omitempty"`
	Lint   *DevxConfigPipelineStage `yaml:"lint,omitempty"`
	Build  *DevxConfigPipelineStage `yaml:"build,omitempty"`
	Verify *DevxConfigPipelineStage `yaml:"verify,omitempty"`
}

DevxConfigPipeline declares optional explicit pipeline stage overrides. When present, auto-detection via DetectStack is bypassed entirely ("Explicit Wins").

type DevxConfigPipelineStage added in v0.30.0

type DevxConfigPipelineStage struct {
	Command  []string   `yaml:"command,omitempty"`  // Single command shorthand
	Commands [][]string `yaml:"commands,omitempty"` // Multi-command sequential execution
	Before   [][]string `yaml:"before,omitempty"`   // Pre-stage hooks (Idea 45.3)
	After    [][]string `yaml:"after,omitempty"`    // Post-stage hooks (Idea 45.3)
}

DevxConfigPipelineStage defines a single pipeline step (test, lint, build, verify). The Before/After hooks are scaffolded for Idea 45.3 — parsed and validated but not executed in 45.2.

func (*DevxConfigPipelineStage) Cmds added in v0.30.0

func (ps *DevxConfigPipelineStage) Cmds() [][]string

Cmds returns the resolved command list, preferring 'commands' over 'command'.

type DevxConfigProfile added in v0.25.0

type DevxConfigProfile struct {
	Databases []DevxConfigDatabase `yaml:"databases"`
	Tunnels   []DevxConfigTunnel   `yaml:"tunnels"`
	Services  []DevxConfigService  `yaml:"services"`
	Mocks     []DevxConfigMock     `yaml:"mocks"`
	Bridge    *DevxConfigBridge    `yaml:"bridge"` // Idea 46.1: override bridge config per profile
	Telemetry *DevxConfigTelemetry `yaml:"telemetry"`
}

DevxConfigProfile defines a named overlay that merges additively onto the base config. Follows Docker Compose override semantics: matching names merge fields (profile wins), new entries are appended.

type DevxConfigService added in v0.25.0

type DevxConfigService struct {
	Name            string                            `yaml:"name"`
	Runtime         string                            `yaml:"runtime"`    // "host" (default), "container", "kubernetes", "cloud", "bridge"
	Command         []string                          `yaml:"command"`    // e.g. ["npm", "run", "dev"]
	DependsOn       []DevxConfigDependsOn             `yaml:"depends_on"` // services/databases that must be healthy first
	Healthcheck     DevxConfigHealthcheck             `yaml:"healthcheck"`
	Port            int                               `yaml:"port"`
	Env             map[string]string                 `yaml:"env"`                        // extra env vars
	OneShot         bool                              `yaml:"oneshot,omitempty"`          // run-to-completion task (e.g. a seed); dependents use condition: service_completed_successfully
	Sync            []DevxConfigSync                  `yaml:"sync,omitempty"`             // file sync mappings into containers
	BridgeTarget    *DevxConfigServiceBridgeTarget    `yaml:"bridge_target,omitempty"`    // Idea 46.3: inline outbound bridge
	BridgeIntercept *DevxConfigServiceBridgeIntercept `yaml:"bridge_intercept,omitempty"` // Idea 46.3: inline intercept
	Kubernetes      *DevxConfigServiceKubernetes      `yaml:"kubernetes,omitempty"`       // runtime: kubernetes deploy spec
	CloudRun        *DevxConfigServiceCloudRun        `yaml:"cloud_run,omitempty"`        // runtime: cloud (Cloud Run) deploy spec
	Container       *DevxConfigServiceContainer       `yaml:"container,omitempty"`        // runtime: container deploy spec
	Dir             string                            `yaml:"-"`                          // Internal: working directory (set by include resolver)
	Logs            *bool                             `yaml:"logs,omitempty"`             // per-service log-streaming opt-in (overrides top-level)
}

DevxConfigService defines a developer application in devx.yaml.

type DevxConfigServiceBridgeIntercept added in v0.32.0

type DevxConfigServiceBridgeIntercept struct {
	Service   string `yaml:"service"`    // K8s service to intercept
	Namespace string `yaml:"namespace"`  // Override namespace (default: bridge.namespace)
	Port      int    `yaml:"port"`       // Remote service port
	LocalPort int    `yaml:"local_port"` // Local port to route traffic to
	Mode      string `yaml:"mode"`       // "steal" or "mirror" (required)
}

DevxConfigServiceBridgeIntercept defines an inline bridge intercept on a service (Idea 46.3).

type DevxConfigServiceBridgeTarget added in v0.32.0

type DevxConfigServiceBridgeTarget struct {
	Service   string `yaml:"service"`    // K8s service name
	Namespace string `yaml:"namespace"`  // Override namespace (default: bridge.namespace)
	Port      int    `yaml:"port"`       // Remote service port
	LocalPort int    `yaml:"local_port"` // Local port to bind (0 = auto)
}

DevxConfigServiceBridgeTarget defines an inline bridge connect target on a service (Idea 46.3).

type DevxConfigServiceCloudRun added in v0.52.0

type DevxConfigServiceCloudRun struct {
	Image                string            `yaml:"image"`                           // container image to deploy (required)
	Service              string            `yaml:"service,omitempty"`               // Cloud Run service name (default: the service name)
	Region               string            `yaml:"region"`                          // GCP region, e.g. "us-central1" (required)
	Project              string            `yaml:"project"`                         // GCP project ID (required)
	Env                  map[string]string `yaml:"env,omitempty"`                   // env vars set on the service
	AllowUnauthenticated bool              `yaml:"allow_unauthenticated,omitempty"` // expose publicly (default: false)
	Flags                []string          `yaml:"flags,omitempty"`                 // extra `gcloud run deploy` flags (escape hatch)
}

DevxConfigServiceCloudRun configures a runtime: cloud service — devx deploys the image to Google Cloud Run via `gcloud run deploy`. project, region, and image are required (there is no implicit default project).

type DevxConfigServiceContainer added in v0.56.0

type DevxConfigServiceContainer struct {
	Image string                    `yaml:"image,omitempty"` // pre-built image to run (mutually exclusive with build)
	Build *DevxConfigContainerBuild `yaml:"build,omitempty"` // build from local context (mutually exclusive with image)
	Args  []string                  `yaml:"args,omitempty"`  // extra flags appended to `<runtime> run`
}

DevxConfigServiceContainer defines a runtime: container service — a long-lived container devx runs in the VM. Exactly one of Image or Build must be set.

type DevxConfigServiceKubernetes added in v0.48.0

type DevxConfigServiceKubernetes struct {
	Manifests   string                      `yaml:"manifests"`              // kustomize dir (default), raw manifest file/dir, or helm chart
	Renderer    string                      `yaml:"renderer,omitempty"`     // "kustomize" (default) | "raw" | "helm"
	Namespace   string                      `yaml:"namespace,omitempty"`    // target namespace (default: "default")
	Context     string                      `yaml:"context,omitempty"`      // kube context (default: current context)
	Kubeconfig  string                      `yaml:"kubeconfig,omitempty"`   // kubeconfig path (default: $KUBECONFIG or ~/.kube/config)
	Images      []DevxConfigKubernetesImage `yaml:"images,omitempty"`       // images devx builds + loads into the cluster registry before apply
	Release     string                      `yaml:"release,omitempty"`      // helm release name (renderer: helm; default: service name)
	Values      []string                    `yaml:"values,omitempty"`       // helm values files (renderer: helm)
	Sync        []DevxConfigKubernetesSync  `yaml:"sync,omitempty"`         // live-reload: local dirs synced into the deployed pod
	PortForward bool                        `yaml:"port_forward,omitempty"` // auto-discover Services and forward them to localhost
}

DevxConfigServiceKubernetes configures a runtime: kubernetes service — devx renders the manifests and applies them to the target cluster (skaffold-class deploy). Cluster targeting (kubeconfig/context) falls back to KUBECONFIG, then ~/.kube/config.

type DevxConfigState added in v0.38.0

type DevxConfigState struct {
	Relay string `yaml:"relay"` // Upload destination: s3://... or gs://...
}

DevxConfigState defines state sharing/replication settings.

type DevxConfigSync added in v0.28.0

type DevxConfigSync struct {
	Container string   `yaml:"container"` // Target container name (e.g., "my-api")
	Src       string   `yaml:"src"`       // Host source path (relative to devx.yaml)
	Dest      string   `yaml:"dest"`      // Container destination path
	Ignore    []string `yaml:"ignore"`    // Additional ignore patterns (on top of defaults)
}

DevxConfigSync defines a host→container file sync mapping powered by Mutagen. This bypasses slow VirtioFS volume mounts for instant hot-reload.

type DevxConfigTelemetry added in v0.43.1

type DevxConfigTelemetry struct {
	GrafanaURL   string `yaml:"grafana_url"`
	OtlpEndpoint string `yaml:"otlp_endpoint"`
}

DevxConfigTelemetry configures telemetry endpoints.

type DevxConfigTest added in v0.23.0

type DevxConfigTest struct {
	UI DevxConfigTestUI `yaml:"ui"`
}

DevxConfigTest holds test configuration.

type DevxConfigTestUI added in v0.23.0

type DevxConfigTestUI struct {
	Setup   string `yaml:"setup"`   // Pre-processing steps (e.g., migrations) to run before tests
	Command string `yaml:"command"` // The actual test command to execute
}

DevxConfigTestUI defines end-to-end test orchestration settings.

type DevxConfigTunnel added in v0.2.4

type DevxConfigTunnel struct {
	Name      string `yaml:"name"`       // Subdomain explicitly requested
	Port      int    `yaml:"port"`       // Local port to forward traffic towards
	BasicAuth string `yaml:"basic_auth"` // basic auth literal value 'user:pass'
	Throttle  string `yaml:"throttle"`   // traffic shaping profile e.g. '3g'
}

DevxConfigTunnel configures a Cloudflare tunnel to expose a local port.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL