config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config loads and merges git-courer configuration. Merge order: defaults → global (~/.config/git-courer/config.yaml) → project (.gcourer/config.yaml).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalConfigPath

func GlobalConfigPath() string

GlobalConfigPath returns the platform-appropriate global config path.

func ProjectConfigPaths

func ProjectConfigPaths(workDir string) []string

ProjectConfigPaths returns possible project config paths (first match wins).

Types

type BackupConfig

type BackupConfig struct {
	Enabled bool `yaml:"enabled"`
}

BackupConfig holds settings for the automatic backup system. Before every destructive _APPLY, git-courer creates a ref + optional stash. On success the backup is deleted. On failure it auto-restores and notifies the user.

type CommandsConfig

type CommandsConfig struct {
	EnabledOperations []string `yaml:"enabled_operations"`
}

CommandsConfig holds settings for enabled/disabled workflow commands.

func (CommandsConfig) IsEnabled

func (c CommandsConfig) IsEnabled(operationKey string) bool

IsEnabled returns true if the given operation is in the list of enabled operations.

type CommitConfig

type CommitConfig struct {
	TTL                 DurationConfig `yaml:"ttl"`
	MaxPlanRetries      int            `yaml:"max_plan_retries"`
	LockFile            string         `yaml:"lock_file"`
	PlanFile            string         `yaml:"plan_file"`
	BlockerFile         string         `yaml:"blocker_file"`
	LogPath             string         `yaml:"log_path"`
	MaxLogLines         int            `yaml:"max_log_lines"`
	BackgroundThreshold int            `yaml:"background_threshold"`
}

CommitConfig holds commit-related settings including plan TTL and file paths.

type Config

type Config struct {
	Ollama     OllamaConfig     `yaml:"ollama"`
	Git        GitConfig        `yaml:"git"`
	Secrets    SecretsConfig    `yaml:"secrets"`
	Validation ValidationConfig `yaml:"validation"`
	UI         UIConfig         `yaml:"ui"`
	MCP        MCPConfig        `yaml:"mcp"`
	Preview    PreviewConfig    `yaml:"preview"`
	Commit     CommitConfig     `yaml:"commit"`
	Release    ReleaseConfig    `yaml:"release"`
	Commands   CommandsConfig   `yaml:"commands"`
	Backup     BackupConfig     `yaml:"backup"`
}

Config represents the git-courer configuration.

func Default

func Default() *Config

Default returns the default configuration.

func Load

func Load() (*Config, error)

Load loads configuration from the current directory.

func LoadFromDir

func LoadFromDir(workDir string) (*Config, error)

LoadFromDir loads configuration with cascade: defaults → global → project.

func (*Config) SaveGlobal

func (c *Config) SaveGlobal() error

SaveGlobal saves the config to the global config path.

type DurationConfig

type DurationConfig struct {
	time.Duration
}

DurationConfig wraps time.Duration for YAML unmarshaling.

func NewDurationConfig

func NewDurationConfig(d time.Duration) DurationConfig

NewDurationConfig creates a DurationConfig with the given duration.

func (DurationConfig) MarshalYAML

func (d DurationConfig) MarshalYAML() (interface{}, error)

MarshalYAML implements custom marshaling for DurationConfig.

func (*DurationConfig) UnmarshalYAML

func (d *DurationConfig) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements custom unmarshaling for DurationConfig.

type GitConfig

type GitConfig struct {
	WorkDir          string `yaml:"workdir"`
	AutoAddSecrets   bool   `yaml:"auto_add_secrets"`
	RequireCleanRepo bool   `yaml:"require_clean_repo"`
}

GitConfig holds git-related settings.

type MCPConfig

type MCPConfig struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

MCPConfig holds MCP server settings.

type OllamaConfig

type OllamaConfig struct {
	Host          string `yaml:"host"`
	Model         string `yaml:"model"`
	ContextWindow int    `yaml:"context_window"`
	AutoStart     bool   `yaml:"auto_start"`
	ModelsDir     string `yaml:"models_dir"`
}

OllamaConfig holds Ollama-related settings.

type PreviewConfig

type PreviewConfig struct {
	Enabled    bool            `yaml:"enabled"`
	Operations map[string]bool `yaml:"operations"`
}

PreviewConfig holds preview/confirmation settings.

func (PreviewConfig) IsRequired

func (p PreviewConfig) IsRequired(operationKey string) bool

IsRequired returns true if confirmation is required for the given operation key.

type ReleaseConfig

type ReleaseConfig struct {
	LogPath            string `yaml:"log_path"`
	MaxLogLines        int    `yaml:"max_log_lines"`
	MaxCommitsPerChunk int    `yaml:"max_commits_per_chunk"`
}

ReleaseConfig holds release-related settings.

type SecretsConfig

type SecretsConfig struct {
	DetectionMode      string   `yaml:"detection_mode"`
	Patterns           []string `yaml:"patterns"`
	UseLLMSecurityScan string   `yaml:"use_llm_security_scan"`
}

SecretsConfig holds secrets detection settings.

type UIConfig

type UIConfig struct {
	Theme     string `yaml:"theme"`
	ShowIcons bool   `yaml:"show_icons"`
}

UIConfig holds UI settings.

type ValidationConfig

type ValidationConfig struct {
	RequireConfirmation bool `yaml:"require_confirmation"`
	MaxCommitLength     int  `yaml:"max_commit_length"`
}

ValidationConfig holds validation settings.

Jump to

Keyboard shortcuts

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