manage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package manage provides session-independent operations for the assistant to configure itself: install/enable/remove plugins, author skills, and add/remove MCP servers. All operations persist to disk (plugin/skill registries and the user config file) and are fully unit-testable without a running session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configurator

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

Configurator performs self-configuration operations against a base directory (the plugin/skill registries) and a single user config file (mcp_servers).

Every field is derived from the one root override handed to NewIn, which is the only constructor. That is deliberate: a Configurator built from pre-resolved paths could not tell EffectiveConfig which root to reload from, so the reload would silently fall back to nib's default paths while the writes went somewhere else. Keeping the override as the sole input makes that mismatch unrepresentable rather than merely discouraged.

func NewIn added in v0.5.0

func NewIn(baseDirOverride string) *Configurator

NewIn returns a Configurator for a base-directory override, resolving the registry root and the writable config path from it. An empty override reproduces standalone nib exactly: plugin.BaseDirIn and config.WritablePathIn both fall back to the default resolution. Tests pass a temp dir.

func (*Configurator) AddMCPServer

func (c *Configurator) AddMCPServer(name string, srv types.MCPServer) error

AddMCPServer persists an MCP server (stdio or remote) to the user config file. Exactly one of srv.Command (stdio) or srv.URL (remote) must be set.

func (*Configurator) EffectiveConfig

func (c *Configurator) EffectiveConfig() (types.Config, error)

EffectiveConfig recomputes the merged config (same as startup) so callers can re-wire a live session after a change. Disabled MCP servers are dropped here so they never start a transport; ListMCPServers still reports them for the UI.

func (*Configurator) GenerateSkill

func (c *Configurator) GenerateSkill(name, description, instructions string) (SkillInfo, error)

GenerateSkill writes a new SKILL.md into the shared "local" skill pack and ensures that pack is registered enabled, so the skill becomes loadable once the session reloads. Returns the new skill's tool-facing info.

func (*Configurator) GetMCPServer added in v0.3.0

func (c *Configurator) GetMCPServer(name string) (types.MCPServer, error)

GetMCPServer returns the named server from the user config file.

func (*Configurator) InstallPlugin

func (c *Configurator) InstallPlugin(url, ref string) (PluginInfo, error)

InstallPlugin installs a plugin (DISABLED) and returns its record.

func (*Configurator) ListMCPServers

func (c *Configurator) ListMCPServers() ([]MCPServerInfo, error)

ListMCPServers returns the MCP servers configured in the user config file, sorted by name. It reads the writable user file (the authoritative source for add/remove), not the merged effective config.

func (*Configurator) ListPlugins

func (c *Configurator) ListPlugins() ([]PluginInfo, error)

ListPlugins returns all installed plugins from the registry.

func (*Configurator) ListSkills

func (c *Configurator) ListSkills() ([]SkillInfo, error)

ListSkills returns the skills contributed by enabled skill packs.

func (*Configurator) RemoveMCPServer

func (c *Configurator) RemoveMCPServer(name string) error

RemoveMCPServer deletes an MCP server from the user config file.

func (*Configurator) RemovePlugin

func (c *Configurator) RemovePlugin(name string) error

RemovePlugin deletes a plugin's files and registry record.

func (*Configurator) SetMCPServerEnabled added in v0.4.1

func (c *Configurator) SetMCPServerEnabled(name string, enabled bool) error

SetMCPServerEnabled flips a configured server's enabled state by toggling its Disabled flag in the user config file. Unknown names error, matching GetMCPServer/RemoveMCPServer.

func (*Configurator) SetPluginEnabled

func (c *Configurator) SetPluginEnabled(name string, enabled bool) error

SetPluginEnabled flips a plugin's enabled flag.

type MCPServerInfo

type MCPServerInfo struct {
	Name      string
	Command   string
	Args      []string
	URL       string
	Transport string
	// Authenticated is true if BearerToken or ANY custom header is set; the values
	// themselves are never exposed here. Note this deliberately does not distinguish
	// a real auth token from an ordinary custom header — its purpose is "don't
	// silently print secrets", not "classify which headers are authentication".
	Authenticated bool
	// Enabled is false when the server's Disabled flag is set. Absent == enabled.
	Enabled bool
}

MCPServerInfo is a configured MCP server in tool-facing form.

type PluginInfo

type PluginInfo struct {
	Name      string
	SourceURL string
	Ref       string
	Enabled   bool
}

PluginInfo is a registry plugin record in tool-facing form.

type SkillInfo

type SkillInfo struct {
	Name        string
	Description string
	Pack        string
}

SkillInfo is one available skill in tool-facing form.

Jump to

Keyboard shortcuts

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