slashcmd

package
v0.2.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package slashcmd is the single source of truth for the runtime chat's slash-command set. Both the terminal TUI (internal/interface/cli) and the Desktop app (internal/interface/desktop, over a Wails binding) read this list, so the two surfaces no longer maintain parallel command tables that drift apart. It describes the commands; each surface still owns how it dispatches and renders them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCommand

func IsCommand(s Surface, name string) bool

IsCommand reports whether name (with or without a leading slash) is a builtin command on the given surface.

func Names

func Names(s Surface) []string

Names returns the "/"-prefixed command names offered on the given surface, in order. The TUI uses it as its completion list.

Types

type Command

type Command struct {
	// Name is the command without its leading slash, e.g. "info".
	Name string `json:"name"`
	// Description is the one-line summary shown in completion and the palette.
	Description string `json:"description"`
	// Surfaces is the set of clients that offer this command.
	Surfaces Surface `json:"-"`
	// RequiresSession marks a command that acts on a saved session, so a surface
	// disables it until the current chat has one (rewind, fork, compact, info).
	RequiresSession bool `json:"requires_session"`
}

Command describes one slash command. It carries only what both surfaces need to present and gate it; the handler that runs it lives in each surface.

func For

func For(s Surface) []Command

For returns the commands offered on the given surface, in order.

func (Command) On

func (c Command) On(s Surface) bool

On reports whether the command is offered on the given surface.

func (Command) Slash

func (c Command) Slash() string

Slash returns the command as typed, with its leading slash.

type Surface

type Surface uint8

Surface is a client that presents commands. A command can be offered on some surfaces and not others: /sessions has no place in Desktop, where the session list is always visible in the sidebar.

const (
	// CLI is the terminal TUI.
	CLI Surface = 1 << iota
	// Desktop is the Wails desktop app.
	Desktop
)

Jump to

Keyboard shortcuts

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