config

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 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

View Source
const ServerName = "git-courer"

ServerName is the MCP server identifier registered with AI clients.

View Source
const ServerVersion = "1.3.1"

ServerVersion is the current MCP server version.

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"` // [USER] Enable auto-backup
}

BackupConfig holds settings for the automatic backup system. [USER] 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"` // [USER] List of enabled operation keys
}

CommandsConfig holds settings for enabled/disabled workflow commands. [USER] Which operations are allowed to run.

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"`           // Plan TTL
	LogPath     string         `yaml:"log_path"`      // Log file path
	MaxLogLines int            `yaml:"max_log_lines"` // Max log lines
}

CommitConfig holds commit-related settings including plan TTL and file paths. [USER] Configure commit workflow behavior.

type Config

type Config struct {
	Ollama   OllamaConfig   `yaml:"ollama"`   // Ollama AI settings
	Git      GitConfig      `yaml:"git"`      // Git behavior settings
	Secrets  SecretsConfig  `yaml:"secrets"`  // Secrets detection
	Preview  PreviewConfig  `yaml:"preview"`  // Preview/confirmation settings
	Commit   CommitConfig   `yaml:"commit"`   // Commit workflow settings
	Release  ReleaseConfig  `yaml:"release"`  // Release workflow settings
	Commands CommandsConfig `yaml:"commands"` // Enabled operations
	Backup   BackupConfig   `yaml:"backup"`   // Auto-backup settings
}

Config represents the git-courer configuration. All fields are editable by users via config files.

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"`            // [USER] Default working directory
	AutoAddSecrets   bool   `yaml:"auto_add_secrets"`   // [USER] Auto-stage detected secrets
	RequireCleanRepo bool   `yaml:"require_clean_repo"` // [USER] Require clean working tree
}

GitConfig holds git-related settings. [USER] Configure git behavior.

type OllamaConfig

type OllamaConfig struct {
	Host          string `yaml:"host"`           // [USER] Ollama server URL
	Model         string `yaml:"model"`          // [USER] Model to use
	ContextWindow int    `yaml:"context_window"` // [USER] Context window size (0 = default)
	AutoStart     bool   `yaml:"auto_start"`     // [USER] Auto-start Ollama if not running
	ModelsDir     string `yaml:"models_dir"`     // [USER] Custom models directory
}

OllamaConfig holds Ollama-related settings. [USER] Configure the Ollama AI backend.

type PreviewConfig

type PreviewConfig struct {
	Enabled    bool            `yaml:"enabled"`    // [USER] Enable preview mode
	Operations map[string]bool `yaml:"operations"` // [USER] Operations requiring preview
}

PreviewConfig holds preview/confirmation settings. [USER] Configure preview dialogs and confirmations.

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"`              // [USER] Log file path
	MaxLogLines        int    `yaml:"max_log_lines"`         // [USER] Max log lines
	MaxCommitsPerChunk int    `yaml:"max_commits_per_chunk"` // [USER] Max commits per chunk
}

ReleaseConfig holds release-related settings. [USER] Configure release workflow behavior.

type SecretsConfig

type SecretsConfig struct {
	DetectionMode      string   `yaml:"detection_mode"`        // [USER] Detection mode: regex, ai, regex+ai
	Patterns           []string `yaml:"patterns"`              // [USER] Regex patterns for secrets
	UseLLMSecurityScan string   `yaml:"use_llm_security_scan"` // [USER] Use LLM for security scan
}

SecretsConfig holds secrets detection settings. [USER] Configure secrets detection.

Jump to

Keyboard shortcuts

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