command

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	// Name returns the command trigger without the leading slash (e.g. "new").
	Name() string
	// Description returns a short human-readable summary.
	Description() string
	// Execute runs the command. args is the trimmed text after the command name.
	Execute(ctx context.Context, args string, env Env) Result
}

Command is the interface every slash command must implement.

type CronCommand

type CronCommand struct{}

CronCommand implements /cron — manage scheduled jobs. Subcommands: list, remove <id>, enable <id>, disable <id>, run <id>

func (*CronCommand) Description

func (c *CronCommand) Description() string

func (*CronCommand) Execute

func (c *CronCommand) Execute(ctx context.Context, args string, env Env) Result

func (*CronCommand) Name

func (c *CronCommand) Name() string

type Env

type Env struct {
	Channel       string
	ChatID        string
	SenderID      string
	SessionKey    string
	Sessions      *session.Manager
	WorkspacePath string
	Config        *config.Config
	Metrics       *metrics.RuntimeMetrics
	ListCommands  func() []Command // for /help
}

Env carries per-invocation context for a slash command.

type HelpCommand

type HelpCommand struct{}

HelpCommand implements /help — lists all available slash commands.

func (*HelpCommand) Description

func (c *HelpCommand) Description() string

func (*HelpCommand) Execute

func (c *HelpCommand) Execute(_ context.Context, _ string, env Env) Result

func (*HelpCommand) Name

func (c *HelpCommand) Name() string

type MemoryCommand

type MemoryCommand struct{}

MemoryCommand implements /memory — read long-term memory and diary entries. Subcommands: (none)|read, diary [date|recent]

func (*MemoryCommand) Description

func (c *MemoryCommand) Description() string

func (*MemoryCommand) Execute

func (c *MemoryCommand) Execute(_ context.Context, args string, env Env) Result

func (*MemoryCommand) Name

func (c *MemoryCommand) Name() string

type NewSessionCommand

type NewSessionCommand struct{}

NewSessionCommand implements /new — resets the current conversation session.

func (*NewSessionCommand) Description

func (c *NewSessionCommand) Description() string

func (*NewSessionCommand) Execute

func (c *NewSessionCommand) Execute(_ context.Context, _ string, env Env) Result

func (*NewSessionCommand) Name

func (c *NewSessionCommand) Name() string

type Registry

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

Registry holds registered slash commands and dispatches them.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty command registry.

func (*Registry) List

func (r *Registry) List() []Command

List returns all registered commands sorted by name.

func (*Registry) Lookup

func (r *Registry) Lookup(content string) (Command, string, bool)

Lookup parses raw user input. If it starts with "/" and matches a registered command, it returns the command, the remaining args, and true.

func (*Registry) Register

func (r *Registry) Register(cmd Command)

Register adds a command. Panics on duplicate names.

type Result

type Result struct {
	Content string
}

Result is the output of a slash command execution.

type SkillsCommand

type SkillsCommand struct{}

SkillsCommand implements /skills — list and inspect installed skills. Subcommands: list, show <name>

func (*SkillsCommand) Description

func (c *SkillsCommand) Description() string

func (*SkillsCommand) Execute

func (c *SkillsCommand) Execute(_ context.Context, args string, env Env) Result

func (*SkillsCommand) Name

func (c *SkillsCommand) Name() string

type StatusCommand

type StatusCommand struct{}

StatusCommand implements /status — shows runtime status summary.

func (*StatusCommand) Description

func (c *StatusCommand) Description() string

func (*StatusCommand) Execute

func (c *StatusCommand) Execute(_ context.Context, _ string, env Env) Result

func (*StatusCommand) Name

func (c *StatusCommand) Name() string

type VersionCommand

type VersionCommand struct{}

VersionCommand implements /version — shows build version info.

func (*VersionCommand) Description

func (c *VersionCommand) Description() string

func (*VersionCommand) Execute

func (c *VersionCommand) Execute(_ context.Context, _ string, _ Env) Result

func (*VersionCommand) Name

func (c *VersionCommand) Name() string

Jump to

Keyboard shortcuts

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