commands

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandDefinition

type CommandDefinition struct {
	// 基础信息
	Name         string   // 命令名(如 "write")
	Description  string   // 描述
	ArgumentHint string   // 参数提示
	AllowedTools []string // 允许使用的工具

	// 模型要求
	Models struct {
		Preferred           []string // 推荐的模型
		MinimumCapabilities []string // 最小能力要求
	}

	// 脚本路径
	Scripts struct {
		Sh string // bash 脚本路径
		Ps string // powershell 脚本路径
	}

	// 提示词模板
	PromptTemplate string // Markdown 内容
}

CommandDefinition Slash Command 定义

func LoadLocal

func LoadLocal(baseDir, commandName string) (*CommandDefinition, error)

LoadLocal 从本地文件系统加载(用于开发)

type CommandLoader

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

CommandLoader 命令加载器

func NewLoader

func NewLoader(baseDir string, fs sandbox.SandboxFS) *CommandLoader

NewLoader 创建加载器

func (*CommandLoader) List

func (cl *CommandLoader) List(ctx context.Context) ([]string, error)

List 列出所有可用命令

func (*CommandLoader) Load

func (cl *CommandLoader) Load(ctx context.Context, commandName string) (*CommandDefinition, error)

Load 加载命令定义

type Executor

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

Executor 命令执行器

func NewExecutor

func NewExecutor(config *ExecutorConfig) *Executor

NewExecutor 创建执行器

func (*Executor) CheckCapabilities

func (e *Executor) CheckCapabilities(cmd *CommandDefinition) error

CheckCapabilities 检查模型能力

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, commandName string, args map[string]string) (string, error)

Execute 执行命令

func (*Executor) IsSlashCommand

func (e *Executor) IsSlashCommand(message string) bool

IsSlashCommand 检查消息是否为斜杠命令

type ExecutorConfig

type ExecutorConfig struct {
	Loader       *CommandLoader
	Sandbox      sandbox.Sandbox
	Provider     provider.Provider
	Capabilities provider.ProviderCapabilities
}

ExecutorConfig 执行器配置

Jump to

Keyboard shortcuts

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