cfg

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRegistry = "public.ecr.aws/w1l3v2k8/devcell"

DefaultRegistry is the default container registry for devcell images. Must match runner.DefaultRegistry.

Variables

This section is empty.

Functions

func ApplyEnv

func ApplyEnv(c *CellConfig, getenv func(string) string)

ApplyEnv overrides scalar fields from environment variables.

func KnownStacks added in v0.4.0

func KnownStacks() []string

KnownStacks returns the list of valid stack names.

func StackSize added in v0.4.0

func StackSize(stack string) (string, bool)

StackSize returns the approximate download size for the given stack.

func ValidateStack added in v0.4.0

func ValidateStack(stack string) error

ValidateStack checks that stack is a known stack name. Empty is valid (defaults to ultimate).

Types

type AwsSection added in v0.4.0

type AwsSection struct {
	ReadOnly *bool `toml:"read_only"` // default: true (nil = not set → true)
}

AwsSection holds [aws] config for AWS credential scoping.

func (AwsSection) ResolvedReadOnly added in v0.4.0

func (a AwsSection) ResolvedReadOnly() bool

ResolvedReadOnly returns false unless explicitly set to true.

type CellConfig

type CellConfig struct {
	Cell     CellSection
	LLM      LLMSection   `toml:"llm"`
	Git      GitSection   `toml:"git"`
	Ports    PortsSection `toml:"ports"`
	Op       OpSection    `toml:"op"`
	Aws      AwsSection   `toml:"aws"`
	Env      map[string]string
	Mise     map[string]string `toml:"mise"` // [mise] — keys map to MISE_<UPPER_KEY> env vars
	Volumes  []VolumeMount
	Packages PackagesSection
}

CellConfig is the merged configuration from all TOML layers.

func LoadFile

func LoadFile(path string) (CellConfig, error)

LoadFile parses a TOML file into CellConfig. Returns zero value + nil error if the file does not exist.

func LoadFromOS

func LoadFromOS(configDir, cwd string) CellConfig

LoadFromOS loads the layered config using real XDG paths and os.Getenv.

func LoadLayered

func LoadLayered(globalPath, projectPath string, getenv func(string) string) CellConfig

LoadLayered loads global + project files, merges them, then applies env overrides.

func Merge

func Merge(global, project CellConfig) CellConfig

Merge returns a new CellConfig with project overriding global for scalars; Env maps and Volumes slices are accumulated (project wins on key conflict).

type CellSection

type CellSection struct {
	ImageTag    string   `toml:"image_tag"`
	Registry    string   `toml:"registry"` // container registry; default: DefaultRegistry; env: DEVCELL_REGISTRY
	GUI         *bool    `toml:"gui"`      // default: true (nil = not set → true)
	Timezone    string   `toml:"timezone"` // IANA tz (e.g. "Europe/Prague"); default: host $TZ
	Locale      string   `toml:"locale"`   // POSIX locale (e.g. "en_US.UTF-8"); default: "en_US.UTF-8"
	Stack       string   `toml:"stack"`    // nix stack name (e.g. "go", "python"); default: "ultimate"
	Modules     []string `toml:"modules"`  // extra nix modules to compose on top of stack
	NixhomePath string   `toml:"nixhome"`  // local nixhome path; overridden by DEVCELL_NIXHOME_PATH env
}

CellSection holds [cell] config.

func (CellSection) ResolvedGUI added in v0.4.0

func (c CellSection) ResolvedGUI() bool

ResolvedGUI returns the effective GUI setting: true unless explicitly set to false.

func (CellSection) ResolvedRegistry added in v0.4.0

func (c CellSection) ResolvedRegistry() string

ResolvedRegistry returns the effective registry: env > toml > default.

func (CellSection) ResolvedStack added in v0.4.0

func (c CellSection) ResolvedStack() string

ResolvedStack returns Stack if set, else "base".

type GitSection added in v0.3.0

type GitSection struct {
	AuthorName     string `toml:"author_name"`
	AuthorEmail    string `toml:"author_email"`
	CommitterName  string `toml:"committer_name"`
	CommitterEmail string `toml:"committer_email"`
}

GitSection holds [git] config for git identity inside the container.

func (GitSection) HasIdentity added in v0.3.0

func (g GitSection) HasIdentity() bool

HasIdentity reports whether any git identity field is set.

func (GitSection) ResolvedCommitterEmail added in v0.3.0

func (g GitSection) ResolvedCommitterEmail() string

ResolvedCommitterEmail returns CommitterEmail if set, else falls back to AuthorEmail.

func (GitSection) ResolvedCommitterName added in v0.3.0

func (g GitSection) ResolvedCommitterName() string

ResolvedCommitterName returns CommitterName if set, else falls back to AuthorName.

type LLMModelsSection added in v0.3.0

type LLMModelsSection struct {
	Default   string                 `toml:"default"`
	Providers map[string]LLMProvider `toml:"providers"`
}

LLMModelsSection holds [llm.models] config — provider/model declarations.

type LLMProvider added in v0.2.0

type LLMProvider struct {
	BaseURL string   `toml:"base_url"`
	Models  []string `toml:"models"`
}

LLMProvider holds a single provider entry under [llm.models.providers.<name>].

type LLMSection added in v0.3.0

type LLMSection struct {
	SystemPrompt string           `toml:"system_prompt"`
	UseOllama    bool             `toml:"use_ollama"`
	Models       LLMModelsSection `toml:"models"`
}

LLMSection holds [llm] config — all AI agent settings in one place.

type OpSection added in v0.3.0

type OpSection struct {
	Documents []string `toml:"documents"` // 1Password document names to resolve via `op item get`
	Items     []string `toml:"items"`     // deprecated: use documents (kept for backwards compat)
}

OpSection holds [op] config for 1Password secret injection.

func (OpSection) ResolvedDocuments added in v0.4.0

func (o OpSection) ResolvedDocuments() []string

ResolvedDocuments returns the merged list of documents + legacy items (deduped).

type PackagesSection

type PackagesSection struct {
	Npm    map[string]string `toml:"npm"`
	Python map[string]string `toml:"python"`
}

PackagesSection holds [packages] config for npm and python tools.

type PortsSection added in v0.4.0

type PortsSection struct {
	Forward []string `toml:"forward"` // port mappings: "3000", "8080:3000"
}

PortsSection holds [ports] config for port forwarding.

type VolumeMount

type VolumeMount struct {
	Mount string `toml:"mount"`
}

VolumeMount holds a single [[volumes]] entry.

Jump to

Keyboard shortcuts

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