bundle

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package bundle provides a unified type for AI assistant plugin bundles. A bundle combines all components (plugin, skills, commands, hooks, agents, MCP servers, and context) into a single structure that can be generated for any supported tool.

Example usage:

package main

import (
    "log"
    "github.com/agentplexus/assistantkit/bundle"
)

func main() {
    b := bundle.New("agentcall", "0.1.0", "Voice calling for AI assistants")
    b.Plugin.Author = "agentplexus"
    b.Plugin.Repository = "https://github.com/agentplexus/agentcall"

    // Add MCP server
    b.AddMCPServer("agentcall", bundle.MCPServer{
        Command: "./agentcall",
        Env: map[string]string{"NGROK_AUTHTOKEN": "${NGROK_AUTHTOKEN}"},
    })

    // Add skill
    skill := bundle.NewSkill("phone-input", "Voice calling via phone")
    skill.Instructions = "Use initiate_call to start a call..."
    b.AddSkill(skill)

    // Generate for Claude Code
    if err := b.Generate("claude", "."); err != nil {
        log.Fatal(err)
    }

    // Or generate for all supported tools
    if err := b.GenerateAll("./plugins"); err != nil {
        log.Fatal(err)
    }
}

Index

Constants

View Source
const (
	EventOnStop         = hookscore.OnStop
	EventOnNotification = hookscore.OnNotification
	EventOnSubagentStop = hookscore.OnSubagentStop
	EventBeforeCommand  = hookscore.BeforeCommand
	EventAfterCommand   = hookscore.AfterCommand
	EventBeforeFileRead = hookscore.BeforeFileRead
	EventAfterFileRead  = hookscore.AfterFileRead
)

Re-export common hook events.

Variables

View Source
var DefaultToolConfigs = map[string]ToolConfig{
	"claude": {
		PluginDir:   ".claude-plugin",
		PluginFile:  "plugin.json",
		SkillsDir:   "skills",
		CommandsDir: "commands",
		AgentsDir:   "agents",

		ContextDir:  ".",
		ContextFile: "CLAUDE.md",
	},
	"kiro": {
		AgentsDir: ".kiro/agents",
		MCPDir:    ".kiro/settings",
		MCPFile:   "mcp.json",
	},
	"gemini": {
		PluginDir:   ".",
		PluginFile:  "gemini-extension.json",
		CommandsDir: "commands",
		AgentsDir:   "agents",
	},
	"cursor": {
		HooksDir:    ".",
		HooksFile:   ".cursorrules",
		MCPDir:      ".cursor",
		MCPFile:     "mcp.json",
		ContextDir:  ".",
		ContextFile: ".cursorrules",
	},
	"codex": {
		SkillsDir:   "skills",
		CommandsDir: "prompts",
		AgentsDir:   "agents",
		MCPDir:      ".codex",
		MCPFile:     "mcp.json",
		ContextDir:  ".",
		ContextFile: "AGENTS.md",
	},
	"vscode": {
		MCPDir:  ".vscode",
		MCPFile: "mcp.json",
	},
}

DefaultToolConfigs maps tool names to their configurations.

View Source
var SupportedTools = []string{
	"claude",
	"kiro",
	"gemini",
	"cursor",
	"codex",
}

SupportedTools lists all tools that have bundle generation support.

Functions

func NewAgent

func NewAgent(name, description string) *agentscore.Agent

NewAgent creates a new agent.

func NewCommand

func NewCommand(name, description string) *commandscore.Command

NewCommand creates a new command.

func NewContext

func NewContext(name string) *contextcore.Context

NewContext creates a new context.

func NewHooksConfig

func NewHooksConfig() *hookscore.Config

NewHooksConfig creates a new hooks configuration.

func NewSkill

func NewSkill(name, description string) *skillscore.Skill

NewSkill creates a new skill.

Types

type Agent

type Agent = agentscore.Agent

Agent represents an agent definition.

type Argument

