Documentation
¶
Index ¶
- Constants
- func DeriveSkillName(frontmatterName string, prompt artifact.Prompt, modelRef *registry.Reference) string
- func DetectInstalledAgents() ([]string, error)
- func GetGlobalSkillsDir(agentName string) (string, error)
- func GetProjectSkillsDir(agentName, projectDir string) (string, error)
- func IsValidAgentName(name string) bool
- func ValidAgentNames() []string
- type AgentConfig
- type AgentInstallResult
- type InstallResult
- type SkillFrontmatter
- type SkillInstallOptions
- type TarEntry
Constants ¶
const ( // MaxSkillEntrySize is the maximum size of a single tar entry in a skill layer. MaxSkillEntrySize = 10 * 1024 * 1024 // 10 MB // MaxSkillLayerSize is the maximum total size of all entries in a skill layer. MaxSkillLayerSize = 10 * 1024 * 1024 // 10 MB )
Variables ¶
This section is empty.
Functions ¶
func DeriveSkillName ¶
func DeriveSkillName(frontmatterName string, prompt artifact.Prompt, modelRef *registry.Reference) string
DeriveSkillName determines the skill directory name from a prompt entry and optional SKILL.md frontmatter name.
Priority:
- frontmatterName (from SKILL.md frontmatter "name" field)
- prompt.Name (from Kitfile)
- Parent directory name (for SKILL.md files or directory prompts)
- Fallback: repository name from modelRef
func DetectInstalledAgents ¶
DetectInstalledAgents probes global config directories to find installed agents. Always checks global paths regardless of installation scope. Returns a sorted list of detected agent names. Agents with no detection probe (replit, universal) are silently skipped.
func GetGlobalSkillsDir ¶
GetGlobalSkillsDir returns the absolute global skills directory for the given agent.
func GetProjectSkillsDir ¶
GetProjectSkillsDir returns the absolute skills directory for the given agent within a project directory.
func IsValidAgentName ¶
IsValidAgentName returns true if the name is a known agent.
func ValidAgentNames ¶
func ValidAgentNames() []string
ValidAgentNames returns a sorted list of all valid agent names.
Types ¶
type AgentConfig ¶
type AgentConfig struct {
Name string
DisplayName string
SkillsDir string // project-relative skills path (e.g., ".claude/skills")
GlobalDetectDirs func() []string // returns dirs to probe for detection; first existing dir wins
GlobalSkillsDir func() string // computes absolute global skills path
}
AgentConfig defines the directory layout and detection logic for a coding agent.
func GetAgentConfig ¶
func GetAgentConfig(name string) (AgentConfig, error)
GetAgentConfig returns the configuration for the named agent.
type AgentInstallResult ¶
type AgentInstallResult struct {
Agent string
Path string // resolved absolute path
Skipped bool // true if skipped due to IgnoreExisting or path dedup
Err error
}
AgentInstallResult records the outcome for a single agent.
type InstallResult ¶
type InstallResult struct {
SkillName string
Prompt artifact.Prompt
Agents []AgentInstallResult
}
InstallResult records the outcome of installing one skill across all agents.
func InstallSkill ¶
func InstallSkill(entries []TarEntry, skillName string, prompt artifact.Prompt, opts *SkillInstallOptions) InstallResult
InstallSkill writes the buffered tar entries as a skill to each agent's skill directory. Does NOT fail-fast: attempts every agent, returns per-agent results.
func (InstallResult) Errors ¶
func (r InstallResult) Errors() []AgentInstallResult
Errors returns all agent-level errors.
func (InstallResult) HasErrors ¶
func (r InstallResult) HasErrors() bool
HasErrors returns true if any agent installation failed.
type SkillFrontmatter ¶
type SkillFrontmatter struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
License string `yaml:"license,omitempty"`
}
SkillFrontmatter represents the YAML frontmatter in a SKILL.md file.
func ParseSkillFrontmatter ¶
func ParseSkillFrontmatter(data []byte) *SkillFrontmatter
ParseSkillFrontmatter extracts and parses YAML frontmatter from SKILL.md content. Returns nil if no valid frontmatter is found.
type SkillInstallOptions ¶
type SkillInstallOptions struct {
Agents []string
ProjectDir string // if non-empty, install project-scoped; if empty, install globally
Overwrite bool
IgnoreExisting bool
ModelRef *registry.Reference
}
SkillInstallOptions configures how skills are installed.
type TarEntry ¶
TarEntry holds a single file from a tar archive.
func ReadSkillLayer ¶
func ReadSkillLayer(tr *tar.Reader) (entries []TarEntry, isSkill bool, frontmatterName string, err error)
ReadSkillLayer reads all entries from a tar reader, buffers them, and determines whether the layer contains a SKILL.md file. Returns the buffered entries, whether it qualifies as a skill, and the frontmatter "name" if present.
Enforces that there are no symlinks/hardlinks and the size limits. The tar.Reader is fully consumed by this call.