Documentation
¶
Overview ¶
Package config provides configuration management for ralphex with embedded defaults.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigDir ¶
func DefaultConfigDir() string
DefaultConfigDir returns the default configuration directory path. returns ~/.config/ralphex/ on all platforms. if os.UserHomeDir() fails, falls back to ./.config/ralphex/ silently - this allows the tool to work even in unusual environments.
func DumpDefaults ¶
DumpDefaults extracts all embedded defaults (raw, uncommented) to the specified directory. creates config, prompts/, agents/ structure under dir.
Types ¶
type ColorConfig ¶
type ColorConfig struct {
Task string // task execution phase
Review string // review phase
Codex string // codex external review
ClaudeEval string // claude evaluation of codex output
Warn string // warning messages
Error string // error messages
Signal string // completion/failure signals
Timestamp string // timestamp prefix
Info string // informational messages
}
ColorConfig holds RGB values for output colors. each field stores comma-separated RGB values (e.g., "255,0,0" for red).
type Config ¶
type Config struct {
CopilotCommand string `json:"copilot_command"`
CopilotArgs string `json:"copilot_args"`
CopilotCodingModel string `json:"copilot_coding_model"`
CopilotReviewModel string `json:"copilot_review_model"`
ExternalReviewTool string `json:"external_review_tool"` // "copilot", "custom", or "none"
CustomReviewScript string `json:"custom_review_script"` // path to custom review script
IterationDelayMs int `json:"iteration_delay_ms"`
IterationDelayMsSet bool `json:"-"` // tracks if iteration_delay_ms was explicitly set in config
TaskRetryCount int `json:"task_retry_count"`
TaskRetryCountSet bool `json:"-"` // tracks if task_retry_count was explicitly set in config
MaxIterations int `json:"max_iterations"`
MaxIterationsSet bool `json:"-"` // tracks if max_iterations was explicitly set in config
MaxExternalIterations int `json:"max_external_iterations"`
ReviewPatience int `json:"review_patience"`
FinalizeEnabled bool `json:"finalize_enabled"`
FinalizeEnabledSet bool `json:"-"` // tracks if finalize_enabled was explicitly set in config
WorktreeEnabled bool `json:"worktree_enabled"`
WorktreeEnabledSet bool `json:"-"` // tracks if use_worktree was explicitly set in config
PlansDir string `json:"plans_dir"`
WatchDirs []string `json:"watch_dirs"` // directories to watch for progress files
DefaultBranch string `json:"default_branch"` // override auto-detected default branch
VcsCommand string `json:"vcs_command"` // custom VCS command (default: "git")
// error patterns to detect in executor output (e.g., rate limit messages)
CopilotErrorPatterns []string `json:"copilot_error_patterns"`
// limit patterns for wait+retry behavior (overlap with error patterns is intentional)
CopilotLimitPatterns []string `json:"copilot_limit_patterns"`
WaitOnLimit time.Duration `json:"wait_on_limit"`
WaitOnLimitSet bool `json:"-"` // tracks if wait_on_limit was explicitly set in config
// notification parameters
NotifyParams notify.Params `json:"-"`
// output colors (RGB values as comma-separated strings)
Colors ColorConfig `json:"-"`
// prompts (loaded separately from files)
TaskPrompt string `json:"-"`
ReviewFirstPrompt string `json:"-"`
ReviewSecondPrompt string `json:"-"`
CopilotReviewPrompt string `json:"-"`
MakePlanPrompt string `json:"-"`
FinalizePrompt string `json:"-"`
CustomReviewPrompt string `json:"-"`
CustomEvalPrompt string `json:"-"`
// custom agents (loaded separately from files)
CustomAgents []CustomAgent `json:"-"`
// contains filtered or unexported fields
}
Config holds all configuration settings for ralphex. Fields ending in *Set track whether that field was explicitly set in config. This allows distinguishing explicit false/0 from "not set", enabling proper merge behavior where local config can override global config with zero values.
*Set fields:
- IterationDelayMsSet: tracks if iteration_delay_ms was explicitly set
- TaskRetryCountSet: tracks if task_retry_count was explicitly set
- FinalizeEnabledSet: tracks if finalize_enabled was explicitly set
- WorktreeEnabledSet: tracks if use_worktree was explicitly set
- MaxIterationsSet: tracks if max_iterations was explicitly set
- WaitOnLimitSet: tracks if wait_on_limit was explicitly set
func Load ¶
Load loads all configuration from the specified directory. If configDir is empty, uses the default location (~/.config/ralphex/). It also auto-detects .ralphex/ in the current working directory for local overrides. It installs defaults if needed, parses config file, loads prompts and agents.
func LoadReadOnly ¶
LoadReadOnly loads configuration without installing defaults. use this in tests or tools that should not modify user's config directory. if config files don't exist, embedded defaults are used.
type CustomAgent ¶
type CustomAgent struct {
Name string // filename without extension
Prompt string // contents of the agent file (body after options header)
Options // embedded: model and agent type parsed from frontmatter
}
CustomAgent represents a user-defined review agent.
type Options ¶
Options holds agent options parsed from YAML frontmatter in agent files.
type Prompts ¶
type Prompts struct {
Task string
ReviewFirst string
ReviewSecond string
CopilotReview string
MakePlan string
Finalize string
CustomReview string
CustomEval string
}
Prompts holds all loaded prompt templates for different phases of execution. Each prompt can be customized by placing a .txt file in the prompts directory.
type ResetResult ¶
ResetResult holds the result of the reset operation.
type Values ¶
type Values struct {
CopilotCommand string
CopilotArgs string
CopilotCodingModel string
CopilotReviewModel string
CopilotErrorPatterns []string // patterns to detect in copilot output (e.g., rate limit messages)
CopilotLimitPatterns []string // patterns to detect rate limits in copilot output (for wait+retry)
WaitOnLimit time.Duration
WaitOnLimitSet bool // tracks if wait_on_limit was explicitly set
ExternalReviewTool string // "copilot", "custom", or "none"
CustomReviewScript string // path to custom review script (when ExternalReviewTool = "custom")
IterationDelayMs int
IterationDelayMsSet bool // tracks if iteration_delay_ms was explicitly set
TaskRetryCount int
TaskRetryCountSet bool // tracks if task_retry_count was explicitly set
MaxIterations int
MaxIterationsSet bool // tracks if max_iterations was explicitly set
MaxExternalIterations int // override external review iteration limit (0 = auto)
ReviewPatience int // terminate external review after N unchanged rounds (0 = disabled)
FinalizeEnabled bool
FinalizeEnabledSet bool // tracks if finalize_enabled was explicitly set
WorktreeEnabled bool
WorktreeEnabledSet bool // tracks if use_worktree was explicitly set
VcsCommand string // custom VCS command (default: "git")
PlansDir string
DefaultBranch string // override auto-detected default branch
WatchDirs []string // directories to watch for progress files
// notification settings
NotifyChannels []string // channels to use: telegram, email, webhook, slack, custom
NotifyChannelsSet bool // tracks if notify_channels was explicitly set (allows empty to disable)
NotifyOnError bool
NotifyOnErrorSet bool // tracks if notify_on_error was explicitly set
NotifyOnComplete bool
NotifyOnCompleteSet bool // tracks if notify_on_complete was explicitly set
NotifyTimeoutMs int
NotifyTimeoutMsSet bool // tracks if notify_timeout_ms was explicitly set
NotifyTelegramToken string
NotifyTelegramChat string
NotifySlackToken string
NotifySlackChannel string
NotifySMTPHost string
NotifySMTPPort int
NotifySMTPPortSet bool // tracks if notify_smtp_port was explicitly set
NotifySMTPUsername string
NotifySMTPPassword string
NotifySMTPStartTLS bool
NotifySMTPStartTLSSet bool // tracks if notify_smtp_starttls was explicitly set
NotifyEmailFrom string
NotifyEmailTo []string // comma-separated in config
NotifyEmailToSet bool // tracks if notify_email_to was explicitly set (allows empty to disable)
NotifyWebhookURLs []string // comma-separated in config
NotifyWebhookURLsSet bool // tracks if notify_webhook_urls was explicitly set (allows empty to disable)
NotifyCustomScript string // path to custom notification script (tilde-expanded)
}
Values holds scalar configuration values. Fields ending in *Set track whether that field was explicitly set in config. This allows distinguishing explicit false/0 from "not set", enabling proper merge behavior where local config can override global config with zero values.