globalconfig

package
v0.147.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package globalconfig loads and validates the user-level dark-factory configuration from ~/.dark-factory/config.yaml.

Index

Constants

View Source
const DefaultMaxContainers = 3

DefaultMaxContainers is the system-wide container limit when no config is set.

View Source
const ModelPattern = `^[a-zA-Z0-9._:/-]{1,256}$`

ModelPattern is the regex source string. Exported so callers can include it in error messages.

Variables

ModelRegex validates model identifiers at every config layer (global, project, CLI arg). Permits Anthropic IDs (claude-opus-4-7), other-provider IDs (qwen3.6:35b-a3b), namespaced paths (local/qwen3.6:35b-a3b), and Docker image refs (docker.io/bborbe/claude-yolo:v0.6.1). Blocks shell metacharacters since model flows to container args. EXPORTED so pkg/config and main.go reuse the SAME compiled regex — do not duplicate the pattern.

Functions

func FileExists added in v0.111.0

func FileExists(ctx context.Context) (bool, error)

FileExists reports whether the global config file (~/.dark-factory/config.yaml) exists. Callers use this only to distinguish "global file present" from "using built-in defaults" in diagnostic logs. - Config file missing → (false, nil) - Home dir lookup fails → (false, wrapped error) - Any other stat error → (false, wrapped error) - File present (any size) → (true, nil)

Types

type GlobalConfig

type GlobalConfig struct {
	MaxContainers      int     `yaml:"maxContainers"`
	HideGit            *bool   `yaml:"hideGit,omitempty"`
	AutoRelease        *bool   `yaml:"autoRelease,omitempty"`
	DirtyFileThreshold *int    `yaml:"dirtyFileThreshold,omitempty"`
	Model              *string `yaml:"model,omitempty"`
}

GlobalConfig holds the user-level dark-factory configuration. It is loaded from ~/.dark-factory/config.yaml once at daemon startup. When the file does not exist or the field is omitted, defaults apply.

func (GlobalConfig) Validate

func (g GlobalConfig) Validate(ctx context.Context) error

Validate validates the GlobalConfig fields.

type Loader

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

Loader loads the global dark-factory configuration.

func NewLoader

func NewLoader() Loader

NewLoader creates a Loader that reads from ~/.dark-factory/config.yaml.

Jump to

Keyboard shortcuts

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