cmd

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 66 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DetailedOutput bool
View Source
var DryRun bool
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.

Types

type DevxConfig added in v0.2.4

type DevxConfig struct {
	Name          string                            `yaml:"name"`          // Project name
	Domain        string                            `yaml:"domain"`        // Custom domain (BYOD)
	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)
}

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 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" or "service_started"
}

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 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
}

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
	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
	Dir             string                            `yaml:"-"`                          // Internal: working directory (set by include resolver)
}

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 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 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.

Jump to

Keyboard shortcuts

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