config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config provides project-level configuration for Holon. It supports loading configuration from .holon/config.yaml files with proper precedence: CLI flags > project config > defaults.

Index

Constants

View Source
const (
	// ConfigDir is the directory name for Holon configuration
	ConfigDir = ".holon"
	// ConfigFile is the name of the configuration file
	ConfigFile = "config.yaml"
	// ConfigPath is the full path to the config file relative to project root
	ConfigPath = ConfigDir + "/" + ConfigFile
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitConfig

type GitConfig struct {
	// AuthorName overrides git config user.name for containers
	AuthorName string `yaml:"author_name,omitempty"`

	// AuthorEmail overrides git config user.email for containers
	AuthorEmail string `yaml:"author_email,omitempty"`
}

GitConfig contains Git identity overrides for container operations. These settings override the host's git config when running inside containers.

type ProjectConfig

type ProjectConfig struct {
	// BaseImage is the default container toolchain image (e.g., "golang:1.22")
	// Set to "auto" or "auto-detect" to enable automatic detection based on workspace files.
	BaseImage string `yaml:"base_image,omitempty"`

	// Agent is the default agent bundle reference (path, URL, or alias)
	Agent string `yaml:"agent,omitempty"`

	// AgentChannel controls how the agent is resolved when no explicit agent is specified.
	// Values: "latest" (default), "builtin", "pinned:<version>"
	AgentChannel string `yaml:"agent_channel,omitempty"`

	// LogLevel is the default Holon log level (debug, info, progress, minimal)
	LogLevel string `yaml:"log_level,omitempty"`

	// Git configuration overrides for container operations
	Git GitConfig `yaml:"git,omitempty"`
}

ProjectConfig represents the project-level configuration for Holon. It provides defaults that can be overridden by CLI flags.

func Load

func Load(dir string) (*ProjectConfig, error)

Load loads the project configuration from the given directory. It searches for .holon/config.yaml in the directory and its parents.

If no config file is found, it returns a zero config and nil error. If a config file is found but cannot be parsed, it returns an error.

func LoadFromCurrentDir

func LoadFromCurrentDir() (*ProjectConfig, error)

LoadFromCurrentDir loads the project configuration from the current working directory.

func (*ProjectConfig) GetGitAuthorEmail

func (c *ProjectConfig) GetGitAuthorEmail() string

GetGitAuthorEmail returns the configured git author email, or empty if not set.

func (*ProjectConfig) GetGitAuthorName

func (c *ProjectConfig) GetGitAuthorName() string

GetGitAuthorName returns the configured git author name, or empty if not set.

func (*ProjectConfig) HasGitConfig

func (c *ProjectConfig) HasGitConfig() bool

HasGitConfig returns true if any git configuration is set.

func (*ProjectConfig) IsImageAutoDetectEnabled

func (c *ProjectConfig) IsImageAutoDetectEnabled() bool

IsImageAutoDetectEnabled returns true if auto-detection is explicitly configured in the project config (vs. default behavior).

func (*ProjectConfig) ResolveAgent

func (c *ProjectConfig) ResolveAgent(cliValue string) (string, string)

ResolveAgent returns the effective agent bundle and its source.

func (*ProjectConfig) ResolveAgentChannel

func (c *ProjectConfig) ResolveAgentChannel(cliValue string) (string, string)

ResolveAgentChannel returns the effective agent channel and its source. Default is "latest" if not specified.

func (*ProjectConfig) ResolveBaseImage

func (c *ProjectConfig) ResolveBaseImage(cliValue, defaultValue string) (string, string)

ResolveBaseImage returns the effective base image and its source.

func (*ProjectConfig) ResolveLogLevel

func (c *ProjectConfig) ResolveLogLevel(cliValue, defaultValue string) (string, string)

ResolveLogLevel returns the effective log level and its source.

func (*ProjectConfig) ResolveString

func (c *ProjectConfig) ResolveString(cliValue, configValue, defaultValue string) (string, string)

ResolveString returns the effective value for a string configuration field. Precedence: cliValue > configValue > defaultValue. Returns the effective value and its source ("cli", "config", or "default").

func (*ProjectConfig) ShouldAutoDetectImage

func (c *ProjectConfig) ShouldAutoDetectImage() bool

ShouldAutoDetectImage returns true if auto-detection is enabled. Auto-detection is enabled if base_image is "auto" or "auto-detect".

Jump to

Keyboard shortcuts

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