handlers

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirSkills       = "skills"
	DirInstructions = "instructions"
	DirPrompts      = "prompts"
	DirAgents       = "agents"
	DirMCPServers   = "mcp-servers"
)

Directory names for GitHub Copilot assets

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentHandler

type AgentHandler struct {
	// contains filtered or unexported fields
}

AgentHandler handles agent asset installation for GitHub Copilot. Agents are written to agents/{name}.agent.md with YAML frontmatter.

func NewAgentHandler

func NewAgentHandler(meta *metadata.Metadata) *AgentHandler

NewAgentHandler creates a new agent handler

func (*AgentHandler) Install

func (h *AgentHandler) Install(ctx context.Context, zipData []byte, targetBase string) error

Install writes the agent as an .agent.md file to {targetBase}/agents/

func (*AgentHandler) Remove

func (h *AgentHandler) Remove(ctx context.Context, targetBase string) error

Remove removes the agent file

func (*AgentHandler) VerifyInstalled

func (h *AgentHandler) VerifyInstalled(targetBase string) (bool, string)

VerifyInstalled checks if the agent file exists

type CommandHandler

type CommandHandler struct {
	// contains filtered or unexported fields
}

CommandHandler handles command asset installation for GitHub Copilot. Commands are written to prompts/{name}.prompt.md with optional YAML frontmatter.

func NewCommandHandler

func NewCommandHandler(meta *metadata.Metadata) *CommandHandler

NewCommandHandler creates a new command handler

func (*CommandHandler) Install

func (h *CommandHandler) Install(ctx context.Context, zipData []byte, targetBase string) error

Install writes the command as a .prompt.md file to {targetBase}/prompts/

func (*CommandHandler) Remove

func (h *CommandHandler) Remove(ctx context.Context, targetBase string) error

Remove removes the prompt file

func (*CommandHandler) VerifyInstalled

func (h *CommandHandler) VerifyInstalled(targetBase string) (bool, string)

VerifyInstalled checks if the prompt file exists

type Handler

type Handler interface {
	// Install installs the asset from zip data to the target base directory
	Install(ctx context.Context, zipData []byte, targetBase string) error

	// Remove removes the asset from the target base directory
	Remove(ctx context.Context, targetBase string) error

	// VerifyInstalled checks if the asset is properly installed
	// Returns (installed bool, message string)
	VerifyInstalled(targetBase string) (bool, string)
}

Handler defines the interface for asset type handlers

func NewHandler

func NewHandler(assetType asset.Type, meta *metadata.Metadata) (Handler, error)

NewHandler creates a handler for the given asset type and metadata

type MCPHandler

type MCPHandler struct {
	// contains filtered or unexported fields
}

MCPHandler handles MCP asset installation for GitHub Copilot (VS Code)

func NewMCPHandler

func NewMCPHandler(meta *metadata.Metadata) *MCPHandler

NewMCPHandler creates a new MCP handler

func (*MCPHandler) Install

func (h *MCPHandler) Install(ctx context.Context, zipData []byte, targetBase string) error

Install installs an MCP asset to VS Code by updating .vscode/mcp.json

func (*MCPHandler) Remove

func (h *MCPHandler) Remove(ctx context.Context, targetBase string) error

Remove removes an MCP entry from VS Code

func (*MCPHandler) VerifyInstalled

func (h *MCPHandler) VerifyInstalled(targetBase string) (bool, string)

VerifyInstalled checks if the MCP server is properly installed

type RuleHandler

type RuleHandler struct {
	// contains filtered or unexported fields
}

RuleHandler handles rule asset installation for GitHub Copilot. Rules are written to instructions/{name}.instructions.md with YAML frontmatter using Copilot's applyTo field for glob patterns.

func NewRuleHandler

func NewRuleHandler(meta *metadata.Metadata) *RuleHandler

NewRuleHandler creates a new rule handler

func (*RuleHandler) Install

func (h *RuleHandler) Install(ctx context.Context, zipData []byte, targetBase string) error

Install writes the rule as an .instructions.md file to {targetBase}/instructions/

func (*RuleHandler) Remove

func (h *RuleHandler) Remove(ctx context.Context, targetBase string) error

Remove removes the instruction file

func (*RuleHandler) VerifyInstalled

func (h *RuleHandler) VerifyInstalled(targetBase string) (bool, string)

VerifyInstalled checks if the instruction file exists

type SkillHandler

type SkillHandler struct {
	// contains filtered or unexported fields
}

SkillHandler handles skill asset installation for GitHub Copilot. Skills are extracted to {targetBase}/skills/{name}/

func NewSkillHandler

func NewSkillHandler(meta *metadata.Metadata) *SkillHandler

NewSkillHandler creates a new skill handler

func (*SkillHandler) Install

func (h *SkillHandler) Install(ctx context.Context, zipData []byte, targetBase string) error

Install extracts a skill to {targetBase}/skills/{name}/

func (*SkillHandler) Remove

func (h *SkillHandler) Remove(ctx context.Context, targetBase string) error

Remove removes a skill from {targetBase}/skills/

func (*SkillHandler) VerifyInstalled

func (h *SkillHandler) VerifyInstalled(targetBase string) (bool, string)

VerifyInstalled checks if the skill is properly installed

Jump to

Keyboard shortcuts

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