ui

package
v0.1.59 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinSlashCommands = []AutocompleteItem{
	{Value: "/ask", Label: "/ask", Desc: "Isolated QA: Ask codebase questions without context pollution"},
	{Value: "/spec", Label: "/spec", Desc: "Spec-First Gate: Draft an architectural blueprint contract"},
	{Value: "/tournament", Label: "/tournament", Desc: "Multi-Candidate: Run 2 parallel candidate agents to solve tasks"},
	{Value: "/repair", Label: "/repair", Desc: "Autonomous pipeline repair doctor for build/test failures"},
	{Value: "/help", Label: "/help", Desc: "Help commands & keyboard shortcuts"},
	{Value: "/plan", Label: "/plan", Desc: "View or archive active plan (/plan, /plan archive)"},
	{Value: "/undo", Label: "/undo", Desc: "Time-Travel Rollback: Revert file changes from last turn"},
	{Value: "/diff", Label: "/diff", Desc: "Side-by-side visual diff viewer for modified files"},
	{Value: "/diagnose", Label: "/diagnose", Desc: "Run autonomous codebase diagnostics (/diagnose, /diagnose fix)"},
	{Value: "/trace", Label: "/trace", Desc: "Show provenance trace for last turn's output"},
	{Value: "/cost", Label: "/cost", Desc: "Token statistics & estimated spend (USD & IDR)"},
	{Value: "/report", Label: "/report", Desc: "View or export privacy-safe benchmark/activity report"},
	{Value: "/memory", Label: "/memory", Desc: "View learned project knowledge & gotchas"},
	{Value: "/sessions", Label: "/sessions", Desc: "Switch / manage session history (/sessions, /history)"},
	{Value: "/models", Label: "/models", Desc: "Select active AI model interactively"},
	{Value: "/model", Label: "/model", Desc: "Switch model directly (/model <name>)"},
	{Value: "/connect", Label: "/connect", Desc: "Configure providers & API keys"},
	{Value: "/copy", Label: "/copy", Desc: "Copy last assistant response directly to OS clipboard"},
	{Value: "/mouse", Label: "/mouse", Desc: "Toggle mouse mode: SELECT (drag copy) ↔ SCROLL (wheel scrolling)"},
	{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: "/lsp", Label: "/lsp", Desc: "Language Server Protocol status"},
	{Value: "/lsp-install", Label: "/lsp-install", Desc: "LSP binary installation guide"},
	{Value: "/mcp", Label: "/mcp", Desc: "Show MCP server status & registered tools"},
	{Value: "/mcp-reload", Label: "/mcp-reload", Desc: "Hot-reload all MCP server configurations"},
	{Value: "/workspace", Label: "/workspace", Desc: "Manage multi-repo workspace & repos (/workspace, /repos)"},
	{Value: "/worktree", Label: "/worktree", Desc: "Git worktree sandboxing for isolated agent experiments"},
	{Value: "/search-key", Label: "/search-key", Desc: "Configure web search API key (Tavily/Exa)"},
	{Value: "/context7-key", Label: "/context7-key", Desc: "Configure Context7 API key for library docs"},
	{Value: "/clear", Label: "/clear", Desc: "Clear chat history screen"},
	{Value: "/new", Label: "/new", Desc: "Start a new conversation session"},
	{Value: "/update", Label: "/update", Desc: "Check and perform autonomous in-place self-update"},
	{Value: "/debug-context", Label: "/debug-context", Desc: "Dump active context tokens"},
	{Value: "/agents", Label: "/agents", Desc: "List all detected custom subagents"},
}

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 GenerateSessionDiffSummary added in v0.1.36

func GenerateSessionDiffSummary(targetPath string, termWidth int) string

GenerateSessionDiffSummary collects and renders side-by-side diffs for all recent changes.

func RenderAutocomplete

func RenderAutocomplete(state AutocompleteState, width int) string

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

func RenderRecommendationsBar added in v0.1.32

func RenderRecommendationsBar(recs []QuickRecommendation, width int) string

RenderRecommendationsBar formats the quick recommendations into an interactive TUI card.

func RenderSideBySideDiff added in v0.1.36

func RenderSideBySideDiff(path, oldContent, newContent string, termWidth int) string

RenderSideBySideDiff renders a two-column (Before vs After) visual diff for a file change.

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, customAgents []agent.CustomAgent, customSkills []skill.Skill, prev AutocompleteState) AutocompleteState

DetectAutocomplete inspects the current prompt input text and cursor position to determine if slash command, custom skill, agent mention, 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.

type QuickRecommendation added in v0.1.32

type QuickRecommendation struct {
	Index   int    `json:"index"`  // 1, 2, 3...
	Title   string `json:"title"`  // e.g. "Lanjutkan test auth"
	Prompt  string `json:"prompt"` // e.g. "Lanjutkan test auth dengan beberapa validator"
	Clicked bool   `json:"clicked"`
}

QuickRecommendation represents an actionable follow-up suggestion proposed by the AI.

func ExtractRecommendations added in v0.1.32

func ExtractRecommendations(content string) []QuickRecommendation

ExtractRecommendations parses senior recommendations from the end of an assistant's response.

Jump to

Keyboard shortcuts

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