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 supervisor consumes.

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

  • config.toml (committed) — declared capability biases, per-variant overrides, and daemon-wide defaults.

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

The config package only parses and validates. Applying variant defaults and safety floors happens at supervisor boot time in cmd/radioactive_ralph/run.go (M2 shape) and will move into a dedicated Resolve() entry point once the knob-override matrix grows enough per-variant overrides to warrant the abstraction (M3).

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 Capabilities

Capabilities declares the operator’s preferred helper per bias category. A zero-valued string means “no preference / don’t bias”. The keys match the BiasCategory constants defined in the variant package (M3).

type Capabilities struct {
    Review         string `toml:"review"`
    SecurityReview string `toml:"security_review"`
    DocsQuery      string `toml:"docs_query"`
    Brainstorm     string `toml:"brainstorm"`
    Debugging      string `toml:"debugging"`

    // DisabledBiases lists helpers the operator explicitly never wants
    // Ralph to bias toward, even when they're present in the inventory.
    // This is how operators opt out of a specific review helper in favor
    // of another.
    DisabledBiases []string `toml:"disabled_biases"`
}

type Daemon

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

type Daemon 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"`
    MultiplexerPreference   string `toml:"multiplexer_preference"` // "tmux" | "screen" | "setsid"
    LogLevel                string `toml:"log_level"`              // "debug" | "info" | "warn" | "error"
}

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 {
    Capabilities Capabilities           `toml:"capabilities"`
    Daemon       Daemon                 `toml:"daemon"`
    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 {
    MultiplexerPreference string `toml:"multiplexer_preference"`
    LogLevel              string `toml:"log_level"`
}

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 Daemon defaults.

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 Daemon, 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"`
    ReviewBias     string   `toml:"review_bias"`
    SecurityBias   string   `toml:"security_review_bias"`
    DocsQueryBias  string   `toml:"docs_query_bias"`
    BrainstormBias string   `toml:"brainstorm_bias"`
    DebuggingBias  string   `toml:"debugging_bias"`
    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