Documentation
¶
Index ¶
- func DemoFS() fs.FS
- func InstallDirForScope(scope string) (string, error)
- func IsManaged(dir string) bool
- func Run(ctx context.Context, argv []string, outStream, errStream io.Writer) error
- func Version() string
- func WriteMeta(dir string, meta *SkillMeta) error
- type CopyMode
- type CopyOptions
- type CopyResult
- type Options
- type SkillAction
- type SkillMeta
- type SkillStatus
- type Smith
- func (s *Smith) Install(ctx context.Context, opts Options) (*CopyResult, error)
- func (s *Smith) List(ctx context.Context) ([]*agentskills.Skill, error)
- func (s *Smith) Name() string
- func (s *Smith) Reinstall(ctx context.Context, opts Options) (*CopyResult, error)
- func (s *Smith) Run(ctx context.Context, args []string) error
- func (s *Smith) Status(ctx context.Context, opts Options) (*StatusResult, error)
- func (s *Smith) Uninstall(ctx context.Context, opts Options) (*UninstallResult, error)
- func (s *Smith) Update(ctx context.Context, opts Options) (*CopyResult, error)
- func (s *Smith) Version() string
- type StatusResult
- type UninstallAction
- type UninstallResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DemoFS ¶
DemoFS returns the embedded demo skills filesystem. The "skills/" prefix is stripped automatically by Smith.skillsFS().
func InstallDirForScope ¶
InstallDirForScope returns the skill installation directory for the given scope. An empty scope defaults to "user".
- user (default): ~/.agents/skills (absolute, under the user's home directory)
- repo: <repo-root>/.agents/skills (absolute, under the repository root found by traversing parent directories for .git)
Types ¶
type CopyOptions ¶
type CopyOptions struct {
// Mode determines whether this is an install, update, or reinstall.
Mode CopyMode
// Force allows overwriting unmanaged (externally placed) skills.
Force bool
// DryRun reports what would happen without making any changes.
DryRun bool
// Name is the tool name written to .skillsmith.json (installedBy).
Name string
// Version is the tool version written to .skillsmith.json.
Version string
}
CopyOptions configures the behavior of CopySkills.
type CopyResult ¶
type CopyResult struct {
Actions []SkillAction
}
CopyResult summarizes the outcome of a CopySkills call.
func CopySkills ¶
func CopySkills(src fs.FS, destDir string, opts CopyOptions) (*CopyResult, error)
CopySkills copies skills from src (an fs.FS whose top-level directories are skill directories) into destDir.
func (*CopyResult) Installed ¶
func (r *CopyResult) Installed() []SkillAction
Installed returns the actions whose Action is "installed", "updated", or "reinstalled".
func (*CopyResult) Skipped ¶
func (r *CopyResult) Skipped() []SkillAction
Skipped returns the actions whose Action is "skipped".
func (*CopyResult) Warned ¶
func (r *CopyResult) Warned() []SkillAction
Warned returns the actions whose Action is "warned".
type Options ¶ added in v0.1.0
Options holds parameters shared by most subcommands. CLI frameworks can populate this struct directly and pass it to the exported operation methods (Install, Update, etc.) without going through Run / flag parsing.
type SkillAction ¶
type SkillAction struct {
Dir string
Action string // "installed", "updated", "reinstalled", "skipped", "warned"
Message string
}
SkillAction describes what happened to a single skill during CopySkills.
type SkillMeta ¶
type SkillMeta struct {
InstalledBy string `json:"installedBy"`
Version string `json:"version"`
InstalledAt time.Time `json:"installedAt"`
}
SkillMeta holds metadata written alongside an installed skill.
type SkillStatus ¶ added in v0.1.0
type SkillStatus struct {
Dir string
Installed bool
InstalledVersion string
AvailableVersion string
UpToDate bool
MetadataError error
}
SkillStatus describes the installation status of a single skill.
type Smith ¶
type Smith struct {
// FlagSet is the top-level flag set, created by New.
FlagSet *flag.FlagSet
// OutWriter is the writer for normal output (defaults to os.Stdout).
OutWriter io.Writer
// ErrWriter is the writer for error / diagnostic output (defaults to os.Stderr).
ErrWriter io.Writer
// contains filtered or unexported fields
}
Smith is the main entry point for the skillsmith skills subcommand. Create one with New and call Run to dispatch to the appropriate subcommand.
func New ¶
New creates a Smith with the given name, version and skill filesystem.
Version validation: if version does not start with "v", one is prepended for validation only. The version is stored as provided.
FS auto-detection: if the root of skillFS contains exactly one directory named "skills" (files at root are ignored), that directory is used as the skill root via fs.Sub. Otherwise skillFS is used as-is.
func (*Smith) List ¶ added in v0.1.0
List returns the discovered skills from the embedded filesystem.
func (*Smith) Reinstall ¶ added in v0.1.0
Reinstall reinstalls all managed skills regardless of version.
type StatusResult ¶ added in v0.1.0
type StatusResult struct {
Skills []SkillStatus
}
StatusResult summarizes the outcome of a Status call.
type UninstallAction ¶ added in v0.1.0
UninstallAction describes what happened to a single skill during Uninstall.
type UninstallResult ¶ added in v0.1.0
type UninstallResult struct {
Actions []UninstallAction
}
UninstallResult summarizes the outcome of an Uninstall call.