Documentation
¶
Overview ¶
Package config handles configuration loading and validation.
Index ¶
- Variables
- type BitbucketConfig
- type Config
- func (c Config) ParsedMaxPromptDuration() time.Duration
- func (c Config) ParsedPreflightInterval() time.Duration
- func (c Config) ParsedQueueInterval() time.Duration
- func (c Config) ParsedSweepInterval() time.Duration
- func (c Config) ResolvedBitbucketToken() string
- func (c Config) ResolvedClaudeDir() string
- func (c Config) ResolvedDiscordWebhook() string
- func (c Config) ResolvedGitHubToken() string
- func (c Config) ResolvedTelegramBotToken() string
- func (c Config) ResolvedTelegramChatID() string
- func (c Config) Validate(ctx context.Context) error
- type DiscordConfig
- type ExtraMount
- type FieldSources
- type GitHubConfig
- type LayeredProjectOverrides
- type LoadResult
- type Loader
- type NotificationsConfig
- type PromptsConfig
- type Provider
- type Providers
- type SpecsConfig
- type TelegramConfig
- type Workflow
- type Workflows
Constants ¶
This section is empty.
Variables ¶
var AvailableProviders = Providers{ProviderGitHub, ProviderBitbucketServer}
AvailableProviders contains all valid provider values.
var AvailableWorkflows = Workflows{WorkflowDirect, WorkflowBranch, WorkflowWorktree, WorkflowClone}
AvailableWorkflows contains the four valid workflow values for new configs. WorkflowPR ("pr") is intentionally excluded — it is legacy and mapped at load time.
Functions ¶
This section is empty.
Types ¶
type BitbucketConfig ¶ added in v0.45.0
BitbucketConfig holds Bitbucket Server-specific configuration.
type Config ¶
type Config struct {
ProjectName string `yaml:"projectName"`
Workflow Workflow `yaml:"workflow"`
PR bool `yaml:"pr,omitempty"`
Worktree bool `yaml:"worktree,omitempty"`
HideGit bool `yaml:"hideGit,omitempty"`
DefaultBranch string `yaml:"defaultBranch"`
Prompts PromptsConfig `yaml:"prompts"`
Specs SpecsConfig `yaml:"specs"`
ContainerImage string `yaml:"containerImage"`
NetrcFile string `yaml:"netrcFile"`
GitconfigFile string `yaml:"gitconfigFile"`
Model string `yaml:"model"`
ValidationCommand string `yaml:"validationCommand"`
ValidationPrompt string `yaml:"validationPrompt"`
TestCommand string `yaml:"testCommand"`
DebounceMs int `yaml:"debounceMs"`
ServerPort int `yaml:"serverPort"`
AutoMerge bool `yaml:"autoMerge"`
AutoRelease bool `yaml:"autoRelease"`
VerificationGate bool `yaml:"verificationGate"`
AutoReview bool `yaml:"autoReview"`
MaxReviewRetries int `yaml:"maxReviewRetries"`
AllowedReviewers []string `yaml:"allowedReviewers,omitempty"`
UseCollaborators bool `yaml:"useCollaborators"`
PollIntervalSec int `yaml:"pollIntervalSec"`
GitHub GitHubConfig `yaml:"github"`
Provider Provider `yaml:"provider"`
Bitbucket BitbucketConfig `yaml:"bitbucket"`
Notifications NotificationsConfig `yaml:"notifications"`
Env map[string]string `yaml:"env,omitempty"`
ExtraMounts []ExtraMount `yaml:"extraMounts,omitempty"`
ClaudeDir string `yaml:"claudeDir"`
GenerateCommand string `yaml:"generateCommand"`
AdditionalInstructions string `yaml:"additionalInstructions,omitempty"`
MaxContainers int `yaml:"maxContainers,omitempty"`
DirtyFileThreshold int `yaml:"dirtyFileThreshold,omitempty"`
MaxPromptDuration string `yaml:"maxPromptDuration"`
AutoRetryLimit int `yaml:"autoRetryLimit"`
PreflightCommand string `yaml:"preflightCommand"`
PreflightInterval string `yaml:"preflightInterval"`
QueueInterval string `yaml:"queueInterval"`
SweepInterval string `yaml:"sweepInterval"`
}
Config holds the dark-factory configuration.
func (Config) ParsedMaxPromptDuration ¶ added in v0.98.0
ParsedMaxPromptDuration returns the parsed duration from MaxPromptDuration. Returns 0 when MaxPromptDuration is empty or unparseable (disables timeout). Safe to call at any time — returns 0 on error, never panics.
func (Config) ParsedPreflightInterval ¶ added in v0.126.0
ParsedPreflightInterval returns the parsed duration from PreflightInterval. Returns 0 when PreflightInterval is empty (disables interval-based caching). Safe to call at any time — returns 0 on error, never panics.
func (Config) ParsedQueueInterval ¶ added in v0.135.4
ParsedQueueInterval returns the parsed duration from QueueInterval. Returns 5 * time.Second when QueueInterval is empty or unparseable (preserves default behaviour). Safe to call at any time — never panics.
func (Config) ParsedSweepInterval ¶ added in v0.135.4
ParsedSweepInterval returns the parsed duration from SweepInterval. Returns 60 * time.Second when SweepInterval is empty or unparseable (preserves default behaviour). Safe to call at any time — never panics.
func (Config) ResolvedBitbucketToken ¶ added in v0.45.0
ResolvedBitbucketToken reads the Bitbucket token from the env var named in TokenEnv. Returns empty string when not configured or env var is empty. Uses os.Getenv directly (not resolveEnvVar) because tokenEnv holds the env var name (e.g. "BITBUCKET_TOKEN"), not a ${VAR} reference that resolveEnvVar expects.
func (Config) ResolvedClaudeDir ¶ added in v0.71.0
ResolvedClaudeDir returns the claude-yolo config directory with ~ expanded.
func (Config) ResolvedDiscordWebhook ¶ added in v0.47.0
ResolvedDiscordWebhook reads the Discord webhook URL from the env var named in WebhookEnv. Returns empty string when not configured or env var is empty.
func (Config) ResolvedGitHubToken ¶ added in v0.15.0
ResolvedGitHubToken returns the GitHub token with environment variables resolved. Returns empty string when not configured, letting gh use its own auth.
func (Config) ResolvedTelegramBotToken ¶ added in v0.47.0
ResolvedTelegramBotToken reads the Telegram bot token from the env var named in BotTokenEnv. Returns empty string when not configured or env var is empty.
func (Config) ResolvedTelegramChatID ¶ added in v0.47.0
ResolvedTelegramChatID reads the Telegram chat ID from the env var named in ChatIDEnv. Returns empty string when not configured or env var is empty.
type DiscordConfig ¶ added in v0.47.0
type DiscordConfig struct {
WebhookEnv string `yaml:"webhookEnv"`
}
DiscordConfig holds Discord notification configuration.
type ExtraMount ¶ added in v0.87.0
type ExtraMount struct {
Src string `yaml:"src"`
Dst string `yaml:"dst"`
ReadOnly *bool `yaml:"readOnly,omitempty"` // nil defaults to false (read-write)
}
ExtraMount describes an additional volume mount to inject into the YOLO container.
func (ExtraMount) IsReadonly ¶ added in v0.87.0
func (m ExtraMount) IsReadonly() bool
IsReadonly returns true if the mount is read-only (default when ReadOnly is nil is false = read-write).
type FieldSources ¶ added in v0.140.0
type FieldSources struct {
HideGit string
AutoRelease string
DirtyFileThreshold string
Model string
}
FieldSources records which config layer provided each of the 4 layered user-pref fields. Valid values for each field are: "default", "global", "project", "arg". Zero value (empty string) is treated the same as "default" by callers.
type GitHubConfig ¶ added in v0.15.0
type GitHubConfig struct {
Token string `yaml:"token"`
}
GitHubConfig holds GitHub-specific configuration.
type LayeredProjectOverrides ¶ added in v0.140.0
type LayeredProjectOverrides struct {
HideGit *bool
AutoRelease *bool
DirtyFileThreshold *int
Model *string
MaxContainers *int // included for completeness; maxContainers uses its own precedence path
}
LayeredProjectOverrides reports which of the 4 layered user-pref fields were explicitly set in .dark-factory.yaml. nil means the field was absent from the file (so the default or global value applies). Non-nil means project explicitly set it.
type LoadResult ¶ added in v0.140.0
type LoadResult struct {
Config Config
Overrides LayeredProjectOverrides
}
LoadResult bundles the merged project config with information about which of the 4 layered user-pref fields the project explicitly set.
func LoadWithOverrides ¶ added in v0.140.0
func LoadWithOverrides(ctx context.Context) (LoadResult, error)
LoadWithOverrides reads .dark-factory.yaml, merges with defaults, validates, and returns the merged config plus project override detection data. Use this when global-config layering is needed (e.g. in main.run()). Existing callers that use NewLoader().Load() are unaffected.
type NotificationsConfig ¶ added in v0.47.0
type NotificationsConfig struct {
Telegram TelegramConfig `yaml:"telegram"`
Discord DiscordConfig `yaml:"discord"`
}
NotificationsConfig holds notification channel configuration.
type PromptsConfig ¶ added in v0.20.3
type PromptsConfig struct {
InboxDir string `yaml:"inboxDir"`
InProgressDir string `yaml:"inProgressDir"`
CompletedDir string `yaml:"completedDir"`
RejectedDir string `yaml:"rejectedDir"`
LogDir string `yaml:"logDir"`
}
PromptsConfig holds directories for the prompt lifecycle.
type Provider ¶ added in v0.45.0
type Provider string
Provider is a string-based enum for git provider types.
Provider selects the git hosting provider for PR operations.
type Providers ¶ added in v0.45.0
type Providers []Provider
Providers is a collection of Provider values.
type SpecsConfig ¶ added in v0.20.3
type SpecsConfig struct {
InboxDir string `yaml:"inboxDir"`
InProgressDir string `yaml:"inProgressDir"`
CompletedDir string `yaml:"completedDir"`
RejectedDir string `yaml:"rejectedDir"`
LogDir string `yaml:"logDir"`
}
SpecsConfig holds directories for the spec lifecycle.
type TelegramConfig ¶ added in v0.47.0
type TelegramConfig struct {
BotTokenEnv string `yaml:"botTokenEnv"`
ChatIDEnv string `yaml:"chatIDEnv"`
}
TelegramConfig holds Telegram notification configuration.
type Workflow ¶
type Workflow string
Workflow is a string-based enum for workflow types.
const ( WorkflowDirect Workflow = "direct" WorkflowBranch Workflow = "branch" WorkflowWorktree Workflow = "worktree" WorkflowClone Workflow = "clone" // WorkflowPR is the legacy enum value kept for parsing only. // The loader maps it to WorkflowClone + pr: true before validation. // Do not use this constant in new code. WorkflowPR Workflow = "pr" )
Workflow defines how prompts are processed.