Documentation
¶
Overview ¶
Package plugin loads, installs, and merges nib plugins. A plugin is a git repo whose contributions (MCP servers, sub-agent types, and — in later phases — prompt fragments, skills, commands, hooks) are normalized into a format-agnostic Manifest and merged into the effective wiz config.
Index ¶
- Constants
- func Apply(cfg *types.Config, baseDir, nibVersion string) error
- func BaseDir() string
- func LoadRegistry(baseDir string) (*registry.Registry[Entry], error)
- func ParseSkillMarkdown(data []byte) (name, description string, tools []string, body string)
- func PluginsDir(baseDir string) string
- type Entry
- type Format
- type FragmentSpec
- type InstructionsSpec
- type Manager
- func (mgr *Manager) EnabledManifests(nibVersion string) []Manifest
- func (mgr *Manager) Install(url, ref, nibVersion string) (Manifest, error)
- func (mgr *Manager) List() ([]Entry, error)
- func (mgr *Manager) Remove(name string) error
- func (mgr *Manager) SetEnabled(name string, enabled bool) error
- func (mgr *Manager) Update(name string) error
- type Manifest
- type SkillSpec
Constants ¶
const NativeManifestFile = "nib-plugin.yaml"
NativeManifestFile is the native manifest filename at a plugin's root.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply merges all enabled plugins' contributions into cfg. Precedence is plugins < user; user config (already in cfg) always wins.
func BaseDir ¶
func BaseDir() string
BaseDir resolves nib's config base directory (XDG-aware), where the plugin registry and installed plugins live. The legacy wiz base directory is used as a fallback only when the nib dir is absent but the wiz dir exists.
func LoadRegistry ¶
LoadRegistry reads <baseDir>/plugins.yaml, returning an empty registry if the file does not exist yet.
func ParseSkillMarkdown ¶
ParseSkillMarkdown parses a SKILL.md byte slice into its frontmatter fields (name, description, wiz tool names) and body. Tool names are aliased from Claude names to wiz names. Shared by the plugin Claude adapter and the standalone skill installer (skill package).
func PluginsDir ¶
PluginsDir is where plugin git checkouts live.
Types ¶
type Format ¶
type Format int
Format identifies a plugin's on-disk layout.
func DetectFormat ¶
DetectFormat inspects a plugin directory and reports its layout.
type FragmentSpec ¶
FragmentSpec is a prompt fragment in a manifest: either a bare YAML string (→ Text) or a mapping with text:/file:.
func (*FragmentSpec) UnmarshalYAML ¶
func (f *FragmentSpec) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML lets a fragment be written as a bare string or a {text,file} map.
type InstructionsSpec ¶
InstructionsSpec carries a skill body inline or via a file path (relative to the plugin root).
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager performs plugin install/update/remove against a base directory.
func NewManager ¶
NewManager returns a Manager rooted at baseDir (use plugin.BaseDir() in prod).
func (*Manager) EnabledManifests ¶
EnabledManifests loads the manifest of every enabled plugin in the registry, in registry order. A plugin that fails to load is skipped with a warning.
func (*Manager) Install ¶
Install clones a plugin, validates its manifest, places it at plugins/<name>, and records it in the registry as DISABLED. The caller (CLI) enables it after presenting the contribution summary for consent.
func (*Manager) SetEnabled ¶
SetEnabled flips a plugin's enabled flag in the registry.
type Manifest ¶
type Manifest struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Description string `yaml:"description"`
NibVersion string `yaml:"nib_version"`
MCPServers map[string]types.MCPServer `yaml:"mcp_servers"`
Agents []types.AgentTypeConfig `yaml:"agents"`
PromptFragments []FragmentSpec `yaml:"prompt_fragments"`
Skills []SkillSpec `yaml:"skills"`
Commands []types.CommandConfig `yaml:"commands"`
Hooks []types.HookConfig `yaml:"hooks"`
// contains filtered or unexported fields
}
Manifest is the normalized, format-agnostic representation of a plugin. Both the native (nib-plugin.yaml) and Claude (.claude-plugin/) adapters produce a Manifest. P0 carries only the config-driven contributions.
func LoadManifest ¶
LoadManifest detects a plugin's format, loads it via the matching adapter, stamps its install dir as root, and validates it against nibVersion.
func ParseManifest ¶
ParseManifest parses a native nib-plugin.yaml document.