Documentation
¶
Overview ¶
Package state persists Skillcrew's local files: the user configuration, the lockfile and the last sync state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotInitialized = errors.New(`skillcrew is not initialized; run "skillcrew init <registry>"`)
ErrNotInitialized means "skillcrew init" has not been run.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Registry string `yaml:"registry"`
Ref string `yaml:"ref,omitempty"`
Teams []string `yaml:"teams,omitempty"`
Disabled []string `yaml:"disabled,omitempty"` // recommended skills turned off
Installed []string `yaml:"installed,omitempty"` // available skills turned on
Debounce time.Duration `yaml:"debounce,omitempty"`
Interval time.Duration `yaml:"interval,omitempty"`
}
Config is the developer's configuration (~/.skillcrew/config.yaml).
func LoadConfig ¶
LoadConfig reads the configuration, returning ErrNotInitialized if it does not exist.
func (Config) SyncDebounce ¶
SyncDebounce is the minimum delay between two fetches.
func (Config) SyncInterval ¶
SyncInterval is the period of the fallback timer.
type Lock ¶
type Lock struct {
Commit string `json:"commit"`
Skills map[string]LockedSkill `json:"skills"` // keyed by install name
}
Lock records what Skillcrew installed (~/.skillcrew/lock.json). A skill directory is owned by Skillcrew if and only if it appears here.
type LockedSkill ¶
type LockedSkill struct {
ID string `json:"id"`
Commit string `json:"commit"`
SourceHash string `json:"source_hash"` // content in the registry
Hash string `json:"hash"` // content on disk (differs when aliased)
Stamp string `json:"stamp"` // metadata fingerprint of the copy on disk
}
LockedSkill is one installed skill.
type State ¶
type State struct {
LastSync time.Time `json:"last_sync"`
LastError string `json:"last_error,omitempty"`
Warnings []string `json:"warnings,omitempty"` // from the last sync
Notices []string `json:"notices,omitempty"` // kept until shown to the developer
FetchFailedAt time.Time `json:"fetch_failed_at,omitzero"` // last failed fetch, for backoff
}
State is the outcome of the last sync (~/.skillcrew/state.json).