Documentation
¶
Overview ¶
Package plugins installs, validates, and loads Codog plugin bundles.
Index ¶
- Constants
- func DataDir(workspace string, id string) string
- func DataDirForManifest(manifest Manifest) string
- func DataRoot(workspace string) string
- func Disabled(dir string) bool
- func LifecycleCommands(manifest Manifest, phase string) ([]string, bool)
- func LoadMCPServers(workspace string) (map[string]config.MCPServerConfig, error)
- func LoadMCPServersFromManifests(manifests []Manifest) map[string]config.MCPServerConfig
- func NormalizeLifecyclePhase(phase string) (string, error)
- func PluginMCPServerName(pluginID string, serverName string) string
- func Remove(workspace, id string) error
- func ResolveContentPath(root string, value string) (string, error)
- func Root(workspace string) string
- func UnsupportedLifecyclePhaseError(phase string) error
- func ValidToolPermission(permission string) bool
- func VerifyMarketplace(index MarketplaceIndex, publicKey string) error
- type HookConfigFile
- type LifecycleCommandResult
- type LifecycleConfig
- type LifecycleRunResult
- type Manifest
- func Disable(workspace, id string) (Manifest, error)
- func Enable(workspace, id string) (Manifest, error)
- func Install(workspace, source string) (Manifest, error)
- func Load(workspace string) ([]Manifest, error)
- func LoadManifest(dir string) (Manifest, error)
- func LoadWithDirs(workspace string, pluginDirs []string) ([]Manifest, error)
- type MarketplaceIndex
- type MarketplaceSource
- type MarketplaceUpdate
- type RemoteInstallResult
- type RemotePlugin
- type RemoteUpdateResult
- type ToolManifest
- type ValidationMessage
- type ValidationResult
Constants ¶
const DisabledMarker = ".disabled"
const LifecycleDefaultTimeout = 30 * time.Second
LifecycleDefaultTimeout is the per-command timeout used for plugin lifecycle hooks.
Variables ¶
This section is empty.
Functions ¶
func DataDirForManifest ¶
func LifecycleCommands ¶
LifecycleCommands returns the manifest commands configured for a lifecycle phase.
func LoadMCPServers ¶
func LoadMCPServers(workspace string) (map[string]config.MCPServerConfig, error)
func LoadMCPServersFromManifests ¶
func LoadMCPServersFromManifests(manifests []Manifest) map[string]config.MCPServerConfig
LoadMCPServersFromManifests resolves MCP contributions from an already resolved runtime plugin set.
func NormalizeLifecyclePhase ¶
NormalizeLifecyclePhase returns the canonical lifecycle phase for a phase alias.
func PluginMCPServerName ¶
func UnsupportedLifecyclePhaseError ¶
UnsupportedLifecyclePhaseError reports an unsupported lifecycle phase with suggestions.
func ValidToolPermission ¶
func VerifyMarketplace ¶
func VerifyMarketplace(index MarketplaceIndex, publicKey string) error
Types ¶
type HookConfigFile ¶
type HookConfigFile struct {
PluginID string `json:"plugin_id"`
Path string `json:"path"`
Config config.HookConfig `json:"config"`
}
func LoadHookConfigs ¶
func LoadHookConfigs(workspace string) ([]HookConfigFile, error)
func LoadHookConfigsFromManifests ¶
func LoadHookConfigsFromManifests(manifests []Manifest) ([]HookConfigFile, error)
LoadHookConfigsFromManifests loads hook contributions from an already resolved runtime plugin set.
type LifecycleCommandResult ¶
type LifecycleCommandResult struct {
Index int `json:"index"`
Command string `json:"command"`
WorkingDir string `json:"working_dir,omitempty"`
Status string `json:"status"`
ExitCode int `json:"exit_code"`
DurationMS int64 `json:"duration_ms"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
StdoutTruncated bool `json:"stdout_truncated,omitempty"`
StderrTruncated bool `json:"stderr_truncated,omitempty"`
TimedOut bool `json:"timed_out,omitempty"`
Error string `json:"error,omitempty"`
}
LifecycleCommandResult records one lifecycle command invocation.
type LifecycleConfig ¶
type LifecycleConfig struct {
Init []string `json:"init,omitempty"`
Shutdown []string `json:"shutdown,omitempty"`
}
LifecycleConfig declares plugin lifecycle commands without executing them.
func (LifecycleConfig) Empty ¶
func (l LifecycleConfig) Empty() bool
Empty reports whether no lifecycle commands are configured.
type LifecycleRunResult ¶
type LifecycleRunResult struct {
PluginID string `json:"plugin_id"`
Phase string `json:"phase"`
Status string `json:"status"`
CommandCount int `json:"command_count"`
Commands []LifecycleCommandResult `json:"commands"`
Message string `json:"message,omitempty"`
}
LifecycleRunResult summarizes an explicit plugin lifecycle phase execution.
func RunLifecycle ¶
func RunLifecycle(ctx context.Context, manifest Manifest, phase string, timeout time.Duration) LifecycleRunResult
RunLifecycle executes one lifecycle phase for a plugin manifest.
type Manifest ¶
type Manifest struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version,omitempty"`
Description string `json:"description,omitempty"`
Lifecycle LifecycleConfig `json:"lifecycle,omitempty"`
Tools []ToolManifest `json:"tools,omitempty"`
Commands []string `json:"commands,omitempty"`
Skills []string `json:"skills,omitempty"`
Agents []string `json:"agents,omitempty"`
Hooks []string `json:"hooks,omitempty"`
MCPServers map[string]config.MCPServerConfig `json:"mcp_servers,omitempty"`
Path string `json:"path,omitempty"`
Root string `json:"root,omitempty"`
Enabled bool `json:"enabled"`
Session bool `json:"session,omitempty"`
DataPath string `json:"data_path,omitempty"`
}
func LoadManifest ¶
type MarketplaceIndex ¶
type MarketplaceIndex struct {
Name string `json:"name,omitempty"`
Plugins []RemotePlugin `json:"plugins,omitempty"`
Signature string `json:"signature,omitempty"`
Source string `json:"source,omitempty"`
SignatureValid bool `json:"signature_valid,omitempty"`
}
func FetchMarketplace ¶
func FetchMarketplace(ctx context.Context, indexURL, publicKey string) (MarketplaceIndex, error)
func (MarketplaceIndex) Find ¶
func (index MarketplaceIndex) Find(id string) (RemotePlugin, bool)
type MarketplaceSource ¶
type MarketplaceUpdate ¶
type MarketplaceUpdate struct {
MarketplaceURL string `json:"marketplace_url"`
ID string `json:"id"`
CurrentVersion string `json:"current_version,omitempty"`
LatestVersion string `json:"latest_version,omitempty"`
UpdateAvailable bool `json:"update_available"`
URL string `json:"url"`
SHA256 string `json:"sha256"`
SignatureValid bool `json:"signature_valid,omitempty"`
}
func CheckUpdates ¶
func CheckUpdates(ctx context.Context, workspace string, sources []MarketplaceSource) ([]MarketplaceUpdate, error)
type RemoteInstallResult ¶
type RemoteInstallResult struct {
MarketplaceURL string `json:"marketplace_url"`
ID string `json:"id"`
Version string `json:"version,omitempty"`
URL string `json:"url"`
SHA256 string `json:"sha256"`
ChecksumValid bool `json:"checksum_valid"`
SignatureValid bool `json:"signature_valid,omitempty"`
Manifest Manifest `json:"manifest"`
}
func InstallRemote ¶
func InstallRemote(ctx context.Context, workspace, indexURL, id, publicKey string) (RemoteInstallResult, error)
func InstallRemoteFromIndex ¶
func InstallRemoteFromIndex(ctx context.Context, workspace string, index MarketplaceIndex, id string) (RemoteInstallResult, error)
type RemotePlugin ¶
type RemoteUpdateResult ¶
type RemoteUpdateResult struct {
MarketplaceURL string `json:"marketplace_url"`
ID string `json:"id"`
PreviousVersion string `json:"previous_version,omitempty"`
Version string `json:"version,omitempty"`
URL string `json:"url"`
SHA256 string `json:"sha256"`
ChecksumValid bool `json:"checksum_valid"`
SignatureValid bool `json:"signature_valid,omitempty"`
BackupPath string `json:"backup_path"`
Manifest Manifest `json:"manifest"`
Updated bool `json:"updated"`
}
func UpdateRemote ¶
func UpdateRemote(ctx context.Context, workspace string, sources []MarketplaceSource, id string) (RemoteUpdateResult, error)
func UpdateRemoteFromIndex ¶
func UpdateRemoteFromIndex(ctx context.Context, workspace string, index MarketplaceIndex, id, previousVersion string) (RemoteUpdateResult, error)
type ToolManifest ¶
type ValidationMessage ¶
type ValidationResult ¶
type ValidationResult struct {
Success bool `json:"success"`
Errors []ValidationMessage `json:"errors"`
Warnings []ValidationMessage `json:"warnings"`
FilePath string `json:"file_path"`
FileType string `json:"file_type"`
Manifest *Manifest `json:"manifest,omitempty"`
}
func Validate ¶
func Validate(source string) (ValidationResult, error)