config

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Overview

Package config handles configuration loading, writing, and scope detection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContractPath

func ContractPath(path string) string

ContractPath replaces home directory with ~.

func DetectGitRoot added in v0.7.1

func DetectGitRoot() string

DetectGitRoot returns the git root for cwd, or empty when cwd is not in a git repo.

func DetectLocalPath

func DetectLocalPath() string

DetectLocalPath finds the local config path by searching from cwd to git root.

func ExpandPath

func ExpandPath(path string) string

ExpandPath expands ~ to home directory.

Types

type CacheConfig

type CacheConfig struct {
	Path string `toml:"path"`
}

CacheConfig defines the cache settings.

type Config

type Config struct {
	Cache   CacheConfig         `toml:"cache"`
	Targets map[string]Target   `toml:"targets"`
	Repos   map[string]RepoInfo `toml:"repos"`
}

Config represents the main configuration structure.

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader handles configuration loading with scope detection.

func NewLoader

func NewLoader(scope Scope) *Loader

NewLoader creates a new config loader.

func (*Loader) GlobalPath

func (l *Loader) GlobalPath() string

GlobalPath returns the global config file path.

func (*Loader) Load

func (l *Loader) Load() (*Config, error)

Load loads the configuration based on scope.

func (*Loader) LoadAllRepos

func (l *Loader) LoadAllRepos() (map[string]RepoInfo, CacheConfig, error)

LoadAllRepos loads repos from both global and local configs. This is needed for skill discovery since repos are cached globally.

func (*Loader) Save

func (l *Loader) Save(cfg *Config, local bool) error

Save writes the configuration to a file.

type RepoInfo

type RepoInfo struct {
	URL     string `toml:"url"`
	Branch  string `toml:"branch"`
	Updated string `toml:"updated"`
	Alias   string `toml:"alias"`
}

RepoInfo tracks a cached repository.

type Scope

type Scope int

Scope represents the config scope.

const (
	ScopeLocal Scope = iota
	ScopeGlobal
)

func (Scope) IsLocal added in v0.4.0

func (s Scope) IsLocal() bool

IsLocal returns true if this is a local scope.

func (Scope) String

func (s Scope) String() string

String returns the string representation of a Scope.

type Target

type Target struct {
	Name        string            `toml:"name"`
	GlobalPath  string            `toml:"globalPath"`
	GlobalPaths map[string]string `toml:"globalPaths"`
	LocalPath   string            `toml:"localPath"`
	Enabled     bool              `toml:"enabled"`
}

Target defines an agent skill directory target. GlobalPath is used when installing with -s global (global agent). LocalPath is used when installing with -s local (local/project agent).

Jump to

Keyboard shortcuts

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