ui

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinSlashCommands = []AutocompleteItem{
	{Value: "/help", Label: "/help", Desc: "Help commands & keyboard shortcuts"},
	{Value: "/memory", Label: "/memory", Desc: "View learned project knowledge & gotchas"},
	{Value: "/undo", Label: "/undo", Desc: "Roll back current turn changes (Git Shadow)"},
	{Value: "/sessions", Label: "/sessions", Desc: "Switch / manage session history"},
	{Value: "/models", Label: "/models", Desc: "Select active AI model"},
	{Value: "/connect", Label: "/connect", Desc: "Configure providers & API keys"},
	{Value: "/cost", Label: "/cost", Desc: "Token statistics & estimated spend"},
	{Value: "/lsp", Label: "/lsp", Desc: "Language Server Protocol status"},
	{Value: "/diagnose", Label: "/diagnose", Desc: "Run autonomous codebase diagnostics"},
	{Value: "/lsp-install", Label: "/lsp-install", Desc: "LSP binary installation guide"},
	{Value: "/builder", Label: "/builder", Desc: "BUILDER mode: autonomous coding & file editing"},
	{Value: "/planner", Label: "/planner", Desc: "PLANNER mode: read-only architecture analysis"},
	{Value: "/miner", Label: "/miner", Desc: "MINER mode: deep codebase exploration & memory persistence"},
	{Value: "/mode", Label: "/mode", Desc: "Switch engine mode (/mode builder|planner|miner)"},
	{Value: "/plan", Label: "/plan", Desc: "View or archive current active execution plan (/plan, /plan archive)"},
	{Value: "/workspace", Label: "/workspace", Desc: "Manage multi-repo workspace & repos"},
	{Value: "/clear", Label: "/clear", Desc: "Clear chat history screen"},
	{Value: "/new", Label: "/new", Desc: "Start a new conversation session"},
	{Value: "/mcp", Label: "/mcp", Desc: "List Model Context Protocol tools"},
	{Value: "/mcp-reload", Label: "/mcp-reload", Desc: "Reload MCP configuration"},
	{Value: "/debug-context", Label: "/debug-context", Desc: "Dump active context tokens"},
}

BuiltinSlashCommands lists all known BroCode slash commands with descriptions.

Functions

func ApplyAutocomplete

func ApplyAutocomplete(input string, state AutocompleteState) string

ApplyAutocomplete updates input text by replacing the active query with the selected item.

func FormatMessageForTerminal

func FormatMessageForTerminal(msg string, width int) string

FormatMessageForTerminal renders a formatted message string for stdout stream printing.

func RenderAutocomplete

func RenderAutocomplete(state AutocompleteState, width int) string

RenderAutocomplete renders a compact floating suggestion box with sliding window scrolling.

func WelcomeBanner added in v0.1.2

func WelcomeBanner() string

WelcomeBanner renders the fresh-session hero banner with blue-gradient logo.

Types

type AutocompleteItem

type AutocompleteItem struct {
	Value string // text to insert (e.g. "/memory" or "internal/ui/app.go")
	Label string // display name
	Desc  string // short explanation
}

AutocompleteItem represents a single selectable completion candidate.

type AutocompleteKind

type AutocompleteKind int

AutocompleteKind distinguishes between slash commands and file mentions.

const (
	AutoKindNone AutocompleteKind = iota
	AutoKindSlash
	AutoKindFile
)

type AutocompleteState

type AutocompleteState struct {
	Active   bool
	Kind     AutocompleteKind
	Items    []AutocompleteItem
	Selected int
	Query    string
}

AutocompleteState manages the active suggestion popup.

func DetectAutocomplete

func DetectAutocomplete(input string, allFiles []string, prev AutocompleteState) AutocompleteState

DetectAutocomplete inspects the current prompt input text and cursor position to determine if slash command or file mention completion should activate. It preserves previous selection index if the query has not changed.

type Model

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

Model defines the Bubble Tea v2 TUI state.

func NewApp

func NewApp(
	cfg provider.AppConfig,
	p provider.DetectedProvider,
	modelName string,
	adapter provider.ProviderAdapter,
	tools *tool.Registry,
	ctxMgr *bcontext.Manager,
	mcpMgr *mcp.Manager,
	lspMgr *lsp.Manager,
	scoutMgr *subagent.ScoutManager,
	budgetUSD float64,
	previousPrompts []string,
	activityLog io.Writer,
	initialMsgs ...string,
) Model

NewApp initializes the Bubble Tea v2 TUI model.

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) SetProgram

func (m *Model) SetProgram(p *tea.Program)

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Model) View

func (m *Model) View() tea.View

type QueuedPrompt added in v0.1.24

type QueuedPrompt struct {
	Text string `json:"text"`
	Mode string `json:"mode"`
}

QueuedPrompt holds a user prompt waiting to run, along with the engine mode (BUILDER/PLANNER/MINER) under which it should be executed when drained.

Jump to

Keyboard shortcuts

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