commands

package
v1.3.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDisabledState added in v1.1.34

func ApplyDisabledState(cmds map[string]*Command)

ApplyDisabledState sets the Enabled field on each command based on persisted state. New skills (not in the persisted set) default to enabled.

func InvalidateDisabledCache added in v1.1.34

func InvalidateDisabledCache()

InvalidateDisabledCache clears the in-memory cache so next load reads from disk.

func PersistEnabledState added in v1.1.34

func PersistEnabledState(name string, enabled bool)

PersistEnabledState saves the enabled/disabled state for a single skill.

func RecordUsage

func RecordUsage(name string) error

func UsageScore

func UsageScore(name string) float64

Types

type Command

type Command struct {
	Name                   string
	Template               string
	Description            string
	Source                 Source
	LoadedFrom             LoadedFrom
	Path                   string
	DisplayName            string
	AllowedTools           []string
	ArgumentHint           string
	Arguments              []string
	WhenToUse              string
	UserInvocable          bool
	DisableModelInvocation bool
	Context                string
	Enabled                bool // false = skill is disabled and won't be invoked by the agent
}

Command represents a reusable slash command or skill loaded from markdown.

func (*Command) Expand

func (c *Command) Expand(vars map[string]string) string

Expand replaces template variables in the command template. Supported: $FILE, $DIR, $ARGS, plus any named variables supplied.

func (*Command) IsBuiltin added in v1.1.34

func (c *Command) IsBuiltin() bool

IsBuiltin returns true for bundled/internal skills that cannot be disabled.

func (*Command) SlashName

func (c *Command) SlashName() string

func (*Command) Title

func (c *Command) Title() string

func (*Command) UserSlashVisible added in v1.1.6

func (c *Command) UserSlashVisible() bool

type LoadedFrom

type LoadedFrom string
const (
	LoadedFromBundled  LoadedFrom = "bundled"
	LoadedFromSkills   LoadedFrom = "skills"
	LoadedFromCommands LoadedFrom = "commands"
	LoadedFromPlugin   LoadedFrom = "plugin"
	LoadedFromMCP      LoadedFrom = "mcp"
)

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader finds and loads reusable skills and legacy custom slash commands.

func NewLoader

func NewLoader(projectDir string) *Loader

NewLoader creates a loader scanning global and project-local skills and commands.

func (*Loader) CommandDirs

func (l *Loader) CommandDirs() []string

CommandDirs returns the directories being scanned (for display purposes).

func (*Loader) List

func (l *Loader) List() []*Command

func (*Loader) Load

func (l *Loader) Load() map[string]*Command

Load scans all command directories and returns loaded commands. Later targets override earlier ones for the same command name.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(projectDir string) *Manager

func (*Manager) Commands

func (m *Manager) Commands() map[string]*Command

func (*Manager) Get

func (m *Manager) Get(name string) (*Command, bool)

func (*Manager) List

func (m *Manager) List() []*Command

func (*Manager) RecordUsage

func (m *Manager) RecordUsage(name string)

func (*Manager) Reload

func (m *Manager) Reload() bool

func (*Manager) SetEnabled added in v1.1.34

func (m *Manager) SetEnabled(name string, enabled bool)

SetEnabled enables or disables a skill by name and persists the state.

func (*Manager) SetExtraProviders

func (m *Manager) SetExtraProviders(providers ...func() []*Command)

func (*Manager) UserSlashCommands

func (m *Manager) UserSlashCommands() map[string]*Command

type Source

type Source string
const (
	SourceBundled Source = "bundled"
	SourceUser    Source = "user"
	SourceProject Source = "project"
	SourcePlugin  Source = "plugin"
	SourceMCP     Source = "mcp"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL