Documentation
¶
Overview ¶
Package globalconfig loads and validates the user-level dark-factory configuration from ~/.dark-factory/config.yaml.
Index ¶
Constants ¶
const DefaultMaxContainers = 3
DefaultMaxContainers is the system-wide container limit when no config is set.
const ModelPattern = `^[a-zA-Z0-9._:/-]{1,256}$`
ModelPattern is the regex source string. Exported so callers can include it in error messages.
Variables ¶
var ModelRegex = regexp.MustCompile(ModelPattern)
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
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.