commands

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommitStatusSuccess = "success"
	CommitStatusError   = "error"
	CommitStatusDryRun  = "dry-run"
)

Commit status constants

Variables

This section is empty.

Functions

func ExtractGitSubcommand

func ExtractGitSubcommand(command string) string

ExtractGitSubcommand extracts the first git subcommand from a command string for display purposes.

func IsGitCheckoutSubcommand

func IsGitCheckoutSubcommand(command string) bool

IsGitCheckoutSubcommand checks if a git command is a checkout or switch operation. These operations are blocked from direct execution to require explicit user approval. This function checks ALL git commands in a compound shell command (e.g., "cd x && git checkout").

func IsGitDiscardCommand

func IsGitDiscardCommand(command string) bool

IsGitDiscardCommand checks if a git command could discard changes (restore, reset --hard, checkout -- <file>). These are always blocked from direct execution regardless of orchestrator permissions. This function checks ALL git commands in a compound shell command (e.g., "cd x && git reset").

func PathCompleter added in v0.16.25

func PathCompleter(prefix string) []string

PathCompleter returns file/directory path completions matching the given prefix. Directories are returned with a trailing "/" so the user can continue pressing Tab to drill deeper. Hidden files (dotfiles) are excluded unless the prefix starts with ".".

Uses os.ReadDir for fast directory listing without stat'ing every entry. Returns absolute paths for absolute prefixes, relative paths otherwise. Sorted alphabetically.

func SetGitDir

func SetGitDir(dir string)

SetGitDir sets the working directory for subsequent gitCommand calls.

func WriteJSONToOutput

func WriteJSONToOutput(value interface{}) error

WriteJSONToOutput writes a JSON representation of value to stdout

func WriteToOutput

func WriteToOutput(output string)

WriteToOutput writes a string to os.Stdout

Types

type ChangesCommand

type ChangesCommand struct{}

ChangesCommand shows tracked file changes in the current session

func (*ChangesCommand) Description

func (c *ChangesCommand) Description() string

Description returns the command description

func (*ChangesCommand) Execute

