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 ¶ added in v0.5.0
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 ¶ added in v0.12.0
DumpDefaults extracts all embedded defaults (raw, uncommented) to the specified directory. creates config, prompts/, agents/ structure under dir.
Types ¶
type ColorConfig ¶ added in v0.2.0
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 {
ClaudeCommand string `json:"claude_command"`
ClaudeArgs string `json:"claude_args"`
CodexEnabled bool `json:"codex_enabled"`
CodexEnabledSet bool `json:"-"` // tracks if codex_enabled was explicitly set in config
CodexCommand string `json:"codex_command"`
CodexModel string `json:"codex_model"`
CodexReasoningEffort string `json:"codex_reasoning_effort"`
CodexTimeoutMs int `json:"codex_timeout_ms"`
CodexTimeoutMsSet bool `json:"-"` // tracks if codex_timeout_ms was explicitly set in config
CodexSandbox string `json:"codex_sandbox"`
ExternalReviewTool string `json:"external_review_tool"` // "codex", "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
FinalizeEnabled bool `json:"finalize_enabled"`
FinalizeEnabledSet bool `json:"-"` // tracks if finalize_enabled 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
// error patterns to detect in executor output (e.g., rate limit messages)
ClaudeErrorPatterns []string `json:"claude_error_patterns"`
CodexErrorPatterns []string `json:"codex_error_patterns"`
// 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:"-"`
CodexPrompt 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:
- CodexEnabledSet: tracks if codex_enabled was explicitly set
- CodexTimeoutMsSet: tracks if codex_timeout_ms was explicitly set
- 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
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 ¶ added in v0.6.0
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 ¶ added in v0.10.0
Options holds agent options parsed from YAML frontmatter in agent files.
type Prompts ¶ added in v0.3.0
type Prompts struct {
Task string
ReviewFirst string
ReviewSecond string
Codex 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 ¶ added in v0.5.0
ResetResult holds the result of the reset operation.
type Values ¶ added in v0.3.0
type Values struct {
ClaudeCommand string
ClaudeArgs string
ClaudeErrorPatterns []string // patterns to detect in claude output (e.g., rate limit messages)
CodexEnabled bool
CodexEnabledSet bool // tracks if codex_enabled was explicitly set
CodexCommand string
CodexModel string
CodexReasoningEffort string
CodexTimeoutMs int
CodexTimeoutMsSet bool // tracks if codex_timeout_ms was explicitly set
CodexSandbox string
CodexErrorPatterns []string // patterns to detect in codex output (e.g., rate limit messages)
ExternalReviewTool string // "codex", "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
FinalizeEnabled bool
FinalizeEnabledSet bool // tracks if finalize_enabled was explicitly set
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 (e.g., CodexEnabledSet) 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.