Documentation
¶
Overview ¶
Package commands provides a shared registry of slash commands used across ACP, TUI, and WebUI interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Content ¶ added in v0.629.4
Content returns the markdown body of a custom command (a name such as "project:review" or "user:tools/lint"). It reports false when the name is not a custom command or no matching file exists.
func IsExtensionCommand ¶ added in v0.700.0
IsExtensionCommand reports whether name is served by an extension.
func Parse ¶
Parse checks if input is a slash command. Returns the command name, arguments, and whether parsing succeeded.
func SetExtensionManager ¶ added in v0.700.0
SetExtensionManager wires the loaded extension manager into the slash-command registry. Passing nil detaches it.
Types ¶
type ExtensionResult ¶ added in v0.700.0
ExtensionResult is what running an extension slash command produced. Prompt, when non-empty, is text the caller should send to the model as if the user had typed it; Output is text to show directly without a model turn.
func RunExtension ¶ added in v0.700.0
func RunExtension(ctx context.Context, name, args string) (res ExtensionResult, handled bool, err error)
RunExtension executes an extension slash command. It reports false when no extension owns the name, which lets a caller fall through to its own handling.
A panicking extension is contained: a broken command must not take down the session it was typed into.
type SlashCommand ¶
type SlashCommand struct {
Name string `json:"name"`
Description string `json:"description"`
AcceptsArgs bool `json:"acceptsArgs"`
}
SlashCommand represents a slash command available to users.
func AllCommands ¶
func AllCommands(dataDir string) []SlashCommand
AllCommands returns built-in commands, custom commands discovered from the filesystem (user and project command directories), and the commands contributed by loaded extensions.
func BuiltinCommands ¶
func BuiltinCommands() []SlashCommand
BuiltinCommands returns the built-in slash commands shared across all interfaces.
func ExtensionCommands ¶ added in v0.700.0
func ExtensionCommands() []SlashCommand
ExtensionCommands returns the slash commands contributed by loaded extensions, in provider order.
A command whose name collides with a built-in is dropped: an extension must not be able to redefine /compact, and resolving the collision in the extension's favour would change core behaviour depending on which binary the user is running.
func Match ¶
func Match(query string, cmds []SlashCommand) []SlashCommand
Match filters commands by prefix match on name (case-insensitive).