config

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseDirOf added in v0.5.0

func BaseDirOf(cfg types.Config) string

BaseDirOf resolves the plugins/skills root that a loaded config points at.

types.Config.BaseDir holds the RAW OVERRIDE, empty for standalone nib, so it is not a directory and must never be joined onto a path: filepath.Join("", "plugins") silently yields a relative path under the process working directory. Use this helper wherever a resolved directory is wanted. Handing the raw field to something that documents its parameter as an override (manage.NewIn, setup.Save) is the other correct use and needs no wrapping.

This cannot be a method on types.Config: plugin already imports types, so types importing plugin would be an import cycle.

func Load

func Load() types.Config

Load loads the configuration from YAML file and environment variables. Environment variables take precedence over YAML config.

func LoadWith added in v0.5.0

func LoadWith(o LoadOptions) types.Config

LoadWith is Load with injectable roots and behavior switches.

func WritablePath

func WritablePath() string

WritablePath returns the config file self-configuration should write to: the first existing config path (so additions are visible to Load), else the preferred default ~/.config/nib/config.yaml.

func WritablePathIn added in v0.5.0

func WritablePathIn(root string) string

WritablePathIn returns the config file to write to for the given root.

Types

type AgentTypeConfig

type AgentTypeConfig = types.AgentTypeConfig

AgentTypeConfig is re-exported for ergonomic use within the config package.

func MergeAgentTypes

func MergeAgentTypes(user []AgentTypeConfig) []AgentTypeConfig

MergeAgentTypes returns the built-in types with any user entries merged in: an entry whose Name matches a default overrides it field-for-field; a new Name is appended. Defaults not mentioned by the user are preserved.

type LoadOptions added in v0.5.0

type LoadOptions struct {
	// BaseDir overrides the config/plugins/skills root. Empty means the
	// default XDG resolution.
	BaseDir string
	// Defaults seed fields the config file leaves empty. They sit beneath the
	// file so a user edit always wins. Every field of types.Config is seedable,
	// not a hand-picked subset, with ONE carve-out: Defaults.BaseDir is ignored.
	// The root has exactly one knob, LoadOptions.BaseDir above, and a seeded
	// BaseDir is overwritten by it (including when it is empty, which is what
	// selects standalone nib's XDG resolution). See applySeeds for exactly what
	// "empty" means for maps, slices and booleans.
	Defaults types.Config
	// SkipBareEnv suppresses the bare MODEL / API_KEY / BASE_URL environment
	// variables. Embedders that expose their own prefixed variables set this so
	// a MODEL meant for some other tool cannot retarget the agent.
	SkipBareEnv bool
}

LoadOptions configures LoadWith. The zero value is what standalone nib uses.

Jump to

Keyboard shortcuts

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