Documentation
¶
Overview ¶
Package cache manages the local caching of repositories and skills.
Index ¶
- Constants
- func GetReposCacheDir() string
- type Cache
- type Entry
- type RepoInfo
- type ReposCache
- func (c *ReposCache) CloneOrPull(ctx context.Context, repoURL, repoName string) error
- func (c *ReposCache) GetCachedRepos() []string
- func (c *ReposCache) HasRepo(repoName string) bool
- func (c *ReposCache) IsStale(repoName string, ttl time.Duration) bool
- func (c *ReposCache) ListSkills(repoName string) ([]SkillEntry, error)
- func (c *ReposCache) LoadIndex() ([]RepoInfo, error)
- func (c *ReposCache) SaveIndex() error
- func (c *ReposCache) SaveIndexWithStars(starCounts map[string]int, urls map[string]string) error
- func (c *ReposCache) SearchSkills(keyword string) ([]SkillEntry, error)
- type SkillEntry
Constants ¶
const DefaultTTL = 5 * time.Minute
DefaultTTL is the default cache time-to-live
Variables ¶
This section is empty.
Functions ¶
func GetReposCacheDir ¶ added in v0.9.3
func GetReposCacheDir() string
GetReposCacheDir returns the repos cache directory path
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache provides file-based caching with TTL
type Entry ¶ added in v1.0.0
type Entry struct {
Data json.RawMessage `json:"data"`
CreatedAt time.Time `json:"created_at"`
}
Entry represents a cached item with metadata
type RepoInfo ¶ added in v0.9.3
type RepoInfo struct {
Name string `json:"name"`
URL string `json:"url"`
LocalPath string `json:"local_path"`
UpdatedAt time.Time `json:"updated_at"`
LastSyncedAt time.Time `json:"last_synced_at"`
Stars int `json:"stars"`
}
RepoInfo represents cached repository metadata
type ReposCache ¶ added in v0.9.3
type ReposCache struct {
// contains filtered or unexported fields
}
ReposCache manages local git repository cache for skill discovery
func NewReposCache ¶ added in v0.9.3
func NewReposCache() (*ReposCache, error)
NewReposCache creates a new repos cache instance
func (*ReposCache) CloneOrPull ¶ added in v0.9.3
func (c *ReposCache) CloneOrPull(ctx context.Context, repoURL, repoName string) error
CloneOrPull clones a repo if not exists, or pulls if exists
func (*ReposCache) GetCachedRepos ¶ added in v0.9.3
func (c *ReposCache) GetCachedRepos() []string
GetCachedRepos returns list of cached repo names
func (*ReposCache) HasRepo ¶ added in v0.9.3
func (c *ReposCache) HasRepo(repoName string) bool
HasRepo checks if a repository is cached locally
func (*ReposCache) IsStale ¶ added in v1.5.0
func (c *ReposCache) IsStale(repoName string, ttl time.Duration) bool
IsStale checks if a repository's cache is older than the ttl
func (*ReposCache) ListSkills ¶ added in v0.9.3
func (c *ReposCache) ListSkills(repoName string) ([]SkillEntry, error)
ListSkills lists all skills in a cached repo
func (*ReposCache) LoadIndex ¶ added in v0.9.5
func (c *ReposCache) LoadIndex() ([]RepoInfo, error)
LoadIndex loads the repo index from disk
func (*ReposCache) SaveIndex ¶ added in v0.9.3
func (c *ReposCache) SaveIndex() error
SaveIndex saves the current repo index to disk (without stars)
func (*ReposCache) SaveIndexWithStars ¶ added in v0.9.5
SaveIndexWithStars saves the current repo index to disk with star counts and URLs
func (*ReposCache) SearchSkills ¶ added in v0.9.3
func (c *ReposCache) SearchSkills(keyword string) ([]SkillEntry, error)
SearchSkills searches for skills matching keyword in all cached repos