Documentation
¶
Overview ¶
Package library is lich's own library of skills and MCP servers: what lich holds in <config>/lich/library, what each provider has installed in its own config that is not there yet (found.go), moving one in, turning each item on or off per provider and per profile, and handing the ones on to a session (deliver.go).
The library is shared by every profile; the switches live in lich.db, one settings key per item, provider and profile. A switch never stored is off: an item reaches only the providers it was moved in from until someone turns it on elsewhere.
Index ¶
- type Delivery
- type Server
- type Service
- func (s *Service) Deliver(provider, profile, profileDir string) Delivery
- func (s *Service) List(_ context.Context, _ api.None) (api.Library, error)
- func (s *Service) MoveIn(_ context.Context, opts api.LibraryItemOptions) (api.None, error)
- func (s *Service) On(kind, name, provider, profile string) bool
- func (s *Service) Seen(_ context.Context, opts api.LibrarySeenOptions) (api.None, error)
- func (s *Service) Set(_ context.Context, opts api.LibrarySwitchOptions) (api.None, error)
- func (s *Service) Watch(ctx context.Context)
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Delivery ¶
type Delivery struct {
// PluginDir is a Claude Code plugin holding the skills, for --plugin-dir.
PluginDir string
// SkillsDir is the folder of skills, for opencode's skills.paths.
SkillsDir string
// OMPConfig is an omp --config overlay naming SkillsDir.
OMPConfig string
// CrushSkills is the folder for CRUSH_SKILLS_DIR: Crush's own global
// skills and the library's, since the variable replaces Crush's search.
CrushSkills string
// MCP are the servers for the providers that take them at spawn.
MCP map[string]Server
}
Delivery is what one spawn hands its provider.
type Server ¶
type Server struct {
Type string `json:"type,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
URL string `json:"url,omitempty"`
}
Server is one MCP server as the library keeps it.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the library over one config directory.
func New ¶
func New(settings Settings, emit func(name string, data any), profiles func(string) []api.Profile, pluginDir func() string) *Service
New returns the library, reporting changes through emit.
func (*Service) Deliver ¶
Deliver works out provider's items for a session in profile (its slug, "" for Personal), whose own config directory is profileDir ("" for Personal's), and writes what the provider can only read from its config. A failure costs the session those items, never its spawn.
func (*Service) List ¶
List answers the library, what the providers hold beside it and lich's own plugin, over RPC.
func (*Service) MoveIn ¶
MoveIn copies a found item into the library, turns it off in every provider it was found in, and turns it on in lich for those providers, over RPC.
func (*Service) On ¶
On is whether item reaches provider's sessions in profile ("" for the provider as a whole): the profile's own switch once it was set, else the provider's, which a move in sets for every profile at once.