Documentation
¶
Overview ¶
Package config provides unified configuration management for programmator. Configuration is loaded from multiple sources with the following precedence: embedded defaults → global file → local file → CLI flags
Package config provides unified configuration management for programmator.
Index ¶
- func DefaultConfigDir() string
- type ClaudeConfig
- type CodexConfig
- type Config
- func (c *Config) ApplyCLIFlags(maxIterations, stagnationLimit, timeout int)
- func (c *Config) ConfigDir() string
- func (c *Config) LocalDir() string
- func (c *Config) Sources() []string
- func (c *Config) ToExecutorConfig() executor.Config
- func (c *Config) ToReviewConfig() (review.Config, error)
- func (c *Config) ToSafetyConfig() safety.Config
- func (c *Config) Validate() error
- type GitConfig
- type OpenCodeConfig
- type PiConfig
- type Prompts
- type ReviewConfig
- type ReviewExecutorConfig
- type ReviewValidatorsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigDir ¶
func DefaultConfigDir() string
DefaultConfigDir returns the default global configuration directory path.
Types ¶
type ClaudeConfig ¶ added in v1.0.0
type ClaudeConfig struct {
Flags string `yaml:"flags"`
ConfigDir string `yaml:"config_dir"`
AnthropicAPIKey string `yaml:"anthropic_api_key"`
}
ClaudeConfig holds Claude executor configuration.
type CodexConfig ¶
type CodexConfig struct {
Flags string `yaml:"flags"`
Model string `yaml:"model"`
APIKey string `yaml:"api_key"`
}
CodexConfig holds Codex executor configuration.
type Config ¶
type Config struct {
MaxIterations int `yaml:"max_iterations"`
StagnationLimit int `yaml:"stagnation_limit"`
Timeout int `yaml:"timeout"` // seconds
Executor string `yaml:"executor"`
Claude ClaudeConfig `yaml:"claude"`
Pi PiConfig `yaml:"pi"`
OpenCode OpenCodeConfig `yaml:"opencode"`
Codex CodexConfig `yaml:"codex"`
TicketCommand string `yaml:"ticket_command"`
Git GitConfig `yaml:"git"`
Review ReviewConfig `yaml:"review"`
// Prompts (loaded separately, not from YAML)
Prompts *Prompts `yaml:"-"`
// contains filtered or unexported fields
}
Config holds all configuration settings for programmator.
func Load ¶
Load loads all configuration from the default locations. It auto-detects .programmator/ in the current working directory for local overrides.
func LoadWithDirs ¶
LoadWithDirs loads configuration with explicit global and local directories. Local config (.programmator/) overrides global config (~/.config/programmator/) per-field. If localDir is empty, only global config is used.
func (*Config) ApplyCLIFlags ¶
ApplyCLIFlags applies CLI flag overrides to the config. CLI flags have the highest precedence.
func (*Config) Sources ¶
Sources returns a human-readable description of where config values came from.
func (*Config) ToExecutorConfig ¶ added in v1.0.0
ToExecutorConfig converts the unified Config to an executor.Config. For Claude, always injects --dangerously-skip-permissions because the permission system has been removed; dcg is the sole safety layer.
func (*Config) ToReviewConfig ¶
ToReviewConfig converts the unified Config to a review.Config.
func (*Config) ToSafetyConfig ¶
ToSafetyConfig converts the unified Config to a safety.Config.
type GitConfig ¶
type GitConfig struct {
AutoCommit bool `yaml:"auto_commit"`
MoveCompletedPlans bool `yaml:"move_completed_plans"`
CompletedPlansDir string `yaml:"completed_plans_dir"`
BranchPrefix string `yaml:"branch_prefix"`
}
GitConfig holds git workflow configuration.
type OpenCodeConfig ¶ added in v1.4.0
type OpenCodeConfig struct {
Flags string `yaml:"flags"`
Model string `yaml:"model"`
APIKey string `yaml:"api_key"`
ConfigDir string `yaml:"config_dir"`
}
OpenCodeConfig holds OpenCode executor configuration.
type PiConfig ¶ added in v1.0.0
type PiConfig struct {
Flags string `yaml:"flags"`
ConfigDir string `yaml:"config_dir"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
APIKey string `yaml:"api_key"`
}
PiConfig holds pi coding agent executor configuration.
type Prompts ¶
type Prompts struct {
Phased string // Template for phased execution (has checkboxed tasks)
Phaseless string // Template for phaseless execution (single task)
ReviewFirst string // Template for review fix prompt
}
Prompts holds all loaded prompt templates. Each prompt is a Go text/template string with named variables.
func LoadPrompts ¶
LoadPrompts loads all prompt templates with fallback chain: local → global → embedded. localDir can be empty to skip local lookup.
type ReviewConfig ¶
type ReviewConfig struct {
MaxIterations int `yaml:"max_iterations"`
Parallel bool `yaml:"parallel"`
Executor ReviewExecutorConfig `yaml:"executor,omitempty"`
Include []string `yaml:"include,omitempty"`
Exclude []string `yaml:"exclude,omitempty"`
Overrides []review.AgentConfig `yaml:"overrides,omitempty"`
Agents []review.AgentConfig `yaml:"agents,omitempty"`
Validators ReviewValidatorsConfig `yaml:"validators"`
}
ReviewConfig holds review-specific configuration.
type ReviewExecutorConfig ¶ added in v1.0.0
type ReviewExecutorConfig struct {
Name string `yaml:"name"`
Claude ClaudeConfig `yaml:"claude"`
Pi PiConfig `yaml:"pi"`
OpenCode OpenCodeConfig `yaml:"opencode"`
Codex CodexConfig `yaml:"codex"`
}
ReviewExecutorConfig holds review-specific executor overrides.
type ReviewValidatorsConfig ¶ added in v1.0.0
type ReviewValidatorsConfig struct {
Issue bool `yaml:"issue"`
Simplification bool `yaml:"simplification"`
}
ReviewValidatorsConfig controls validation passes that run after review agents within each iteration.