Internal

internal/adapters/config

Package config loads and merges scafld workspace configuration files.

import "github.com/nilstate/scafld/v2/internal/adapters/config"

Package config loads and merges scafld workspace configuration files.

Functions

func Default() Config

Source: internal/adapters/config/config.go:176

Default returns the built-in workspace configuration.

func DetectExecution(root string) ExecutionDetection

Source: internal/adapters/config/toolchain.go:22

DetectExecution infers safe PATH additions from checked-in toolchain files.

Detection is intentionally limited to version-manager shim directories. It does not run shell startup files or infer per-command state. Project config remains the place for explicit environment variables and policy.

func EffectiveExecution(root string, explicit ExecutionConfig) ExecutionConfig

Source: internal/adapters/config/toolchain.go:46

EffectiveExecution merges auto-detected toolchain shims behind explicit config. Explicit config paths appear first in PATH and explicit environment keys override detected values.

func Load(ctx context.Context, root string) (Config, error)

Source: internal/adapters/config/config.go:95

Load reads base config and local overrides from root.

Types

type Config

Source: internal/adapters/config/config.go:16

Config is the merged runtime configuration for a scafld workspace.

type Config struct {
	Version    string          `yaml:"version"`
	Invariants InvariantConfig `yaml:"invariants"`
	LLM        LLMConfig       `yaml:"llm"`
	Execution  ExecutionConfig `yaml:"execution"`
	Harden     HardenConfig    `yaml:"harden"`
	Review     ReviewConfig    `yaml:"review"`
}
Fields
  • Version string `yaml:"version"`
  • Invariants InvariantConfig `yaml:"invariants"`
  • LLM LLMConfig `yaml:"llm"`
  • Execution ExecutionConfig `yaml:"execution"`
  • Harden HardenConfig `yaml:"harden"`
  • Review ReviewConfig `yaml:"review"`

type ExecutionConfig

Source: internal/adapters/config/config.go:36

ExecutionConfig controls the deterministic environment for acceptance commands.

type ExecutionConfig struct {
	PathPrepend []string          `yaml:"path_prepend"`
	Env         map[string]string `yaml:"env"`
}
Fields
  • PathPrepend []string `yaml:"path_prepend"`
  • Env map[string]string `yaml:"env"`

func ProcessEnv() []string

Source: internal/adapters/config/config.go:409

ProcessEnv returns stable process environment overrides for acceptance commands.

type ExecutionDetection

Source: internal/adapters/config/toolchain.go:12

ExecutionDetection records repo-declared toolchain hints that can make non-login acceptance shells behave like the checked-in project expects.

type ExecutionDetection struct {
	Execution ExecutionConfig
	Sources   []string
}
Fields
  • Execution ExecutionConfig
  • Sources []string

type ExternalReviewConfig

Source: internal/adapters/config/config.go:70

ExternalReviewConfig configures external model-provider review execution.

type ExternalReviewConfig struct {
	Provider           string         `yaml:"provider"`
	Command            string         `yaml:"command"`
	ProviderBinary     string         `yaml:"provider_binary"`
	IdleTimeoutSeconds int            `yaml:"idle_timeout_seconds"`
	AbsoluteMaxSeconds int            `yaml:"absolute_max_seconds"`
	FallbackPolicy     string         `yaml:"fallback_policy"`
	Codex              ProviderConfig `yaml:"codex"`
	Claude             ProviderConfig `yaml:"claude"`
}
Fields
  • Provider string `yaml:"provider"`
  • Command string `yaml:"command"`
  • ProviderBinary string `yaml:"provider_binary"`
  • IdleTimeoutSeconds int `yaml:"idle_timeout_seconds"`
  • AbsoluteMaxSeconds int `yaml:"absolute_max_seconds"`
  • FallbackPolicy string `yaml:"fallback_policy"`
  • Codex ProviderConfig `yaml:"codex"`
  • Claude ProviderConfig `yaml:"claude"`

type HardenConfig

Source: internal/adapters/config/config.go:42

HardenConfig controls hardening prompt behavior.

type HardenConfig struct {
	MaxQuestionsPerRound int `yaml:"max_questions_per_round"`
}
Fields
  • MaxQuestionsPerRound int `yaml:"max_questions_per_round"`

type InvariantConfig

Source: internal/adapters/config/config.go:26

InvariantConfig names project-level invariant IDs available to specs.

type InvariantConfig struct {
	Canonical map[string]string `yaml:"canonical"`
}
Fields
  • Canonical map[string]string `yaml:"canonical"`

type LLMConfig

Source: internal/adapters/config/config.go:31

LLMConfig contains shared model-profile settings.

type LLMConfig struct {
	ModelProfile string `yaml:"model_profile"`
}
Fields
  • ModelProfile string `yaml:"model_profile"`

type ProviderConfig

Source: internal/adapters/config/config.go:82

ProviderConfig configures a named external provider implementation.

type ProviderConfig struct {
	Model  string `yaml:"model"`
	Binary string `yaml:"binary"`
}
Fields
  • Model string `yaml:"model"`
  • Binary string `yaml:"binary"`

type ReviewConfig

Source: internal/adapters/config/config.go:47

ReviewConfig controls automated and adversarial review behavior.

type ReviewConfig struct {
	External          ExternalReviewConfig        `yaml:"external"`
	Context           ReviewContextConfig         `yaml:"context"`
	Dossier           ReviewDossierConfig         `yaml:"dossier"`
	AutomatedPasses   map[string]ReviewPassConfig `yaml:"automated_passes"`
	AdversarialPasses map[string]ReviewPassConfig `yaml:"adversarial_passes"`
}
Fields
  • External ExternalReviewConfig `yaml:"external"`
  • Context ReviewContextConfig `yaml:"context"`
  • Dossier ReviewDossierConfig `yaml:"dossier"`
  • AutomatedPasses map[string]ReviewPassConfig `yaml:"automated_passes"`
  • AdversarialPasses map[string]ReviewPassConfig `yaml:"adversarial_passes"`

type ReviewContextConfig

Source: internal/adapters/config/config.go:64

ReviewContextConfig controls bounded project context sent to reviewers.

type ReviewContextConfig struct {
	MaxBytes int      `yaml:"max_bytes"`
	Files    []string `yaml:"files"`
}
Fields
  • MaxBytes int `yaml:"max_bytes"`
  • Files []string `yaml:"files"`

type ReviewDossierConfig

Source: internal/adapters/config/config.go:56

ReviewDossierConfig controls default review dossier budget and rerun behavior.

type ReviewDossierConfig struct {
	MaxFindings     int    `yaml:"max_findings"`
	MinAttackAngles int    `yaml:"min_attack_angles"`
	ReviewDepth     string `yaml:"review_depth"`
	RerunPolicy     string `yaml:"rerun_policy"`
}
Fields
  • MaxFindings int `yaml:"max_findings"`
  • MinAttackAngles int `yaml:"min_attack_angles"`
  • ReviewDepth string `yaml:"review_depth"`
  • RerunPolicy string `yaml:"rerun_policy"`

type ReviewPassConfig

Source: internal/adapters/config/config.go:88

ReviewPassConfig describes one review pass in the review agenda.

type ReviewPassConfig struct {
	Order       int    `yaml:"order"`
	Title       string `yaml:"title"`
	Description string `yaml:"description"`
}
Fields
  • Order int `yaml:"order"`
  • Title string `yaml:"title"`
  • Description string `yaml:"description"`