Documentation
¶
Overview ¶
Package claude provides the Claude Code plugin adapter.
Index ¶
- type Adapter
- func (a *Adapter) DefaultPaths() []string
- func (a *Adapter) Marshal(plugin *core.Plugin) ([]byte, error)
- func (a *Adapter) Name() string
- func (a *Adapter) Parse(data []byte) (*core.Plugin, error)
- func (a *Adapter) ReadFile(path string) (*core.Plugin, error)
- func (a *Adapter) WriteFile(plugin *core.Plugin, path string) error
- func (a *Adapter) WritePlugin(plugin *core.Plugin, dir string) error
- type ClaudePlugin
- type Hook
- type HookEntry
- type HooksConfig
- type MCPServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter converts between canonical Plugin and Claude Code plugin format.
func (*Adapter) DefaultPaths ¶
DefaultPaths returns default file paths for Claude plugin manifest.
type ClaudePlugin ¶
type ClaudePlugin struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
// Optional metadata
Author string `json:"author,omitempty"`
License string `json:"license,omitempty"`
Repository string `json:"repository,omitempty"`
Homepage string `json:"homepage,omitempty"`
// MCP Servers - embedded directly in plugin.json for consolidated config
MCPServers map[string]MCPServerConfig `json:"mcpServers,omitempty"`
// Hooks - embedded directly in plugin.json for consolidated config
Hooks *HooksConfig `json:"hooks,omitempty"`
// Component paths (relative to plugin root)
Commands string `json:"commands,omitempty"` // e.g., "./commands/"
Skills string `json:"skills,omitempty"` // e.g., "./skills/"
Agents string `json:"agents,omitempty"` // e.g., "./agents/"
}
ClaudePlugin represents the Claude Code plugin.json format. See: https://docs.anthropic.com/en/docs/claude-code/plugins
func FromCanonical ¶
func FromCanonical(p *core.Plugin) *ClaudePlugin
FromCanonical creates a ClaudePlugin from canonical Plugin.
func (*ClaudePlugin) SetHooks ¶ added in v0.6.0
func (cp *ClaudePlugin) SetHooks(hooks *HooksConfig)
SetHooks sets the hooks configuration on the plugin.
func (*ClaudePlugin) ToCanonical ¶
func (cp *ClaudePlugin) ToCanonical() *core.Plugin
ToCanonical converts ClaudePlugin to canonical Plugin.
type Hook ¶ added in v0.6.0
type Hook struct {
Type string `json:"type"` // "command" or "prompt"
Command string `json:"command,omitempty"` // For command hooks
Prompt string `json:"prompt,omitempty"` // For prompt hooks
}
Hook represents a single hook action.
type HooksConfig ¶ added in v0.6.0
type HooksConfig struct {
// Event-based hooks (Claude Code format)
PreToolUse []HookEntry `json:"PreToolUse,omitempty"`
PostToolUse []HookEntry `json:"PostToolUse,omitempty"`
Notification []HookEntry `json:"Notification,omitempty"`
Stop []HookEntry `json:"Stop,omitempty"`
SubagentStop []HookEntry `json:"SubagentStop,omitempty"`
}
HooksConfig represents the hooks configuration embedded in plugin.json.
type MCPServerConfig ¶ added in v0.6.0
type MCPServerConfig struct {
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
Cwd string `json:"cwd,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}
MCPServerConfig represents an MCP server configuration in Claude format.