Documentation
¶
Overview ¶
Package plugin reads plugins in the Agent Plugins 1.0 format and fetches them from git. A plugin directory holds plugin.json, skills/ and mcp.json, and codebot's own Namespace directory. See https://github.com/agentplugins/agent-plugins-spec.
Index ¶
- Constants
- func Cached(s Source, cache, commit string) string
- func DataDir(s Source, root string) string
- func Fetch(ctx context.Context, s Source, cache, commit string) (string, error)
- func Latest(ctx context.Context, s Source, cache string) (string, error)
- func SweepCache(cache string, now time.Time) error
- func ValidName(name string) bool
- type Author
- type Manifest
- type Plugin
- type Source
Constants ¶
const Namespace = "io.github.voocel.codebot"
Namespace is codebot's client extension namespace, for what the format leaves to clients. Its entry under "extensions" in plugin.json holds hooks, in the settings format; its directory, which the format puts at the top level under its name, holds agents/.
"extensions": {"io.github.voocel.codebot": {
"hooks": {"PreToolUse": [{"type": "command", "command": "\"$PLUGIN_ROOT\"/bin/guard", "matcher": "bash"}]}
}}
io.github.voocel.codebot/agents/reviewer.md
Variables ¶
This section is empty.
Functions ¶
func Fetch ¶
Fetch fetches commit, or the source's ref when commit is "", and returns the commit. A cached commit is not fetched again, and a failed fetch leaves nothing behind.
func Latest ¶
Latest resolves the ref as Fetch would, with ls-remote and no fetch. It returns "" when the remote has no such ref, as when the ref is a commit. It runs git in cache, outside any repository.
func SweepCache ¶
SweepCache skips dot-named entries, which are fetches in progress.
Types ¶
type Plugin ¶
type Plugin struct {
Manifest
// Root has symlinks resolved.
Root string
// Data is PLUGIN_DATA, which survives updates; it may not exist yet.
Data string
// Skills, MCP and Agents keep the plugin's own names, not namespaced.
// Skills are frozen as read.
Skills []skill.Spec
MCP map[string]config.MCPServer
// Command hooks get PLUGIN_ROOT and PLUGIN_DATA in their environment.
Hooks config.HooksConfig
Agents []subagent.AgentDefinition
// contains filtered or unexported fields
}
type Source ¶
type Source struct {
Dir string // "" for a git plugin
URL string
Path string // slash-separated directory in the repository; "" for its root
Ref string // tag, branch or commit; "" for the default branch
}
func ParseSource ¶
ParseSource accepts a path (absolute, ~/ or relative to base) or a git repository ("host/owner/repo", or an https or ssh URL). In a repository, "//dir" selects the plugin directory and "#ref" pins a tag, branch or commit.