plugin

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrustTrusted   = "trusted"
	TrustUntrusted = "untrusted"
)
View Source
const (
	ScopeProject = "project"
	ScopeUser    = "user"
)

Variables

This section is empty.

Functions

func AllowedMCPServers

func AllowedMCPServers(trust string, servers map[string]mcpclient.ServerConfig) map[string]mcpclient.ServerConfig

func DefaultTrust

func DefaultTrust(_ string) string

func IsTrusted

func IsTrusted(trust string) bool

func NormalizeID

func NormalizeID(raw string) string

func NormalizeTrust

func NormalizeTrust(trust string) string

func Remove

func Remove(cwd string, loaded Loaded) error

func RuntimeSkillSource

func RuntimeSkillSource(scope, trust string) string

func RuntimeSkillSpecs

func RuntimeSkillSpecs(scope, trust string, specs []skill.Spec) []skill.Spec

func SetEnabled

func SetEnabled(cwd string, loaded Loaded, enabled bool) error

SetEnabled persists a plugin enable/disable decision into the matching state file.

func SetTrust

func SetTrust(cwd string, loaded Loaded, trust string) error

SetTrust persists a plugin trust decision into the matching state file.

func ValidateID

func ValidateID(id string) error

Types

type Catalog

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

Catalog is the in-memory registry of discovered plugins.

func LoadAll

func LoadAll(cwd string) (*Catalog, error)

LoadAll discovers plugins from user and project roots. Project scope wins on duplicate IDs.

func (*Catalog) Contributions

func (c *Catalog) Contributions() Contributions

Contributions collects runtime contributions from enabled plugins.

func (*Catalog) Plugins

func (c *Catalog) Plugins() []Loaded

Plugins returns a copy of all discovered plugins, including disabled ones.

type Contributions

type Contributions struct {
	SkillSpecs  []skill.Spec
	SkillDirs   []SkillDir
	CommandDirs []string
	MCPServers  map[string]mcpclient.ServerConfig
}

Contributions is the runtime-facing view of all enabled plugins.

type InstallInput

type InstallInput struct {
	Cwd        string
	SourcePath string
	Scope      string
}

type InstallResult

type InstallResult struct {
	ID           string
	Scope        string
	RootDir      string
	ManifestPath string
}

func InstallLocal

func InstallLocal(input InstallInput) (*InstallResult, error)

type Loaded

type Loaded struct {
	Manifest Manifest
	State    State
	RootDir  string
	Scope    string // "builtin", "project", or "user"
	// contains filtered or unexported fields
}

Loaded is a validated plugin plus its effective local state.

func (Loaded) CommandCount

func (p Loaded) CommandCount() int

CommandCount returns the number of command roots contributed by this plugin.

func (Loaded) IsTrusted

func (p Loaded) IsTrusted() bool

func (Loaded) MCPCount

func (p Loaded) MCPCount() int

MCPCount returns the number of MCP servers contributed by this plugin.

func (Loaded) SkillCount

func (p Loaded) SkillCount() int

SkillCount returns the number of skills contributed by this plugin.

type Manifest

type Manifest struct {
	ID          string                            `json:"id"`
	Name        string                            `json:"name"`
	Version     string                            `json:"version"`
	Description string                            `json:"description,omitempty"`
	SkillsDir   string                            `json:"skillsDir,omitempty"`
	CommandsDir string                            `json:"commandsDir,omitempty"`
	MCPServers  map[string]mcpclient.ServerConfig `json:"mcpServers,omitempty"`
}

Manifest describes a plugin package and the contributions it exports.

type ScaffoldInput

type ScaffoldInput struct {
	Cwd   string
	ID    string
	Scope string
}

type ScaffoldResult

type ScaffoldResult struct {
	ID           string
	Scope        string
	RootDir      string
	ManifestPath string
}

func Scaffold

func Scaffold(input ScaffoldInput) (*ScaffoldResult, error)

type SkillDir

type SkillDir struct {
	Path   string
	Source string
}

SkillDir identifies a skill directory contributed by a plugin.

type State

type State struct {
	Enabled bool
	Trust   string
}

State stores local operator decisions, not plugin-authored metadata.

type ValidationReport

type ValidationReport struct {
	RootDir      string
	Scope        string
	Manifest     Manifest
	State        *State
	SkillsDir    string
	CommandsDir  string
	SkillCount   int
	CommandCount int
	MCPCount     int
	Errors       []string
	Warnings     []string
}

func ValidateLoaded

func ValidateLoaded(loaded Loaded) (*ValidationReport, error)

func ValidatePath

func ValidatePath(path, scope string) (*ValidationReport, error)

func (*ValidationReport) Summary

func (r *ValidationReport) Summary() string

Jump to

Keyboard shortcuts

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