Documentation
¶
Overview ¶
Package skills implements the skills command chain, which installs the Fly agent skills from github.com/superfly/skills into local coding agents.
Index ¶
- func AgentFlagDescription() string
- func InstallInto(ctx context.Context, targets []Target, verb string, force, quiet bool) (map[string]InstallResult, error)
- func KnownAgentSlugs() []string
- func New() *cobra.Command
- type CodingTool
- type InstallResult
- type Manifest
- type PreservedFile
- type SkillFile
- type SkillFiles
- type SkillRecord
- type SkillState
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentFlagDescription ¶ added in v0.5.2
func AgentFlagDescription() string
AgentFlagDescription is the shared --agent help text. The slug list comes from codingTools so fly skills and fly setup agent cannot drift apart.
func InstallInto ¶ added in v0.5.2
func InstallInto(ctx context.Context, targets []Target, verb string, force, quiet bool) (map[string]InstallResult, error)
InstallInto downloads the Fly skills once and writes them into targets. Results are keyed by Target.Key. A target failure does not stop the others; the returned error is reserved for shared download or manifest failures. verb names a fresh write in the output ("installed"). When quiet is set, per-skill lines, the closing summary and the progress indicator are omitted; the files and the manifest are still written. fly setup agent uses quiet for --json and for the installer's embedded output.
func KnownAgentSlugs ¶ added in v0.5.2
func KnownAgentSlugs() []string
KnownAgentSlugs is every agent slug fly skills and fly setup agent accept, in display order.
Types ¶
type CodingTool ¶
type CodingTool struct {
Slug string
Name string
Parent string // directory whose presence means the tool is installed
}
CodingTool is a coding agent that reads skills from a global directory.
func ResolveTools ¶ added in v0.5.2
func ResolveTools(home string, slugs []string) ([]CodingTool, error)
ResolveTools picks the tools to act on. With no slugs, the universal target plus every tool whose parent directory exists. With slugs, exactly those agents, in the order given.
func (CodingTool) SkillsDir ¶
func (t CodingTool) SkillsDir() string
SkillsDir is the directory skills are written into for this tool.
type InstallResult ¶ added in v0.5.2
type InstallResult struct {
Err error
Preserved []PreservedFile
Incomplete bool
}
InstallResult is the outcome for one target. Incomplete means an incoming file is still missing because its local deletion was preserved.
type Manifest ¶
type Manifest struct {
// SourceSHA is the last revision that was applied in full everywhere.
SourceSHA string `json:"source_sha,omitempty"`
// ArchiveSHA256 is the hex digest of the tarball that revision was
// installed from, recorded together with SourceSHA.
ArchiveSHA256 string `json:"archive_sha256,omitempty"`
// SourceRef is the branch, tag or commit the install is pinned to. It is
// empty when tracking main. Later update and status runs use it unless
// --ref or FLY_SKILLS_REF overrides it.
SourceRef string `json:"source_ref,omitempty"`
// LatestRef identifies the ref LatestSHA was resolved from. An empty
// value is an older, unscoped cache and cannot be reused by status.
LatestRef string `json:"latest_ref,omitempty"`
// LatestSHA is the last revision seen for LatestRef, applied or not.
LatestSHA string `json:"latest_sha,omitempty"`
LastChecked string `json:"last_checked,omitempty"`
Targets map[string]map[string]SkillRecord `json:"targets"`
}
Manifest records what fly skills has installed, keyed by target skills directory and then by skill name.
type PreservedFile ¶ added in v0.5.2
type PreservedFile struct {
Path string `json:"path"` // relative to the target's skills directory
Reason string `json:"reason"`
}
PreservedFile describes a local change left untouched during installation.
type SkillFile ¶
type SkillFile struct {
// Rel is the path relative to the skill directory, forward-slashed.
Rel string
Contents []byte
}
SkillFile is one file inside a skill directory.
type SkillFiles ¶
SkillFiles maps a skill directory name to its files.
type SkillRecord ¶
type SkillRecord struct {
// SourceSHA is the skills repository commit the files came from. It only
// advances when every incoming file was applied.
SourceSHA string `json:"source_sha,omitempty"`
InstalledAt string `json:"installed_at"`
// Files maps a forward-slashed path relative to the skill directory to
// the content hash we wrote.
Files map[string]string `json:"files"`
}
SkillRecord is what we last wrote for one skill into one target.
type SkillState ¶
type SkillState int
SkillState is how an on-disk skill compares to the recorded baseline and the incoming upstream content.
const ( // NotInstalled means the skill directory does not exist. NotInstalled SkillState = iota // UpToDate means every incoming file is already on disk with matching // content and nothing we own has been left behind. UpToDate // CleanUpgrade means every file we own is unmodified and upstream moved. CleanUpgrade // Modified means at least one file we own was edited or deleted, or a // user-added file collides with an incoming one. Modified // Unverifiable means the directory exists but we have no baseline and it // differs from upstream, so we cannot prove it is untouched. Unverifiable )
func (SkillState) String ¶
func (s SkillState) String() string
type Target ¶
Target is one skills directory an install writes into.
func BuildTargets ¶ added in v0.5.2
func BuildTargets(tools []CodingTool) []Target
BuildTargets maps tools to the skills directories an install writes into.