config

import "github.com/jbcom/radioactive-ralph/internal/config"

Package config loads radioactive-ralph’s per-repo TOML configuration and produces a resolved view that the runtime consumes.

Two files live under .radioactive-ralph/ in every repo that uses Ralph:

  • config.toml (committed) — provider bindings, per-variant overrides, and service-wide defaults.

  • local.toml (gitignored) — operator-specific overrides that don’t belong in git: local binary overrides, log verbosity, etc.

The config package only parses and validates. Applying variant defaults and provider bindings happens at runtime boot.

Index

Constants

Filename constants for the per-repo config directory.

const (
    // Dir is the directory under the repo root.
    Dir = ".radioactive-ralph"

    // ConfigFile is committed.
    ConfigFile = "config.toml"

    // LocalFile is gitignored; per-operator overrides.
    LocalFile = "local.toml"

    // GitignoreFile inside Dir pins what ralph init appended so we can
    // tell apart operator edits from generated lines on ralph init --refresh.
    GitignoreFile = ".gitignore"
)

Variables

Errors returned by the config package.

var (
    // ErrMissingConfig is returned when the caller expects a config file
    // to exist but it doesn't. Use IsMissingConfig to check.
    ErrMissingConfig = errors.New("config: .radioactive-ralph/config.toml not found; run `radioactive_ralph init` first")

    // ErrMissingLocal is returned when the caller expects a local.toml
    // and it doesn't exist (typical case: teammate cloned the repo and
    // hasn't run `radioactive_ralph init --local-only` yet).
    ErrMissingLocal = errors.New("config: .radioactive-ralph/local.toml not found; run `radioactive_ralph init --local-only` to create it")
)

func IsMissingConfig

func IsMissingConfig(err error) bool

IsMissingConfig reports whether err indicates a missing config.toml.

func IsMissingLocal

func IsMissingLocal(err error) bool

IsMissingLocal reports whether err indicates a missing local.toml.

func LocalPath

func LocalPath(repoRoot string) string

LocalPath returns the absolute path to local.toml for repoRoot.

func Path

func Path(repoRoot string) string

Path returns the absolute path to config.toml for repoRoot.

type File

File represents the shape of config.toml. Every section is optional so that a fresh `radioactive_ralph init` can emit minimal files and iterate.

type File struct {
    Service         Service                 `toml:"service"`
    DefaultProvider string                  `toml:"default_provider"`
    Providers       map[string]ProviderFile `toml:"providers"`
    Variants        map[string]VariantFile  `toml:"variants"`
}

func Load

func Load(repoRoot string) (File, error)

Load parses the per-repo config file(s) under repoRoot/.radioactive-ralph/. It returns ErrMissingConfig if config.toml is absent.

type Local

Local is the shape of local.toml (gitignored per-operator preferences). Keeping it minimal on purpose — everything else belongs in config.toml.

type Local struct {
    LogLevel       string `toml:"log_level"`
    ProviderBinary string `toml:"provider_binary"`
}

func LoadLocal

func LoadLocal(repoRoot string) (Local, error)

LoadLocal parses the local.toml file under repoRoot/.radioactive-ralph/. Returns ErrMissingLocal if absent; callers can decide whether to treat that as fatal or fall through to committed service defaults.

type ProviderFile

ProviderFile declares how one named provider is invoked. The shape is intentionally generic.

type ProviderFile struct {
    Type                  string   `toml:"type"`
    Binary                string   `toml:"binary"`
    Args                  []string `toml:"args"`
    HaikuModel            string   `toml:"haiku_model"`
    SonnetModel           string   `toml:"sonnet_model"`
    OpusModel             string   `toml:"opus_model"`
    LowEffort             string   `toml:"low_effort"`
    MediumEffort          string   `toml:"medium_effort"`
    HighEffort            string   `toml:"high_effort"`
    MaxEffort             string   `toml:"max_effort"`
    SupportsResume        *bool    `toml:"supports_resume"`
    UseAppendSystemPrompt *bool    `toml:"use_append_system_prompt"`
}

func DefaultClaudeProvider

func DefaultClaudeProvider() ProviderFile

DefaultClaudeProvider returns the built-in provider binding that uses the local `claude` CLI as the execution backend.

func DefaultCodexProvider

func DefaultCodexProvider() ProviderFile

DefaultCodexProvider returns the built-in provider binding that uses the local `codex` CLI as the execution backend.

func DefaultGeminiProvider

func DefaultGeminiProvider() ProviderFile

DefaultGeminiProvider returns the built-in provider binding that uses the local `gemini` CLI as the execution backend.

type Service

Service holds repo-wide defaults. Individual variants override these in their own [variants.<name>] section; safety floors still apply on top.

type Service struct {
    DefaultObjectStore      string `toml:"default_object_store"` // "reference" | "full"
    DefaultLfsMode          string `toml:"default_lfs_mode"`     // "full" | "on-demand" | "pointers-only" | "excluded"
    CopyHooks               *bool  `toml:"copy_hooks"`           // pointer so "unset" ≠ false
    AllowConcurrentVariants *bool  `toml:"allow_concurrent_variants"`
    LogLevel                string `toml:"log_level"` // "debug" | "info" | "warn" | "error"
}

type VariantFile

VariantFile is the per-variant overrides block inside config.toml. Any field left zero-valued falls through to the variant profile’s hardcoded default, which falls through to Service, which falls through to project defaults. Safety floors may override any of these.

type VariantFile struct {
    Isolation   string   `toml:"isolation"`
    ObjectStore string   `toml:"object_store"`
    SyncSource  string   `toml:"sync_source"`
    LfsMode     string   `toml:"lfs_mode"`
    Provider    string   `toml:"provider"`
    SpendCapUSD *float64 `toml:"spend_cap_usd"`
    CycleLimit  *int     `toml:"cycle_limit"`

    // Fixit-specific advisor knobs. Only meaningful in
    // [variants.fixit]. CLI flags take precedence; these are the
    // defaults when no flag is passed.
    MaxRefinementIterations *int   `toml:"max_refinement_iterations"`
    MinConfidenceThreshold  *int   `toml:"min_confidence_threshold"`
    PlanModel               string `toml:"plan_model"`
    PlanEffort              string `toml:"plan_effort"`
}

Generated by gomarkdoc