Documentation
¶
Overview ¶
Package source manages agent sources including git repositories and local paths.
Index ¶
- func IsGitURL(s string) bool
- type AgentInfo
- type GitOperations
- type Manager
- func (m *Manager) AddLocalPath(path string) error
- func (m *Manager) AddRepository(name, gitURL, ref string) error
- func (m *Manager) FindAgent(name string) (string, error)
- func (m *Manager) GetSearchPaths() ([]string, error)
- func (m *Manager) ListAgents() ([]AgentInfo, error)
- func (m *Manager) PinRepository(name, ref string) error
- func (m *Manager) RemoveSource(nameOrPath string) error
- func (m *Manager) UpdateRepositories(force bool) error
- type SkillsManager
- func (m *SkillsManager) AddLocalPath(path string) error
- func (m *SkillsManager) AddRepository(name, gitURL, ref string) error
- func (m *SkillsManager) CatalogPaths() []string
- func (m *SkillsManager) EnsureRepositoriesCloned() error
- func (m *SkillsManager) PinRepository(name, ref string) error
- func (m *SkillsManager) RemoveSource(nameOrPath string) error
- func (m *SkillsManager) UpdateRepositories(force bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GitOperations ¶
type GitOperations struct {
// contains filtered or unexported fields
}
func NewGitOperations ¶
func NewGitOperations(cacheDir string) *GitOperations
NewGitOperations returns a GitOperations that caches cloned repositories under cacheDir.
func (*GitOperations) CachePath ¶
func (g *GitOperations) CachePath(gitURL string) (string, bool)
CachePath returns the local cache path for a repository URL without performing any network operations. It returns the path and true if the repository is already cached locally, or empty string and false otherwise.
func (*GitOperations) CloneOrUpdate ¶
func (g *GitOperations) CloneOrUpdate(gitURL, ref string) (string, error)
CloneOrUpdate clones a repository if it doesn't exist, or updates it if it does, then checks out ref. An empty ref leaves the working tree on the default branch (the historical behavior).
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
NewManager creates a new agent source manager.
func (*Manager) AddLocalPath ¶
AddLocalPath adds a local directory as an agent source.
func (*Manager) AddRepository ¶
AddRepository adds a git repository as an agent source. An empty ref tracks the default branch; a non-empty ref pins the source to that commit SHA, tag, or branch.
func (*Manager) GetSearchPaths ¶
GetSearchPaths returns all directories to search for agents in priority order.
func (*Manager) ListAgents ¶
ListAgents returns all available agents across all sources.
func (*Manager) PinRepository ¶
PinRepository sets or replaces the pinned ref for an existing repository. An empty ref unpins (returns to tracking the default branch).
func (*Manager) RemoveSource ¶
RemoveSource removes a repository by name or a local path.
func (*Manager) UpdateRepositories ¶
UpdateRepositories pulls latest from configured git repositories. Pinned repositories (Ref != "") are skipped unless force is true, in which case the ref is re-resolved against the remote (useful when a tag has been re-pointed or a branch has advanced).
type SkillsManager ¶
type SkillsManager struct {
// contains filtered or unexported fields
}
SkillsManager handles the registration, caching, and update of skill catalog sources (git repositories and local directories). Mirrors Manager for agents but operates on cfg.Skills and the dedicated skills cache dir.
func NewSkillsManager ¶
func NewSkillsManager(cfg *config.Config) (*SkillsManager, error)
NewSkillsManager returns a manager bound to cfg. The skills cache dir from cfg.Skills.CacheDir wins; otherwise the default XDG location.
func (*SkillsManager) AddLocalPath ¶
func (m *SkillsManager) AddLocalPath(path string) error
AddLocalPath registers an absolute local directory as a skills catalog source. Each immediate subdirectory is treated as a skill.
func (*SkillsManager) AddRepository ¶
func (m *SkillsManager) AddRepository(name, gitURL, ref string) error
AddRepository registers a git URL under name. An empty ref tracks the default branch; a non-empty ref pins the catalog to a specific commit, tag, or branch. Cloning happens on the next call to UpdateRepositories (or implicitly on first list).
func (*SkillsManager) CatalogPaths ¶
func (m *SkillsManager) CatalogPaths() []string
CatalogPaths returns the local-path + cached-repo directories that skill.Discover should scan as catalog scope. Repositories that have not been cloned yet are silently omitted; callers should run UpdateRepositories first if they need fresh content.
func (*SkillsManager) EnsureRepositoriesCloned ¶
func (m *SkillsManager) EnsureRepositoriesCloned() error
EnsureRepositoriesCloned guarantees that every configured repo is present in the cache before catalog discovery runs. Failure to clone any single repo is reported but does not abort the batch.
func (*SkillsManager) PinRepository ¶
func (m *SkillsManager) PinRepository(name, ref string) error
PinRepository sets or replaces the pinned ref for an existing catalog. An empty ref unpins (returns to tracking the default branch).
func (*SkillsManager) RemoveSource ¶
func (m *SkillsManager) RemoveSource(nameOrPath string) error
RemoveSource unregisters every catalog source that matches nameOrPath, across both namespaces. A single identifier can name a Repository by alias, a Repository by its URL (so passing the path of a `file://`-cloned repo finds it), or a LocalPath by either its literal or absolute form. All matches are removed in one pass so a catalog registered both ways — e.g. `add humanizer file:///tmp/x` plus `add /tmp/x` — comes out in a single call rather than leaving the cached clone behind to show up in `skill list`. Returns an error only when nothing matched.
func (*SkillsManager) UpdateRepositories ¶
func (m *SkillsManager) UpdateRepositories(force bool) error
UpdateRepositories pulls latest from configured git repositories. Pinned repositories (Ref != "") are skipped unless force is true, in which case the ref is re-resolved against the remote.