Documentation
¶
Overview ¶
Package config resolves gskill's layered configuration. Precedence, lowest to highest, is: built-in defaults, user config file, project config file, GSKILL_-prefixed environment variables, then explicit flags. Storage paths follow the platform convention (XDG on Linux, the OS equivalents elsewhere) and may be overridden with GSKILL_CONFIG_DIR / GSKILL_CACHE_DIR.
Index ¶
Constants ¶
const ( StoreScopeGlobal = "global" StoreScopeProject = "project" )
Store scope values accepted for StoreScope (empty = auto-detect).
const ( PrivacyFull = "full" PrivacyMinimal = "minimal" PrivacyDisabled = "disabled" )
Privacy modes accepted for PrivacyProjectRegistry.
const (
// EnvPrefix is the prefix for environment-variable overrides.
EnvPrefix = "GSKILL_"
)
Variables ¶
This section is empty.
Functions ¶
func CacheDir ¶
CacheDir returns the gskill cache directory, honoring GSKILL_CACHE_DIR and otherwise following the platform convention.
func DefaultMap ¶
DefaultMap returns the built-in configuration defaults.
Types ¶
type Config ¶
type Config struct {
LogLevel string
LogFormat string
Offline bool
NoCache bool
Jobs int
// Repositories are the known skill repositories an unscoped `find` searches
// (FR-038). Configured in a config file (TOML array) or via
// GSKILL_REPOSITORIES (comma-separated).
Repositories []string
// StoreScope selects the physical content-store location: "global"
// (user-level store under the gskill home) or "project" (legacy
// <project>/.gskill/store). Empty means auto-detect per project. Distinct
// from the installer's agent-target scope.
StoreScope string
// StoreVerifyOnUse re-hashes a global store object's content on every
// activation when true (the default).
StoreVerifyOnUse bool
// StoreGCGracePeriod is the minimum age before an unreferenced global
// store object becomes eligible for garbage collection.
StoreGCGracePeriod time.Duration
// StoreLockTimeout bounds how long a contended global-store or project
// lock is waited on before failing.
StoreLockTimeout time.Duration
// ProjectsRegistry enables the advisory per-user project registry.
ProjectsRegistry bool
// PrivacyProjectRegistry controls how much project detail the registry
// records: "full", "minimal" (no absolute paths), or "disabled".
PrivacyProjectRegistry string
}
Config is the resolved, layered gskill configuration.
type Sources ¶
type Sources struct {
// Defaults seeds the lowest layer. When nil, DefaultMap is used.
Defaults map[string]any
// UserFile and ProjectFile are optional TOML config paths. A missing file
// is skipped without error.
UserFile string
ProjectFile string
// Environ is a list of "KEY=VALUE" entries (as from os.Environ); only
// GSKILL_-prefixed entries are consulted. When nil, the process environment
// is used.
Environ []string
// Flags is the highest-precedence layer of explicitly set flag values.
Flags map[string]any
}
Sources are the inputs to Load. Empty fields are skipped; later layers override earlier ones in the documented precedence order.