plugins

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plugins loads Claude-format plugins (commands, skills and agents) from <project>/.decsr/plugins and ~/.decsr/plugins. Hooks and MCP servers are detected but never used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() string

Dir is the user plugin directory, ~/.decsr/plugins ("" without a home).

func LoadSkill

func LoadSkill(projectRoot, id string) (string, error)

LoadSkill returns the body (without frontmatter) of the skill id "<plugin>:<skill>". It wraps os.ErrNotExist when the plugin or skill is missing or the plugin is disabled.

func SetEnabled

func SetEnabled(name string, enabled bool) error

SetEnabled adds name to or removes it from the disabled file.

func SplitCommand

func SplitCommand(text string) (desc, hint, body string)

SplitCommand returns the description, argument hint and body of a command file. A frontmatter "description" wins. Otherwise a leading "# heading" line becomes the description and leaves the body, or the description is the first 60 characters of the body.

Types

type Agent

type Agent struct {
	Plugin, Name string
	config.PluginAgent
}

Agent is a plugin agent offered as the workspace role <plugin>:<name>.

func (Agent) Role

func (a Agent) Role() string

Role is the workspace role name of the agent.

type Command

type Command struct {
	Plugin, Name, Description, ArgHint, Body string
}

Command is a plugin command, run as /<plugin>:<name>.

type Frontmatter

type Frontmatter map[string]any

Frontmatter holds the YAML header of a markdown file as a map.

func ParseFrontmatter

func ParseFrontmatter(text string) (Frontmatter, string)

ParseFrontmatter splits a markdown file that may start with "---\n<yaml>\n---\n". Without a header, or when the header is not valid YAML mapping and holds no "key: value" line, the whole text is returned as the body and the map is nil.

func (Frontmatter) List

func (f Frontmatter) List(key string) (items []string, ok bool)

List returns the value of key as a list: a YAML list, or a string split on commas and spaces. ok is false when the key is absent or null.

func (Frontmatter) String

func (f Frontmatter) String(key string) string

String returns the value of key as one sanitized line ("" when absent). A list value is joined as "[a, b]".

type Plugin

type Plugin struct {
	Name, Description, Version string
	Scope                      string // "project" or "user"
	Enabled                    bool
	Commands                   []Command
	Skills                     []Skill
	Agents                     []Agent
	HasHooks, HasMCP           bool
}

Plugin is one discovered plugin. A disabled plugin has no parts.

type Set

type Set struct {
	Plugins  []Plugin
	Warnings []string
}

Set is the result of a scan.

func Load

func Load(projectRoot string) Set

Load scans <projectRoot>/.decsr/plugins and then ~/.decsr/plugins. A project plugin wins over a user plugin of the same name. The result is sorted by name.

func (Set) AgentRoles

func (s Set) AgentRoles() map[string]config.PluginAgent

AgentRoles returns the agents of all enabled plugins keyed by role name.

func (Set) Commands

func (s Set) Commands() []Command

Commands returns the commands of all enabled plugins, sorted by name.

type Skill

type Skill struct {
	ID, Plugin, Name, Description string
	// contains filtered or unexported fields
}

Skill is a plugin skill with the id <plugin>:<name>.

Jump to

Keyboard shortcuts

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