{"modulePath":"github.com/OpenSIN-Code/SIN-Code-Bundle","version":"v1.7.3","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugins\n\nSPDX-License-Identifier: MIT Purpose: plugin manifest format + validator. Plugins live in ~/.local/share/sin-code/plugins/\\\u003cname\u003e/ with a plugin.toml file describing their subcommands, agents, and tools.\n\nSPDX-License-Identifier: MIT Purpose: plugin registry — discovers plugins on disk, exposes their subcommands via cobra, their agents via the orchestrator registry, and their tools via the MCP server. SOTA pattern: gh-extensions, oh-my-zsh.\n\n## Constants\n\n```go\nconst ManifestFile = \"plugin.toml\"\n```\n\n## Functions\n\n```go\nfunc DefaultPluginDir() string\n```\n\n```go\nfunc ResolvePluginDir(override string) string\n```\nResolvePluginDir returns the plugin dir to use. Empty arg → env override (SIN\\_CODE\\_CONFIG\\_DIR) → default user config dir. Lets testscripts redirect discovery to a tmp dir without touching HOME.\n\n## Types\n\n```go\ntype HookDef struct {\n\tPlugin  string\n\tEvent   string\n\tCommand string\n\tTimeout int\n}\n```\nHookDef is a plugin-registered todo event hook. Plugin hooks are run as subprocesses with the same SIN\\_TODO\\_\\* env vars the built-in todo hooks receive.\n\n```go\ntype MCPToolDef struct {\n\tName        string\n\tDescription string\n\tPlugin      string\n\tPluginPath  string\n\tTool        string\n\tBinary      string\n\tArgs        []string\n\tTimeout     int\n\tSchema      map[string]any\n}\n```\nMCPToolDef describes one plugin tool to be exposed via the MCP server. The Name uses the canonical \"sin\\_plugin\\_\\\u003cplugin\u003e\\_\\\u003ctool\u003e\" form, the Description comes from the manifest, and Schema is built from the manifest's Args slice (each arg → JSON Schema string property).\n\n```go\ntype Plugin struct {\n\tName         string         `toml:\"name\"`\n\tVersion      string         `toml:\"version\"`\n\tDescription  string         `toml:\"description\"`\n\tAuthor       string         `toml:\"author\"`\n\tHomepage     string         `toml:\"homepage\"`\n\tLicense      string         `toml:\"license\"`\n\tMinSinCode   string         `toml:\"min_sin_code\"`\n\tCapabilities []string       `toml:\"capabilities\"`\n\tSubcommands  []PluginSubcmd `toml:\"subcommand\"`\n\tAgents       []PluginAgent  `toml:\"agents\"`\n\tTools        []PluginTool   `toml:\"tools\"`\n\tHooks        []PluginHook   `toml:\"hooks\"`\n\n\tEnabled bool   `toml:\"-\"`\n\tPath    string `toml:\"-\"`\n}\n```\n\n```go\nfunc Load(path string) (*Plugin, error)\n```\n\n```go\nfunc LoadDir(dir string) ([]*Plugin, error)\n```\n\n```go\nfunc (p *Plugin) Dir() string\n```\n\n```go\nfunc (p *Plugin) Disable() error\n```\n\n```go\nfunc (p *Plugin) Enable() error\n```\n\n```go\nfunc (p *Plugin) Validate() error\n```\n\n```go\ntype PluginAgent struct {\n\tName     string `toml:\"name\"`\n\tType     string `toml:\"type\"`\n\tModel    string `toml:\"model\"`\n\tSystem   string `toml:\"system_file\"`\n\tProvider string `toml:\"provider\"`\n}\n```\n\n```go\ntype PluginHook struct {\n\tEvent   string `toml:\"event\"`\n\tCommand string `toml:\"command\"`\n\tTimeout int    `toml:\"timeout\"`\n}\n```\n\n```go\ntype PluginSubcmd struct {\n\tName        string   `toml:\"name\"`\n\tDescription string   `toml:\"description\"`\n\tBinary      string   `toml:\"binary\"`\n\tArgs        []string `toml:\"args\"`\n\tEnv         []string `toml:\"env\"`\n}\n```\n\n```go\ntype PluginTool struct {\n\tName        string   `toml:\"name\"`\n\tDescription string   `toml:\"description\"`\n\tBinary      string   `toml:\"binary\"`\n\tArgs        []string `toml:\"args\"`\n\tTimeout     int      `toml:\"timeout\"`\n}\n```\n\n```go\ntype Registry struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewRegistry() *Registry\n```\n\n```go\nfunc (r *Registry) AddSubcommandsTo(root *cobra.Command)\n```\nAddSubcommandsTo attaches all enabled plugin subcommands to the given root cobra command. Each subcommand becomes a real cobra.Command that exec's the plugin binary.\n\n```go\nfunc (r *Registry) AgentConfigs() []orchestrator.AgentConfig\n```\nAgentConfigs returns the agents contributed by all enabled plugins, converted to orchestrator.AgentConfig.\n\n```go\nfunc (r *Registry) Get(name string) (*Plugin, bool)\n```\n\n```go\nfunc (r *Registry) HooksFor(event string) []HookDef\n```\nHooksFor returns all enabled plugin hooks matching the given event name (e.g. \"post\\_complete\"). Unknown events yield no hooks.\n\n```go\nfunc (r *Registry) List() []*Plugin\n```\n\n```go\nfunc (r *Registry) LoadFromDir(dir string) error\n```\n\n```go\nfunc (r *Registry) MCPTools() []MCPToolDef\n```\nMCPTools returns one MCPToolDef per enabled plugin tool, named \"sin\\_plugin\\_\\\u003cplugin\u003e\\_\\\u003ctool\u003e\" so they are easily greppable and don't collide with the built-in sin\\_\\* MCP tools.\n\n```go\nfunc (r *Registry) Register(p *Plugin)\n```\n\n","path":"github.com/OpenSIN-Code/SIN-Code-Bundle/cmd/sin-code/internal/plugins","name":"plugins","synopsis":"SPDX-License-Identifier: MIT Purpose: plugin manifest format + validator.","isRedistributable":true}
