handlers

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 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"
	DirHooks        = "hooks"
)

Directory names for GitHub Copilot assets

View Source
const (
	// ConfigDir is the GitHub Copilot configuration directory name (in home dir)
	ConfigDir = ".copilot"
)

Configuration directory

View Source
const (
	FileHooks = "sx.json"
)

File names

Variables

This section is empty.

Functions

func AddCopilotCLIMCPServer added in v0.11.1

func AddCopilotCLIMCPServer(copilotDir, name string, serverConfig map[string]any) error

AddCopilotCLIMCPServer adds an MCP server entry to ~/.copilot/mcp-config.json This is the Copilot CLI-specific MCP config location.

func AddMCPServer added in v0.11.1

func AddMCPServer(vscodeDir, name string, serverConfig map[string]any) error

AddMCPServer adds an MCP server entry to .vscode/mcp.json This is used by bootstrap to add servers like the sx query MCP.

func RemoveCopilotCLIMCPServer added in v0.11.1

func RemoveCopilotCLIMCPServer(copilotDir, name string) error

RemoveCopilotCLIMCPServer removes an MCP server entry from ~/.copilot/mcp-config.json

func RemoveMCPServer added in v0.11.1

func RemoveMCPServer(vscodeDir, name string) error

RemoveMCPServer removes an MCP server entry from .vscode/mcp.json

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