command

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config, _ Deps) (agentkit.Commands, error)

New registers commands/registry: Aggregate slash commands contributed by CommandProvider plugins.

Best practices:

  • Providers are discovered from the built graph, so a command appears as soon as its plugin is wired in.

func PluginHelpCommand added in v0.1.2

func PluginHelpCommand() agentkit.Command

PluginHelpCommand exposes the plugin catalog help slash command.

Types

type Config

type Config struct {
	// Allow exposes only these command names; empty means all.
	Allow []string `json:"allow,omitempty"`
	// Deny hides these command names; applied after Allow.
	Deny []string `json:"deny,omitempty"`
	// Admins lists user IDs that may run admin-only slash commands. Matching is
	// case-insensitive. When empty, admin restrictions are not enforced.
	Admins []string `json:"admins,omitempty"`
	// AdminOnly lists command names and aliases that require an admin user when
	// Admins is non-empty.
	AdminOnly []string `json:"adminOnly,omitempty"`
}

Config controls which contributed commands are exposed. Allow and Deny match command names and aliases case-insensitively. When Allow is empty, every command is eligible unless denied. When Allow is non-empty, only listed commands are registered.

type Deps

type Deps struct{}

type Registry

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

Registry collects slash commands contributed by built plugins.

func NewFromProviders

func NewFromProviders(cfg Config, providers []agentkit.CommandProvider) (*Registry, error)

NewFromProviders builds a registry from explicit command providers.

func (*Registry) Commands added in v0.1.2

func (r *Registry) Commands() []agentkit.Command

func (*Registry) Dispatch

func (r *Registry) Dispatch(ctx context.Context, name string, rawArgs string) (string, error)

func (*Registry) EnrichSlashContext added in v0.1.16

func (r *Registry) EnrichSlashContext(ctx context.Context) context.Context

EnrichSlashContext sets KeyIsAdmin when the current user matches Config.Admins.

func (*Registry) List

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

func (*Registry) SetCommands

func (r *Registry) SetCommands(providers []agentkit.CommandProvider) error

SetCommands registers commands from every built CommandProvider.

Jump to

Keyboard shortcuts

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