Documentation
¶
Index ¶
- Constants
- Variables
- func RequiredDirs() []string
- func ValidateConfig(cfg Config) error
- func WriteConfig(path string, cfg Config) error
- type Config
- type Defaults
- type LocalStore
- func (s *LocalStore) ConfigPath() string
- func (s *LocalStore) Doctor(ctx context.Context) error
- func (s *LocalStore) GetComponent(ctx context.Context, ref components.Ref) (components.Component, error)
- func (s *LocalStore) GetLoadout(ctx context.Context, id string) (loadouts.Loadout, error)
- func (s *LocalStore) Home() string
- func (s *LocalStore) Init(ctx context.Context) error
- func (s *LocalStore) ListComponents(ctx context.Context, filter components.Filter) ([]components.ComponentSummary, error)
- func (s *LocalStore) ListLoadouts(ctx context.Context) ([]loadouts.Summary, error)
- func (s *LocalStore) RemoveComponent(ctx context.Context, ref components.Ref) error
- func (s *LocalStore) RemoveLoadout(ctx context.Context, id string) error
- func (s *LocalStore) SaveComponent(ctx context.Context, component components.Component) error
- func (s *LocalStore) SaveComponentFrom(ctx context.Context, component components.Component, sourceDir string) error
- func (s *LocalStore) SaveLoadout(ctx context.Context, loadout loadouts.Loadout) error
Constants ¶
const APIVersion = "contextcart.dev/v1"
const ConfigFileName = "config.yaml"
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
func RequiredDirs ¶
func RequiredDirs() []string
RequiredDirs returns the store directories required by v1.
func ValidateConfig ¶
ValidateConfig verifies supported config schema and required fields.
func WriteConfig ¶
WriteConfig writes a store config YAML file, creating the parent directory.
Types ¶
type Config ¶
type Config struct {
APIVersion string `yaml:"apiVersion"`
CreatedAt string `yaml:"createdAt"`
Defaults Defaults `yaml:"defaults"`
}
Config is the versioned store configuration written to config.yaml.
func ReadConfig ¶
ReadConfig reads and validates a store config YAML file.
type Defaults ¶
type Defaults struct {
PreferSymlink bool `yaml:"preferSymlink"`
}
Defaults contains store-wide default preferences.
type LocalStore ¶
type LocalStore struct {
// contains filtered or unexported fields
}
LocalStore is the file-backed ContextCart store rooted at a resolved home.
func (*LocalStore) ConfigPath ¶
func (s *LocalStore) ConfigPath() string
ConfigPath returns the store config.yaml path.
func (*LocalStore) Doctor ¶
func (s *LocalStore) Doctor(ctx context.Context) error
Doctor verifies the v1 store layout, config schema, and readable component metadata files.
func (*LocalStore) GetComponent ¶
func (s *LocalStore) GetComponent(ctx context.Context, ref components.Ref) (components.Component, error)
GetComponent loads a component by typed ID.
func (*LocalStore) GetLoadout ¶
GetLoadout loads a loadout by ID.
func (*LocalStore) Home ¶
func (s *LocalStore) Home() string
Home returns the resolved ContextCart home directory used by this store.
func (*LocalStore) Init ¶
func (s *LocalStore) Init(ctx context.Context) error
Init creates the ContextCart store layout and writes config.yaml if missing.
func (*LocalStore) ListComponents ¶
func (s *LocalStore) ListComponents(ctx context.Context, filter components.Filter) ([]components.ComponentSummary, error)
ListComponents returns component summaries matching the supplied filter.
func (*LocalStore) ListLoadouts ¶
ListLoadouts returns all loadout summaries in deterministic filename order.
func (*LocalStore) RemoveComponent ¶
func (s *LocalStore) RemoveComponent(ctx context.Context, ref components.Ref) error
RemoveComponent removes a component record and payload directory from the store.
func (*LocalStore) RemoveLoadout ¶
func (s *LocalStore) RemoveLoadout(ctx context.Context, id string) error
RemoveLoadout removes one loadout definition from the store.
func (*LocalStore) SaveComponent ¶
func (s *LocalStore) SaveComponent(ctx context.Context, component components.Component) error
SaveComponent validates and writes a component record whose payload files are already present in its target store directory.
func (*LocalStore) SaveComponentFrom ¶
func (s *LocalStore) SaveComponentFrom(ctx context.Context, component components.Component, sourceDir string) error
SaveComponentFrom validates and writes a component record, copying any payload files from sourceDir before persisting metadata.
func (*LocalStore) SaveLoadout ¶
SaveLoadout validates and writes one loadout definition.