Documentation
¶
Overview ¶
Package core provides canonical types for AI assistant plugin/extension definitions.
Index ¶
- Constants
- Variables
- func AdapterNames() []string
- func Convert(data []byte, from, to string) ([]byte, error)
- func Register(adapter Adapter)
- func WriteCanonicalFile(plugin *Plugin, path string) error
- type Adapter
- type Dependency
- type MCPServer
- type MarshalError
- type ParseError
- type Plugin
- type ReadError
- type Registry
- type ValidationError
- type WriteError
Constants ¶
const DefaultDirMode fs.FileMode = 0700
DefaultDirMode is the default permission for generated directories.
const DefaultFileMode fs.FileMode = 0600
DefaultFileMode is the default permission for generated files.
Variables ¶
var DefaultRegistry = NewRegistry()
DefaultRegistry is the global adapter registry.
Functions ¶
func AdapterNames ¶
func AdapterNames() []string
AdapterNames returns adapter names from the default registry.
func WriteCanonicalFile ¶
WriteCanonicalFile writes a canonical plugin.json file.
Types ¶
type Adapter ¶
type Adapter interface {
// Name returns the adapter identifier (e.g., "claude", "gemini").
Name() string
// DefaultPaths returns default file paths for this tool's plugin manifest.
DefaultPaths() []string
// Parse converts tool-specific bytes to canonical Plugin.
Parse(data []byte) (*Plugin, error)
// Marshal converts canonical Plugin to tool-specific bytes.
Marshal(plugin *Plugin) ([]byte, error)
// ReadFile reads from path and returns canonical Plugin.
ReadFile(path string) (*Plugin, error)
// WriteFile writes canonical Plugin to path.
WriteFile(plugin *Plugin, path string) error
// WritePlugin writes the complete plugin structure to the given directory.
// This includes the manifest file and any referenced component directories.
WritePlugin(plugin *Plugin, dir string) error
}
Adapter converts between canonical Plugin and tool-specific formats.
func GetAdapter ¶
GetAdapter returns an adapter from the default registry.
type Dependency ¶
type Dependency struct {
Name string `json:"name"`
Command string `json:"command,omitempty"` // CLI command to check availability
Optional bool `json:"optional,omitempty"` // If true, missing dependency is a warning
}
Dependency represents a required or optional dependency.
type MCPServer ¶
type MCPServer struct {
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Cwd string `json:"cwd,omitempty"`
Env map[string]string `json:"env,omitempty"`
}
MCPServer represents an MCP server configuration.
type MarshalError ¶
MarshalError occurs when marshaling to tool-specific format fails.
func (*MarshalError) Error ¶
func (e *MarshalError) Error() string
func (*MarshalError) Unwrap ¶
func (e *MarshalError) Unwrap() error
type ParseError ¶
ParseError occurs when parsing tool-specific format fails.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶
func (e *ParseError) Unwrap() error
type Plugin ¶
type Plugin struct {
// Metadata
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author,omitempty"`
License string `json:"license,omitempty"`
Repository string `json:"repository,omitempty"`
Homepage string `json:"homepage,omitempty"`
// Components - paths to spec files
Commands string `json:"commands,omitempty"` // Directory containing command specs
Skills string `json:"skills,omitempty"` // Directory containing skill specs
Agents string `json:"agents,omitempty"` // Directory containing agent specs
Hooks string `json:"hooks,omitempty"` // Path to hooks spec file
// Context file content
Context string `json:"context,omitempty"` // System prompt / context content
// Dependencies
Dependencies []Dependency `json:"dependencies,omitempty"`
// MCP Servers (used by Gemini extensions)
MCPServers map[string]MCPServer `json:"mcp_servers,omitempty"`
}
Plugin represents a canonical plugin/extension definition that can be converted to tool-specific formats (Claude, Gemini, etc.).
func ReadCanonicalFile ¶
ReadCanonicalFile reads a canonical plugin.json file.
func (*Plugin) AddDependency ¶
AddDependency adds a required dependency to the plugin.
func (*Plugin) AddMCPServer ¶
AddMCPServer adds an MCP server configuration to the plugin.
func (*Plugin) AddOptionalDependency ¶
AddOptionalDependency adds an optional dependency to the plugin.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages adapter registration and lookup.
func (*Registry) AdapterNames ¶
AdapterNames returns all registered adapter names sorted alphabetically.
func (*Registry) GetAdapter ¶
GetAdapter returns an adapter by name.
type ValidationError ¶
ValidationError occurs when a plugin configuration is invalid.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type WriteError ¶
WriteError occurs when writing a file fails.
func (*WriteError) Error ¶
func (e *WriteError) Error() string
func (*WriteError) Unwrap ¶
func (e *WriteError) Unwrap() error