Documentation
¶
Index ¶
- Constants
- Variables
- func Answer(label, value string)
- func AskConfirm(title string, defaultVal bool) (bool, error)
- func AskMultiSelect(title string, options []huh.Option[string]) ([]string, error)
- func AskSelect(title string, options []huh.Option[string]) (string, error)
- func AskText(title, defaultVal string, required bool) (string, error)
- func Banner(version, action string)
- func Blank()
- func BonsaiTheme() *huh.Theme
- func CardFields(pairs [][2]string) string
- func CatalogTable(headers []string, rows [][]string)
- func DisableColor()
- func EmptyPanel(msg string)
- func Error(msg string)
- func ErrorDetail(title, detail, hint string)
- func ErrorPanel(msg string)
- func FatalPanel(title, detail, hint string)
- func Fields(pairs [][2]string)
- func FileTree(files []string, rootLabel string) string
- func Heading(title string)
- func Hint(msg string)
- func Info(msg string)
- func InfoPanel(content, title string)
- func ItemTree(root string, categories []Category, describe func(string) string) string
- func PickItems(label string, available []ItemOption, defaults []string) ([]string, error)
- func RenderFileTree(nodes []TreeNode, opts FileTreeOpts) string
- func Section(title string)
- func SectionHeader(title string)
- func Success(msg string)
- func SuccessPanel(content, title string)
- func TitledPanel(title, content string, color lipgloss.TerminalColor)
- func TitledPanelString(title, content string, color lipgloss.TerminalColor) string
- func Warning(msg string)
- func WarningPanel(msg string)
- type Category
- type FileTreeOpts
- type ItemOption
- type NodeKind
- type NodeStatus
- type TreeNode
Constants ¶
const ( GlyphCheck = "✓" GlyphCross = "✗" GlyphWarn = "⚠" GlyphArrow = "→" GlyphDash = "—" GlyphDot = "·" )
Variables ¶
var ( Leaf lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#4A9E6F", Light: "#2D7A4B"} Bark lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#D4AF37", Light: "#7A5E10"} Stone lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#6B7280", Light: "#4B5563"} Water lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#7EC8E3", Light: "#1A7FA0"} Moss lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#73D677", Light: "#2D8A3E"} Ember lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#E36F6F", Light: "#C53030"} Amber lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#E3C16F", Light: "#B7791F"} Sand lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#C4B7A6", Light: "#6B5E4F"} Petal lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#D4A0C0", Light: "#9B4D8A"} Moon lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#F5F5F5", Light: "#1A1A1A"} Slate lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#2D2D3D", Light: "#E5E7EB"} )
var ( ColorPrimary = Leaf // Brand accent — headings, primary action, banner title ColorSecondary = Bark // Field labels, category headers ColorAccent = Moon // Interactive chrome — cursor, selectors, bold emphasis ColorSubtle = Sand // Body text, option labels ColorMuted = Stone // Hints, descriptions, at-rest borders ColorSuccess = Moss // Success states ColorDanger = Ember // Errors ColorWarning = Amber // Warnings ColorInfo = Water // Info panels, review box ColorSurface = Slate // Neutral UI surface — idle button backgrounds, inactive chrome )
var ( ColorLeafDim lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#3A7253", Light: "#3D6D53"} ColorRule lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#3B4049", Light: "#D4D0CA"} ColorRule2 lipgloss.TerminalColor = lipgloss.AdaptiveColor{Dark: "#4A4F58", Light: "#B9B5AF"} )
Enso / rule chrome tokens — used by the init-flow chrome. Dimmer shades of Leaf/Stone for at-rest rail segments and thin dividers. Kept separate from the primary semantic tokens above so other commands keep their current palette untouched.
var ( StyleTitle = lipgloss.NewStyle().Bold(true).Foreground(ColorPrimary) StyleLabel = lipgloss.NewStyle().Bold(true).Foreground(ColorSecondary) StyleMuted = lipgloss.NewStyle().Foreground(ColorMuted) StyleSuccess = lipgloss.NewStyle().Foreground(ColorSuccess) StyleError = lipgloss.NewStyle().Foreground(ColorDanger) StyleWarning = lipgloss.NewStyle().Foreground(ColorWarning) StyleAccent = lipgloss.NewStyle().Foreground(ColorInfo) StyleSand = lipgloss.NewStyle().Foreground(ColorSubtle) )
var ( PanelSuccess = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorSuccess). Padding(1, 2) PanelError = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorDanger). Padding(1, 2) PanelWarning = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorWarning). Padding(1, 2) PanelInfo = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorInfo). Padding(1, 2) PanelEmpty = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorMuted). Padding(1, 2) )
var ( HarnessHeader = lipgloss.NewStyle().Padding(0, 2).Foreground(ColorMuted) HarnessCrumb = lipgloss.NewStyle().Foreground(ColorPrimary).Bold(true) )
Functions ¶
func Answer ¶ added in v0.2.0
func Answer(label, value string)
Answer prints a compact styled summary of an answered prompt so prior answers stay visible as the user advances through a multi-step flow. Example output: ▸ Project name my-project
func AskConfirm ¶
AskConfirm prompts for yes/no confirmation.
func AskMultiSelect ¶
AskMultiSelect prompts for multiple selections.
func Banner ¶
func Banner(version, action string)
Banner prints the Bonsai welcome banner. version is the build version (pass "" or "dev" to hide). action is an optional contextual sub-line (e.g., "Initializing new project"). Pass "" for no action line.
func BonsaiTheme ¶
BonsaiTheme returns a custom Huh form theme matching the Zen Garden palette.
func CardFields ¶
CardFields builds aligned key:value field lines as a string for embedding in panels.
func CatalogTable ¶
CatalogTable renders a styled table for abilities.
func DisableColor ¶ added in v0.2.0
func DisableColor()
DisableColor forces all output to plain text (no ANSI escapes).
func ErrorDetail ¶ added in v0.2.0
func ErrorDetail(title, detail, hint string)
ErrorDetail renders a structured non-fatal error. Same shape as FatalPanel but does not exit. title: what happened (bold, error color). detail: why. hint: how to fix (muted).
func FatalPanel ¶ added in v0.2.0
func FatalPanel(title, detail, hint string)
FatalPanel renders a structured error and exits. title: what happened. detail: why. hint: how to fix.
func PickItems ¶
func PickItems(label string, available []ItemOption, defaults []string) ([]string, error)
PickItems shows a section heading and multi-select for abilities. Items whose names appear in defaults are pre-selected. Items marked Required are auto-included and shown as a locked info line. Returns machine identifiers (Value fields), not display names.
func RenderFileTree ¶ added in v0.2.0
func RenderFileTree(nodes []TreeNode, opts FileTreeOpts) string
RenderFileTree renders nodes (and the optional Root) into a string safe to embed inside AltScreen views.
func SectionHeader ¶
func SectionHeader(title string)
SectionHeader prints a section title with a trailing rule line.
func SuccessPanel ¶
func SuccessPanel(content, title string)
SuccessPanel renders a green-bordered panel.
func TitledPanel ¶
func TitledPanel(title, content string, color lipgloss.TerminalColor)
TitledPanel renders a bordered panel with the title embedded in the top border. The panel is capped to the terminal width so borders don't break when content is wider than the visible columns; over-long lines are truncated with an ellipsis.
func TitledPanelString ¶ added in v0.2.0
func TitledPanelString(title, content string, color lipgloss.TerminalColor) string
TitledPanelString renders the same bordered panel as TitledPanel and returns the result as a string (with a leading newline, matching the side-effecting TitledPanel's fmt.Println output). Use inside AltScreen or when composing with other styled content.
Types ¶
type FileTreeOpts ¶ added in v0.2.0
type FileTreeOpts struct {
// Root, when non-nil, renders a prefix line with the root's name and note
// above the main tree. The root itself is not counted as a sibling of the
// top-level nodes; its children (if any) are ignored.
Root *TreeNode
// Dense collapses sibling spacing to a single line each (no blank line
// between siblings at any depth).
Dense bool
// MaxWidth caps the rendered width of each row. 0 means auto-detect via
// the terminal width (falling back to 80).
MaxWidth int
}
FileTreeOpts tunes the renderer.
type ItemOption ¶
ItemOption describes an item for multi-select prompts. Name is the human-readable display label. Value is the machine identifier returned as the selection result; if empty, Name is used.
type NodeKind ¶ added in v0.2.0
type NodeKind int
NodeKind discriminates directories from files for rendering purposes.
type NodeStatus ¶ added in v0.2.0
type NodeStatus int
NodeStatus styles a node and optionally attaches a right-aligned badge.
const ( // NodeNormal renders the node with the default foreground colors; no badge. NodeNormal NodeStatus = iota // NodeNew marks newly-written files: Leaf-colored name + "NEW" badge. NodeNew // NodeRequired marks required files: bold Subtle name + "REQUIRED" badge. NodeRequired // NodeCurrent tints a whole subtree with a leaf border + background. NodeCurrent )
type TreeNode ¶ added in v0.2.0
type TreeNode struct {
Name string
Kind NodeKind
Status NodeStatus
Note string
Children []TreeNode
}
TreeNode is one entry in the rendered tree. Kind=NodeFile entries ignore Children. Status controls coloring and badge. Note is a one-line caption rendered after the name in muted text.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package addflow implements the cinematic 4-stage `bonsai add` flow.
|
Package addflow implements the cinematic 4-stage `bonsai add` flow. |
|
Package catalogflow implements the cinematic tabbed browser for `bonsai catalog`.
|
Package catalogflow implements the cinematic tabbed browser for `bonsai catalog`. |
|
Package guideflow implements the cinematic `bonsai guide` viewer — a tabbed BubbleTea scroll viewport that renders bundled markdown guides through glamour inside the shared initflow chrome (header + footer + min-size floor).
|
Package guideflow implements the cinematic `bonsai guide` viewer — a tabbed BubbleTea scroll viewport that renders bundled markdown guides through glamour inside the shared initflow chrome (header + footer + min-size floor). |
|
Package harness provides a single long-lived BubbleTea program that owns the screen for the lifetime of an interactive Bonsai command.
|
Package harness provides a single long-lived BubbleTea program that owns the screen for the lifetime of an interactive Bonsai command. |
|
Package hints provides the 3-layer yield-stage hints renderer (Plan 31 Phase H).
|
Package hints provides the 3-layer yield-stage hints renderer (Plan 31 Phase H). |
|
Package initflow implements the cinematic 4-stage `bonsai init` flow.
|
Package initflow implements the cinematic 4-stage `bonsai init` flow. |
|
Package listflow renders the cinematic `bonsai list` surface — a static, non-interactive string output composed of the shared initflow chrome (header + min-size floor) plus per-agent panels and a counts footer.
|
Package listflow renders the cinematic `bonsai list` surface — a static, non-interactive string output composed of the shared initflow chrome (header + min-size floor) plus per-agent panels and a counts footer. |
|
Package removeflow implements the cinematic 4-stage `bonsai remove` flow.
|
Package removeflow implements the cinematic 4-stage `bonsai remove` flow. |
|
Package updateflow implements the cinematic 5-stage `bonsai update` flow.
|
Package updateflow implements the cinematic 5-stage `bonsai update` flow. |