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.

Constants

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

const (
	// DefaultCodexModel is empty by design: scafld omits -m for the "latest"
	// Codex model path so Codex CLI can use its own current default.
	DefaultCodexModel = ""
	// DefaultCodexModelReasoningEffort keeps governed review/harden runs from
	// inheriting a medium-effort CLI default after user config is isolated.
	DefaultCodexModelReasoningEffort = "xhigh"
	// DefaultClaudeModel uses Claude Code's rolling latest-Opus alias.
	DefaultClaudeModel = "opus"
	// DefaultClaudeEffort uses Claude Code's native effort control for governed
	// review/harden runs.
	DefaultClaudeEffort = "xhigh"
)

Functions

func Default() Config

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

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:165

Load reads base config and local overrides from root.

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

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

LoadBase reads only the committed base config, ignoring config.local overrides. The gate and verify paths use this so a host-committed config.local.yaml cannot repoint the trust anchor, relax the independence policy, or redirect reviewer endpoints. config.local stays an authoring convenience for the human lifecycle, never an input to the accountability gate.

func ValidVerifyPolicy(policy string) bool

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

ValidVerifyPolicy reports whether policy is a supported verify enforcement tier.

Types

type ClaudeProviderConfig

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

ClaudeProviderConfig configures the Claude Code adapter.

type ClaudeProviderConfig struct {
	ProviderConfig `yaml:",inline"`

	Effort string `yaml:"effort"`
}
Fields
  • ProviderConfig `yaml:",inline"`
  • Effort string `yaml:"effort"`

type CodexProviderConfig

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

CodexProviderConfig configures the Codex CLI adapter. ModelReasoningEffort is intentionally Codex-specific; other provider thinking controls need their own verified adapter fields before scafld exposes them.

type CodexProviderConfig struct {
	ProviderConfig `yaml:",inline"`

	ModelReasoningEffort string `yaml:"model_reasoning_effort"`
}
Fields
  • ProviderConfig `yaml:",inline"`
  • ModelReasoningEffort string `yaml:"model_reasoning_effort"`

type Config

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

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"`
	Verify     VerifyConfig    `yaml:"verify"`
	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"`
  • Verify VerifyConfig `yaml:"verify"`
  • Harden HardenConfig `yaml:"harden"`
  • Review ReviewConfig `yaml:"review"`

type ExecutionConfig

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

ExecutionConfig controls the deterministic environment for acceptance commands.

type ExecutionConfig struct {
	PathPrepend            []string          `yaml:"path_prepend"`
	Env                    map[string]string `yaml:"env"`
	AbsoluteTimeoutSeconds int               `yaml:"absolute_timeout_seconds"`
	IdleTimeoutSeconds     int               `yaml:"idle_timeout_seconds"`
}
Fields
  • PathPrepend []string `yaml:"path_prepend"`
  • Env map[string]string `yaml:"env"`
  • AbsoluteTimeoutSeconds int `yaml:"absolute_timeout_seconds"`
  • IdleTimeoutSeconds int `yaml:"idle_timeout_seconds"`

func AbsoluteTimeout() time.Duration

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

AbsoluteTimeout returns the configured per-acceptance-command wall clock cap.

func IdleTimeout() time.Duration

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

IdleTimeout returns the configured idle-output watchdog duration.

func ProcessEnv() []string

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

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:121

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              CodexProviderConfig  `yaml:"codex"`
	Claude             ClaudeProviderConfig `yaml:"claude"`
	Gemini             ProviderConfig       `yaml:"gemini"`
}
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 CodexProviderConfig `yaml:"codex"`
  • Claude ClaudeProviderConfig `yaml:"claude"`
  • Gemini ProviderConfig `yaml:"gemini"`

type HardenConfig

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

HardenConfig controls hardening prompt behavior.

type HardenConfig struct {
	MaxIssuesPerRound       int                  `yaml:"max_issues_per_round"`
	ContextMaxBytes         int                  `yaml:"context_max_bytes"`
	RequiredContextMaxBytes int                  `yaml:"required_context_max_bytes"`
	External                ExternalReviewConfig `yaml:"external"`
}
Fields
  • MaxIssuesPerRound int `yaml:"max_issues_per_round"`
  • ContextMaxBytes int `yaml:"context_max_bytes"`
  • RequiredContextMaxBytes int `yaml:"required_context_max_bytes"`
  • External ExternalReviewConfig `yaml:"external"`

type InvariantConfig

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

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:64

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:150

ProviderConfig configures a named external provider implementation.

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

type ReviewConfig

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

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:114

ReviewContextConfig controls bounded project context sent to reviewers.

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

type ReviewDossierConfig

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

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:158

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"`

type VerifyConfig

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

VerifyConfig controls CI receipt verification defaults.

type VerifyConfig struct {
	MinIndependence string `yaml:"min_independence"`
	TrustedKeysPath string `yaml:"trusted_keys_path"`
	ReceiptPath     string `yaml:"receipt_path"`
	// Policy declares the operator's intended enforcement tier (local, advisory,
	// required). It is reporting-only metadata: it is read by `scafld verify
	// --self-check` and the docs framing, never by the receipt-verification
	// verdict path, so a tier can never bypass a real check.
	Policy string `yaml:"policy"`
}
Fields
  • MinIndependence string `yaml:"min_independence"`
  • TrustedKeysPath string `yaml:"trusted_keys_path"`
  • ReceiptPath string `yaml:"receipt_path"`
  • Policy string `yaml:"policy"`

    Policy declares the operator's intended enforcement tier (local, advisory, required). It is reporting-only metadata: it is read by scafld verify --self-check and the docs framing, never by the receipt-verification verdict path, so a tier can never bypass a real check.