config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinImages = map[string]string{
	"base":   "ghcr.io/dyluth/reactor/base:latest",
	"python": "ghcr.io/dyluth/reactor/python:latest",
	"node":   "ghcr.io/dyluth/reactor/node:latest",
	"go":     "ghcr.io/dyluth/reactor/go:latest",
}

Built-in image mappings for convenience

View Source
var BuiltinProviders = map[string]ProviderInfo{
	"claude": {
		Name:         "claude",
		DefaultImage: "ghcr.io/dyluth/reactor/base:latest",
		Mounts: []MountPoint{
			{Source: "claude", Target: "/home/claude/.claude"},
		},
	},
	"gemini": {
		Name:         "gemini",
		DefaultImage: "ghcr.io/dyluth/reactor/base:latest",
		Mounts: []MountPoint{
			{Source: "gemini", Target: "/home/claude/.gemini"},
		},
	},
}

Built-in provider mappings (hardcoded but extensible)

Functions

func CheckDependencies

func CheckDependencies() error

CheckDependencies verifies that required system dependencies are available

func FindDevContainerFile added in v1.1.0

func FindDevContainerFile(dir string) (string, bool, error)

FindDevContainerFile searches for devcontainer.json in the specified directory Search order: .devcontainer/devcontainer.json, then .devcontainer.json

func GenerateProjectHash

func GenerateProjectHash(projectRoot string) string

GenerateProjectHash creates a consistent hash for the project directory This is used to isolate configurations between different projects for the same account

func GetProjectConfigPath

func GetProjectConfigPath() string

GetProjectConfigPath returns the path to the project configuration file with optional isolation prefix

func GetReactorHomeDir

func GetReactorHomeDir() (string, error)

GetReactorHomeDir returns the reactor configuration directory path with optional isolation prefix

func GetSystemUsername

func GetSystemUsername() (string, error)

GetSystemUsername returns the current system username as default account

func ResolveImage

func ResolveImage(projectImage, providerDefault, cliImage string) string

ResolveImage determines the final container image to use based on precedence: CLI override > project config > provider default

func ValidateAccount

func ValidateAccount(account string) error

ValidateAccount validates that the account name is valid for filesystem use

func ValidateImage

func ValidateImage(image string) error

ValidateImage validates that the image specification is valid

func ValidateProvider

func ValidateProvider(provider string) error

ValidateProvider validates that the provider name is supported

Types

type Build added in v1.1.0

type Build struct {
	Dockerfile string `json:"dockerfile"`
	Context    string `json:"context"`
}

Build defines Docker build properties

type Customizations added in v1.1.0

type Customizations struct {
	Reactor *ReactorCustomizations `json:"reactor"`
}

Customizations block for tool-specific settings

type DevContainerConfig added in v1.1.0

type DevContainerConfig struct {
	Name              string          `json:"name"`
	Image             string          `json:"image"`
	Build             *Build          `json:"build"`
	ForwardPorts      []interface{}   `json:"forwardPorts"` // Can be int or string "host:container"
	RemoteUser        string          `json:"remoteUser"`
	PostCreateCommand interface{}     `json:"postCreateCommand"`
	Customizations    *Customizations `json:"customizations"`
}

DevContainerConfig represents the structure of a devcontainer.json file

func LoadDevContainerConfig added in v1.1.0

func LoadDevContainerConfig(filePath string) (*DevContainerConfig, error)

LoadDevContainerConfig loads and parses a devcontainer.json file

type MountPoint

type MountPoint struct {
	Source string // subdirectory under ~/.reactor/<account>/<project-hash>/
	Target string // path in container
}

MountPoint defines a directory mount for providers

type PortMapping added in v1.1.0

type PortMapping struct {
	HostPort      int // port on host machine
	ContainerPort int // port inside container
}

PortMapping defines a port forwarding configuration

type ProviderInfo

type ProviderInfo struct {
	Name         string       // claude, gemini
	DefaultImage string       // suggested default image
	Mounts       []MountPoint // multiple mount points for this provider
}

ProviderInfo defines built-in provider configuration

type ReactorCustomizations added in v1.1.0

type ReactorCustomizations struct {
	Account        string `json:"account"`
	DefaultCommand string `json:"defaultCommand"`
}

ReactorCustomizations defines reactor-specific settings

type ResolvedConfig

type ResolvedConfig struct {
	Provider          ProviderInfo
	Account           string
	Image             string
	ProjectRoot       string
	ProjectHash       string        // first 8 chars of project path hash
	AccountConfigDir  string        // ~/.reactor/<account>/
	ProjectConfigDir  string        // ~/.reactor/<account>/<project-hash>/
	ForwardPorts      []PortMapping // port forwarding from devcontainer.json
	RemoteUser        string        // container user from devcontainer.json
	Build             *Build        // Docker build configuration from devcontainer.json
	PostCreateCommand interface{}   // post-creation command from devcontainer.json (string or []string)
	DefaultCommand    string        // default command from reactor customizations
	Danger            bool
}

ResolvedConfig contains fully resolved configuration with all paths

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service handles configuration operations

func NewService

func NewService() *Service

NewService creates a new configuration service

func NewServiceWithRoot added in v1.1.0

func NewServiceWithRoot(projectRoot string) *Service

NewServiceWithRoot creates a new configuration service with a specific project root

func (*Service) InitializeProject

func (s *Service) InitializeProject() error

InitializeProject creates a basic devcontainer.json template

func (*Service) ListAccounts

func (s *Service) ListAccounts() error

ListAccounts scans ~/.reactor/ for existing accounts

func (*Service) ResolveConfiguration added in v1.1.0

func (s *Service) ResolveConfiguration() (*ResolvedConfig, error)

ResolveConfiguration loads and resolves configuration using the new devcontainer.json workflow

func (*Service) ShowConfiguration

func (s *Service) ShowConfiguration() error

ShowConfiguration displays the current devcontainer configuration

Jump to

Keyboard shortcuts

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