Documentation
¶
Index ¶
- Constants
- Variables
- func SaveLockfile(path string, l *Lockfile) error
- func SaveManifest(path string, m *Manifest) error
- type AddOptions
- type Adder
- type CachedCollection
- type CollectionInstaller
- type CollectionPublisher
- type CollectionSpec
- type Extractor
- type Installer
- type LockEntry
- type LockSource
- type Lockfile
- type Manifest
- type ManifestCollection
- type ManifestEntry
- type Project
- func (p *Project) AdditionalDirs(entry ManifestEntry) []string
- func (p *Project) AdditionalRelPaths(entry ManifestEntry) []string
- func (p *Project) CollectionCacheDir() string
- func (p *Project) CollectionCachePath(name string) string
- func (p *Project) LoadCollectionCache(name string) (*CachedCollection, error)
- func (p *Project) LoadLockfile() (*Lockfile, error)
- func (p *Project) LoadManifest() (*Manifest, error)
- func (p *Project) LockfilePath() string
- func (p *Project) ManifestPath() string
- func (p *Project) SaveCollectionCache(name string, c *CachedCollection) error
- func (p *Project) SaveLockfile(l *Lockfile) error
- func (p *Project) SaveManifest(m *Manifest) error
- func (p *Project) SkillDir(name string) string
- func (p *Project) SkillRelPath(name string) string
- func (p *Project) SkillsDir() string
- type Registry
- type SkillResolution
- type SpecSkill
- type UpdateResult
- type Updater
Constants ¶
const CurrentLockfileVersion = 1
Variables ¶
var ErrProjectNotFound = errors.New("no skills.json found in current directory or any parent")
Functions ¶
func SaveLockfile ¶
func SaveManifest ¶
SaveManifest writes the manifest to path with indented JSON. The output is human-edited file material, so prettiness matters.
Types ¶
type AddOptions ¶
type AddOptions struct {
AdditionalBasePaths []string
}
type CachedCollection ¶
type CachedCollection struct {
Ref string `json:"ref"`
FetchedAt time.Time `json:"fetchedAt"`
Index oci.Index `json:"index"`
}
CachedCollection persists a fetched collection index for offline name lookup.
type CollectionInstaller ¶ added in v0.4.0
type CollectionInstaller struct {
// contains filtered or unexported fields
}
CollectionInstaller registers a collection on a project and installs every skill the collection index lists.
func NewCollectionInstaller ¶ added in v0.4.0
func NewCollectionInstaller(r Registry, a *Adder, p *Project) *CollectionInstaller
func (*CollectionInstaller) InstallAll ¶ added in v0.4.0
func (c *CollectionInstaller) InstallAll(ctx context.Context, alias, ref string) ([]LockEntry, error)
InstallAll fetches the collection index at ref, registers the collection on the project under alias (caching the index for later name lookups), and installs every skill the index lists. The index is fetched before skills.json is touched, so a bad ref leaves the project unchanged.
type CollectionPublisher ¶
type CollectionPublisher struct {
// contains filtered or unexported fields
}
CollectionPublisher resolves each spec entry to a digest, builds an OCI Image Index, and pushes it to the registry.
func NewCollectionPublisher ¶
func NewCollectionPublisher(r Registry) *CollectionPublisher
func (*CollectionPublisher) Publish ¶
func (p *CollectionPublisher) Publish( ctx context.Context, spec *CollectionSpec, collectionRef string, force bool, ) (oci.Descriptor, error)
type CollectionSpec ¶
type CollectionSpec struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
License string `yaml:"license,omitempty"`
Source string `yaml:"source,omitempty"`
Skills []SpecSkill `yaml:"skills"`
}
CollectionSpec is the YAML shape consumed by `intropy skills collection publish`.
type Extractor ¶
Extractor unpacks a skill's tar+gzip content layer to one or more destination directories. Implementations must:
- reject path traversal via ".." in archive entries
- reject symlinks
- preserve POSIX permissions on regular files
- create parent directories as needed
func NewTarGzExtractor ¶
func NewTarGzExtractor() Extractor
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
type LockEntry ¶
type LockEntry struct {
Name string `json:"name"`
Path string `json:"path"`
AdditionalPaths []string `json:"additionalPaths,omitempty"`
Source LockSource `json:"source"`
InstalledAt time.Time `json:"installedAt"`
}
LockEntry is one resolved skill in the lockfile.
type LockSource ¶
type Lockfile ¶
type Lockfile struct {
LockfileVersion int `json:"lockfileVersion"`
GeneratedAt time.Time `json:"generatedAt"`
Skills []LockEntry `json:"skills"`
}
Lockfile is the root of skills.lock.json (§7.3).
func LoadLockfile ¶
type Manifest ¶
type Manifest struct {
Collections []ManifestCollection `json:"collections,omitempty"`
Skills []ManifestEntry `json:"skills"`
}
func LoadManifest ¶
LoadManifest reads and parses skills.json from path.
type ManifestCollection ¶
type ManifestEntry ¶
type ManifestEntry struct {
Name string `json:"name"`
Source string `json:"source"`
Version string `json:"version,omitempty"`
AdditionalBasePaths []string `json:"additionalBasePaths,omitempty"`
}
§6.3
type Project ¶
type Project struct {
Root string
}
func FindProject ¶
FindProject walks up from startDir looking for skills.json. Returns ErrProjectNotFound if no manifest is found before reaching the filesystem root.
func (*Project) AdditionalDirs ¶
func (p *Project) AdditionalDirs(entry ManifestEntry) []string
AdditionalDirs returns the absolute paths from a manifest entry's additionalBasePaths, with skill name appended to each. Returns an empty slice if the entry has no additionalBasePaths.
func (*Project) AdditionalRelPaths ¶
func (p *Project) AdditionalRelPaths(entry ManifestEntry) []string
func (*Project) CollectionCacheDir ¶
CollectionCacheDir returns the directory where collection caches are stored.
func (*Project) CollectionCachePath ¶
CollectionCachePath returns the cache file path for a named collection.
func (*Project) LoadCollectionCache ¶
func (p *Project) LoadCollectionCache(name string) (*CachedCollection, error)
LoadCollectionCache reads and parses the cache file for a collection alias. Returns an os.ErrNotExist-wrapping error if the cache hasn't been fetched yet.
func (*Project) LoadLockfile ¶
LoadLockfile reads and parses skills.lock.json from the project root. Returns an empty lockfile (not an error) if the file doesn't exist yet.
func (*Project) LoadManifest ¶
LoadManifest reads and parses skills.json from the project root.
func (*Project) LockfilePath ¶
LockfilePath returns the absolute path to skills.lock.json.
func (*Project) ManifestPath ¶
ManifestPath returns the absolute path to skills.json.
func (*Project) SaveCollectionCache ¶
func (p *Project) SaveCollectionCache(name string, c *CachedCollection) error
SaveCollectionCache persists the cache file for a collection alias, creating the cache directory if needed.
func (*Project) SaveLockfile ¶
SaveLockfile writes the lockfile to skills.lock.json at the project root.
func (*Project) SaveManifest ¶
SaveManifest writes the manifest to skills.json at the project root.
func (*Project) SkillDir ¶
SkillDir returns the canonical install directory for a named skill: <root>/.agents/skills/<name>.
func (*Project) SkillRelPath ¶
SkillRelPath returns the install directory relative to the project root, in forward-slash form. This is the value to write to the lockfile.
type Registry ¶
type Registry interface {
Pull(ctx context.Context, ref string) (oci.Artifact, error)
PullIndex(ctx context.Context, ref string) (oci.Index, error)
Resolve(ctx context.Context, ref string) (oci.Descriptor, error)
Push(ctx context.Context, ref string, art oci.Artifact) (oci.Descriptor, error)
PushIndex(ctx context.Context, ref string, idx oci.Index) (oci.Descriptor, error)
}
type SkillResolution ¶
type SkillResolution struct {
Collection string
Entry oci.IndexEntry
}
SkillResolution is the result of looking up a skill name across registered collections.
func ResolveSkillName ¶
func ResolveSkillName(p *Project, name, collectionAlias string) (SkillResolution, error)
ResolveSkillName searches every registered collection's cache for a skill matching name. If collectionAlias is non-empty, only that collection is considered. Returns an error if zero or multiple matches are found.
type UpdateResult ¶
UpdateResult describes the outcome of a single skill update.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
func (*Updater) Update ¶
Update reconciles a single installed skill against the ref pinned by the registered collections' cached indexes. If the resolved ref matches the manifest entry already, returns Changed=false and leaves disk untouched. Otherwise pulls the new content, replaces .agents/skills/<name>, and rewrites skills.json and skills.lock.json.
Refresh the relevant collection first (via `intropy skills collection update`) if you want to pick up changes the registry has since published.