Documentation
¶
Overview ¶
Package cli: root and subcommands for the BuildMax CLI.
Index ¶
- Constants
- func ExitCodeFor(err error) int
- func NewRootCommand() *cobra.Command
- type ExitError
- type InputBlock
- func (ib *InputBlock) Blur()
- func (ib *InputBlock) CanScroll() bool
- func (ib *InputBlock) Focus() tea.Cmd
- func (ib *InputBlock) Height() int
- func (ib *InputBlock) Reset()
- func (ib *InputBlock) ScrollDown(lines int) tea.Cmd
- func (ib *InputBlock) ScrollUp(lines int) tea.Cmd
- func (ib *InputBlock) SetValue(v string)
- func (ib *InputBlock) SetWidth(w int)
- func (ib *InputBlock) SyncHeight()
- func (ib *InputBlock) Update(msg tea.Msg) tea.Cmd
- func (ib *InputBlock) Value() string
- func (ib *InputBlock) View() string
- type Model
- type OutputFormat
- type TUIApprovalHandler
- type TUIOpts
Constants ¶
const ( ExitOK = 0 ExitGeneric = 1 ExitUsage = 2 // bad flag, missing config (e.g. no model configured) ExitPolicyDenied = 3 // tool blocked by configured policy ExitModelError = 4 // LLM/agent runtime error ExitToolError = 5 // reserved ExitUserCancelled = 6 // SIGINT / ctx cancelled )
Exit codes for the CLI. Stable contract for shell scripts wrapping `buildmax -p`. Documented for users in docs/reference/cli.md.
const APIKeyPlaceholder = "REPLACE_WITH_YOUR_API_KEY"
APIKeyPlaceholder is what `buildmax init` writes when the user did not pass --api-key. checkModelConfig recognizes it, so a run that would otherwise fail inside the LLM client with a provider authentication error stops with an instruction instead.
Variables ¶
This section is empty.
Functions ¶
func ExitCodeFor ¶
ExitCodeFor returns the exit code embedded in err, or ExitGeneric when err is non-nil but not an ExitError, or ExitOK when err is nil.
func NewRootCommand ¶
NewRootCommand creates and returns the root cobra command for BuildMax.
Types ¶
type ExitError ¶
ExitError wraps an exit code so cobra's RunE can return it and main can surface it as the process exit code.
type InputBlock ¶
type InputBlock struct {
// contains filtered or unexported fields
}
InputBlock groups input state for the textarea at the bottom.
func NewInputBlock ¶
func NewInputBlock() InputBlock
NewInputBlock returns an InputBlock with textarea configured (prompt, placeholder, initial height/width, focused).
func (*InputBlock) CanScroll ¶
func (ib *InputBlock) CanScroll() bool
CanScroll reports whether the textarea has hidden wrapped lines above or below.
func (*InputBlock) Focus ¶
func (ib *InputBlock) Focus() tea.Cmd
Focus focuses the textarea and returns its command (for tea.Batch in Init).
func (*InputBlock) Height ¶
func (ib *InputBlock) Height() int
Height returns the textarea height in lines.
func (*InputBlock) ScrollDown ¶
func (ib *InputBlock) ScrollDown(lines int) tea.Cmd
ScrollDown moves the textarea viewport/cursor downward by the requested number of lines.
func (*InputBlock) ScrollUp ¶
func (ib *InputBlock) ScrollUp(lines int) tea.Cmd
ScrollUp moves the textarea viewport/cursor upward by the requested number of lines.
func (*InputBlock) SetValue ¶
func (ib *InputBlock) SetValue(v string)
SetValue replaces the textarea content.
func (*InputBlock) SetWidth ¶
func (ib *InputBlock) SetWidth(w int)
SetWidth sets the textarea width.
func (*InputBlock) SyncHeight ¶
func (ib *InputBlock) SyncHeight()
SyncHeight sets the textarea height to match wrapped content (1 to inputMaxLines).
func (*InputBlock) Update ¶
func (ib *InputBlock) Update(msg tea.Msg) tea.Cmd
Update forwards the message to the textarea and returns its command.
func (*InputBlock) View ¶
func (ib *InputBlock) View() string
View returns the textarea's rendered content.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model in transcript mode. Chat history lives in the terminal scrollback; this model only manages the bottom live strip: streaming preview, input, slash panels, approval, and footer.
func (*Model) FocusInput ¶
FocusInput returns true when the input has focus (used by tests).
type OutputFormat ¶
type OutputFormat string
OutputFormat is the print-mode output format selected by --output.
const ( OutputText OutputFormat = "text" OutputJSON OutputFormat = "json" OutputJSONL OutputFormat = "jsonl" )
type TUIApprovalHandler ¶
type TUIApprovalHandler struct {
// contains filtered or unexported fields
}
TUIApprovalHandler implements agent.ApprovalHandler for the Bubble Tea TUI. Create it before the program, wire the program in after tea.NewProgram.
func NewTUIApprovalHandler ¶
func NewTUIApprovalHandler() *TUIApprovalHandler
func (*TUIApprovalHandler) RequestApproval ¶
func (h *TUIApprovalHandler) RequestApproval(ctx context.Context, name string, args map[string]any) agent.ApprovalDecision
RequestApproval sends an approval request to the TUI and blocks until the user answers: y (once), a (session), or n/Esc (deny).
func (*TUIApprovalHandler) SetProgram ¶
func (h *TUIApprovalHandler) SetProgram(p *tea.Program)
type TUIOpts ¶
type TUIOpts struct {
App *agentapp.AgentApp
Session *agentapp.SessionContext
ModelName string
Workspace string
SessionsDir string
Approval agent.ApprovalHandler
GlamourStyle string // "dark" or "light", detected once before the program starts
RunStatus agentapp.RunStatus
}
TUIOpts holds dependencies and display config for the TUI (agent, session, model name, paths).
Source Files
¶
- chat.go
- chat_approval.go
- chat_diff.go
- chat_format.go
- chat_input.go
- chat_mcp.go
- chat_models.go
- chat_session.go
- chat_skills.go
- chat_styles.go
- chat_tools.go
- doctor.go
- exit_code.go
- init.go
- login.go
- models.go
- plugin.go
- plugin_marketplace.go
- plugin_status.go
- plugin_validate.go
- print.go
- print_format.go
- root.go
- sandbox.go
- system_prompt.go
- tools.go
- tui.go
- tui_model.go
- version.go