Help us shape the future of Go! Take the 2026 Go Developer Survey

plugin

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseURL

func BaseURL(port int) string

BaseURL returns the plugin HTTP root from port.

func CallTool

func CallTool(route ToolRoute, args json.RawMessage) (json.RawMessage, error)

CallTool forwards args to a plugin HTTP handler from manifest.

func DefaultShelvesStateDir

func DefaultShelvesStateDir(projectRoot string) string

DefaultShelvesStateDir is .imprint/.shelves/.cache under the project root.

func PackageDir

func PackageDir(workspace, pkg string) string

PackageDir resolves entry.Package relative to workspace.

func PluginPort

func PluginPort(entry PluginEntry, def int) int

PluginPort returns the configured port for a plugin id.

func ResolveConfigPath

func ResolveConfigPath(getwd func() (string, error)) (string, error)

ResolveConfigPath walks up from cwd for .imprint/imprint.yaml. IMPRINT_WORKSPACE (absolute project root) overrides cwd when set.

Types

type Config

type Config struct {
	Vault   string                 `yaml:"vault"`
	Host    HostConfig             `yaml:"host"`
	Plugins map[string]PluginEntry `yaml:"plugins"`
	// contains filtered or unexported fields
}

Config is imprint.yaml under .imprint/ in the project.

func Load

func Load(path string) (*Config, error)

Load reads imprint.yaml from path. Missing file yields defaults.

func (*Config) HostURL

func (c *Config) HostURL() string

HostURL returns http:// listen address for the vault API.

func (*Config) ResolveVaultAbs

func (c *Config) ResolveVaultAbs() string

ResolveVaultAbs returns the absolute vault directory for this config.

func (*Config) Save

func (c *Config) Save() error

Save writes imprint.yaml atomically.

func (*Config) Workspace

func (c *Config) Workspace() string

Workspace returns the project repo root (parent of .imprint/).

type HostConfig

type HostConfig struct {
	Listen string `yaml:"listen"`
}

HostConfig is the imprint plugin host section.

type Manager

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

Manager starts and stops plugin processes.

func NewManager

func NewManager(cfg *Config) *Manager

NewManager returns a manager for cfg.

func (*Manager) DeskURL

func (m *Manager) DeskURL() (string, error)

DeskURL returns the UI URL when desk plugin is enabled and healthy.

func (*Manager) List

func (m *Manager) List() ([]Status, error)

List returns status for every configured plugin.

func (*Manager) Reload

func (m *Manager) Reload(ctx context.Context) ([]Status, error)

Reload stops enabled plugins and starts them again.

func (*Manager) StartPlugin

func (m *Manager) StartPlugin(ctx context.Context, id string) error

StartPlugin starts one plugin by id.

func (*Manager) StopAll

func (m *Manager) StopAll()

StopAll kills all managed plugin processes.

type Manifest

type Manifest struct {
	APIVersion   int            `json:"apiVersion"`
	ID           string         `json:"id"`
	Name         string         `json:"name"`
	Version      string         `json:"version"`
	Capabilities []string       `json:"capabilities"`
	Entry        ManifestEntry  `json:"entry"`
	ConfigSchema map[string]any `json:"configSchema,omitempty"`
	Tools        []ManifestTool `json:"tools"`
	// contains filtered or unexported fields
}

Manifest is imprint.plugin.json in a plugin package root.

func LoadManifest

func LoadManifest(packageDir string) (*Manifest, error)

LoadManifest reads imprint.plugin.json from packageDir.

type ManifestEntry

type ManifestEntry struct {
	Start  string `json:"start"`
	Health string `json:"health"`
}

ManifestEntry describes how to start and health-check a plugin.

type ManifestTool

type ManifestTool struct {
	Name         string         `json:"name"`
	Description  string         `json:"description"`
	InputSchema  map[string]any `json:"inputSchema,omitempty"`
	Handler      string         `json:"handler"`
	RegisteredAs string         `json:"-"`
}

ManifestTool is one MCP tool proxied through imprint-mcp.

func ResolveTools

func ResolveTools(pluginID string, tools []ManifestTool, taken map[string]struct{}) []ManifestTool

ResolveTools assigns RegisteredAs names with optional pluginId prefix on collision.

type PluginEntry

type PluginEntry struct {
	Enabled bool           `yaml:"enabled"`
	Package string         `yaml:"package"`
	Config  map[string]any `yaml:"config"`
}

PluginEntry is one plugin in imprint.yaml.

type Status

type Status struct {
	ID       string    `json:"id"`
	Enabled  bool      `json:"enabled"`
	Package  string    `json:"package"`
	Port     int       `json:"port"`
	Running  bool      `json:"running"`
	Healthy  bool      `json:"healthy"`
	URL      string    `json:"url,omitempty"`
	Error    string    `json:"error,omitempty"`
	Name     string    `json:"name,omitempty"`
	Version  string    `json:"version,omitempty"`
	Manifest *Manifest `json:"-"`
}

Status is one plugin row for list/reload.

type ToolRoute

type ToolRoute struct {
	PluginID   string
	Tool       ManifestTool
	BaseURL    string
	Registered string
}

ToolRoute is one MCP tool proxied to a plugin HTTP handler.

func EnabledTools

func EnabledTools(cfg *Config) ([]ToolRoute, error)

EnabledTools returns proxied tools from enabled plugins with resolved names.

Jump to

Keyboard shortcuts

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