Documentation
¶
Index ¶
- Constants
- type OutputMode
- type Renderer
- func (r Renderer) PrintCitations(cites []client.Citation)
- func (r Renderer) PrintError(err error)
- func (r Renderer) PrintFinalAnswer(text string)
- func (r Renderer) PrintJSON(raw json.RawMessage) error
- func (r Renderer) PrintMarkdown(resp client.ExtractMarkdownResponse) error
- func (r Renderer) RenderEvent(e client.Event) error
- type Spinner
- type Styles
Constants ¶
const ( HexPurple = "#541bff" // primary accent HexPurpleLight = "#7c5cff" // lighter purple for dark terminals HexPink = "#ff97ea" // secondary accent (reads on dark) HexPinkLight = "#b3408f" // pink that reads on light terminals HexGray = "#7c7985" // muted text HexInk = "#10100f" // near-black body text HexPaper = "#f4f4f5" // off-white body text on dark HexWhite = "#ffffff" HexPinkDeep = "#e688d3" // pink that reads on light terminals (fang help theme only) HexRose = "#d61f69" // error rose, bridges the pink family (fang help theme only) )
Tabstack brand palette (tabstack.ai), as raw hex. Defined once here so the fang help theme (cmd/tabstack, lipgloss v2) and these output styles (lipgloss v1) share a single source of truth; each consumer wraps these in its own color type and picks a context-appropriate light/dark variant.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OutputMode ¶
type OutputMode string
OutputMode selects how results are rendered. Pretty is the styled, human-facing mode; JSON is the machine-facing mode that emits raw JSON (and NDJSON for streams) so output composes with tools like jq.
const ( ModePretty OutputMode = "pretty" ModeJSON OutputMode = "json" )
type Renderer ¶
Renderer carries everything the output helpers need: where to write, which mode we are in, and the resolved styles.
func (Renderer) PrintCitations ¶
PrintCitations renders the research source list under a "Sources" heading, numbered to match the [n] markers in the report. In JSON mode nothing is printed since the events already carried the sources. Each entry shows its number, title (when present), and URL.
func (Renderer) PrintError ¶
PrintError writes an error to stderr. Pretty mode tags it; JSON mode emits a single {"error": "..."} object so failures stay parseable on the error stream.
func (Renderer) PrintFinalAnswer ¶
PrintFinalAnswer renders a terminal "final answer" block. In JSON mode nothing is printed here because the events already carried the data. In pretty mode a short, single-line answer (e.g. an automate result) is boxed, while a long or multi-line report (e.g. research output) is printed plain under a heading, since a border around multi-paragraph text reads poorly.
func (Renderer) PrintJSON ¶
func (r Renderer) PrintJSON(raw json.RawMessage) error
PrintJSON writes raw JSON. In pretty mode it indents; in JSON mode it writes the bytes through as-is so we never reshape a caller-defined schema result.
func (Renderer) PrintMarkdown ¶
func (r Renderer) PrintMarkdown(resp client.ExtractMarkdownResponse) error
PrintMarkdown renders an extract/markdown response. In JSON mode it prints the full response object; in pretty mode it prints the content, with metadata as a short styled header when present.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner is a minimal in-place spinner for pretty mode. It is intentionally small: we are not pulling in Bubble Tea for a one-line indicator while a stream is between events. It writes to a TTY, clears its own line, and is safe to Stop multiple times.
Usage pattern in a streaming command:
sp := ui.NewSpinner(out, "working") sp.Start() // on each event: sp.Pause(); render(event); sp.Resume() // at the end: sp.Stop()
func NewSpinner ¶
NewSpinner builds a spinner that writes to out with the given label.
type Styles ¶
type Styles struct {
Success lipgloss.Style
Agent lipgloss.Style
Browser lipgloss.Style
Muted lipgloss.Style
ErrorTag lipgloss.Style
Label lipgloss.Style
Box lipgloss.Style
Key lipgloss.Style
Cite lipgloss.Style
}
Styles holds every lipgloss style the CLI uses. We bundle them into a struct rather than scattering package level vars so that colour can be switched off cleanly: when colour is disabled we hand back a Styles whose fields are all no-op styles, and the rest of the code never has to branch on it again.