Documentation
¶
Overview ¶
Package devops provides a portable development environment using LinuxKit images.
Index ¶
- func ConfigPath() (string, error)
- func DetectServeCommand(projectDir string) string
- func DetectTestCommand(projectDir string) string
- func ImageName() string
- func ImagePath() (string, error)
- func ImagesDir() (string, error)
- type BootOptions
- type CDNConfig
- type ClaudeOptions
- type Config
- type DevOps
- func (d *DevOps) Boot(ctx context.Context, opts BootOptions) error
- func (d *DevOps) CheckUpdate(ctx context.Context) (current, latest string, hasUpdate bool, err error)
- func (d *DevOps) Claude(ctx context.Context, projectDir string, opts ClaudeOptions) error
- func (d *DevOps) CopyGHAuth(ctx context.Context) error
- func (d *DevOps) Install(ctx context.Context, progress func(downloaded, total int64)) error
- func (d *DevOps) IsInstalled() bool
- func (d *DevOps) IsRunning(ctx context.Context) (bool, error)
- func (d *DevOps) Serve(ctx context.Context, projectDir string, opts ServeOptions) error
- func (d *DevOps) Shell(ctx context.Context, opts ShellOptions) error
- func (d *DevOps) Status(ctx context.Context) (*DevStatus, error)
- func (d *DevOps) Stop(ctx context.Context) error
- func (d *DevOps) Test(ctx context.Context, projectDir string, opts TestOptions) error
- type DevStatus
- type GitHubConfig
- type ImageInfo
- type ImageManager
- type ImagesConfig
- type Manifest
- type RegistryConfig
- type ServeOptions
- type ShellOptions
- type TestCommand
- type TestConfig
- type TestOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectServeCommand ¶
DetectServeCommand auto-detects the serve command for a project.
func DetectTestCommand ¶
DetectTestCommand auto-detects the test command for a project.
Types ¶
type BootOptions ¶
type BootOptions struct {
Memory int // MB, default 4096
CPUs int // default 2
Name string // container name
Fresh bool // destroy existing and start fresh
}
BootOptions configures how to boot the dev environment.
func DefaultBootOptions ¶
func DefaultBootOptions() BootOptions
DefaultBootOptions returns sensible defaults.
type CDNConfig ¶
type CDNConfig struct {
URL string `yaml:"url"` // base URL for downloads
}
CDNConfig holds CDN/S3 configuration.
type ClaudeOptions ¶
type ClaudeOptions struct {
NoAuth bool // Don't forward any auth
Auth []string // Selective auth: "gh", "anthropic", "ssh", "git"
Model string // Model to use: opus, sonnet
}
ClaudeOptions configures the Claude sandbox session.
type Config ¶
type Config struct {
Version int `yaml:"version"`
Images ImagesConfig `yaml:"images"`
}
Config holds global devops configuration from ~/.core/config.yaml.
func LoadConfig ¶
LoadConfig loads configuration from ~/.core/config.yaml. Returns default config if file doesn't exist.
type DevOps ¶
type DevOps struct {
// contains filtered or unexported fields
}
DevOps manages the portable development environment.
func (*DevOps) Boot ¶
func (d *DevOps) Boot(ctx context.Context, opts BootOptions) error
Boot starts the dev environment.
func (*DevOps) CheckUpdate ¶
func (d *DevOps) CheckUpdate(ctx context.Context) (current, latest string, hasUpdate bool, err error)
CheckUpdate checks if an update is available.
func (*DevOps) CopyGHAuth ¶
CopyGHAuth copies GitHub CLI auth to the VM.
func (*DevOps) IsInstalled ¶
IsInstalled checks if the dev image is installed.
func (*DevOps) Shell ¶
func (d *DevOps) Shell(ctx context.Context, opts ShellOptions) error
Shell connects to the dev environment.
type DevStatus ¶
type DevStatus struct {
Installed bool
Running bool
ImageVersion string
ContainerID string
Memory int
CPUs int
SSHPort int
Uptime time.Duration
}
DevStatus returns information about the dev environment.
type GitHubConfig ¶
type GitHubConfig struct {
Repo string `yaml:"repo"` // owner/repo format
}
GitHubConfig holds GitHub Releases configuration.
type ImageInfo ¶
type ImageInfo struct {
Version string `json:"version"`
SHA256 string `json:"sha256,omitempty"`
Downloaded time.Time `json:"downloaded"`
Source string `json:"source"`
}
ImageInfo holds metadata about an installed image.
type ImageManager ¶
type ImageManager struct {
// contains filtered or unexported fields
}
ImageManager handles image downloads and updates.
func NewImageManager ¶
func NewImageManager(cfg *Config) (*ImageManager, error)
NewImageManager creates a new image manager.
func (*ImageManager) CheckUpdate ¶
func (m *ImageManager) CheckUpdate(ctx context.Context) (current, latest string, hasUpdate bool, err error)
CheckUpdate checks if an update is available.
func (*ImageManager) Install ¶
func (m *ImageManager) Install(ctx context.Context, progress func(downloaded, total int64)) error
Install downloads and installs the dev image.
func (*ImageManager) IsInstalled ¶
func (m *ImageManager) IsInstalled() bool
IsInstalled checks if the dev image is installed.
type ImagesConfig ¶
type ImagesConfig struct {
Source string `yaml:"source"` // auto, github, registry, cdn
GitHub GitHubConfig `yaml:"github,omitempty"`
Registry RegistryConfig `yaml:"registry,omitempty"`
CDN CDNConfig `yaml:"cdn,omitempty"`
}
ImagesConfig holds image source configuration.
type Manifest ¶
type Manifest struct {
Images map[string]ImageInfo `json:"images"`
// contains filtered or unexported fields
}
Manifest tracks installed images.
type RegistryConfig ¶
type RegistryConfig struct {
Image string `yaml:"image"` // e.g., ghcr.io/host-uk/core-devops
}
RegistryConfig holds container registry configuration.
type ServeOptions ¶
type ServeOptions struct {
Port int // Port to serve on (default 8000)
Path string // Subdirectory to serve (default: current dir)
}
ServeOptions configures the dev server.
type ShellOptions ¶
type ShellOptions struct {
Console bool // Use serial console instead of SSH
Command []string // Command to run (empty = interactive shell)
}
ShellOptions configures the shell connection.
type TestCommand ¶
TestCommand is a named test command.
type TestConfig ¶
type TestConfig struct {
Version int `yaml:"version"`
Command string `yaml:"command,omitempty"`
Commands []TestCommand `yaml:"commands,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
}
TestConfig holds test configuration from .core/test.yaml.
func LoadTestConfig ¶
func LoadTestConfig(projectDir string) (*TestConfig, error)
LoadTestConfig loads .core/test.yaml.
type TestOptions ¶
type TestOptions struct {
Name string // Run specific named command from .core/test.yaml
Command []string // Override command (from -- args)
}
TestOptions configures test execution.