type Argument = commandscore.Argument

Re-export command argument type.

type Bundle

type Bundle struct {
	// Plugin is the core plugin/extension metadata.
	Plugin *pluginscore.Plugin

	// Skills are the skill definitions.
	Skills []*skillscore.Skill

	// Commands are the command/prompt definitions.
	Commands []*commandscore.Command

	// Hooks is the lifecycle hooks configuration.
	Hooks *hookscore.Config

	// Agents are the agent/subagent definitions.
	Agents []*agentscore.Agent

	// Context is the project context (CLAUDE.md, .cursorrules, etc.).
	Context *contextcore.Context

	// MCP is the MCP server configuration.
	MCP *mcpcore.Config
}

Bundle represents a complete plugin bundle with all components.

func New

func New(name, version, description string) *Bundle

New creates a new Bundle with the given name, version, and description.

func (*Bundle) AddAgent

func (b *Bundle) AddAgent(agent *agentscore.Agent)

AddAgent adds an agent to the bundle.

func (*Bundle) AddCommand

func (b *Bundle) AddCommand(cmd *commandscore.Command)

AddCommand adds a command to the bundle.

func (*Bundle) AddMCPServer

func (b *Bundle) AddMCPServer(name string, server MCPServer)

AddMCPServer adds an MCP server configuration. This is a convenience method that adds the server to both the MCP config and the Plugin's MCPServers field.

func (*Bundle) AddSkill

func (b *Bundle) AddSkill(skill *skillscore.Skill)

AddSkill adds a skill to the bundle.

func (*Bundle) Generate

func (b *Bundle) Generate(tool, outputDir string) error

Generate outputs the bundle for a specific tool to the given directory.

func (*Bundle) GenerateAll

func (b *Bundle) GenerateAll(outputDir string) error

GenerateAll outputs the bundle for all supported tools.

func (*Bundle) SetContext

func (b *Bundle) SetContext(ctx *contextcore.Context)

SetContext sets the project context.

func (*Bundle) SetHooks

func (b *Bundle) SetHooks(cfg *hookscore.Config)

SetHooks sets the hooks configuration.

type Command

type Command = commandscore.Command

Command represents a command definition.

type Config

type Config = hookscore.Config

Config represents hooks configuration (alias for convenience).

type Context

type Context = contextcore.Context

Context represents project context.

type Event

type Event = hookscore.Event

Event represents a hook event type.

type GenerateError

type GenerateError struct {
	Tool      string
	Component string
	Err       error
}

GenerateError represents an error during bundle generation.

func (*GenerateError) Error

func (e *GenerateError) Error() string

func (*GenerateError) Unwrap

func (e *GenerateError) Unwrap() error

type Hook

type Hook = hookscore.Hook

Hook represents a single hook action.

type HookEntry

type HookEntry = hookscore.HookEntry

HookEntry represents a hook entry with optional matcher.

type MCPServer

type MCPServer struct {
	Command string
	Args    []string
	Env     map[string]string
}

MCPServer represents an MCP server configuration.

type Skill

type Skill = skillscore.Skill

Skill represents a skill definition.

type ToolConfig

type ToolConfig struct {
	// PluginDir is the directory for the plugin manifest.
	PluginDir string
	// PluginFile is the plugin manifest filename.
	PluginFile string
	// SkillsDir is the directory for skills.
	SkillsDir string
	// CommandsDir is the directory for commands.
	CommandsDir string
	// HooksDir is the directory for hooks config.
	HooksDir string
	// HooksFile is the hooks config filename.
	HooksFile string
	// AgentsDir is the directory for agents.
	AgentsDir string
	// MCPDir is the directory for MCP config.
	MCPDir string
	// MCPFile is the MCP config filename.
	MCPFile string
	// ContextDir is the directory for context files.
	ContextDir string
	// ContextFile is the context filename.
	ContextFile string
}

ToolConfig defines the output paths and supported components for a tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL