modes

package
v0.0.0-...-e487a75 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentHandler

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

AgentHandler Agent模式处理器 处理自动化触发的事件(Issue分配、标签添加等)

func NewAgentHandler

func NewAgentHandler(github *ghclient.Client, workspace *workspace.Manager, mcpClient mcp.MCPClient) *AgentHandler

NewAgentHandler 创建Agent模式处理器

func (*AgentHandler) CanHandle

func (ah *AgentHandler) CanHandle(ctx context.Context, event models.GitHubContext) bool

CanHandle 检查是否能处理给定的事件

func (*AgentHandler) Execute

func (ah *AgentHandler) Execute(ctx context.Context, event models.GitHubContext) error

Execute 执行Agent模式处理逻辑

type BaseHandler

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

BaseHandler 基础处理器,提供通用功能

func NewBaseHandler

func NewBaseHandler(mode ExecutionMode, priority int, description string) *BaseHandler

NewBaseHandler 创建基础处理器

func (*BaseHandler) GetDescription

func (bh *BaseHandler) GetDescription() string

func (*BaseHandler) GetHandlerName

func (bh *BaseHandler) GetHandlerName() string

func (*BaseHandler) GetMode

func (bh *BaseHandler) GetMode() ExecutionMode

func (*BaseHandler) GetPriority

func (bh *BaseHandler) GetPriority() int

type ExecutionMode

type ExecutionMode string

ExecutionMode 执行模式类型

const (
	// TagMode @codeagent 提及模式
	TagMode ExecutionMode = "tag"

	// AgentMode 自动化模式
	AgentMode ExecutionMode = "agent"

	// ReviewMode 自动审查模式
	ReviewMode ExecutionMode = "review"
)

type Manager

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

Manager 模式管理器

func NewManager

func NewManager() *Manager

NewManager 创建新的模式管理器

func (*Manager) GetHandlerByMode

func (m *Manager) GetHandlerByMode(mode ExecutionMode) ModeHandler

GetHandlerByMode 根据模式类型获取处理器

func (*Manager) GetHandlerCount

func (m *Manager) GetHandlerCount() int

GetHandlerCount 获取处理器数量

func (*Manager) GetHandlers

func (m *Manager) GetHandlers() []ModeHandler

GetHandlers 获取所有注册的处理器

func (*Manager) ProcessEvent

func (m *Manager) ProcessEvent(ctx context.Context, event models.GitHubContext) error

ProcessEvent 处理事件(选择合适的处理器并执行)

func (*Manager) RegisterHandler

func (m *Manager) RegisterHandler(handler ModeHandler)

RegisterHandler 注册模式处理器

func (*Manager) SelectHandler

func (m *Manager) SelectHandler(ctx context.Context, event models.GitHubContext) (ModeHandler, error)

SelectHandler 选择合适的处理器处理事件

type ModeHandler

type ModeHandler interface {
	// CanHandle 检查是否能处理给定的事件上下文
	CanHandle(ctx context.Context, event models.GitHubContext) bool

	// Execute 执行模式逻辑
	Execute(ctx context.Context, event models.GitHubContext) error

	// GetPriority 获取处理器优先级(数字越小优先级越高)
	GetPriority() int

	// GetMode 获取模式类型
	GetMode() ExecutionMode

	// GetDescription 获取模式描述
	GetDescription() string

	// GetHandlerName 获取处理器名称
	GetHandlerName() string
}

ModeHandler 模式处理器接口

type ModeManager

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

ModeManager 模式管理器

func NewModeManager

func NewModeManager() *ModeManager

NewModeManager 创建新的模式管理器

func (*ModeManager) DisableMode

func (mm *ModeManager) DisableMode(mode ExecutionMode)

DisableMode 禁用指定模式

func (*ModeManager) EnableMode

func (mm *ModeManager) EnableMode(mode ExecutionMode)

EnableMode 启用指定模式

func (*ModeManager) Execute

func (mm *ModeManager) Execute(ctx context.Context, event models.GitHubContext) error

Execute 执行事件处理

func (*ModeManager) FindHandler

func (mm *ModeManager) FindHandler(ctx context.Context, event models.GitHubContext) (ModeHandler, error)

FindHandler 根据事件上下文找到合适的处理器

func (*ModeManager) GetEnabledModes

func (mm *ModeManager) GetEnabledModes() []ExecutionMode

GetEnabledModes 获取所有启用的模式

func (*ModeManager) GetHandlerCount

func (mm *ModeManager) GetHandlerCount() int

GetHandlerCount 获取注册的处理器数量

func (*ModeManager) GetRegisteredHandlers

func (mm *ModeManager) GetRegisteredHandlers() []ModeHandler

GetRegisteredHandlers 获取所有注册的处理器

func (*ModeManager) IsEnabled

func (mm *ModeManager) IsEnabled(mode ExecutionMode) bool

IsEnabled 检查模式是否启用

func (*ModeManager) RegisterHandler

func (mm *ModeManager) RegisterHandler(handler ModeHandler)

RegisterHandler 注册模式处理器

func (*ModeManager) SelectHandler

func (mm *ModeManager) SelectHandler(ctx context.Context, event models.GitHubContext) (ModeHandler, error)

SelectHandler 选择合适的处理器(FindHandler的别名)

type ReviewHandler

type ReviewHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

ReviewHandler Review模式处理器 处理自动代码审查相关的事件

func NewReviewHandler

func NewReviewHandler(github *ghclient.Client, workspace *workspace.Manager, mcpClient mcp.MCPClient, sessionManager *code.SessionManager) *ReviewHandler

NewReviewHandler 创建Review模式处理器

func (*ReviewHandler) CanHandle

func (rh *ReviewHandler) CanHandle(ctx context.Context, event models.GitHubContext) bool

CanHandle 检查是否能处理给定的事件

func (*ReviewHandler) Execute

func (rh *ReviewHandler) Execute(ctx context.Context, event models.GitHubContext) error

Execute 执行Review模式处理逻辑

type TagHandler

type TagHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

TagHandler Tag mode handler Handles GitHub events containing commands (/code, /continue, /fix)

func NewTagHandler

func NewTagHandler(defaultAIModel string, github *ghclient.Client, workspace *workspace.Manager, mcpClient mcp.MCPClient, sessionManager *code.SessionManager) *TagHandler

NewTagHandler creates a Tag mode handler

func (*TagHandler) CanHandle

func (th *TagHandler) CanHandle(ctx context.Context, event models.GitHubContext) bool

CanHandle checks if the given event can be handled

func (*TagHandler) Execute

func (th *TagHandler) Execute(ctx context.Context, event models.GitHubContext) error

Execute executes Tag mode processing logic

Jump to

Keyboard shortcuts

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