func (c *ChangesCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute shows the tracked changes for this session

func (*ChangesCommand) Name

func (c *ChangesCommand) Name() string

Name returns the command name

func (*ChangesCommand) Usage added in v0.16.19

func (c *ChangesCommand) Usage() string

Usage returns the detailed help text shown by `/help changes`.

type ClearCommand

type ClearCommand struct{}

ClearCommand handles closing the current session and starting a fresh one

func (*ClearCommand) Description

func (c *ClearCommand) Description() string

func (*ClearCommand) Execute

func (c *ClearCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*ClearCommand) Name

func (c *ClearCommand) Name() string

func (*ClearCommand) Usage added in v0.16.19

func (c *ClearCommand) Usage() string

Usage returns the detailed help text shown by `/help clear`.

type CodegraphCommand added in v0.16.19

type CodegraphCommand struct{}

CodegraphCommand implements the /codegraph slash command for managing the code intelligence graph: build, stats, and dead-code detection.

func (*CodegraphCommand) Complete added in v0.16.25

func (c *CodegraphCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete returns completions for the /codegraph command.

func (*CodegraphCommand) Description added in v0.16.19

func (c *CodegraphCommand) Description() string

Description returns the command description

func (*CodegraphCommand) Execute added in v0.16.19

func (c *CodegraphCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the codegraph command

func (*CodegraphCommand) Name added in v0.16.19

func (c *CodegraphCommand) Name() string

Name returns the command name

func (*CodegraphCommand) Usage added in v0.16.19

func (c *CodegraphCommand) Usage() string

Usage returns detailed help text for the command

type Command

type Command interface {
	Name() string
	Description() string
	Execute(args []string, chatAgent *agent.Agent) error
}

Command represents a slash command

type CommandContext

type CommandContext struct {
	OutputFormat OutputFormat
}

CommandContext provides context for command execution

type CommandRegistry

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

CommandRegistry manages all available slash commands

func NewCommandRegistry

func NewCommandRegistry() *CommandRegistry

NewCommandRegistry creates a new command registry

func (*CommandRegistry) AliasesOf

func (r *CommandRegistry) AliasesOf(canonical string) []string

AliasesOf returns the set of aliases that resolve to the given canonical command name. Used by /help <name> to show alternate spellings.

func (*CommandRegistry) CompletionCandidates

func (r *CommandRegistry) CompletionCandidates() []string

CompletionCandidates returns all valid slash-command names (canonical plus aliases) sorted alphabetically. Used by the tab-completion CompletionProvider in the input reader.

func (*CommandRegistry) Execute

func (r *CommandRegistry) Execute(input string, chatAgent *agent.Agent) error

Execute processes a slash command input Supports both / and ! prefixes (e.g. /exec ls or !exec ls)

func (*CommandRegistry) GetCommand

func (r *CommandRegistry) GetCommand(name string) (Command, bool)

GetCommand returns a command by name. If name matches an alias, the canonical command is returned (SP-048-2d).

func (*CommandRegistry) IsSlashCommand

func (r *CommandRegistry) IsSlashCommand(input string) bool

IsSlashCommand checks if input starts with a slash or bang

func (*CommandRegistry) ListCommands

func (r *CommandRegistry) ListCommands() []Command

ListCommands returns all available commands

func (*CommandRegistry) Register

func (r *CommandRegistry) Register(cmd Command)

Register adds a command to the registry

func (*CommandRegistry) RegisterAlias

func (r *CommandRegistry) RegisterAlias(short, canonical string)

RegisterAlias maps a short name to a canonical command name. Looking up the alias via GetCommand or Execute resolves transparently. Aliases also participate in tab completion and "did you mean" suggestions.

func (*CommandRegistry) SuggestCommands

func (r *CommandRegistry) SuggestCommands(name string, maxSuggestions int) []string

SuggestCommands returns up to maxSuggestions command names that are plausible corrections for a mistyped command. Matches are ranked by Levenshtein distance against the lowercased canonical name; commands whose lowercased name has the input as a prefix are pulled to the front (distance 0). Returns nil for empty input or when no candidate is reasonably close.

type CommitAction

type CommitAction struct {
	ID          string
	DisplayName string
	Description string
	Action      func(*CommitFlow) error
}

CommitAction represents different commit actions

type CommitActionItem

type CommitActionItem struct {
	ID          string
	DisplayName string
	Description string
}

CommitActionItem adapts CommitAction for dropdown display

func (*CommitActionItem) Display

func (c *CommitActionItem) Display() string

func (*CommitActionItem) SearchText

func (c *CommitActionItem) SearchText() string

func (*CommitActionItem) Value

func (c *CommitActionItem) Value() interface{}

type CommitCommand

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

CommitCommand implements the /commit slash command

func (*CommitCommand) Description

func (c *CommitCommand) Description() string

Description returns the command description

func (*CommitCommand) Execute

func (c *CommitCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the commit command

func (*CommitCommand) ExecuteWithJSONOutput

func (c *CommitCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

ExecuteWithJSONOutput runs the commit command with JSON output

func (*CommitCommand) Name

func (c *CommitCommand) Name() string

Name returns the command name

func (*CommitCommand) SetAgentError

func (c *CommitCommand) SetAgentError(err error)

SetAgentError sets the agent creation error for better error reporting

func (*CommitCommand) Usage added in v0.16.19

func (c *CommitCommand) Usage() string

Usage returns the detailed help text shown by `/help commit`.

type CommitFlow

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

CommitFlow manages the interactive commit workflow

func NewCommitFlow

func NewCommitFlow(chatAgent *agent.Agent) *CommitFlow

NewCommitFlow creates a new commit flow

func NewCommitFlowWithFlags

func NewCommitFlowWithFlags(chatAgent *agent.Agent, skipPrompt, dryRun, allowSecrets bool) *CommitFlow

NewCommitFlowWithFlags creates a new commit flow with CLI flags

func (*CommitFlow) CommitStagedWithMessage

func (cf *CommitFlow) CommitStagedWithMessage() error

CommitStagedWithMessage commits staged files with an optional message or auto-generated message This method is designed for non-interactive use by the commit tool

func (*CommitFlow) Execute

func (cf *CommitFlow) Execute() error

Execute runs a simplified commit flow: 1) If there are staged changes, use them and generate a commit message 2) If there are no staged changes, prompt user to select files, then generate the commit message

func (*CommitFlow) SetUserInstructions

func (cf *CommitFlow) SetUserInstructions(instructions string)

SetUserInstructions sets the user instructions for commit message generation

type CommitJSONResult

type CommitJSONResult struct {
	Status  string `json:"status"`            // success, error, dry-run
	Commit  string `json:"commit,omitempty"`  // commit hash if successful
	Message string `json:"message,omitempty"` // commit message
	Branch  string `json:"branch,omitempty"`  // branch name
	Error   string `json:"error,omitempty"`   // error message
	Review  string `json:"review,omitempty"`  // commit review (critical concerns)
}

CommitJSONResult is the JSON output structure for commit command

func (*CommitJSONResult) Validate

func (r *CommitJSONResult) Validate() error

Validate checks that required fields are populated

type CommitMessageHandler

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

CommitMessageHandler handles commit message generation, editing, and retry logic

func NewCommitMessageHandler

func NewCommitMessageHandler(chatAgent *agent.Agent, reader *bufio.Reader) *CommitMessageHandler

NewCommitMessageHandler creates a new commit message handler

func (*CommitMessageHandler) CreateCommit

func (h *CommitMessageHandler) CreateCommit(commitMessage string) error

CreateCommit creates the git commit with the given message

func (*CommitMessageHandler) EditCommitMessage

func (h *CommitMessageHandler) EditCommitMessage(commitMessage string) (string, error)

EditCommitMessage opens the default editor to edit the commit message

func (*CommitMessageHandler) GenerateCommitMessage

func (h *CommitMessageHandler) GenerateCommitMessage(diffOutput []byte, isSingleFile bool, filename string) (string, error)

GenerateCommitMessage generates a commit message from staged diff

func (*CommitMessageHandler) HandleCommitConfirmation

func (h *CommitMessageHandler) HandleCommitConfirmation(commitMessage string, filename string) (string, bool, error)

HandleCommitConfirmation handles the commit message preview, editing, and confirmation

type CompactCommand

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

CompactCommand implements the /compact slash command. It splits the conversation into three segments — the opening task anchor (system + first user/assistant turn), the middle, and the recent causal chain (last 12 messages, adjusted to keep tool calls paired with their results) — and replaces the middle with a single LLM-generated recap while preserving anchor and recent verbatim.

func (*CompactCommand) Description

func (c *CompactCommand) Description() string

Description returns the command description

func (*CompactCommand) Execute

func (c *CompactCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the compact command

func (*CompactCommand) Name

func (c *CompactCommand) Name() string

Name returns the command name

func (*CompactCommand) SetContext added in v0.16.19

func (c *CompactCommand) SetContext(ctx context.Context)

SetContext sets the cancellation context for the LLM summarization call. When wired through the command registry, this receives the agent's InterruptCtx so Stop/Ctrl+C can abort in-flight compaction.

Note: in concurrent multi-chat daemon mode, the registry reuses the same CompactCommand singleton, so c.ctx may be overwritten by a concurrent call. The Execute method falls back to the agent's own InterruptCtx() to avoid cross-chat interference.

func (*CompactCommand) Usage added in v0.16.19

func (c *CompactCommand) Usage() string

Usage returns the detailed help text shown by `/help compact`.

type CompletableCommand added in v0.16.25

type CompletableCommand interface {
	Command
	Complete(args []string, chatAgent *agent.Agent) []string
}

CompletableCommand is implemented by commands that support argument completion beyond the command name itself. args does NOT include the command name — it's already been parsed off. chatAgent may be nil for commands that only need their static argument lists.

NOTE: Complete is only called when the cursor is at end-of-line (cursorPos == len(line)). The buildSlashCommandCompleter enforces this invariant; individual implementations can rely on it.

Returns candidate completions for the last positional argument in args. If args is empty, returns completions for the first argument.

type EditCommand

type EditCommand struct{}

EditCommand opens $EDITOR to compose or edit a query.

func (*EditCommand) Description

func (c *EditCommand) Description() string

func (*EditCommand) Execute

func (c *EditCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*EditCommand) Name

func (c *EditCommand) Name() string

func (*EditCommand) Usage added in v0.16.19

func (c *EditCommand) Usage() string

Usage returns the detailed help text shown by `/help edit`.

type ExecCommand

type ExecCommand struct{}

ExecCommand handles the /exec slash command Usage: /exec <shell-command-to-execute> Alias: !<shell-command-to-execute> (matches other tools like Jupyter, R, etc.)

func (*ExecCommand) Description

func (c *ExecCommand) Description() string

func (*ExecCommand) Execute

func (c *ExecCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*ExecCommand) Name

func (c *ExecCommand) Name() string

func (*ExecCommand) Usage added in v0.16.19

func (c *ExecCommand) Usage() string

Usage returns the detailed help text shown by `/help exec`.

type ExitCommand

type ExitCommand struct{}

ExitCommand implements the /exit slash command

func (*ExitCommand) Description

func (e *ExitCommand) Description() string

Description returns the command description

func (*ExitCommand) Execute

func (e *ExitCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the exit command

func (*ExitCommand) Name

func (e *ExitCommand) Name() string

Name returns the command name

func (*ExitCommand) Usage added in v0.16.19

func (e *ExitCommand) Usage() string

Usage returns the detailed help text shown by `/help exit`.

type FileItem

type FileItem struct {
	Filename    string
	Description string
}

FileItem adapts file information for dropdown display

func (*FileItem) Display

func (f *FileItem) Display() string

func (*FileItem) SearchText

func (f *FileItem) SearchText() string

func (*FileItem) Value

func (f *FileItem) Value() interface{}

type ForkCommand added in v0.16.25

type ForkCommand struct{}

ForkCommand handles forking the conversation at a user message breakpoint.

func (*ForkCommand) Description added in v0.16.25

func (c *ForkCommand) Description() string

func (*ForkCommand) Execute added in v0.16.25

func (c *ForkCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*ForkCommand) Name added in v0.16.25

func (c *ForkCommand) Name() string

func (*ForkCommand) Usage added in v0.16.25

func (c *ForkCommand) Usage() string

Usage returns the detailed help text shown by `/help fork`.

type HelpCommand

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

HelpCommand implements the /help slash command

func (*HelpCommand) Complete added in v0.16.25

func (h *HelpCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete provides argument completions for /help. Suggests command names (canonical and aliases) from the registry.

func (*HelpCommand) Description

func (h *HelpCommand) Description() string

Description returns the command description

func (*HelpCommand) Execute

func (h *HelpCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the help command. With no args, prints the global help and command list. With one arg, prints per-command help (SP-048-2c).

func (*HelpCommand) Name

func (h *HelpCommand) Name() string

Name returns the command name

func (*HelpCommand) Usage added in v0.16.19

func (h *HelpCommand) Usage() string

Usage returns the detailed help text shown by `/help help`.

type IndexCommand

type IndexCommand struct{}

IndexCommand implements the /index slash command for toggling workspace indexing.

func (*IndexCommand) Complete added in v0.16.25

func (c *IndexCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete returns completions for the /index command.

func (*IndexCommand) Description

func (c *IndexCommand) Description() string

Description returns the command description

func (*IndexCommand) Execute

func (c *IndexCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the index command

func (*IndexCommand) Name

func (c *IndexCommand) Name() string

Name returns the command name

func (*IndexCommand) Usage added in v0.16.19

func (c *IndexCommand) Usage() string

Usage returns the detailed help text shown by `/help index`.

type InfoCommand added in v0.16.19

type InfoCommand struct{}

InfoCommand implements the /info slash command — a one-shot overview of the agent's current state: model, provider, context, cost, persona, embedding index, and subagent config.

func (*InfoCommand) Description added in v0.16.19

func (c *InfoCommand) Description() string

Description returns the command description

func (*InfoCommand) Execute added in v0.16.19

func (c *InfoCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute renders the agent state overview

func (*InfoCommand) ExecuteWithJSONOutput added in v0.16.19

func (c *InfoCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

ExecuteWithJSONOutput emits the agent state overview as JSON.

func (*InfoCommand) Name added in v0.16.19

func (c *InfoCommand) Name() string

Name returns the command name

func (*InfoCommand) Usage added in v0.16.19

func (c *InfoCommand) Usage() string

Usage returns the detailed help text shown by `/help info`.

type InitCommand

type InitCommand struct{}

InitCommand implements the /init slash command

func (*InitCommand) Description

func (i *InitCommand) Description() string

Description returns the command description

func (*InitCommand) Execute

func (i *InitCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the init command using the LLM to analyze the codebase

func (*InitCommand) Name

func (i *InitCommand) Name() string

Name returns the command name

func (*InitCommand) Usage added in v0.16.19

func (i *InitCommand) Usage() string

Usage returns the detailed help text shown by `/help init`.

type JSONCommand

type JSONCommand interface {
	Command
	ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error
}

JSONCommand extends Command to support JSON output

type LogAction

type LogAction struct {
	ID          string
	DisplayName string
	Description string
	Action      func(*LogFlow) error
}

LogAction represents different log management actions

type LogActionItem

type LogActionItem struct {
	ID          string
	DisplayName string
	Description string
}

LogActionItem adapts LogAction for dropdown display

func (*LogActionItem) Display

func (l *LogActionItem) Display() string

func (*LogActionItem) SearchText

func (l *LogActionItem) SearchText() string

func (*LogActionItem) Value

func (l *LogActionItem) Value() interface{}

type LogCommand

type LogCommand struct{}

LogCommand shows the change history using the history package

func (*LogCommand) Description

func (l *LogCommand) Description() string

Description returns the command description

func (*LogCommand) Execute

func (l *LogCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute shows the change log using enhanced flow

func (*LogCommand) Name

func (l *LogCommand) Name() string

Name returns the command name

func (*LogCommand) Usage added in v0.16.19

func (l *LogCommand) Usage() string

Usage returns the detailed help text shown by `/help log`.

type LogFlow

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

LogFlow manages enhanced log and history operations

func NewLogFlow

func NewLogFlow(chatAgent *agent.Agent) *LogFlow

NewLogFlow creates a new log flow

func (*LogFlow) Execute

func (lf *LogFlow) Execute(args []string) error

Execute runs the enhanced log flow

type MCPCommand

type MCPCommand struct{}

MCPCommand implements the /mcp slash command

func (*MCPCommand) Complete added in v0.16.25

func (m *MCPCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete returns completions for the /mcp command.

func (*MCPCommand) Description

func (m *MCPCommand) Description() string

Description returns the command description

func (*MCPCommand) Execute

func (m *MCPCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the MCP command

func (*MCPCommand) Name

func (m *MCPCommand) Name() string

Name returns the command name

func (*MCPCommand) Usage added in v0.16.19

func (m *MCPCommand) Usage() string

Usage returns the detailed help text shown by `/help mcp`.

type MaxContextCommand added in v0.16.17

type MaxContextCommand struct{}

MaxContextCommand implements /max-context for inspecting or setting the user-defined context window cap (Config.MaxContextTokens). When set, the agent treats the model as if it has at most this many context tokens, limiting input/output budgets as a cost-control measure.

func (*MaxContextCommand) Description added in v0.16.17

func (c *MaxContextCommand) Description() string

func (*MaxContextCommand) Execute added in v0.16.17

func (c *MaxContextCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*MaxContextCommand) Name added in v0.16.17

func (c *MaxContextCommand) Name() string

func (*MaxContextCommand) Usage added in v0.16.17

func (c *MaxContextCommand) Usage() string

type ModelsCommand

type ModelsCommand struct{}

ModelsCommand implements the /model slash command

func (*ModelsCommand) Complete added in v0.16.25

func (m *ModelsCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete provides argument completions for /model. Suggests the "select" subcommand, and when a partial model name is typed, lists matching models from the current provider.

func (*ModelsCommand) Description

func (m *ModelsCommand) Description() string

Description returns the command description

func (*ModelsCommand) Execute

func (m *ModelsCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the models command

func (*ModelsCommand) ExecuteWithJSONOutput added in v0.16.19

func (m *ModelsCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

ExecuteWithJSONOutput emits the available models for the current provider as a JSON array. This mirrors the no-args /model list path. The `select` and `<model_id>` subcommands are interactive/stateful and are not meaningfully representable as JSON, so they fall through to the text Execute.

func (*ModelsCommand) Name

func (m *ModelsCommand) Name() string

Name returns the command name

func (*ModelsCommand) Usage added in v0.16.19

func (m *ModelsCommand) Usage() string

Usage returns the detailed help text shown by `/help model`.

type OutputFormat

type OutputFormat int

OutputFormat defines output format for commands

const (
	OutputText OutputFormat = iota
	OutputJSON
)

type OutputWriter

type OutputWriter struct {
	Buffer bytes.Buffer
}

OutputWriter captures and buffers output

func (*OutputWriter) String

func (ow *OutputWriter) String() string

String returns the captured output

func (*OutputWriter) Write

func (ow *OutputWriter) Write(p []byte) (n int, err error)

Write implements io.Writer

type PersonaCommand

type PersonaCommand struct{}

PersonaCommand implements the /persona slash command.

Personas are catalog-fixed: the set of personas, their tool allowlists, system prompts, providers, and models are defined in pkg/personas/configs/*.json and are NOT user-customizable at runtime. The only mutable knob is enable/disable, which is recorded by ID in Config.DisabledPersonas so the catalog itself never gets mutated.

Workflow-level provider/model overrides (sprout automate) and per-spawn overrides (`run_subagent` arguments) remain available — those are transient, programmatic, and tracked separately.

func (*PersonaCommand) Complete added in v0.16.25

func (p *PersonaCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete returns completions for the /persona command.

func (*PersonaCommand) Description

func (p *PersonaCommand) Description() string

func (*PersonaCommand) Execute

func (p *PersonaCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*PersonaCommand) Name

func (p *PersonaCommand) Name() string

func (*PersonaCommand) Usage added in v0.16.19

func (p *PersonaCommand) Usage() string

Usage returns the detailed help text shown by `/help persona`.

type ProvidersCommand

type ProvidersCommand struct{}

ProvidersCommand implements the /provider slash command

func (*ProvidersCommand) Complete added in v0.16.25

func (p *ProvidersCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete provides argument completions for /provider. Suggests subcommands and provider names from the configuration manager.

func (*ProvidersCommand) Description

func (p *ProvidersCommand) Description() string

Description returns the command description

func (*ProvidersCommand) Execute

func (p *ProvidersCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the providers command

func (*ProvidersCommand) ExecuteWithJSONOutput added in v0.16.19

func (p *ProvidersCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

ExecuteWithJSONOutput emits the provider list as a JSON array. This mirrors the /provider list path (the status, select, and setProvider subcommands are interactive/stateful and fall through to text Execute).

func (*ProvidersCommand) Name

func (p *ProvidersCommand) Name() string

Name returns the command name

func (*ProvidersCommand) Usage added in v0.16.19

func (p *ProvidersCommand) Usage() string

Usage returns the detailed help text shown by `/help provider`.

type RecallCommand added in v0.16.19

type RecallCommand struct{}

RecallCommand implements the /recall slash command. It searches past sessions for content matching the given query and renders the results.

func (*RecallCommand) Description added in v0.16.19

func (c *RecallCommand) Description() string

Description returns the short description shown in /help listings.

func (*RecallCommand) Execute added in v0.16.19

func (c *RecallCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute renders the recalled items as a friendly markdown block.

func (*RecallCommand) ExecuteWithJSONOutput added in v0.16.19

func (c *RecallCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

ExecuteWithJSONOutput emits the raw []RecalledItem slice as JSON.

func (*RecallCommand) Name added in v0.16.19

func (c *RecallCommand) Name() string

Name returns the slash command name.

func (*RecallCommand) Usage added in v0.16.19

func (c *RecallCommand) Usage() string

Usage returns the long help string shown by /help recall.

type ReviewCommand

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

func (*ReviewCommand) Complete added in v0.16.25

func (c *ReviewCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete returns file path completions for /review arguments.

func (*ReviewCommand) Description

func (c *ReviewCommand) Description() string

Description returns the command description

func (*ReviewCommand) Execute

func (c *ReviewCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the code review command

func (*ReviewCommand) Name

func (c *ReviewCommand) Name() string

Name returns the command name

func (*ReviewCommand) SetContext added in v0.16.17

func (c *ReviewCommand) SetContext(ctx context.Context)

SetContext sets the cancellation context for review LLM calls (SP-073). When wired through the command registry, this receives the agent's InterruptCtx so Stop/Ctrl+C can abort in-flight review requests.

func (*ReviewCommand) Usage added in v0.16.19

func (c *ReviewCommand) Usage() string

Usage returns the detailed help text shown by `/help review`.

type ReviewDeepCommand

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

ReviewDeepCommand implements the /review-deep slash command This command performs a deeper evidence-focused review on staged Git changes

func (*ReviewDeepCommand) Complete added in v0.16.25

func (c *ReviewDeepCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete returns file path completions for /review-deep arguments.

func (*ReviewDeepCommand) Description

func (c *ReviewDeepCommand) Description() string

Description returns the command description

func (*ReviewDeepCommand) Execute

func (c *ReviewDeepCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the deep code review command

func (*ReviewDeepCommand) Name

func (c *ReviewDeepCommand) Name() string

Name returns the command name

func (*ReviewDeepCommand) SetContext added in v0.16.17

func (c *ReviewDeepCommand) SetContext(ctx context.Context)

SetContext sets the cancellation context for review LLM calls (SP-073).

func (*ReviewDeepCommand) Usage added in v0.16.19

func (c *ReviewDeepCommand) Usage() string

Usage returns the detailed help text shown by `/help review-deep`.

type RevisionItem

type RevisionItem struct {
	RevisionID  string
	Description string
	Timestamp   string
}

RevisionItem adapts revision information for dropdown display

func (*RevisionItem) Display

func (r *RevisionItem) Display() string

func (*RevisionItem) SearchText

func (r *RevisionItem) SearchText() string

func (*RevisionItem) Value

func (r *RevisionItem) Value() interface{}

type RewindCommand added in v0.16.12

type RewindCommand struct{}

RewindCommand handles rewinding conversation to a previous turn

func (*RewindCommand) Description added in v0.16.12

func (c *RewindCommand) Description() string

func (*RewindCommand) Execute added in v0.16.12

func (c *RewindCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*RewindCommand) Name added in v0.16.12

func (c *RewindCommand) Name() string

func (*RewindCommand) Usage added in v0.16.12

func (c *RewindCommand) Usage() string

type RiskProfileCommand

type RiskProfileCommand struct{}

RiskProfileCommand implements /risk-profile for inspecting or switching the SP-058 shell-command gating profile mid-session. The CLI flag --risk-profile sets the same field at startup; this command lets the user adjust without restarting.

func (*RiskProfileCommand) Description

func (c *RiskProfileCommand) Description() string

func (*RiskProfileCommand) Execute

func (c *RiskProfileCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*RiskProfileCommand) Name

func (c *RiskProfileCommand) Name() string

func (*RiskProfileCommand) Usage

func (c *RiskProfileCommand) Usage() string

type RollbackCommand

type RollbackCommand struct{}

RollbackCommand provides rollback functionality

func (*RollbackCommand) Complete added in v0.16.25

func (r *RollbackCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete returns completions for the /rollback command.

func (*RollbackCommand) Description

func (r *RollbackCommand) Description() string

Description returns the command description

func (*RollbackCommand) Execute

func (r *RollbackCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute performs a rollback

func (*RollbackCommand) Name

func (r *RollbackCommand) Name() string

Name returns the command name

func (*RollbackCommand) Usage added in v0.16.19

func (r *RollbackCommand) Usage() string

Usage returns the detailed help text shown by `/help rollback`.

type SearchCommand added in v0.16.18

type SearchCommand struct{}

SearchCommand implements the /search slash command for searching across saved sessions by message content.

func (*SearchCommand) Description added in v0.16.18

func (c *SearchCommand) Description() string

func (*SearchCommand) Execute added in v0.16.18

func (c *SearchCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*SearchCommand) ExecuteWithJSONOutput added in v0.16.18

func (c *SearchCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

func (*SearchCommand) Name added in v0.16.18

func (c *SearchCommand) Name() string

func (*SearchCommand) Usage added in v0.16.18

func (c *SearchCommand) Usage() string

type SessionsCommand

type SessionsCommand struct{}

SessionsCommand handles session management with auto-tracking and session recovery

func (*SessionsCommand) Description

func (c *SessionsCommand) Description() string

func (*SessionsCommand) Execute

func (c *SessionsCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*SessionsCommand) Name

func (c *SessionsCommand) Name() string

func (*SessionsCommand) Usage added in v0.16.19

func (c *SessionsCommand) Usage() string

Usage returns the detailed help text shown by `/help sessions`.

type SessionsFlow

type SessionsFlow struct{}

SessionsFlow handles advanced session operations

func (*SessionsFlow) ExecuteSessionDelete

func (f *SessionsFlow) ExecuteSessionDelete(args []string) (string, error)

ExecuteSessionDelete removes a session file

func (*SessionsFlow) ExecuteSessionExport

func (f *SessionsFlow) ExecuteSessionExport(args []string) (string, error)

ExecuteSessionExport exports a session to a JSON file

func (*SessionsFlow) ExecuteSessionImport

func (f *SessionsFlow) ExecuteSessionImport(chatAgent *agent.Agent, args []string) (string, error)

ExecuteSessionImport imports a session from a JSON file

func (*SessionsFlow) ExecuteSessionList

func (f *SessionsFlow) ExecuteSessionList(chatAgent *agent.Agent) (string, error)

ExecuteSessionList lists sessions for the current working directory, newest first.

func (*SessionsFlow) ExecuteSessionLoad

func (f *SessionsFlow) ExecuteSessionLoad(chatAgent *agent.Agent, args []string) (string, error)

ExecuteSessionLoad loads a session with optional summary context restoration

func (*SessionsFlow) ExecuteSessionRename

func (f *SessionsFlow) ExecuteSessionRename(chatAgent *agent.Agent, args []string) (string, error)

ExecuteSessionRename renames a session

type SettingsCommand added in v0.16.19

type SettingsCommand struct{}

SettingsCommand implements the /settings slash command — an interactive settings browser that lets the user view and change configuration values.

func (*SettingsCommand) Complete added in v0.16.25

func (s *SettingsCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete returns completions for the /settings command.

Completion stages:

  1. No args → return ["set"] (subcommand).
  2. args=["set"] → return all setting keys.
  3. args=["set", key, ...] where key exactly matches a setting with enum values → return matching enum values.
  4. args=["set", partialKey] → return setting keys with matching prefix.

func (*SettingsCommand) Description added in v0.16.19

func (s *SettingsCommand) Description() string

Description returns the command description

func (*SettingsCommand) Execute added in v0.16.19

func (s *SettingsCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the settings command

func (*SettingsCommand) Name added in v0.16.19

func (s *SettingsCommand) Name() string

Name returns the command name

func (*SettingsCommand) Usage added in v0.16.19

func (s *SettingsCommand) Usage() string

Usage returns the detailed help text shown by `/help settings`.

type SetupCommand added in v0.16.2

type SetupCommand struct{}

SetupCommand implements the /setup slash command, which displays a human-readable summary of the current Sprout configuration.

func (*SetupCommand) Description added in v0.16.2

func (s *SetupCommand) Description() string

Description returns the command description.

func (*SetupCommand) Execute added in v0.16.2

func (s *SetupCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the /setup command.

func (*SetupCommand) Name added in v0.16.2

func (s *SetupCommand) Name() string

Name returns the command name.

func (*SetupCommand) Usage added in v0.16.19

func (s *SetupCommand) Usage() string

Usage returns the detailed help text shown by `/help setup`.

type ShellCommand

type ShellCommand struct {
	Provider string
	Model    string
	// contains filtered or unexported fields
}

func (*ShellCommand) Description

func (c *ShellCommand) Description() string

func (*ShellCommand) Execute

func (c *ShellCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*ShellCommand) Name

func (c *ShellCommand) Name() string

func (*ShellCommand) SetContext added in v0.16.12

func (c *ShellCommand) SetContext(ctx context.Context)

SetContext sets the cancellation context for LLM calls (SP-073).

func (*ShellCommand) Usage added in v0.16.19

func (c *ShellCommand) Usage() string

Usage returns the detailed help text shown by `/help shell`.

type SkillCommand added in v0.16.18

type SkillCommand struct{}

SkillCommand exposes the /skill slash command.

func (*SkillCommand) Complete added in v0.16.25

func (c *SkillCommand) Complete(args []string, chatAgent *agent.Agent) []string

Complete provides argument completions for /skill. Static subcommands first, then skill IDs for enable/disable/remove/update.

func (*SkillCommand) Description added in v0.16.18

func (c *SkillCommand) Description() string

func (*SkillCommand) Execute added in v0.16.18

func (c *SkillCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*SkillCommand) ExecuteWithJSONOutput added in v0.16.18

func (c *SkillCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

func (*SkillCommand) Name added in v0.16.18

func (c *SkillCommand) Name() string

func (*SkillCommand) Usage added in v0.16.18

func (c *SkillCommand) Usage() string

type StatusCommand

type StatusCommand struct{}

StatusCommand shows the current change tracking status

func (*StatusCommand) Description

func (s *StatusCommand) Description() string

Description returns the command description

func (*StatusCommand) Execute

func (s *StatusCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute shows the current status

func (*StatusCommand) ExecuteWithJSONOutput added in v0.16.19

func (s *StatusCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

ExecuteWithJSONOutput emits the runtime status as JSON.

func (*StatusCommand) Name

func (s *StatusCommand) Name() string

Name returns the command name

func (*StatusCommand) Usage added in v0.16.19

func (s *StatusCommand) Usage() string

Usage returns the detailed help text shown by `/help status`.

type SubagentConfigCommand

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

SubagentConfigCommand implements the /subagent-provider and /subagent-model commands

func (*SubagentConfigCommand) Description

func (s *SubagentConfigCommand) Description() string

Description returns the command description

func (*SubagentConfigCommand) Execute

func (s *SubagentConfigCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the subagent config command

func (*SubagentConfigCommand) Name

func (s *SubagentConfigCommand) Name() string

Name returns the command name

func (*SubagentConfigCommand) Usage added in v0.16.19

func (s *SubagentConfigCommand) Usage() string

Usage returns the detailed help text shown by `/help subagent-provider` or `/help subagent-model`.

type SubagentPersonaCommand

type SubagentPersonaCommand struct{}

SubagentPersonaCommand is a backwards-compatible alias for /persona.

func (*SubagentPersonaCommand) Description

func (s *SubagentPersonaCommand) Description() string

func (*SubagentPersonaCommand) Execute

func (s *SubagentPersonaCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*SubagentPersonaCommand) Name

func (s *SubagentPersonaCommand) Name() string

func (*SubagentPersonaCommand) Usage added in v0.16.19

func (s *SubagentPersonaCommand) Usage() string

Usage returns the detailed help text shown by `/help subagent-persona`.

type SubagentPersonasCommand

type SubagentPersonasCommand struct{}

SubagentPersonasCommand is a backwards-compatible alias for /persona list.

func (*SubagentPersonasCommand) Description

func (s *SubagentPersonasCommand) Description() string

func (*SubagentPersonasCommand) Execute

func (s *SubagentPersonasCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*SubagentPersonasCommand) Name

func (s *SubagentPersonasCommand) Name() string

func (*SubagentPersonasCommand) Usage added in v0.16.19

func (s *SubagentPersonasCommand) Usage() string

Usage returns the detailed help text shown by `/help subagent-personas`.

type ToolsCommand added in v0.16.25

type ToolsCommand struct{}

ToolsCommand implements /tools for toggling per-tool invocation detail visibility in the UI. Maps to the show_tool_invocations config setting.

func (*ToolsCommand) Complete added in v0.16.25

func (c *ToolsCommand) Complete(args []string, _ *agent.Agent) []string

Complete implements CompletableCommand for argument tab completion.

func (*ToolsCommand) Description added in v0.16.25

func (c *ToolsCommand) Description() string

func (*ToolsCommand) Execute added in v0.16.25

func (c *ToolsCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*ToolsCommand) Name added in v0.16.25

func (c *ToolsCommand) Name() string

func (*ToolsCommand) Usage added in v0.16.25

func (c *ToolsCommand) Usage() string

type TranscriptCommand added in v0.16.4

type TranscriptCommand struct{}

TranscriptCommand implements the /transcript slash command, a diagnostic tool for inspecting the agent's current conversation state. The default invocation captures a JSON snapshot to ~/.sprout/transcripts/<scope>/<session>/<utc>-manual.json. Subcommands enrich or change the output:

/transcript                # snapshot only
/transcript preview        # snapshot + would-be /compact preview
/transcript markdown       # snapshot + rendered .md alongside
/transcript diff           # snapshot + diff vs previous snapshot

Multiple subcommands can be combined (e.g. `/transcript preview diff`). All snapshots include per-message source annotations so a reader can see which messages are LLM-generated checkpoint substitutes vs the original turns.

func (*TranscriptCommand) Description added in v0.16.4

func (c *TranscriptCommand) Description() string

Description returns the command description

func (*TranscriptCommand) Execute added in v0.16.4

func (c *TranscriptCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute runs the transcript command.

func (*TranscriptCommand) Name added in v0.16.4

func (c *TranscriptCommand) Name() string

Name returns the command name

func (*TranscriptCommand) Usage added in v0.16.4

func (c *TranscriptCommand) Usage() string

Usage returns the detailed help text shown by `/help transcript`.

type UsageCommand added in v0.16.19

type UsageCommand struct{}

UsageCommand implements the /usage slash command — a visual dashboard with Unicode bar charts for context window, cache efficiency, and cost.

func (*UsageCommand) Description added in v0.16.19

func (u *UsageCommand) Description() string

Description returns the command description

func (*UsageCommand) Execute added in v0.16.19

func (u *UsageCommand) Execute(args []string, chatAgent *agent.Agent) error

Execute renders the usage dashboard

func (*UsageCommand) ExecuteWithJSONOutput added in v0.16.19

func (u *UsageCommand) ExecuteWithJSONOutput(args []string, chatAgent *agent.Agent, ctx *CommandContext) error

ExecuteWithJSONOutput emits the usage dashboard data as JSON.

func (*UsageCommand) Name added in v0.16.19

func (u *UsageCommand) Name() string

Name returns the command name

func (*UsageCommand) Usage added in v0.16.19

func (u *UsageCommand) Usage() string

Usage returns the detailed help text shown by `/help usage`.

type UsageProvider

type UsageProvider interface {
	Usage() string
}

UsageProvider is implemented by commands that want to surface a longer per-command help string via `/help <name>`. Commands that don't implement it fall back to their Description().

type VerboseCommand added in v0.16.25

type VerboseCommand struct{}

VerboseCommand implements /verbose for inspecting or cycling the output_verbosity setting (compact / default / verbose).

func (*VerboseCommand) Complete added in v0.16.25

func (c *VerboseCommand) Complete(args []string, _ *agent.Agent) []string

Complete implements CompletableCommand for argument tab completion.

func (*VerboseCommand) Description added in v0.16.25

func (c *VerboseCommand) Description() string

func (*VerboseCommand) Execute added in v0.16.25

func (c *VerboseCommand) Execute(args []string, chatAgent *agent.Agent) error

func (*VerboseCommand) Name added in v0.16.25

func (c *VerboseCommand) Name() string

func (*VerboseCommand) Usage added in v0.16.25

func (c *VerboseCommand) Usage() string

Jump to

Keyboard shortcuts

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