Documentation
¶
Overview ¶
Package installer provides installation management for skill dependencies.
The installer package handles the installation and verification of external dependencies required by SKILL.md-defined skills. It supports multiple package managers and provides a unified interface for dependency resolution.
Index ¶
- func DefaultGlobalDir() string
- func DefaultSkillsDir() string
- type InstallResult
- type InstalledSkill
- type InstallerFunc
- type Manager
- func (m *Manager) Install(ctx context.Context, steps []loader.InstallStep) error
- func (m *Manager) InstallMissing(ctx context.Context, steps []loader.InstallStep) error
- func (m *Manager) InstallStep(ctx context.Context, step loader.InstallStep) error
- func (m *Manager) InstallWithResults(ctx context.Context, steps []loader.InstallStep) []InstallResult
- func (m *Manager) RegisterInstaller(kind string, fn InstallerFunc)
- func (m *Manager) VerifyBinaries(bins []string) (missing []string)
- type SkillInstaller
- func (i *SkillInstaller) Install(ctx context.Context, sourceStr string) (*InstalledSkill, error)
- func (i *SkillInstaller) InstallGit(ctx context.Context, source *Source) (*InstalledSkill, error)
- func (i *SkillInstaller) InstallLocal(ctx context.Context, source *Source) (*InstalledSkill, error)
- func (i *SkillInstaller) List() ([]*InstalledSkill, error)
- func (i *SkillInstaller) TargetDir() string
- func (i *SkillInstaller) Uninstall(name string) error
- type Source
- type SourceType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultGlobalDir ¶
func DefaultGlobalDir() string
DefaultGlobalDir returns the default global skills directory.
func DefaultSkillsDir ¶
func DefaultSkillsDir() string
DefaultSkillsDir returns the default local skills directory.
Types ¶
type InstallResult ¶
type InstallResult struct {
// Step is the installation step that was executed.
Step loader.InstallStep
// Success indicates if the installation succeeded.
Success bool
// Error contains any error that occurred.
Error error
// Duration is how long the installation took.
Duration time.Duration
}
InstallResult contains the result of an installation attempt.
type InstalledSkill ¶
type InstalledSkill struct {
// Name is the skill name (directory name).
Name string
// Path is the installed path.
Path string
// Source is the original source location.
Source *Source
// SourceType is git or local.
SourceType SourceType
// Global indicates if installed to global directory.
Global bool
// Symlinked indicates if the skill is symlinked (local installs).
Symlinked bool
}
InstalledSkill contains information about an installed skill.
type InstallerFunc ¶
type InstallerFunc func(ctx context.Context, step loader.InstallStep) error
InstallerFunc is a function that installs a dependency.
type Manager ¶
type Manager struct {
// Timeout is the maximum time for an installation command.
// Zero means use default (5 minutes).
Timeout time.Duration
// Env contains additional environment variables for install commands.
Env []string
// DryRun when true, only reports what would be installed.
DryRun bool
// Verbose enables detailed output.
Verbose bool
// contains filtered or unexported fields
}
Manager handles installation of skill dependencies.
Manager provides methods to verify, install, and manage external dependencies defined in SKILL.md files. It supports multiple installation methods including Go modules, npm packages, and pip.
func NewManager ¶
func NewManager() *Manager
NewManager creates a new installation manager with default installers.
func (*Manager) InstallMissing ¶
InstallMissing installs only the dependencies whose binaries are missing.
func (*Manager) InstallStep ¶
InstallStep executes a single installation step.
func (*Manager) InstallWithResults ¶
func (m *Manager) InstallWithResults(ctx context.Context, steps []loader.InstallStep) []InstallResult
InstallWithResults installs steps and returns detailed results.
func (*Manager) RegisterInstaller ¶
func (m *Manager) RegisterInstaller(kind string, fn InstallerFunc)
RegisterInstaller registers a custom installer for a given kind.
func (*Manager) VerifyBinaries ¶
VerifyBinaries checks if all required binaries are available.
type SkillInstaller ¶
type SkillInstaller struct {
// SkillsDir is the target directory for installed skills.
SkillsDir string
// GlobalDir is the global skills directory.
GlobalDir string
// UseGlobal indicates whether to install to global directory.
UseGlobal bool
// Symlink uses symlinks for local installs instead of copying.
Symlink bool
// Verbose enables verbose output.
Verbose bool
}
SkillInstaller handles installing skills from various sources.
func NewSkillInstaller ¶
func NewSkillInstaller() *SkillInstaller
NewSkillInstaller creates a new skill installer with defaults.
func (*SkillInstaller) Install ¶
func (i *SkillInstaller) Install(ctx context.Context, sourceStr string) (*InstalledSkill, error)
Install installs a skill from the given source string.
func (*SkillInstaller) InstallGit ¶
func (i *SkillInstaller) InstallGit(ctx context.Context, source *Source) (*InstalledSkill, error)
InstallGit installs a skill from a git repository.
func (*SkillInstaller) InstallLocal ¶
func (i *SkillInstaller) InstallLocal(ctx context.Context, source *Source) (*InstalledSkill, error)
InstallLocal installs a skill from a local path.
func (*SkillInstaller) List ¶
func (i *SkillInstaller) List() ([]*InstalledSkill, error)
List returns all installed skills.
func (*SkillInstaller) TargetDir ¶
func (i *SkillInstaller) TargetDir() string
TargetDir returns the target directory based on UseGlobal setting.
func (*SkillInstaller) Uninstall ¶
func (i *SkillInstaller) Uninstall(name string) error
Uninstall removes an installed skill.
type Source ¶
type Source struct {
// Type is the source type (git or local).
Type SourceType
// URL is the git repository URL (for git sources).
URL string
// Path is the local filesystem path (for local sources).
Path string
// Ref is the git reference (branch, tag, commit) to checkout.
// Empty means default branch.
Ref string
// Subdir is an optional subdirectory within the repo/path.
Subdir string
}
Source represents a skill source location.
func ParseSource ¶
ParseSource parses a source string into a Source struct. Formats:
- github.com/user/repo -> git source
- git@github.com:user/repo.git -> git source
- https://github.com/user/repo -> git source
- /path/to/skill -> local source
- ./relative/path -> local source
- github.com/user/repo@v1.0.0 -> git source with ref
- github.com/user/repo/subdir -> git source with subdir
type SourceType ¶
type SourceType string
SourceType identifies the type of skill source.
const ( // SourceTypeGit is a git repository URL. SourceTypeGit SourceType = "git" // SourceTypeLocal is a local filesystem path. SourceTypeLocal SourceType = "local" )