cmd

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 63 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

DevxConfig is the root devx.yaml schema.

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

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

DevxConfigService defines a developer application in devx.yaml.

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