config

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package config handles configuration loading and validation.

Index

Constants

This section is empty.

Variables

AvailableProviders contains all valid provider values.

View Source
var AvailableWorkflows = Workflows{WorkflowDirect, WorkflowPR}

AvailableWorkflows contains all valid workflow values.

Functions

This section is empty.

Types

type BitbucketConfig added in v0.52.3

type BitbucketConfig struct {
	BaseURL  string `yaml:"baseURL"`
	TokenEnv string `yaml:"tokenEnv"`
}

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"`
	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"`
	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"`
}

Config holds the dark-factory configuration.

func Defaults

func Defaults() Config

Defaults returns a Config with all default values.

func (Config) ResolvedBitbucketToken added in v0.52.3

func (c Config) ResolvedBitbucketToken() string

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) ResolvedDiscordWebhook added in v0.52.3

func (c Config) ResolvedDiscordWebhook() string

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.52.3

func (c Config) ResolvedGitHubToken() string

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.52.3

func (c Config) ResolvedTelegramBotToken() string

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.52.3

func (c Config) ResolvedTelegramChatID() string

ResolvedTelegramChatID reads the Telegram chat ID from the env var named in ChatIDEnv. Returns empty string when not configured or env var is empty.

func (Config) Validate

func (c Config) Validate(ctx context.Context) error

Validate validates the config fields.

type DiscordConfig added in v0.52.3

type DiscordConfig struct {
	WebhookEnv string `yaml:"webhookEnv"`
}

DiscordConfig holds Discord notification configuration.

type GitHubConfig added in v0.52.3

type GitHubConfig struct {
	Token string `yaml:"token"`
}

GitHubConfig holds GitHub-specific configuration.

type Loader

type Loader interface {
	Load(ctx context.Context) (Config, error)
}

Loader loads configuration from a file.

func NewLoader

func NewLoader() Loader

NewLoader creates a Loader that reads from .dark-factory.yaml in the current directory.

type NotificationsConfig added in v0.52.3

type NotificationsConfig struct {
	Telegram TelegramConfig `yaml:"telegram"`
	Discord  DiscordConfig  `yaml:"discord"`
}

NotificationsConfig holds notification channel configuration.

type PromptsConfig added in v0.52.3

type PromptsConfig struct {
	InboxDir      string `yaml:"inboxDir"`
	InProgressDir string `yaml:"inProgressDir"`
	CompletedDir  string `yaml:"completedDir"`
	LogDir        string `yaml:"logDir"`
}

PromptsConfig holds directories for the prompt lifecycle.

type Provider added in v0.52.3

type Provider string

Provider is a string-based enum for git provider types.

const (
	ProviderGitHub          Provider = "github"
	ProviderBitbucketServer Provider = "bitbucket-server"
)

Provider selects the git hosting provider for PR operations.

func (Provider) Ptr added in v0.52.3

func (p Provider) Ptr() *Provider

Ptr returns a pointer to the Provider value.

func (Provider) String added in v0.52.3

func (p Provider) String() string

String returns the string representation of the Provider.

func (Provider) Validate added in v0.52.3

func (p Provider) Validate(ctx context.Context) error

Validate checks that the Provider is a known value.

type Providers added in v0.52.3

type Providers []Provider

Providers is a collection of Provider values.

func (Providers) Contains added in v0.52.3

func (p Providers) Contains(provider Provider) bool

Contains returns true if the given provider is in the collection.

type SpecsConfig added in v0.52.3

type SpecsConfig struct {
	InboxDir      string `yaml:"inboxDir"`
	InProgressDir string `yaml:"inProgressDir"`
	CompletedDir  string `yaml:"completedDir"`
	LogDir        string `yaml:"logDir"`
}

SpecsConfig holds directories for the spec lifecycle.

type TelegramConfig added in v0.52.3

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"
	WorkflowPR     Workflow = "pr"
)

Workflow defines how prompts are processed.

func (Workflow) Ptr

func (w Workflow) Ptr() *Workflow

Ptr returns a pointer to the Workflow value.

func (Workflow) String

func (w Workflow) String() string

String returns the string representation of the Workflow.

func (Workflow) Validate

func (w Workflow) Validate(ctx context.Context) error

Validate checks that the Workflow is a known value.

type Workflows

type Workflows []Workflow

Workflows is a collection of Workflow values.

func (Workflows) Contains

func (w Workflows) Contains(workflow Workflow) bool

Jump to

Keyboard shortcuts

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