Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScanExtensions ¶
func ScanExtensions[T extension.Extension]( ctx context.Context, projectRoot, home string, agents []agent.Agent, strategy ScanStrategy[T], ) ([]T, error)
ScanExtensions provides a generic implementation for scanning any extension type (skills, hooks, sub-agents, mcp servers).
func ToggleDisable ¶
ToggleDisable renames the configuration file to add or remove the .disabled suffix. Uses on-disk state when the cached extension disagrees (e.g. fast double-toggle in the TUI).
Types ¶
type CommonBinding ¶
type CommonBinding[T extension.Extension] struct { Strategy ScanStrategy[T] }
CommonBinding provides generic bind/unbind logic for any extension type
func (*CommonBinding[T]) BindAgent ¶
func (b *CommonBinding[T]) BindAgent(ext T, a agent.Agent, projectRoot, home string) error
BindAgent links the extension to an agent by creating a symlink
func (*CommonBinding[T]) RemoveExtension ¶
func (b *CommonBinding[T]) RemoveExtension(ext T, projectRoot, home string) error
RemoveExtension removes the extension folder and all symlinks
func (*CommonBinding[T]) UnbindAgent ¶
func (b *CommonBinding[T]) UnbindAgent(ext T, a agent.Agent, projectRoot, home string) error
UnbindAgent removes the link between the extension and an agent
type ExtensionManager ¶
type ExtensionManager[T extension.Extension] interface { // Scan discovers extensions across given agents. Scan(ctx context.Context, projectRoot, home string, agents []agent.Agent) ([]T, error) // Bind associates an extension with a specific agent. Bind(ctx context.Context, ext T, a agent.Agent, projectRoot, home string) error // Unbind removes the association between an extension and a specific agent. Unbind(ctx context.Context, ext T, a agent.Agent, projectRoot, home string) error // ToggleDisable toggles the disabled state of an extension. ToggleDisable(ctx context.Context, ext T) error // Remove deletes the extension. Remove(ctx context.Context, ext T, projectRoot, home string) error }
ExtensionManager defines the operations common to all extensions (Skill, MCP Server, Sub-Agent, Hook).
func NewManager ¶
func NewManager[T extension.Extension](strategy ScanStrategy[T]) ExtensionManager[T]
type ScanStrategy ¶
type ScanStrategy[T extension.Extension] interface { // DefaultDir returns the default directory name for this extension type (e.g. ".skills", ".mcp") DefaultDir() string // AgentDir returns the agent-specific directory for this extension type AgentDir(a agent.Agent) string // SkipDir indicates if a directory should be skipped during scanning SkipDir(dirName string) bool // TargetFiles returns the list of configuration file names to look for (e.g. "SKILL.md", "mcp.json") TargetFiles() []string // ParseFile reads and parses the extension configuration ParseFile(filePath, projectRoot, home string, scope extension.Scope) (T, error) // Dedupe removes duplicate extensions from the scan results Dedupe(entities []T) []T }
Strategy provides the type-specific implementation details for scanning and parsing.