config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2025 License: MIT Imports: 8 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 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 SaveProjectConfig

func SaveProjectConfig(config *ProjectConfig, configPath string) error

SaveProjectConfig saves a ProjectConfig to the specified path

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 ValidateProjectConfig

func ValidateProjectConfig(config *ProjectConfig) error

ValidateProjectConfig validates a ProjectConfig struct

func ValidateProvider

func ValidateProvider(provider string) error

ValidateProvider validates that the provider name is supported

Types

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 ProjectConfig

type ProjectConfig struct {
	Provider string `yaml:"provider"`         // claude, gemini, or custom
	Account  string `yaml:"account"`          // account name for isolation
	Image    string `yaml:"image"`            // base, python, go, or custom image URL
	Danger   bool   `yaml:"danger,omitempty"` // enable dangerous permissions
}

ProjectConfig represents the project-level configuration stored in .reactor.conf

func CreateDefaultProjectConfig

func CreateDefaultProjectConfig() (*ProjectConfig, error)

CreateDefaultProjectConfig creates a ProjectConfig with sensible defaults

func LoadProjectConfig

func LoadProjectConfig(configPath string) (*ProjectConfig, error)

LoadProjectConfig loads and parses the .reactor.conf file

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 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>/
	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 (*Service) GetConfigValue

func (s *Service) GetConfigValue(key string) (interface{}, error)

GetConfigValue retrieves a configuration value by key

func (*Service) InitializeProject

func (s *Service) InitializeProject() error

InitializeProject creates a new .reactor.conf with defaults and sets up directories

func (*Service) ListAccounts

func (s *Service) ListAccounts() error

ListAccounts scans ~/.reactor/ for existing accounts

func (*Service) LoadConfiguration

func (s *Service) LoadConfiguration(cliProvider, cliAccount, cliImage string, cliDanger bool) (*ResolvedConfig, error)

LoadConfiguration loads and resolves the complete configuration

func (*Service) SetConfigValue

func (s *Service) SetConfigValue(key, value string) error

SetConfigValue sets a configuration value by key

func (*Service) ShowConfiguration

func (s *Service) ShowConfiguration() error

ShowConfiguration displays the current configuration with directory paths

Jump to

Keyboard shortcuts

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