config

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 18 Imported by: 0

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

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

func Load() (*Config, error)

Load loads all configuration from the default locations. It auto-detects .programmator/ in the current working directory for local overrides.

func LoadWithDirs

func LoadWithDirs(globalDir, localDir string) (*Config, error)

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

func (c *Config) ApplyCLIFlags(maxIterations, stagnationLimit, timeout int)

ApplyCLIFlags applies CLI flag overrides to the config. CLI flags have the highest precedence.

func (*Config) ConfigDir

func (c *Config) ConfigDir() string

ConfigDir returns the global config directory.

func (*Config) LocalDir

func (c *Config) LocalDir() string

LocalDir returns the local project config directory if one was detected.

func (*Config) Sources

func (c *Config) Sources() []string

Sources returns a human-readable description of where config values came from.

func (*Config) ToExecutorConfig added in v1.0.0

func (c *Config) ToExecutorConfig() executor.Config

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

func (c *Config) ToReviewConfig() (review.Config, error)

ToReviewConfig converts the unified Config to a review.Config.

func (*Config) ToSafetyConfig

func (c *Config) ToSafetyConfig() safety.Config

ToSafetyConfig converts the unified Config to a safety.Config.

func (*Config) Validate added in v1.0.0

func (c *Config) Validate() error

Validate checks the configuration for invalid values.

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

func LoadPrompts(globalDir, localDir string) (*Prompts, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL