source

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package source manages agent sources including git repositories and local paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGitURL

func IsGitURL(s string) bool

IsGitURL reports whether s looks like a git URL. file:// URLs are accepted for local-repo workflows (testing, on-disk mirrors) — git natively understands them and go-git's clone path treats them the same as any remote.

Types

type AgentInfo

type AgentInfo struct {
	Name        string
	Version     string
	Description string
	Path        string
	Source      string
}

AgentInfo contains metadata about an available agent.

type GitOperations

type GitOperations struct {
	// contains filtered or unexported fields
}

GitOperations handles git operations for agent repositories.

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
}

Manager handles agent source operations.

func NewManager

func NewManager(cfg *config.Config) (*Manager, error)

NewManager creates a new agent source manager.

func (*Manager) AddLocalPath

func (m *Manager) AddLocalPath(path string) error

AddLocalPath adds a local directory as an agent source.

func (*Manager) AddRepository

func (m *Manager) AddRepository(name, gitURL, ref string) error

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) FindAgent

func (m *Manager) FindAgent(name string) (string, error)

FindAgent returns the path to an agent by name.

func (*Manager) GetSearchPaths

func (m *Manager) GetSearchPaths() ([]string, error)

GetSearchPaths returns all directories to search for agents in priority order.

func (*Manager) ListAgents

func (m *Manager) ListAgents() ([]AgentInfo, error)

ListAgents returns all available agents across all sources.

func (*Manager) PinRepository

func (m *Manager) PinRepository(name, ref string) error

PinRepository sets or replaces the pinned ref for an existing repository. An empty ref unpins (returns to tracking the default branch).

func (*Manager) RemoveSource

func (m *Manager) RemoveSource(nameOrPath string) error

RemoveSource removes a repository by name or a local path.

func (*Manager) UpdateRepositories

func (m *Manager) 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 (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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL