devops

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: EUPL-1.2 Imports: 13 Imported by: 0

Documentation

Overview

Package devops provides a portable development environment using LinuxKit images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns the path to the config file.

func DetectServeCommand

func DetectServeCommand(projectDir string) string

DetectServeCommand auto-detects the serve command for a project.

func DetectTestCommand

func DetectTestCommand(projectDir string) string

DetectTestCommand auto-detects the test command for a project.

func ImageName

func ImageName() string

ImageName returns the platform-specific image name.

func ImagePath

func ImagePath() (string, error)

ImagePath returns the full path to the platform-specific image.

func ImagesDir

func ImagesDir() (string, error)

ImagesDir returns the path to the images directory.

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 DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns sensible defaults.

func LoadConfig

func LoadConfig() (*Config, error)

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 New

func New() (*DevOps, error)

New creates a new DevOps instance.

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

func (d *DevOps) Claude(ctx context.Context, projectDir string, opts ClaudeOptions) error

Claude starts a sandboxed Claude session in the dev environment.

func (*DevOps) CopyGHAuth

func (d *DevOps) CopyGHAuth(ctx context.Context) error

CopyGHAuth copies GitHub CLI auth to the VM.

func (*DevOps) Install

func (d *DevOps) Install(ctx context.Context, progress func(downloaded, total int64)) error

Install downloads and installs the dev image.

func (*DevOps) IsInstalled

func (d *DevOps) IsInstalled() bool

IsInstalled checks if the dev image is installed.

func (*DevOps) IsRunning

func (d *DevOps) IsRunning(ctx context.Context) (bool, error)

IsRunning checks if the dev environment is running.

func (*DevOps) Serve

func (d *DevOps) Serve(ctx context.Context, projectDir string, opts ServeOptions) error

Serve mounts the project and starts a dev server.

func (*DevOps) Shell

func (d *DevOps) Shell(ctx context.Context, opts ShellOptions) error

Shell connects to the dev environment.

func (*DevOps) Status

func (d *DevOps) Status(ctx context.Context) (*DevStatus, error)

Status returns the current dev environment status.

func (*DevOps) Stop

func (d *DevOps) Stop(ctx context.Context) error

Stop stops the dev environment.

func (*DevOps) Test

func (d *DevOps) Test(ctx context.Context, projectDir string, opts TestOptions) error

Test runs tests in 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.

func (*Manifest) Save

func (m *Manifest) Save() error

Save writes the manifest to disk.

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

type TestCommand struct {
	Name string `yaml:"name"`
	Run  string `yaml:"run"`
}

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.

Directories

Path Synopsis
Package sources provides image download sources for core-devops.
Package sources provides image download sources for core-devops.

Jump to

Keyboard shortcuts

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