config

package
v0.7.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDevVersion added in v0.7.8

func IsDevVersion(v string) bool

IsDevVersion reports whether the given ldflags-injected version string represents a non-release build. Used to pick :base-dev over :base-latest by default so `go install @main` gets a matching in-VM gocker binary.

func Save added in v0.7.0

func Save(cfg *Config) error

Save writes cfg to ~/.gocker/config.yaml, creating the directory if needed.

Types

type Config

type Config struct {
	Isolation string        `yaml:"isolation"` // full, hybrid, shared
	SharedVM  SharedVM      `yaml:"sharedVM,omitempty"`
	Compose   Subsystem     `yaml:"compose,omitempty"`
	Sandbox   SandboxConfig `yaml:"sandbox,omitempty"`
	Runtime   string        `yaml:"runtime,omitempty"`       // "container" or "nerdctl"
	Binary    string        `yaml:"runtimeBinary,omitempty"` // custom path to runtime binary

	// LegacyWorkspaceDirs accepts top-level `workspaceDirs:` for back-compat.
	// Old configs (and hand-edited ones) placed it here instead of under
	// sharedVM; Load() migrates it into SharedVM.WorkspaceDirs.
	LegacyWorkspaceDirs []string `yaml:"workspaceDirs,omitempty"`
}

Config represents ~/.gocker/config.yaml.

func Defaults

func Defaults() *Config

Defaults returns a Config with sensible defaults.

func Load

func Load() *Config

Load reads ~/.gocker/config.yaml. Returns defaults if the file doesn't exist.

func (*Config) IsolationFor

func (c *Config) IsolationFor(subsystem, cliOverride string) string

IsolationFor returns the effective isolation mode for a subsystem. Priority: CLI flag > subsystem config > global config > "full".

func (*Config) RuntimeBinary

func (c *Config) RuntimeBinary() string

RuntimeBinary returns the path to the container runtime binary.

func (*Config) SyncClaudeSession

func (c *Config) SyncClaudeSession() bool

SyncClaudeSession returns whether Claude Code sessions should be synced between host and sandbox.

type SandboxConfig

type SandboxConfig struct {
	Isolation         string `yaml:"isolation,omitempty"`
	SyncClaudeSession *bool  `yaml:"syncClaudeSession,omitempty"` // sync Claude Code sessions between host and sandbox (default: true)
}

SandboxConfig extends Subsystem with sandbox-specific settings.

type SharedVM

type SharedVM struct {
	Image         string   `yaml:"image,omitempty"`
	CPUs          int      `yaml:"cpus,omitempty"`
	Memory        string   `yaml:"memory,omitempty"`
	WorkspaceDirs []string `yaml:"workspaceDirs,omitempty"` // host dirs to mount into VM
}

SharedVM configures the persistent shared VM for hybrid/shared modes.

func (*SharedVM) EffectiveWorkspaceDirs

func (s *SharedVM) EffectiveWorkspaceDirs() []string

EffectiveWorkspaceDirs returns WorkspaceDirs or defaults to user home.

type Subsystem

type Subsystem struct {
	Isolation string `yaml:"isolation,omitempty"`
}

Subsystem allows per-subsystem isolation override.

Jump to

Keyboard shortcuts

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