Documentation
¶
Index ¶
- Constants
- func DeleteTracker() error
- func GetTrackerPath() (string, error)
- func SaveTracker(tracker *Tracker) error
- func ValidateDependencies(lockFile *lockfile.LockFile) error
- type AssetFetcher
- func (f *AssetFetcher) FetchAsset(ctx context.Context, asset *lockfile.Asset) (zipData []byte, meta *metadata.Metadata, err error)
- func (f *AssetFetcher) FetchAssetWithProgress(ctx context.Context, asset *lockfile.Asset, bar *progressbar.ProgressBar) (zipData []byte, meta *metadata.Metadata, err error)
- func (f *AssetFetcher) FetchAssets(ctx context.Context, assets []*lockfile.Asset, concurrency int) ([]DownloadResult, error)
- type AssetKey
- type AssetWithMetadata
- type DependencyResolver
- type DownloadResult
- type DownloadTask
- type Fetcher
- type InstallRequest
- type InstallResult
- type InstallTask
- type InstalledAsset
- type Installer
- type Scope
- type Tracker
- func (t *Tracker) FindAsset(key AssetKey) *InstalledAsset
- func (t *Tracker) FindAssetWithMatcher(name, repoURL, path string, matchRepo func(a, b string) bool) *InstalledAsset
- func (t *Tracker) FindByScope(repository, path string) []InstalledAsset
- func (t *Tracker) FindForScope(repoURL, repoPath string, matchRepo func(a, b string) bool) []InstalledAsset
- func (t *Tracker) FindGlobal() []InstalledAsset
- func (t *Tracker) GroupByScope() map[string][]InstalledAsset
- func (t *Tracker) NeedsInstall(key AssetKey, version string, targetClients []string) bool
- func (t *Tracker) RemoveAsset(key AssetKey) bool
- func (t *Tracker) RemoveByScope(repository, path string) int
- func (t *Tracker) UpsertAsset(asset InstalledAsset)
Constants ¶
const TrackerFormatVersion = "3"
TrackerFormatVersion is the version of the tracker file format
Variables ¶
This section is empty.
Functions ¶
func GetTrackerPath ¶
GetTrackerPath returns the path to the single tracker file
func ValidateDependencies ¶
ValidateDependencies checks that all dependencies are present and resolvable
Types ¶
type AssetFetcher ¶
type AssetFetcher struct {
// contains filtered or unexported fields
}
AssetFetcher handles fetching assets from a vault
func NewAssetFetcher ¶
func NewAssetFetcher(vault vaultpkg.Vault) *AssetFetcher
NewAssetFetcher creates a new asset fetcher
func (*AssetFetcher) FetchAsset ¶
func (f *AssetFetcher) FetchAsset(ctx context.Context, asset *lockfile.Asset) (zipData []byte, meta *metadata.Metadata, err error)
FetchAsset downloads a single asset
func (*AssetFetcher) FetchAssetWithProgress ¶
func (f *AssetFetcher) FetchAssetWithProgress(ctx context.Context, asset *lockfile.Asset, bar *progressbar.ProgressBar) (zipData []byte, meta *metadata.Metadata, err error)
FetchAssetWithProgress downloads a single asset with progress bar
func (*AssetFetcher) FetchAssets ¶
func (f *AssetFetcher) FetchAssets(ctx context.Context, assets []*lockfile.Asset, concurrency int) ([]DownloadResult, error)
FetchAssets downloads multiple assets in parallel
type AssetWithMetadata ¶
AssetWithMetadata combines lockfile asset with parsed metadata
type DependencyResolver ¶
type DependencyResolver struct {
// contains filtered or unexported fields
}
DependencyResolver resolves asset dependencies
func NewDependencyResolver ¶
func NewDependencyResolver(lockFile *lockfile.LockFile) *DependencyResolver
NewDependencyResolver creates a new dependency resolver
type DownloadResult ¶
type DownloadResult struct {
Asset *lockfile.Asset
ZipData []byte
Metadata *metadata.Metadata
Error error
Index int
}
DownloadResult represents the result of downloading an asset
type DownloadTask ¶
DownloadTask represents a single asset download task
type Fetcher ¶
type Fetcher interface {
// FetchAsset downloads a single asset
FetchAsset(ctx context.Context, asset *lockfile.Asset) (zipData []byte, meta *metadata.Metadata, err error)
// FetchAssets downloads multiple assets in parallel
FetchAssets(ctx context.Context, assets []*lockfile.Asset, concurrency int) ([]DownloadResult, error)
}
Fetcher defines the interface for fetching assets
type InstallRequest ¶
type InstallRequest struct {
LockFile *lockfile.LockFile
ClientName string // Client to filter by (e.g., "claude-code")
Scope *Scope // Current scope context
TargetBase string // Base directory for installation (e.g., ~/.claude/)
CacheDir string // Cache directory for assets
Concurrency int // Max concurrent downloads (default: 10)
}
InstallRequest represents a request to install assets
type InstallResult ¶
type InstallResult struct {
Installed []string // Successfully installed assets
Failed []string // Failed assets
Errors []error // Errors encountered
}
InstallResult represents the result of an installation
type InstallTask ¶
InstallTask represents a single asset installation task
type InstalledAsset ¶
type InstalledAsset struct {
Name string `json:"name"`
Version string `json:"version"`
Type string `json:"type,omitempty"` // Asset type (skill, agent, mcp, etc) - added in v3
Repository string `json:"repository,omitempty"` // Empty for global scope
Path string `json:"path,omitempty"` // Path within repo (if path-scoped)
Clients []string `json:"clients"`
Config map[string]string `json:"config,omitempty"` // Type-specific config (e.g., marketplace for plugins)
}
InstalledAsset represents a single installed asset with its scope (formerly InstalledArtifact)
func (*InstalledAsset) IsGlobal ¶
func (a *InstalledAsset) IsGlobal() bool
IsGlobal returns true if this asset is installed globally
func (*InstalledAsset) Key ¶
func (a *InstalledAsset) Key() AssetKey
Key returns the unique key for this asset
func (*InstalledAsset) ScopeDescription ¶
func (a *InstalledAsset) ScopeDescription() string
ScopeDescription returns a human-readable scope description
type Installer ¶
type Installer interface {
// Install installs a single asset
Install(ctx context.Context, asset *lockfile.Asset, zipData []byte, metadata *metadata.Metadata) error
// InstallAll installs multiple assets in dependency order
InstallAll(ctx context.Context, assets []*AssetWithMetadata) (*InstallResult, error)
// Remove removes a single asset
Remove(ctx context.Context, asset *lockfile.Asset) error
}
Installer defines the interface for installing assets
type Scope ¶
type Scope struct {
Type string // "global", "repo", or "path"
RepoURL string // Repository URL (if in a repo)
RepoPath string // Path relative to repo root (if applicable)
}
Scope represents the current working context for scope matching
type Tracker ¶
type Tracker struct {
Version string `json:"version"`
Assets []InstalledAsset `json:"assets"`
}
Tracker tracks all installed assets across all scopes
func LoadTracker ¶
LoadTracker loads the tracker file Supports both new "assets" and old "artifacts" field names
func (*Tracker) FindAsset ¶
func (t *Tracker) FindAsset(key AssetKey) *InstalledAsset
FindAsset finds an asset by key in the tracker
func (*Tracker) FindAssetWithMatcher ¶
func (t *Tracker) FindAssetWithMatcher(name, repoURL, path string, matchRepo func(a, b string) bool) *InstalledAsset
FindAssetWithMatcher finds an asset by name using a custom repo URL matcher function This is useful when the tracker URL format may differ from the search URL (e.g., SSH vs HTTPS)
func (*Tracker) FindByScope ¶
func (t *Tracker) FindByScope(repository, path string) []InstalledAsset
FindByScope returns all assets matching a specific scope
func (*Tracker) FindForScope ¶
func (t *Tracker) FindForScope(repoURL, repoPath string, matchRepo func(a, b string) bool) []InstalledAsset
FindForScope returns assets relevant to a given scope: - All global assets - Assets matching the repo (with URL normalization) - For path scopes, assets whose path contains or equals the current path
func (*Tracker) FindGlobal ¶
func (t *Tracker) FindGlobal() []InstalledAsset
FindGlobal returns all globally-scoped assets
func (*Tracker) GroupByScope ¶
func (t *Tracker) GroupByScope() map[string][]InstalledAsset
GroupByScope returns assets grouped by their scope
func (*Tracker) NeedsInstall ¶
NeedsInstall checks if an asset needs to be installed or updated Returns true if the asset is new, has a different version, or is missing clients
func (*Tracker) RemoveAsset ¶
RemoveAsset removes an asset from the tracker by key
func (*Tracker) RemoveByScope ¶
RemoveByScope removes all assets for a specific scope
func (*Tracker) UpsertAsset ¶
func (t *Tracker) UpsertAsset(asset InstalledAsset)
UpsertAsset adds or updates an asset in the tracker