config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides configuration loading and management for norma.

Package config provides configuration loading and management for norma.

Index

Constants

View Source
const (
	AgentTypeGenericACP = agentconfig.AgentTypeGenericACP

	AgentTypeCodexACP      = agentconfig.AgentTypeCodexACP
	AgentTypeOpenCodeACP   = agentconfig.AgentTypeOpenCodeACP
	AgentTypeGeminiACP     = agentconfig.AgentTypeGeminiACP
	AgentTypeCopilotACP    = agentconfig.AgentTypeCopilotACP
	AgentTypeClaudeCodeACP = agentconfig.AgentTypeClaudeCodeACP
)

Supported agent types.

View Source
const CoreConfigFileName = appconfig.CoreConfigFileName

CoreConfigFileName is the fallback config filename.

Variables

This section is empty.

Functions

func ExpandEnv

func ExpandEnv(input string) (string, error)

ExpandEnv expands $VAR and ${VAR} placeholders in the provided text.

func IsACPType

func IsACPType(agentType string) bool

IsACPType reports whether an agent type uses the ACP runtime.

func IsPlannerSupportedType

func IsPlannerSupportedType(agentType string) bool

IsPlannerSupportedType reports whether planner mode supports the agent type.

func LoadRuntimeAndCLIConfig

func LoadRuntimeAndCLIConfig(opts RuntimeLoadOptions) (Config, CLISettings, error)

LoadRuntimeAndCLIConfig loads runtime config and CLI app settings.

func LoadRuntimeAndCLIConfigUnresolved

func LoadRuntimeAndCLIConfigUnresolved(opts RuntimeLoadOptions) (Config, CLISettings, error)

LoadRuntimeAndCLIConfigUnresolved loads runtime config and CLI settings without resolving PDCA role IDs.

func LoadRuntimeAndPlannerConfig

func LoadRuntimeAndPlannerConfig(opts RuntimeLoadOptions) (Config, PlannerSettings, error)

LoadRuntimeAndPlannerConfig loads runtime config and planner settings.

func LoadRuntimeAndSwarmConfig

func LoadRuntimeAndSwarmConfig(opts RuntimeLoadOptions) (Config, SwarmSettings, error)

LoadRuntimeAndSwarmConfig loads runtime config and swarm settings.

Types

type AgentConfig

type AgentConfig = agentconfig.Config

AgentConfig describes how to run an agent.

type Budgets

type Budgets struct {
	MaxIterations int `json:"max_iterations,omitempty" mapstructure:"max_iterations" validate:"omitempty,min=1"`
}

Budgets defines run limits (optional, defaults to 5 iterations if not set).

type CLISettings

type CLISettings struct {
	PDCA      PDCAAgentRefs   `mapstructure:"pdca"    validate:"required"`
	Budgets   Budgets         `mapstructure:"budgets"`
	Retention RetentionPolicy `mapstructure:"retention"`
}

CLISettings are app-specific settings for norma CLI commands.

func (CLISettings) EffectiveBudgets

func (c CLISettings) EffectiveBudgets() Budgets

EffectiveBudgets returns budgets with defaults.

func (CLISettings) EffectiveRetention

func (c CLISettings) EffectiveRetention() RetentionPolicy

EffectiveRetention returns retention with defaults.

type Config

type Config struct {
	Runtime runtimeconfig.RuntimeConfig `json:"runtime"           mapstructure:"runtime"  validate:"required"`
	Profile string                      `json:"profile,omitempty" mapstructure:"profile"`
	RoleIDs map[string]string           `json:"-"                  mapstructure:"-"`
}

Config is the root configuration.

func LoadRuntime

func LoadRuntime(opts RuntimeLoadOptions) (Config, error)

LoadRuntime loads and validates runtime core config for norma CLI commands.

func (Config) ResolvePlannerProvider

func (c Config) ResolvePlannerProvider(planner PlannerSettings) (string, error)

ResolvePlannerProvider validates and resolves planner provider settings.

func (Config) ResolveRoleIDs

func (c Config) ResolveRoleIDs(cli CLISettings) (map[string]string, error)

ResolveRoleIDs resolves PDCA role agent IDs from CLI app settings.

func (Config) ResolveSwarmRoles

func (c Config) ResolveSwarmRoles(swarm SwarmSettings) (map[string]ResolvedSwarmRoleConfig, error)

ResolveSwarmRoles validates and resolves swarm roles from swarm settings.

func (Config) Validate

func (c Config) Validate() error

Validate validates the configuration.

type MCPServerConfig

type MCPServerConfig = agentconfig.MCPServerConfig

MCPServerConfig describes an MCP server configuration.

type PDCAAgentRefs

type PDCAAgentRefs struct {
	Plan  string `json:"plan,omitempty"  mapstructure:"plan"  validate:"required,min=1"`
	Do    string `json:"do,omitempty"    mapstructure:"do"    validate:"required,min=1"`
	Check string `json:"check,omitempty" mapstructure:"check" validate:"required,min=1"`
	Act   string `json:"act,omitempty"   mapstructure:"act"   validate:"required,min=1"`
}

PDCAAgentRefs maps fixed PDCA roles to global agent names.

type PlannerSettings

type PlannerSettings struct {
	Provider string `json:"provider,omitempty" mapstructure:"provider" validate:"omitempty,min=1"`
}

PlannerSettings defines config for the interactive planner app.

type ResolvedSwarmRoleConfig

type ResolvedSwarmRoleConfig struct {
	Key           string
	Assignee      string
	Instruction   string
	ProviderID    string
	IsPrimaryRole bool
}

ResolvedSwarmRoleConfig is a swarm role with its effective provider.

type RetentionPolicy

type RetentionPolicy struct {
	KeepLast int `json:"keep_last,omitempty" mapstructure:"keep_last" validate:"omitempty,min=1"`
	KeepDays int `json:"keep_days,omitempty" mapstructure:"keep_days" validate:"omitempty,min=1"`
}

RetentionPolicy defines how many old runs to keep (optional).

type RuntimeLoadOptions

type RuntimeLoadOptions = appconfig.RuntimeLoadOptions

RuntimeLoadOptions configures runtime config loading.

type SwarmRoleConfig

type SwarmRoleConfig struct {
	Assignee    string `json:"assignee,omitempty"    mapstructure:"assignee"    validate:"omitempty,min=1"`
	Instruction string `json:"instruction,omitempty" mapstructure:"instruction" validate:"omitempty,min=1"`
	Provider    string `json:"provider,omitempty"    mapstructure:"provider"    validate:"omitempty,min=1"`
}

SwarmRoleConfig defines one swarm role worker.

type SwarmSettings

type SwarmSettings struct {
	PrimaryRole     string                     `json:"primary_role,omitempty"     mapstructure:"primary_role"     validate:"omitempty,min=1"`
	DefaultProvider string                     `json:"default_provider,omitempty" mapstructure:"default_provider" validate:"omitempty,min=1"`
	Roles           map[string]SwarmRoleConfig `json:"roles,omitempty"            mapstructure:"roles"`
}

SwarmSettings defines config for assignee-routed swarm execution.

Jump to

Keyboard shortcuts

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