config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoomDataDir

func GetLoomDataDir() string

GetLoomDataDir returns the Loom data directory.

Priority: 1. LOOM_DATA_DIR environment variable (if set and non-empty) 2. ~/.loom (default)

The returned path is always absolute. Tilde (~) in LOOM_DATA_DIR is expanded to the user's home directory. Relative paths in LOOM_DATA_DIR are converted to absolute paths.

This function is called during bootstrap (before config file is loaded) to locate the config file itself. After config is loaded, use config.DataDir for consistency.

Examples:

LOOM_DATA_DIR=/custom/loom        -> /custom/loom
LOOM_DATA_DIR=~/my-loom           -> /home/user/my-loom
LOOM_DATA_DIR=relative/path       -> /current/dir/relative/path
LOOM_DATA_DIR not set             -> /home/user/.loom

Note: This function reads directly from os.Getenv(), not from viper, to avoid circular dependency during config initialization.

func GetLoomSubDir

func GetLoomSubDir(subdir string) string

GetLoomSubDir returns a subdirectory within the Loom data directory. Example: GetLoomSubDir("agents") returns ~/.loom/agents

func LoadProject

func LoadProject(path string) (*loomv1.Project, error)

LoadProject loads a project configuration from a YAML file

func ValidateProject

func ValidateProject(project *loomv1.Project) error

ValidateProject validates a project configuration

Types

type AgentReferenceYAML

type AgentReferenceYAML struct {
	ConfigFile string `yaml:"config_file"`
}

type BackendReferenceYAML

type BackendReferenceYAML struct {
	ConfigFile string `yaml:"config_file"`
}

type EvalReferenceYAML

type EvalReferenceYAML struct {
	ConfigFile string `yaml:"config_file"`
}

type GlobalSettingsYAML

type GlobalSettingsYAML struct {
	DefaultTimeoutSeconds int    `yaml:"default_timeout_seconds"`
	MaxConcurrentAgents   int    `yaml:"max_concurrent_agents"`
	DebugMode             bool   `yaml:"debug_mode"`
	LogLevel              string `yaml:"log_level"`
}

type MCPConfigYAML

type MCPConfigYAML struct {
	ConfigFile string                `yaml:"config_file"`
	Inline     *MCPServersConfigYAML `yaml:"inline"`
}

type MCPServerConfigYAML

type MCPServerConfigYAML struct {
	Enabled        bool                 `yaml:"enabled"`
	Transport      string               `yaml:"transport"`
	Command        string               `yaml:"command"`
	Args           []string             `yaml:"args"`
	TimeoutSeconds int                  `yaml:"timeout_seconds"`
	Tools          MCPToolSelectionYAML `yaml:"tools"`
	Env            map[string]string    `yaml:"env"`
}

type MCPServersConfigYAML

type MCPServersConfigYAML struct {
	Servers map[string]MCPServerConfigYAML `yaml:"servers"`
}

type MCPToolSelectionYAML

type MCPToolSelectionYAML struct {
	All     bool     `yaml:"all"`
	Include []string `yaml:"include"`
	Exclude []string `yaml:"exclude"`
}

type ObservabilityConfigYAML

type ObservabilityConfigYAML struct {
	Enabled       bool              `yaml:"enabled"`
	HawkEndpoint  string            `yaml:"hawk_endpoint"`
	ExportTraces  bool              `yaml:"export_traces"`
	ExportMetrics bool              `yaml:"export_metrics"`
	Tags          map[string]string `yaml:"tags"`
}

type PatternReferenceYAML

type PatternReferenceYAML struct {
	ConfigFile string `yaml:"config_file"`
}

type ProjectMetadataYAML

type ProjectMetadataYAML struct {
	Name        string            `yaml:"name"`
	Version     string            `yaml:"version"`
	Description string            `yaml:"description"`
	Labels      map[string]string `yaml:"labels"`
}

type ProjectSpecYAML

type ProjectSpecYAML struct {
	Observability ObservabilityConfigYAML `yaml:"observability"`
	Prompts       PromptsConfigYAML       `yaml:"prompts"`
	MCP           MCPConfigYAML           `yaml:"mcp"`
	Backends      []BackendReferenceYAML  `yaml:"backends"`
	Agents        []AgentReferenceYAML    `yaml:"agents"`
	Workflows     []WorkflowReferenceYAML `yaml:"workflows"`
	Evals         []EvalReferenceYAML     `yaml:"evals"`
	Patterns      []PatternReferenceYAML  `yaml:"patterns"`
	Settings      GlobalSettingsYAML      `yaml:"settings"`
}

type ProjectYAML

type ProjectYAML struct {
	APIVersion string              `yaml:"apiVersion"`
	Kind       string              `yaml:"kind"`
	Metadata   ProjectMetadataYAML `yaml:"metadata"`
	Spec       ProjectSpecYAML     `yaml:"spec"`
}

ProjectYAML represents the YAML structure for project configuration

type PromptsConfigYAML

type PromptsConfigYAML struct {
	Provider        string `yaml:"provider"`
	Endpoint        string `yaml:"endpoint"`
	CacheEnabled    bool   `yaml:"cache_enabled"`
	CacheTTLSeconds int    `yaml:"cache_ttl_seconds"`
}

type WorkflowReferenceYAML

type WorkflowReferenceYAML struct {
	ConfigFile string `yaml:"config_file"`
}

Jump to

Keyboard shortcuts

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