Documentation
¶
Overview ¶
Package userconfig defines the schema and merge semantics for skill-up's optional user-level configuration file (typically ~/.config/skill-up/config.yaml).
The config provides defaults for OpenTelemetry-related environment variables and per-environment.type runtime kwargs that the `run` command consumes. The embedded defaults are intentionally empty: skill-up ships with no alibaba-specific (or any other vendor-specific) defaults; downstream consumers maintain their own config file.
Discovery and precedence are handled by LoadEffective in loader.go.
Index ¶
- Constants
- func ApplyEnv(c Config) ([]string, error)
- func FromContext(ctx context.Context) (Config, []Source, bool)
- func LoadEffective(opts LoadOptions) (Config, []Source, error)
- func MergeKwargs(c Config, envType string, evalKwargs map[string]string) map[string]string
- func WithContext(ctx context.Context, cfg Config, sources []Source) context.Context
- type Config
- type Kwargs
- type LoadOptions
- type Source
- type Telemetry
- type TracesConfig
Constants ¶
const ConfigEnvVar = "SKILL_UP_CONFIG"
ConfigEnvVar overrides the user-layer config path.
const ProjectConfigFile = ".skill-up.yaml"
ProjectConfigFile is the per-project config file name (in WorkingDir).
const UserConfigDir = "skill-up"
UserConfigDir is the directory under $XDG_CONFIG_HOME / ~/.config.
const UserConfigFile = "config.yaml"
UserConfigFile is the default user-layer file name.
Variables ¶
This section is empty.
Functions ¶
func ApplyEnv ¶
ApplyEnv writes telemetry and arbitrary env defaults from c into the process environment, only setting keys that are currently unset. It returns the list of keys that were actually applied (sorted) for logging and debugging.
func FromContext ¶
FromContext retrieves a Config attached via WithContext.
func LoadEffective ¶
func LoadEffective(opts LoadOptions) (Config, []Source, error)
LoadEffective merges all discovery layers in order of increasing precedence and returns the merged Config and the list of layers that actually contributed.
func MergeKwargs ¶
MergeKwargs returns a kwargs map for envType where eval.yaml entries always win and user-config entries fill in any missing keys.
Types ¶
type Config ¶
type Config struct {
SchemaVersion string `yaml:"schema_version,omitempty"`
Kind string `yaml:"kind,omitempty"`
Telemetry Telemetry `yaml:"telemetry,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
RuntimeKwargs map[string]Kwargs `yaml:"runtime_kwargs,omitempty"`
}
Config is the on-disk schema for a skill-up user-config file.
func LoadFile ¶ added in v0.1.2
LoadFile reads and validates a single config file. Returns an error if the file is missing, unparseable, or fails Validate. Unlike LoadEffective it does not consult any discovery layers — it is meant for callers (e.g. the `init` subcommand) that want to vet a specific file in isolation.
func Redact ¶
Redact returns a copy of c with every string field tagged `secret:"true"` masked. Values that match the ${ENV_VAR} pattern are preserved verbatim so that env references remain visible.
Currently no Config field carries the secret tag; this is forward-compatible for future fields and is exercised by tests with a small fixture struct.
type LoadOptions ¶
type LoadOptions struct {
ExplicitPath string
WorkingDir string
HomeDir string
Env func(string) string
// Warnings receives one line per non-fatal issue (e.g. a corrupt user or
// project layer file). Defaults to os.Stderr when nil.
Warnings io.Writer
}
LoadOptions controls config discovery.
type Telemetry ¶
type Telemetry struct {
ServiceName string `yaml:"service_name,omitempty"`
TracesExporter string `yaml:"traces_exporter,omitempty"`
Traces TracesConfig `yaml:"traces,omitempty"`
ResourceAttributes map[string]string `yaml:"resource_attributes,omitempty"`
// Verbose, when explicitly set to true, enables OTEL_LOG_USER_PROMPTS,
// OTEL_LOG_TOOL_CONTENT, and OTEL_LOG_TOOL_DETAILS. A pointer is used so
// higher-precedence layers can both enable (true) and disable (false) it;
// a nil pointer means "inherit from lower-precedence layers".
Verbose *bool `yaml:"verbose,omitempty"`
}
Telemetry holds OpenTelemetry-related defaults. Each non-empty field maps to a standard OTEL_* environment variable applied only when the corresponding variable is currently unset in the process environment.
type TracesConfig ¶
type TracesConfig struct {
Endpoint string `yaml:"endpoint,omitempty"`
Protocol string `yaml:"protocol,omitempty"`
}
TracesConfig holds OTLP traces transport defaults.