commands

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package commands handles slash commands for Celeste CLI. Commands provide direct user control over modes, endpoints, and configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectRoutingHints

func DetectRoutingHints(message string) string

DetectRoutingHints checks if message contains routing hints. Returns suggested endpoint or empty string.

func IsContentPolicyRefusal

func IsContentPolicyRefusal(response string) bool

IsContentPolicyRefusal checks if the LLM response is a content policy refusal.

func IsImageGenerationRequest

func IsImageGenerationRequest(message string) bool

IsImageGenerationRequest checks if the message is requesting image generation.

Types

type Command

type Command struct {
	Name string
	Args []string
	Raw  string
}

Command represents a parsed slash command.

func Parse

func Parse(input string) *Command

Parse parses a message to check if it's a command. Returns nil if not a command.

type CommandContext

type CommandContext struct {
	NSFWMode      bool
	Provider      string // Current provider (grok, openai, venice, etc.)
	CurrentModel  string // Current model in use
	APIKey        string // API key for model listing
	BaseURL       string // Base URL for API calls
	SkillsEnabled bool   // Whether skills/functions are currently enabled
	Version       string // Application version
	Build         string // Build identifier
}

CommandContext provides context for command execution.

type CommandResult

type CommandResult struct {
	Success      bool
	Message      string
	ShouldRender bool // Whether to show in chat history
	StateChange  *StateChange
}

CommandResult represents the result of executing a command.

func Execute

func Execute(cmd *Command, ctx *CommandContext) *CommandResult

Execute executes a command and returns the result.

func HandleCollectionsCommand

func HandleCollectionsCommand(cmd *Command, cfg *config.Config) *CommandResult

HandleCollectionsCommand handles the collections command and its subcommands. Usage:

celeste collections               - Show help
celeste collections create <name> - Create a collection
celeste collections list          - List all collections
celeste collections upload <id> <files...> - Upload documents
celeste collections delete <id>   - Delete a collection
celeste collections enable <id>   - Add to active set
celeste collections disable <id>  - Remove from active set
celeste collections show <id>     - Show collection details

func HandleContextCommand

func HandleContextCommand(args []string, contextTracker *config.ContextTracker) CommandResult

HandleContextCommand handles the /context command and its subcommands. Usage:

/context          - Show current context usage
/context status   - Detailed context breakdown
/context compact  - Manual context compaction (future)

func HandleExportCommand

func HandleExportCommand(args []string, currentSession *config.Session) CommandResult

HandleExportCommand exports the current or specified session

func HandleProvidersCommand

func HandleProvidersCommand(cmd *Command, ctx *CommandContext) *CommandResult

HandleProvidersCommand handles the /providers command and its subcommands. Usage:

/providers               - List all providers
/providers --tools       - Show only tool-capable providers
/providers info <name>   - Show detailed capabilities
/providers current       - Show current provider info

func HandleStatsCommand

func HandleStatsCommand(args []string, contextTracker *config.ContextTracker) CommandResult

HandleStatsCommand displays a corruption-themed usage dashboard

type SelectorData

type SelectorData struct {
	Title string
	Items []SelectorItem
}

SelectorData holds data for showing the interactive selector.

type SelectorItem

type SelectorItem struct {
	ID          string
	DisplayName string
	Description string
	Badge       string
}

SelectorItem represents an item in the interactive selector.

type SessionAction

type SessionAction struct {
	Action    string // "new", "resume", "list", "clear", "merge", "info"
	SessionID string // For resume/merge operations
	Name      string // For new session with name
}

SessionAction represents a session management operation.

type StateChange

type StateChange struct {
	EndpointChange *string
	NSFWMode       *bool
	Model          *string
	ImageModel     *string
	ClearHistory   bool
	NewSession     bool           // signals the TUI to create a new session after clearing chat
	MenuState      *string        // "status", "commands", "skills"
	SessionAction  *SessionAction // Session management operations
	ShowSelector   *SelectorData  // Show interactive selector
}

StateChange represents a change in application state.

Jump to

Keyboard shortcuts

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