Documentation
¶
Overview ¶
Package idtui provides terminal user interface frontends for Dagger operations. This file contains the dots-style frontend that provides minimal, colorized output with green dots for successful operations and red X's for failures.
Index ¶
- Constants
- Variables
- func ColorProfile() termenv.Profile
- func FromCmdContext(ctx context.Context) (*cmdContext, bool)
- func HasDarkBackground() bool
- func KeyEnabled(enabled bool) key.BindingOpt
- func NewForm(groups ...*huh.Group) *huh.Form
- func NewOutput(w io.Writer, opts ...termenv.OutputOption) *termenv.Output
- func NewWithDB(w io.Writer, db *dagui.DB) *frontendPretty
- func PreviewPatch(ctx context.Context, dag *dagger.Client, changeset *dagger.Changeset) ([]patchpreview.Entry, error)
- func RegisterFieldRenderer(fieldName string, rendererFactory func() FieldRenderer)
- func RenderKeymap(out io.Writer, style lipgloss.Style, keys []key.Binding, pressedKey string, ...) int
- func TTYStyle() *chroma.Style
- func WithPrintTraceLink(ctx context.Context, printTraceLink bool) context.Context
- type AdaptiveColor
- type BranchSummary
- type Dump
- type ErrorLabel
- type ExecCommand
- type ExitError
- type FieldRenderer
- type Frontend
- type FrontendMetricExporter
- func (fe FrontendMetricExporter) Aggregation(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation
- func (fe FrontendMetricExporter) Background(cmd ExecCommand, raw bool) error
- func (fe FrontendMetricExporter) Close() error
- func (fe FrontendMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
- func (fe FrontendMetricExporter) FinalRender(w io.Writer) error
- func (fe FrontendMetricExporter) ForceFlush(context.Context) error
- func (fe FrontendMetricExporter) GetLLMTokenMetrics() *dagui.LLMTokenMetrics
- func (fe FrontendMetricExporter) HandleForm(ctx context.Context, form *huh.Form) error
- func (fe FrontendMetricExporter) HandleKeyPress(_ tuist.Context, ev uv.KeyPressEvent) bool
- func (fe FrontendMetricExporter) HandlePrompt(ctx context.Context, title, prompt string, dest any) error
- func (fe FrontendMetricExporter) ImportSnapshots(snapshots []dagui.SpanSnapshot)
- func (fe FrontendMetricExporter) LogExporter() sdklog.Exporter
- func (fe FrontendMetricExporter) MetricExporter() sdkmetric.Exporter
- func (fe FrontendMetricExporter) OnMount(ctx tuist.Context)
- func (fe FrontendMetricExporter) OpenBrowser(url string) error
- func (fe FrontendMetricExporter) Opts() *dagui.FrontendOpts
- func (fe FrontendMetricExporter) PrintAbove(text string)
- func (fe FrontendMetricExporter) Render(ctx tuist.Context)
- func (fe FrontendMetricExporter) RequestSurfacedLogs()
- func (fe FrontendMetricExporter) RequestZoomLogs(id dagui.SpanID, descendants bool)
- func (fe FrontendMetricExporter) ResolveSpanTarget(check, test string) (dagui.SpanID, bool)
- func (fe FrontendMetricExporter) RevealAllSpans()
- func (fe FrontendMetricExporter) Run(ctx context.Context, opts dagui.FrontendOpts, ...) error
- func (fe FrontendMetricExporter) SetCIContext(commit string, isNativeCI bool)
- func (fe FrontendMetricExporter) SetClient(client *dagger.Client)
- func (fe FrontendMetricExporter) SetCloudURL(ctx context.Context, url string, msg string, logged bool)
- func (fe FrontendMetricExporter) SetFetchWaiter(wait func())
- func (fe FrontendMetricExporter) SetLogProvider(provider func(dagui.SpanID, bool))
- func (fe FrontendMetricExporter) SetPrimary(spanID dagui.SpanID)
- func (fe FrontendMetricExporter) SetSidebarContent(section SidebarSection)
- func (fe FrontendMetricExporter) SetSpanProvider(provider func(dagui.SpanID))
- func (fe FrontendMetricExporter) SetStatusLine(data StatusLineData)
- func (fe FrontendMetricExporter) SetTelemetryError(err error)
- func (fe FrontendMetricExporter) SetTraceID(traceID string)
- func (fe FrontendMetricExporter) SetVerbosity(n int)
- func (fe FrontendMetricExporter) Shell(ctx context.Context, handler ShellHandler)
- func (fe FrontendMetricExporter) Shutdown(ctx context.Context) error
- func (fe FrontendMetricExporter) SpanExporter() sdktrace.SpanExporter
- func (fe FrontendMetricExporter) SurfacedFailedCheckSpans() []dagui.SpanID
- func (fe FrontendMetricExporter) Temporality(ik sdkmetric.InstrumentKind) metricdata.Temporality
- func (fe FrontendMetricExporter) ZoomToSpan(id dagui.SpanID)
- type FrontendMock
- func (mock *FrontendMock) Background(cmd ExecCommand, raw bool) error
- func (mock *FrontendMock) BackgroundCalls() []struct{ ... }
- func (mock *FrontendMock) GetLLMTokenMetrics() *dagui.LLMTokenMetrics
- func (mock *FrontendMock) GetLLMTokenMetricsCalls() []struct{}
- func (mock *FrontendMock) HandleForm(ctx context.Context, form *huh.Form) error
- func (mock *FrontendMock) HandleFormCalls() []struct{ ... }
- func (mock *FrontendMock) HandlePrompt(ctx context.Context, title string, prompt string, dest any) error
- func (mock *FrontendMock) HandlePromptCalls() []struct{ ... }
- func (mock *FrontendMock) LogExporter() sdklog.Exporter
- func (mock *FrontendMock) LogExporterCalls() []struct{}
- func (mock *FrontendMock) MetricExporter() sdkmetric.Exporter
- func (mock *FrontendMock) MetricExporterCalls() []struct{}
- func (mock *FrontendMock) Opts() *dagui.FrontendOpts
- func (mock *FrontendMock) OptsCalls() []struct{}
- func (mock *FrontendMock) RevealAllSpans()
- func (mock *FrontendMock) RevealAllSpansCalls() []struct{}
- func (mock *FrontendMock) Run(ctx context.Context, opts dagui.FrontendOpts, ...) error
- func (mock *FrontendMock) RunCalls() []struct{ ... }
- func (mock *FrontendMock) SetClient(client *dagger.Client)
- func (mock *FrontendMock) SetClientCalls() []struct{ ... }
- func (mock *FrontendMock) SetCloudURL(ctx context.Context, url string, msg string, logged bool)
- func (mock *FrontendMock) SetCloudURLCalls() []struct{ ... }
- func (mock *FrontendMock) SetPrimary(spanID dagui.SpanID)
- func (mock *FrontendMock) SetPrimaryCalls() []struct{ ... }
- func (mock *FrontendMock) SetSidebarContent(sidebarSection SidebarSection)
- func (mock *FrontendMock) SetSidebarContentCalls() []struct{ ... }
- func (mock *FrontendMock) SetStatusLine(statusLineData StatusLineData)
- func (mock *FrontendMock) SetStatusLineCalls() []struct{ ... }
- func (mock *FrontendMock) SetTelemetryError(err error)
- func (mock *FrontendMock) SetTelemetryErrorCalls() []struct{ ... }
- func (mock *FrontendMock) SetVerbosity(n int)
- func (mock *FrontendMock) SetVerbosityCalls() []struct{ ... }
- func (mock *FrontendMock) Shell(ctx context.Context, handler ShellHandler)
- func (mock *FrontendMock) ShellCalls() []struct{ ... }
- func (mock *FrontendMock) SpanExporter() sdktrace.SpanExporter
- func (mock *FrontendMock) SpanExporterCalls() []struct{}
- type KeymapBar
- type LogPagerView
- func (p *LogPagerView) Name() string
- func (p *LogPagerView) OnDismount()
- func (p *LogPagerView) RefreshSearch()
- func (p *LogPagerView) Render(ctx tuist.Context)
- func (p *LogPagerView) ScrollBy(delta int)
- func (p *LogPagerView) ScrollPage(deltaPages int)
- func (p *LogPagerView) ScrollToBottom()
- func (p *LogPagerView) ScrollToTop()
- func (p *LogPagerView) SearchNext()
- func (p *LogPagerView) SearchPrev()
- func (p *LogPagerView) SetFocused(_ tuist.Context, focused bool)
- func (p *LogPagerView) SetSearch(query string)
- type LogsView
- type Markdown
- type NotificationBubble
- type PlainFrontendMetricExporter
- func (fe PlainFrontendMetricExporter) Aggregation(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation
- func (fe PlainFrontendMetricExporter) Background(cmd ExecCommand, raw bool) error
- func (fe PlainFrontendMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
- func (fe PlainFrontendMetricExporter) ForceFlush(context.Context) error
- func (fe PlainFrontendMetricExporter) GetLLMTokenMetrics() *dagui.LLMTokenMetrics
- func (fe PlainFrontendMetricExporter) HandleForm(ctx context.Context, form *huh.Form) error
- func (fe PlainFrontendMetricExporter) HandlePrompt(ctx context.Context, _, prompt string, dest any) error
- func (fe PlainFrontendMetricExporter) LogExporter() sdklog.Exporter
- func (fe PlainFrontendMetricExporter) MetricExporter() sdkmetric.Exporter
- func (fe PlainFrontendMetricExporter) Opts() *dagui.FrontendOpts
- func (fe PlainFrontendMetricExporter) RevealAllSpans()
- func (fe PlainFrontendMetricExporter) Run(ctx context.Context, opts dagui.FrontendOpts, ...) error
- func (fe PlainFrontendMetricExporter) SetClient(client *dagger.Client)
- func (fe PlainFrontendMetricExporter) SetCloudURL(ctx context.Context, url string, msg string, logged bool)
- func (fe PlainFrontendMetricExporter) SetPrimary(spanID dagui.SpanID)
- func (fe PlainFrontendMetricExporter) SetSidebarContent(SidebarSection)
- func (fe PlainFrontendMetricExporter) SetStatusLine(StatusLineData)
- func (fe PlainFrontendMetricExporter) SetTelemetryError(err error)
- func (fe PlainFrontendMetricExporter) SetVerbosity(n int)
- func (fe PlainFrontendMetricExporter) Shell(ctx context.Context, handler ShellHandler)
- func (fe PlainFrontendMetricExporter) Shutdown(ctx context.Context) error
- func (fe PlainFrontendMetricExporter) SpanExporter() sdktrace.SpanExporter
- func (fe PlainFrontendMetricExporter) Temporality(ik sdkmetric.InstrumentKind) metricdata.Temporality
- type QueuedMessageLabel
- type Rave
- func (rave *Rave) Init() tea.Cmd
- func (rave *Rave) Progress(now time.Time) (int, float64)
- func (rave *Rave) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (rave *Rave) View() string
- func (rave *Rave) ViewFancy(now time.Time) string
- func (rave *Rave) ViewFrame(now time.Time, frames SpinnerFrames) (string, int)
- type ShellHandler
- type SidebarSection
- type SpanTreeView
- type Spinner
- type SpinnerFrames
- type StatusLine
- type StatusLineData
- type TermOutput
- type TestSpanChildrenView
- func (v *TestSpanChildrenView) CloseOrGoOut(fe *frontendPretty) bool
- func (v *TestSpanChildrenView) FocusFirst(fe *frontendPretty) bool
- func (v *TestSpanChildrenView) FocusSpan(fe *frontendPretty, id dagui.SpanID) bool
- func (v *TestSpanChildrenView) FocusedSpan() *dagui.Span
- func (v *TestSpanChildrenView) GoDown(fe *frontendPretty) bool
- func (v *TestSpanChildrenView) GoEnd(fe *frontendPretty) bool
- func (v *TestSpanChildrenView) GoStart(fe *frontendPretty) bool
- func (v *TestSpanChildrenView) GoUp(fe *frontendPretty) bool
- func (v *TestSpanChildrenView) OpenOrGoIn(fe *frontendPretty) bool
- func (v *TestSpanChildrenView) Render(ctx tuist.Context)
- func (v *TestSpanChildrenView) UpdateAll()
- type TestView
- func (tv *TestView) CurrentActionSpan() *dagui.Span
- func (tv *TestView) CurrentActionTitle() (string, dagui.TestCategory, bool)
- func (tv *TestView) FocusedNode() *dagui.TestNode
- func (tv *TestView) FocusedNodeCanFocusDetail() bool
- func (tv *TestView) FocusedPassedGroupExpanded() (bool, bool)
- func (tv *TestView) FocusedSpan() *dagui.Span
- func (tv *TestView) GoDown()
- func (tv *TestView) GoEnd()
- func (tv *TestView) GoStart()
- func (tv *TestView) GoUp()
- func (tv *TestView) Name() string
- func (tv *TestView) OnDismount()
- func (tv *TestView) Render(ctx tuist.Context)
- func (tv *TestView) SetFocused(_ tuist.Context, focused bool)
- func (tv *TestView) ToggleFocusedGroup() bool
- type TraceFrontend
- type Vterm
- func (term *Vterm) Init() tea.Cmd
- func (term *Vterm) LastLine() string
- func (term *Vterm) Print(w io.Writer) error
- func (term *Vterm) PrintRaw(w io.Writer) error
- func (term *Vterm) Render(w io.Writer, offset, height int)
- func (term *Vterm) ScrollBy(delta int)
- func (term *Vterm) ScrollPage(deltaPages int)
- func (term *Vterm) ScrollPercent() float64
- func (term *Vterm) ScrollToBottom()
- func (term *Vterm) ScrollToRow(row int)
- func (term *Vterm) ScrollToTop()
- func (term *Vterm) Search(query string, currentIdx int) (count, row int)
- func (term *Vterm) SetHeight(height int)
- func (term *Vterm) SetPrefix(prefix string)
- func (term *Vterm) SetSearchHighlight(query string, currentRow int)
- func (term *Vterm) SetWidth(width int)
- func (term *Vterm) Term() *midterm.Terminal
- func (term *Vterm) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (term *Vterm) UsedHeight() int
- func (term *Vterm) View() string
- func (term *Vterm) Write(p []byte) (int, error)
- func (term *Vterm) WriteMarkdown(p []byte) (int, error)
- type WithDirectoryArgs
- type WithEnvVariableArgs
- type WithExecArgs
- type WithFileArgs
- type WithMountedDirectoryArgs
- type WithMountedFileArgs
- type WithNewFileArgs
- type WithUserArgs
- type WithWorkdirArgs
Constants ¶
const ( Block = "█" Block75 = "▓" Block50 = "▒" Block25 = "░" CaretDownEmpty = "▽" CaretDownFilled = "▼" CaretLeftFilled = "◀" // "<" CaretRightEmpty = "▷" // ">" CaretRightFilled = "▶" // ">" CornerBottomLeft = "╰" CornerBottoRight = "╯" CornerTopLeft = "╭" CornerTopRight = "╮" CrossBar = "┼" DotEmpty = "○" DotHalf = "◐" DotFilled = "●" DotCenter = "◉" DotTiny = "·" HorizBar = "─" HorizBottomBar = "┬" HorizHalfLeftBar = "╴" HorizHalfRightBar = "╶" HorizTopBar = "┴" HorizTopBoldBar = "┻" InactiveGroupSymbol = VertBar TaskSymbol = VertRightBoldBar VertBar = "│" VertBoldBar = "┃" VertDash2 = "╎" VertDash3 = "┆" VertBoldDash3 = "┇" VertDash4 = "┊" VertBoldDash4 = "┋" VertLeftBar = "┤" VertLeftBoldBar = "┫" VertRightBar = "├" VertRightBoldBar = "┣" IconSkipped = "∅" IconSuccess = "✔" IconFailure = "✘" IconCached = "$" // cache money Diamond = "◆" LLMPrompt = "❯" BorderLeft = "▕" CloudIcon = "⬢" // We need a prompt that conveys the unique nature of the Dagger shell. Per gpt4: // The ⋈ symbol, known as the bowtie, has deep roots in relational databases and set theory, // where it denotes a join operation. This makes it especially fitting for a DAG environment, // as it suggests the idea of dependencies, intersections, and points where separate paths // or data sets come together. ShellPrompt = "⋈" )
const DefaultBPM = 123
DefaultBPM is a sane default of 123 beats per minute.
Variables ¶
var ( ErrShellExited = errors.New("shell exited") ErrInterrupted = errors.New("interrupted") )
var ( ANSIBlack = lipgloss.Black ANSIRed = lipgloss.Red ANSIGreen = lipgloss.Green ANSIYellow = lipgloss.Yellow ANSIBlue = lipgloss.Blue ANSIMagenta = lipgloss.Magenta ANSICyan = lipgloss.Cyan ANSIWhite = lipgloss.White ANSIBrightBlack = lipgloss.BrightBlack ANSIBrightRed = lipgloss.BrightRed ANSIBrightGreen = lipgloss.BrightGreen ANSIBrightYellow = lipgloss.BrightYellow ANSIBrightBlue = lipgloss.BrightBlue ANSIBrightMagenta = lipgloss.BrightMagenta ANSIBrightCyan = lipgloss.BrightCyan ANSIBrightWhite = lipgloss.BrightWhite )
var DotFrames = SpinnerFrames{ []string{"⣾", "⣷", "⣧", "⣏", "⡟", "⡿", "⢿", "⢻", "⣹", "⣼"}, ease.Linear, }
var FadeFrames = SpinnerFrames{ []string{"█", "█", "▓", "▓", "▒", "▒", "░", "░", " ", " "}, ease.InCubic, }
var Fail = ExitError{OriginalCode: 1}
var FieldRendererRegistry = map[string]func() FieldRenderer{ "withExec": func() FieldRenderer { return &WithExecArgs{} }, "withWorkdir": func() FieldRenderer { return &WithWorkdirArgs{} }, "withEnvVariable": func() FieldRenderer { return &WithEnvVariableArgs{} }, "withMountedDirectory": func() FieldRenderer { return &WithMountedDirectoryArgs{} }, "withMountedFile": func() FieldRenderer { return &WithMountedFileArgs{} }, "withDirectory": func() FieldRenderer { return &WithDirectoryArgs{} }, "withFile": func() FieldRenderer { return &WithFileArgs{} }, "withNewFile": func() FieldRenderer { return &WithNewFileArgs{} }, "withUser": func() FieldRenderer { return &WithUserArgs{} }, }
FieldRendererRegistry holds all field renderers. Each entry maps a GraphQL field name to a factory function that creates a new renderer instance.
var KeymapStyle = lipgloss.NewStyle(). Foreground(lipgloss.BrightBlack)
KeymapStyle is the default style for keymap text.
var MarkdownStyle = styles.LightStyleConfig
var MeterFrames = SpinnerFrames{ []string{"█", "█", "▇", "▆", "▅", "▄", "▃", "▂", "▁", " "}, ease.InOutCubic, }
var MiniDotFrames = SpinnerFrames{ []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, ease.Linear, }
var RunningInAgent = sync.OnceValue(func() bool { for _, name := range agentEnvVars { if os.Getenv(name) != "" { return true } } return false })
RunningInAgent reports whether the CLI is being driven by an AI coding agent (Claude Code, Cursor, Codex, Gemini, Copilot, pi, Goose, Amp, etc.) rather than a human at a terminal. Agents consume the output as text, so escape codes are just noise.
Memoized: the render loop consults it per row per frame, the environment can't change mid-process, and each os.Getenv takes the runtime's env lock.
var SkipLoggedOutTraceMsgEnvs = []string{
"DAGGER_NO_NAG",
"NOTHANKS", "SHUTUP", "GOAWAY", "STOPIT",
}
Functions ¶
func ColorProfile ¶ added in v0.11.1
ColorProfile returns Ascii if NO_COLOR (or similar) is set, or if we're being driven by an AI agent. Otherwise it returns termenv.ANSI, allowing colors to be used.
Note that color profiles beyond simple ANSI are not used by Progrock. 16 colors is all you need. Anything else disrespects the user's color scheme preferences.
func FromCmdContext ¶ added in v0.13.0
func HasDarkBackground ¶ added in v0.17.0
func HasDarkBackground() bool
func KeyEnabled ¶ added in v0.17.0
func KeyEnabled(enabled bool) key.BindingOpt
func NewOutput ¶ added in v0.11.1
NewOutput returns a termenv.Output that will always use color, regardless of whether w is a TTY, unless NO_COLOR is explicitly set.
Progrock is opinionated here. Termenv disables colors by default if stdout is not a TTY or if the CI env var is set. We don't want that, because folks deserve colorful output in CI too.
To disable colors, set NO_COLOR (https://no-color.org/).
func PreviewPatch ¶ added in v0.19.1
func RegisterFieldRenderer ¶ added in v0.19.7
func RegisterFieldRenderer(fieldName string, rendererFactory func() FieldRenderer)
RegisterFieldRenderer adds a new field renderer to the registry
Types ¶
type AdaptiveColor ¶ added in v0.17.0
func (AdaptiveColor) Sequence ¶ added in v0.17.0
func (c AdaptiveColor) Sequence(bg bool) string
type BranchSummary ¶
type BranchSummary struct {
// Summarize indicates whether to summarize the old conversation.
Summarize bool
// CustomPrompt is an optional custom summarization prompt. Only used
// when Summarize is true. If empty, the default summarization prompt
// is used.
CustomPrompt string
}
ShellHandler defines the interface for handling shell interactions. All methods are called on the UI goroutine unless noted otherwise. BranchSummary controls how the conversation is summarized when branching.
type ErrorLabel ¶ added in v0.20.2
ErrorLabel is a simple component that displays an error message. When the error is nil, it renders nothing (zero lines). Long error messages are word-wrapped to fit the available width.
func NewErrorLabel ¶ added in v0.20.2
func NewErrorLabel() *ErrorLabel
NewErrorLabel creates a new ErrorLabel.
func (*ErrorLabel) Render ¶ added in v0.20.2
func (e *ErrorLabel) Render(ctx tuist.Context)
func (*ErrorLabel) SetError ¶ added in v0.20.2
func (e *ErrorLabel) SetError(err error)
SetError sets the error to display. Pass nil to clear it.
type ExecCommand ¶ added in v0.20.2
type ExecCommand interface {
Run() error
SetStdin(io.Reader)
SetStdout(io.Writer)
SetStderr(io.Writer)
}
ExecCommand is a command that can be executed in a blocking fashion, taking over the terminal. Replaces tea.ExecCommand.
type ExitError ¶ added in v0.19.7
type ExitError struct {
// OriginalCode is the raw exit code that was reported by the caller.
// Code() should be used when deciding the actual process exit status.
OriginalCode int
// An optional originating error, for any code paths that go looking for it,
// e.g. telemetry.EndWithCause which looks for and applies error origins.
Original error
}
ExitError is an error that indicates a command should exit with a specific status code, without printing an error message, assuming a human readable message has been printed already.
It is basically a shortcut for `os.Exit` while giving the TUI a chance to exit gracefully and flush output.
type FieldRenderer ¶ added in v0.19.7
type FieldRenderer interface {
// Render processes the call and returns title text and args to elide from normal rendering
Render(out TermOutput) (title string, elidedArgs []string, specialTitle bool)
}
FieldRenderer defines how to render a specific GraphQL field call
type Frontend ¶
type Frontend interface {
// Run starts a frontend, and runs the target function.
Run(ctx context.Context, opts dagui.FrontendOpts, f func(context.Context) (cleanups.CleanupF, error)) error
// Opts returns the opts of the currently running frontend.
Opts() *dagui.FrontendOpts
SetVerbosity(n int)
// SetTelemetryError records an error from the OTel telemetry pipeline.
SetTelemetryError(error)
// SetPrimary tells the frontend which span should be treated like the focal
// point of the command. Its output will be displayed at the end, and its
// children will be promoted to the "top-level" of the TUI.
SetPrimary(spanID dagui.SpanID)
Background(cmd ExecCommand, raw bool) error
// RevealAllSpans tells the frontend to show all spans, not just
// the spans beneath the primary span.
RevealAllSpans()
// Can consume otel spans, logs and metrics.
SpanExporter() sdktrace.SpanExporter
LogExporter() sdklog.Exporter
MetricExporter() sdkmetric.Exporter
// SetCloudURL is called after the CLI checks auth and sets the cloud URL.
SetCloudURL(ctx context.Context, url string, msg string, logged bool)
// SetClient is called to notify the frontend of a created dagger client.
// This can be used to make requests to the engine for more information.
SetClient(*dagger.Client)
// Shell is called when the CLI enters interactive mode.
Shell(ctx context.Context, handler ShellHandler)
// Populate the sidebar with content.
SetSidebarContent(SidebarSection)
// SetStatusLine updates the compact status line with LLM
// token/cost/context data.
SetStatusLine(StatusLineData)
// GetLLMTokenMetrics returns aggregated LLM token metrics across all spans.
GetLLMTokenMetrics() *dagui.LLMTokenMetrics
prompt.PromptHandler
}
func NewDots ¶ added in v0.18.11
NewDots creates a new dots-style frontend that outputs green dots for successful spans and red X's for failed spans. This frontend is ideal for console/non-TTY environments where you want minimal, clear feedback about operation progress without verbose output.
Output format:
- Green dots (.) for successful operations
- Red X's (X) for failed operations
- Newline printed at the end when shutting down
This frontend does not support interactive features like shell or prompts.
func NewLogs ¶ added in v0.20.0
NewLogs creates a new logs-style frontend that only prints logs from spans, as they arrive, prefixed by span name.
This frontend does not support interactive features like shell or prompts.
func NewReporter ¶ added in v0.15.0
type FrontendMetricExporter ¶ added in v0.13.6
type FrontendMetricExporter struct {
// contains filtered or unexported fields
}
func (FrontendMetricExporter) Aggregation ¶ added in v0.13.6
func (fe FrontendMetricExporter) Aggregation(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation
func (FrontendMetricExporter) Background ¶ added in v0.13.6
func (fe FrontendMetricExporter) Background(cmd ExecCommand, raw bool) error
func (FrontendMetricExporter) Close ¶ added in v0.13.6
func (fe FrontendMetricExporter) Close() error
func (FrontendMetricExporter) Export ¶ added in v0.13.6
func (fe FrontendMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
func (FrontendMetricExporter) FinalRender ¶ added in v0.15.0
FinalRender is called after the program has finished running and prints the final output after the TUI has exited.
func (FrontendMetricExporter) ForceFlush ¶ added in v0.13.6
func (fe FrontendMetricExporter) ForceFlush(context.Context) error
func (FrontendMetricExporter) GetLLMTokenMetrics ¶
func (fe FrontendMetricExporter) GetLLMTokenMetrics() *dagui.LLMTokenMetrics
GetLLMTokenMetrics returns the DB's aggregated LLM token metrics.
func (FrontendMetricExporter) HandleForm ¶ added in v0.18.18
func (FrontendMetricExporter) HandleKeyPress ¶ added in v0.20.2
func (fe FrontendMetricExporter) HandleKeyPress(_ tuist.Context, ev uv.KeyPressEvent) bool
HandleKeyPress implements tuist.Interactive. It dispatches key events to the nav handler. When the TextInput or formWrap is focused, keys go directly to them via tuist's focus routing.
func (FrontendMetricExporter) HandlePrompt ¶ added in v0.17.0
func (FrontendMetricExporter) ImportSnapshots ¶
func (fe FrontendMetricExporter) ImportSnapshots(snapshots []dagui.SpanSnapshot)
ImportSnapshots folds a batch of span snapshots into the DB and refreshes the view. It's the snapshot-based counterpart to the OTLP ExportSpans path, used by 'dagger trace' which receives spans as snapshots from Cloud (carrying ChildCount and Partial, which the OTLP form drops). Mirrors the post-import bookkeeping ExportSpans does so logs and test views stay in sync.
func (FrontendMetricExporter) LogExporter ¶ added in v0.13.6
func (FrontendMetricExporter) MetricExporter ¶ added in v0.13.6
func (FrontendMetricExporter) OnMount ¶ added in v0.20.2
OnMount is called by tuist when the component is mounted into the TUI tree. It starts the frame ticker and, on the first mount, spawns the run function.
func (FrontendMetricExporter) OpenBrowser ¶
OpenBrowser satisfies llmconfig.BrowserOpener, opening url in the user's browser (e.g. for OAuth). runWithTUI already redirects browser.Stdout/Stderr into a buffer, so a failed or noisy opener can't corrupt the TUI.
func (FrontendMetricExporter) Opts ¶ added in v0.13.6
func (fe FrontendMetricExporter) Opts() *dagui.FrontendOpts
func (FrontendMetricExporter) PrintAbove ¶
func (fe FrontendMetricExporter) PrintAbove(text string)
PrintAbove satisfies llmconfig.AbovePrinter: it writes text into the terminal scrollback above the live TUI, so long content like OAuth URLs isn't word-wrapped by the form renderer and stays selectable / Ctrl+Clickable. It runs on the UI goroutine (serialized with rendering) because setup calls it from a background goroutine.
func (FrontendMetricExporter) Render ¶ added in v0.13.6
Render implements tuist.Component. It produces the full TUI output as lines.
func (FrontendMetricExporter) RequestSurfacedLogs ¶
func (fe FrontendMetricExporter) RequestSurfacedLogs()
RequestSurfacedLogs asks the log provider for the logs of every failed span currently visible in the view. It's used by non-interactive ('report') mode, which renders only once: the caller invokes this after the spans are loaded, waits for the fetches it triggers, then the final render includes the surfaced failures' detail. Interactive mode surfaces these during its normal recalc loop, but calling this is harmless (requestLogs dedups).
Blocks until the recalculation (and so the provider calls it makes) has actually run: in TTY mode dispatch only enqueues onto the event loop, and returning before the fetches were even issued would let the caller's subsequent drain observe an idle fetch group and skip them.
func (FrontendMetricExporter) RequestZoomLogs ¶
RequestZoomLogs eagerly requests the zoom target's logs, honoring the roll-up decision the zoom selector resolved (--check/--test roll up their subtree). Unlike setExpanded's lazy request it fires even when the span hasn't been loaded yet: a --span target outside the priority window is fetched asynchronously, and report mode renders only once with no later chance to request. Call before ZoomToSpan so this request wins the requestedLogs dedup over setExpanded's own-logs-only request.
func (FrontendMetricExporter) ResolveSpanTarget ¶
ResolveSpanTarget resolves a --check/--test name against the loaded trace using the selection rules the report itself renders with -- SurfacedChecks' failed representative for a check, the (failing-preferred) case for a test -- so the drill-in commands the report suggests land on the span it described, rather than an arbitrary same-named span (a passing retry, a boundary-contained fixture). Returns false when the name isn't in the loaded view, letting the caller fall back to a raw span lookup.
func (FrontendMetricExporter) RevealAllSpans ¶ added in v0.15.0
func (fe FrontendMetricExporter) RevealAllSpans()
func (FrontendMetricExporter) Run ¶ added in v0.13.6
func (fe FrontendMetricExporter) Run(ctx context.Context, opts dagui.FrontendOpts, run func(context.Context) (cleanups.CleanupF, error)) error
Run starts the TUI, calls the run function, stops the TUI, and finally prints the primary output to the appropriate stdout/stderr streams.
func (FrontendMetricExporter) SetCIContext ¶
SetCIContext records the trace's source commit / CI change so the report can suggest commit-scoped re-run commands. Called by 'dagger trace' for Cloud traces; no-op for live/local runs.
func (FrontendMetricExporter) SetCloudURL ¶ added in v0.13.6
func (FrontendMetricExporter) SetFetchWaiter ¶
func (fe FrontendMetricExporter) SetFetchWaiter(wait func())
SetFetchWaiter registers a callback that blocks until in-flight background fetches (issued via the span/log providers) have completed. The console uses it so a single HTTP request reflects the result of fetches a zoom/expand triggered, instead of returning before the async network round-trip lands. The live TUI doesn't need it -- it re-renders when results arrive -- so only the console settle calls it.
func (FrontendMetricExporter) SetLogProvider ¶
SetLogProvider registers a callback that lazily supplies a span's logs. The frontend calls it when a span's logs become relevant: the user expands the span, or a failed span is surfaced in the view. The bool argument is whether to roll up descendant logs (the span's RollUpLogs). The provider should fetch asynchronously and feed results back through LogExporter. Used by 'dagger trace' to fetch recorded logs per span on demand instead of streaming the whole trace.
func (FrontendMetricExporter) SetPrimary ¶ added in v0.13.6
func (FrontendMetricExporter) SetSidebarContent ¶ added in v0.19.0
func (fe FrontendMetricExporter) SetSidebarContent(section SidebarSection)
func (FrontendMetricExporter) SetSpanProvider ¶
SetSpanProvider registers a callback that lazily supplies a span's children. The frontend calls it when a span's subtree becomes relevant: the user expands the span, or it's surfaced/zoomed. The provider should fetch asynchronously and feed results back through ImportSnapshots. Used by 'dagger trace' to fetch deeper spans on demand instead of streaming the whole trace.
func (FrontendMetricExporter) SetStatusLine ¶
func (fe FrontendMetricExporter) SetStatusLine(data StatusLineData)
SetStatusLine updates the compact status line with LLM token/cost/context data. No-op if there is no active shell/status line.
func (FrontendMetricExporter) SetTelemetryError ¶ added in v0.20.2
func (fe FrontendMetricExporter) SetTelemetryError(err error)
func (FrontendMetricExporter) SetTraceID ¶
func (fe FrontendMetricExporter) SetTraceID(traceID string)
SetTraceID records the trace being rendered so surfaced failure logs can point at 'dagger cloud logs <trace> <span>' for the full output. Called by 'dagger trace'; no-op for live runs.
func (FrontendMetricExporter) SetVerbosity ¶ added in v0.15.3
func (fe FrontendMetricExporter) SetVerbosity(n int)
func (FrontendMetricExporter) Shell ¶ added in v0.16.3
func (fe FrontendMetricExporter) Shell(ctx context.Context, handler ShellHandler)
func (FrontendMetricExporter) SpanExporter ¶ added in v0.13.6
func (fe FrontendMetricExporter) SpanExporter() sdktrace.SpanExporter
func (FrontendMetricExporter) SurfacedFailedCheckSpans ¶
SurfacedFailedCheckSpans returns the span IDs of the surfaced failed leaf checks, so the report driver can fetch their subtrees on demand -- a failed check's cause is often a deep descendant outside the priority window. Failed *parent* checks are skipped: their subtree is the whole run, and they defer their detail to the failed children anyway.
func (FrontendMetricExporter) Temporality ¶ added in v0.13.6
func (fe FrontendMetricExporter) Temporality(ik sdkmetric.InstrumentKind) metricdata.Temporality
func (FrontendMetricExporter) ZoomToSpan ¶
ZoomToSpan scopes the view to a span and treats it as expanded, mirroring the web UI's ?span= deep link. It pulls the span's logs and children on demand (via the registered providers) so 'dagger trace --span' can focus a subtree without loading the whole trace.
type FrontendMock ¶ added in v0.19.4
type FrontendMock struct {
// BackgroundFunc mocks the Background method.
BackgroundFunc func(cmd ExecCommand, raw bool) error
// GetLLMTokenMetricsFunc mocks the GetLLMTokenMetrics method.
GetLLMTokenMetricsFunc func() *dagui.LLMTokenMetrics
// HandleFormFunc mocks the HandleForm method.
HandleFormFunc func(ctx context.Context, form *huh.Form) error
// HandlePromptFunc mocks the HandlePrompt method.
HandlePromptFunc func(ctx context.Context, title string, prompt string, dest any) error
// LogExporterFunc mocks the LogExporter method.
LogExporterFunc func() sdklog.Exporter
// MetricExporterFunc mocks the MetricExporter method.
MetricExporterFunc func() sdkmetric.Exporter
// OptsFunc mocks the Opts method.
OptsFunc func() *dagui.FrontendOpts
// RevealAllSpansFunc mocks the RevealAllSpans method.
RevealAllSpansFunc func()
// RunFunc mocks the Run method.
RunFunc func(ctx context.Context, opts dagui.FrontendOpts, f func(context.Context) (cleanups.CleanupF, error)) error
// SetClientFunc mocks the SetClient method.
SetClientFunc func(client *dagger.Client)
// SetCloudURLFunc mocks the SetCloudURL method.
SetCloudURLFunc func(ctx context.Context, url string, msg string, logged bool)
// SetPrimaryFunc mocks the SetPrimary method.
SetPrimaryFunc func(spanID dagui.SpanID)
// SetSidebarContentFunc mocks the SetSidebarContent method.
SetSidebarContentFunc func(sidebarSection SidebarSection)
// SetStatusLineFunc mocks the SetStatusLine method.
SetStatusLineFunc func(statusLineData StatusLineData)
// SetTelemetryErrorFunc mocks the SetTelemetryError method.
SetTelemetryErrorFunc func(err error)
// SetVerbosityFunc mocks the SetVerbosity method.
SetVerbosityFunc func(n int)
// ShellFunc mocks the Shell method.
ShellFunc func(ctx context.Context, handler ShellHandler)
// SpanExporterFunc mocks the SpanExporter method.
SpanExporterFunc func() sdktrace.SpanExporter
// contains filtered or unexported fields
}
FrontendMock is a mock implementation of Frontend.
func TestSomethingThatUsesFrontend(t *testing.T) {
// make and configure a mocked Frontend
mockedFrontend := &FrontendMock{
BackgroundFunc: func(cmd ExecCommand, raw bool) error {
panic("mock out the Background method")
},
GetLLMTokenMetricsFunc: func() *dagui.LLMTokenMetrics {
panic("mock out the GetLLMTokenMetrics method")
},
HandleFormFunc: func(ctx context.Context, form *huh.Form) error {
panic("mock out the HandleForm method")
},
HandlePromptFunc: func(ctx context.Context, title string, prompt string, dest any) error {
panic("mock out the HandlePrompt method")
},
LogExporterFunc: func() sdklog.Exporter {
panic("mock out the LogExporter method")
},
MetricExporterFunc: func() sdkmetric.Exporter {
panic("mock out the MetricExporter method")
},
OptsFunc: func() *dagui.FrontendOpts {
panic("mock out the Opts method")
},
RevealAllSpansFunc: func() {
panic("mock out the RevealAllSpans method")
},
RunFunc: func(ctx context.Context, opts dagui.FrontendOpts, f func(context.Context) (cleanups.CleanupF, error)) error {
panic("mock out the Run method")
},
SetClientFunc: func(client *dagger.Client) {
panic("mock out the SetClient method")
},
SetCloudURLFunc: func(ctx context.Context, url string, msg string, logged bool) {
panic("mock out the SetCloudURL method")
},
SetPrimaryFunc: func(spanID dagui.SpanID) {
panic("mock out the SetPrimary method")
},
SetSidebarContentFunc: func(sidebarSection SidebarSection) {
panic("mock out the SetSidebarContent method")
},
SetStatusLineFunc: func(statusLineData StatusLineData) {
panic("mock out the SetStatusLine method")
},
SetTelemetryErrorFunc: func(err error) {
panic("mock out the SetTelemetryError method")
},
SetVerbosityFunc: func(n int) {
panic("mock out the SetVerbosity method")
},
ShellFunc: func(ctx context.Context, handler ShellHandler) {
panic("mock out the Shell method")
},
SpanExporterFunc: func() sdktrace.SpanExporter {
panic("mock out the SpanExporter method")
},
}
// use mockedFrontend in code that requires Frontend
// and then make assertions.
}
func (*FrontendMock) Background ¶ added in v0.19.4
func (mock *FrontendMock) Background(cmd ExecCommand, raw bool) error
Background calls BackgroundFunc.
func (*FrontendMock) BackgroundCalls ¶ added in v0.19.4
func (mock *FrontendMock) BackgroundCalls() []struct { Cmd ExecCommand Raw bool }
BackgroundCalls gets all the calls that were made to Background. Check the length with:
len(mockedFrontend.BackgroundCalls())
func (*FrontendMock) GetLLMTokenMetrics ¶
func (mock *FrontendMock) GetLLMTokenMetrics() *dagui.LLMTokenMetrics
GetLLMTokenMetrics calls GetLLMTokenMetricsFunc.
func (*FrontendMock) GetLLMTokenMetricsCalls ¶
func (mock *FrontendMock) GetLLMTokenMetricsCalls() []struct { }
GetLLMTokenMetricsCalls gets all the calls that were made to GetLLMTokenMetrics. Check the length with:
len(mockedFrontend.GetLLMTokenMetricsCalls())
func (*FrontendMock) HandleForm ¶ added in v0.19.4
HandleForm calls HandleFormFunc.
func (*FrontendMock) HandleFormCalls ¶ added in v0.19.4
func (mock *FrontendMock) HandleFormCalls() []struct { Ctx context.Context Form *huh.Form }
HandleFormCalls gets all the calls that were made to HandleForm. Check the length with:
len(mockedFrontend.HandleFormCalls())
func (*FrontendMock) HandlePrompt ¶ added in v0.19.4
func (mock *FrontendMock) HandlePrompt(ctx context.Context, title string, prompt string, dest any) error
HandlePrompt calls HandlePromptFunc.
func (*FrontendMock) HandlePromptCalls ¶ added in v0.19.4
func (mock *FrontendMock) HandlePromptCalls() []struct { Ctx context.Context Title string Prompt string Dest any }
HandlePromptCalls gets all the calls that were made to HandlePrompt. Check the length with:
len(mockedFrontend.HandlePromptCalls())
func (*FrontendMock) LogExporter ¶ added in v0.19.4
func (mock *FrontendMock) LogExporter() sdklog.Exporter
LogExporter calls LogExporterFunc.
func (*FrontendMock) LogExporterCalls ¶ added in v0.19.4
func (mock *FrontendMock) LogExporterCalls() []struct { }
LogExporterCalls gets all the calls that were made to LogExporter. Check the length with:
len(mockedFrontend.LogExporterCalls())
func (*FrontendMock) MetricExporter ¶ added in v0.19.4
func (mock *FrontendMock) MetricExporter() sdkmetric.Exporter
MetricExporter calls MetricExporterFunc.
func (*FrontendMock) MetricExporterCalls ¶ added in v0.19.4
func (mock *FrontendMock) MetricExporterCalls() []struct { }
MetricExporterCalls gets all the calls that were made to MetricExporter. Check the length with:
len(mockedFrontend.MetricExporterCalls())
func (*FrontendMock) Opts ¶ added in v0.19.4
func (mock *FrontendMock) Opts() *dagui.FrontendOpts
Opts calls OptsFunc.
func (*FrontendMock) OptsCalls ¶ added in v0.19.4
func (mock *FrontendMock) OptsCalls() []struct { }
OptsCalls gets all the calls that were made to Opts. Check the length with:
len(mockedFrontend.OptsCalls())
func (*FrontendMock) RevealAllSpans ¶ added in v0.19.4
func (mock *FrontendMock) RevealAllSpans()
RevealAllSpans calls RevealAllSpansFunc.
func (*FrontendMock) RevealAllSpansCalls ¶ added in v0.19.4
func (mock *FrontendMock) RevealAllSpansCalls() []struct { }
RevealAllSpansCalls gets all the calls that were made to RevealAllSpans. Check the length with:
len(mockedFrontend.RevealAllSpansCalls())
func (*FrontendMock) Run ¶ added in v0.19.4
func (mock *FrontendMock) Run(ctx context.Context, opts dagui.FrontendOpts, f func(context.Context) (cleanups.CleanupF, error)) error
Run calls RunFunc.
func (*FrontendMock) RunCalls ¶ added in v0.19.4
func (mock *FrontendMock) RunCalls() []struct { Ctx context.Context Opts dagui.FrontendOpts F func(context.Context) (cleanups.CleanupF, error) }
RunCalls gets all the calls that were made to Run. Check the length with:
len(mockedFrontend.RunCalls())
func (*FrontendMock) SetClient ¶ added in v0.19.4
func (mock *FrontendMock) SetClient(client *dagger.Client)
SetClient calls SetClientFunc.
func (*FrontendMock) SetClientCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetClientCalls() []struct { Client *dagger.Client }
SetClientCalls gets all the calls that were made to SetClient. Check the length with:
len(mockedFrontend.SetClientCalls())
func (*FrontendMock) SetCloudURL ¶ added in v0.19.4
SetCloudURL calls SetCloudURLFunc.
func (*FrontendMock) SetCloudURLCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetCloudURLCalls() []struct { Ctx context.Context URL string Msg string Logged bool }
SetCloudURLCalls gets all the calls that were made to SetCloudURL. Check the length with:
len(mockedFrontend.SetCloudURLCalls())
func (*FrontendMock) SetPrimary ¶ added in v0.19.4
func (mock *FrontendMock) SetPrimary(spanID dagui.SpanID)
SetPrimary calls SetPrimaryFunc.
func (*FrontendMock) SetPrimaryCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetPrimaryCalls() []struct { SpanID dagui.SpanID }
SetPrimaryCalls gets all the calls that were made to SetPrimary. Check the length with:
len(mockedFrontend.SetPrimaryCalls())
func (*FrontendMock) SetSidebarContent ¶ added in v0.19.4
func (mock *FrontendMock) SetSidebarContent(sidebarSection SidebarSection)
SetSidebarContent calls SetSidebarContentFunc.
func (*FrontendMock) SetSidebarContentCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetSidebarContentCalls() []struct { SidebarSection SidebarSection }
SetSidebarContentCalls gets all the calls that were made to SetSidebarContent. Check the length with:
len(mockedFrontend.SetSidebarContentCalls())
func (*FrontendMock) SetStatusLine ¶
func (mock *FrontendMock) SetStatusLine(statusLineData StatusLineData)
SetStatusLine calls SetStatusLineFunc.
func (*FrontendMock) SetStatusLineCalls ¶
func (mock *FrontendMock) SetStatusLineCalls() []struct { StatusLineData StatusLineData }
SetStatusLineCalls gets all the calls that were made to SetStatusLine. Check the length with:
len(mockedFrontend.SetStatusLineCalls())
func (*FrontendMock) SetTelemetryError ¶ added in v0.20.2
func (mock *FrontendMock) SetTelemetryError(err error)
SetTelemetryError calls SetTelemetryErrorFunc.
func (*FrontendMock) SetTelemetryErrorCalls ¶ added in v0.20.2
func (mock *FrontendMock) SetTelemetryErrorCalls() []struct { Err error }
SetTelemetryErrorCalls gets all the calls that were made to SetTelemetryError. Check the length with:
len(mockedFrontend.SetTelemetryErrorCalls())
func (*FrontendMock) SetVerbosity ¶ added in v0.19.4
func (mock *FrontendMock) SetVerbosity(n int)
SetVerbosity calls SetVerbosityFunc.
func (*FrontendMock) SetVerbosityCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetVerbosityCalls() []struct { N int }
SetVerbosityCalls gets all the calls that were made to SetVerbosity. Check the length with:
len(mockedFrontend.SetVerbosityCalls())
func (*FrontendMock) Shell ¶ added in v0.19.4
func (mock *FrontendMock) Shell(ctx context.Context, handler ShellHandler)
Shell calls ShellFunc.
func (*FrontendMock) ShellCalls ¶ added in v0.19.4
func (mock *FrontendMock) ShellCalls() []struct { Ctx context.Context Handler ShellHandler }
ShellCalls gets all the calls that were made to Shell. Check the length with:
len(mockedFrontend.ShellCalls())
func (*FrontendMock) SpanExporter ¶ added in v0.19.4
func (mock *FrontendMock) SpanExporter() sdktrace.SpanExporter
SpanExporter calls SpanExporterFunc.
func (*FrontendMock) SpanExporterCalls ¶ added in v0.19.4
func (mock *FrontendMock) SpanExporterCalls() []struct { }
SpanExporterCalls gets all the calls that were made to SpanExporter. Check the length with:
len(mockedFrontend.SpanExporterCalls())
type KeymapBar ¶ added in v0.20.2
type KeymapBar struct {
tuist.Compo
// Profile is the termenv color profile.
Profile termenv.Profile
// UsingCloudEngine shows the cloud icon prefix.
UsingCloudEngine bool
// Keys returns the current set of key bindings to display.
Keys func(out *termenv.Output) []key.Binding
// PressedKey is the key string that was most recently pressed.
PressedKey string
// PressedKeyAt is when the key was pressed.
PressedKeyAt time.Time
}
KeymapBar is a component that renders a horizontal key binding bar.
type LogPagerView ¶ added in v0.21.0
type LogPagerView struct {
tuist.Compo
Profile termenv.Profile
SpanID dagui.SpanID
Title string
TitleIcon string
Logs *Vterm
SearchQuery string
SearchIndex int
SearchCount int
// contains filtered or unexported fields
}
LogPagerView renders a single Vterm as a fullscreen, focusable log pager. Search is powered by Vterm/midterm's native search/highlight support.
func (*LogPagerView) Name ¶ added in v0.21.0
func (p *LogPagerView) Name() string
func (*LogPagerView) OnDismount ¶ added in v0.21.0
func (p *LogPagerView) OnDismount()
func (*LogPagerView) RefreshSearch ¶ added in v0.21.0
func (p *LogPagerView) RefreshSearch()
func (*LogPagerView) Render ¶ added in v0.21.0
func (p *LogPagerView) Render(ctx tuist.Context)
func (*LogPagerView) ScrollBy ¶ added in v0.21.0
func (p *LogPagerView) ScrollBy(delta int)
func (*LogPagerView) ScrollPage ¶ added in v0.21.0
func (p *LogPagerView) ScrollPage(deltaPages int)
func (*LogPagerView) ScrollToBottom ¶ added in v0.21.0
func (p *LogPagerView) ScrollToBottom()
func (*LogPagerView) ScrollToTop ¶ added in v0.21.0
func (p *LogPagerView) ScrollToTop()
func (*LogPagerView) SearchNext ¶ added in v0.21.0
func (p *LogPagerView) SearchNext()
func (*LogPagerView) SearchPrev ¶ added in v0.21.0
func (p *LogPagerView) SearchPrev()
func (*LogPagerView) SetFocused ¶ added in v0.21.0
func (p *LogPagerView) SetFocused(_ tuist.Context, focused bool)
func (*LogPagerView) SetSearch ¶ added in v0.21.0
func (p *LogPagerView) SetSearch(query string)
type LogsView ¶ added in v0.10.0
LogsView renders a single span's inline logs (its *Vterm) as a memoized child component. It fetches the span's logs on mount and re-renders only when its inputs change (the prefix/height the owner feeds it, or a pushed Update when the logs or search highlight change). This way the expensive Vterm.View() is skipped on unrelated parent repaints -- spinner ticks, focus moving to another row, sibling spans completing.
The owner (SpanTreeView, via renderInlineLogs) decides structurally whether a row should show inline logs and pre-computes the prefixes; LogsView only owns the fetch and the Vterm render.
func (*LogsView) OnMount ¶
OnMount drives the interactive lazy-fetch: the first time a row's logs are rendered (e.g. on expand), fetch them. It runs on the UI goroutine during the render pass, so requestLogsWith (which dedups via fe.requestedLogs) is safe to call directly.
Report mode is skipped: its single final render can't wait for an async fetch dispatched mid-render, so report fetching is driven eagerly by the surfaced- failure pass before the render. (When report mode moves to a two-pass discovery render, this guard is where mount-driven report fetching turns on.)
type Markdown ¶ added in v0.17.0
type NotificationBubble ¶ added in v0.20.2
NotificationBubble renders a bordered notification box with a title embedded in the top border and optional keymap in the border.
╭─ Title ─── q quit ─╮ │ content here │ │ more content │ ╰─────────────────────╯
func (*NotificationBubble) Render ¶ added in v0.20.2
func (n *NotificationBubble) Render(ctx tuist.Context)
type PlainFrontendMetricExporter ¶ added in v0.13.6
type PlainFrontendMetricExporter struct {
// contains filtered or unexported fields
}
func (PlainFrontendMetricExporter) Aggregation ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Aggregation(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation
func (PlainFrontendMetricExporter) Background ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Background(cmd ExecCommand, raw bool) error
func (PlainFrontendMetricExporter) Export ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
func (PlainFrontendMetricExporter) ForceFlush ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) ForceFlush(context.Context) error
func (PlainFrontendMetricExporter) GetLLMTokenMetrics ¶
func (fe PlainFrontendMetricExporter) GetLLMTokenMetrics() *dagui.LLMTokenMetrics
func (PlainFrontendMetricExporter) HandleForm ¶ added in v0.18.18
func (PlainFrontendMetricExporter) HandlePrompt ¶ added in v0.17.0
func (PlainFrontendMetricExporter) LogExporter ¶ added in v0.13.6
func (PlainFrontendMetricExporter) MetricExporter ¶ added in v0.13.6
func (PlainFrontendMetricExporter) Opts ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Opts() *dagui.FrontendOpts
func (PlainFrontendMetricExporter) RevealAllSpans ¶ added in v0.15.0
func (fe PlainFrontendMetricExporter) RevealAllSpans()
func (PlainFrontendMetricExporter) SetCloudURL ¶ added in v0.13.6
func (PlainFrontendMetricExporter) SetPrimary ¶ added in v0.13.6
func (PlainFrontendMetricExporter) SetSidebarContent ¶ added in v0.19.0
func (fe PlainFrontendMetricExporter) SetSidebarContent(SidebarSection)
func (PlainFrontendMetricExporter) SetStatusLine ¶
func (fe PlainFrontendMetricExporter) SetStatusLine(StatusLineData)
func (PlainFrontendMetricExporter) SetTelemetryError ¶ added in v0.20.2
func (fe PlainFrontendMetricExporter) SetTelemetryError(err error)
func (PlainFrontendMetricExporter) SetVerbosity ¶ added in v0.15.3
func (fe PlainFrontendMetricExporter) SetVerbosity(n int)
func (PlainFrontendMetricExporter) Shell ¶ added in v0.16.3
func (fe PlainFrontendMetricExporter) Shell(ctx context.Context, handler ShellHandler)
func (PlainFrontendMetricExporter) SpanExporter ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) SpanExporter() sdktrace.SpanExporter
func (PlainFrontendMetricExporter) Temporality ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Temporality(ik sdkmetric.InstrumentKind) metricdata.Temporality
type QueuedMessageLabel ¶
QueuedMessageLabel displays a queued message (submitted while the shell is busy) in gray above the prompt input. When there is no queued message it renders zero lines.
func NewQueuedMessageLabel ¶
func NewQueuedMessageLabel(profile termenv.Profile) *QueuedMessageLabel
NewQueuedMessageLabel creates a new QueuedMessageLabel.
func (*QueuedMessageLabel) Message ¶
func (q *QueuedMessageLabel) Message() string
Message returns the current queued message.
func (*QueuedMessageLabel) Render ¶
func (q *QueuedMessageLabel) Render(ctx tuist.Context)
func (*QueuedMessageLabel) SetMessage ¶
func (q *QueuedMessageLabel) SetMessage(msg string)
SetMessage sets the queued message to display. Pass "" to clear.
type Rave ¶ added in v0.19.7
type Rave struct {
// Show extra details useful for debugging a desynced rave.
ShowDetails bool
// The animation to display.
Frames SpinnerFrames
// contains filtered or unexported fields
}
type ShellHandler ¶ added in v0.17.0
type ShellHandler interface {
// Handle processes submitted shell input.
Handle(ctx context.Context, input string) error
// AutoComplete provides completions for the current input.
// Uses tuist's completion types directly.
AutoComplete(input string, cursorPos int) tuist.CompletionResult
// IsComplete determines if the current input is a complete command.
// Used to decide whether Enter submits or inserts a newline.
IsComplete(input string) bool
// Prompt generates the shell prompt string based on current state.
// Returns the prompt string and an optional async function for
// lazy initialization (e.g. LLM setup). The caller runs the async
// function in a goroutine and refreshes the prompt when it returns.
Prompt(ctx context.Context, out TermOutput, fg termenv.Color) (string, func())
// KeyBindings returns the keys displayed in the keymap when editing.
KeyBindings(out TermOutput) []key.Binding
// ReactToInput allows reacting to live input before it's submitted.
// Returns nil if the key was not handled. If handled, returns a
// function that performs any async work (may be nil if no async work
// is needed). The caller runs the async function in a goroutine.
//
// inputValue is the current text in the input field. editing is true
// when the input field is focused (editing mode vs navigation mode).
ReactToInput(ctx context.Context, ev uv.KeyPressEvent, inputValue string, editing bool) func()
// EncodeHistory encodes a history entry for persistence.
EncodeHistory(entry string) string
// DecodeHistory decodes a persisted history entry.
// May update internal state (e.g. mode) based on the entry prefix.
DecodeHistory(entry string) string
// SaveBeforeHistory saves the current mode before history navigation.
SaveBeforeHistory()
// RestoreAfterHistory restores the mode saved before history navigation.
RestoreAfterHistory()
// BranchFromID branches the LLM conversation from the state identified by
// the encoded DAG ID, optionally summarizing the abandoned branch first.
// It returns an async function that performs the branch (may be nil), to
// be run by the caller in a goroutine.
BranchFromID(ctx context.Context, encodedID string, summary BranchSummary) func()
}
type SidebarSection ¶ added in v0.19.0
type SidebarSection struct {
// A heading to show for the content, if any. If empty, the content will be
// placed in the topmost portion of the sidebar.
Title string
// The content to display.
Content string
// The content to display, for a given width.
ContentFunc func(int) string
// Keymap associated with this section
KeyMap []key.Binding
}
func (SidebarSection) Body ¶ added in v0.19.4
func (sec SidebarSection) Body(width int) string
type SpanTreeView ¶ added in v0.20.2
func (*SpanTreeView) OnDismount ¶ added in v0.21.0
func (s *SpanTreeView) OnDismount()
func (*SpanTreeView) Render ¶ added in v0.20.2
func (s *SpanTreeView) Render(ctx tuist.Context)
Render produces the lines for this span tree node and its children. Prefix, child, and focus state is synced by the owning tree renderer before RenderChild reaches this component.
func (*SpanTreeView) SetFocused ¶ added in v0.20.2
func (s *SpanTreeView) SetFocused(_ tuist.Context, focused bool)
SetFocused is called by tuist when this component gains or loses focus. This is O(1) — only the old and new focused components are notified.
type SpinnerFrames ¶ added in v0.19.7
SpinnerFrames contains animation frames.
type StatusLine ¶
StatusLine renders a compact, single-line status bar showing LLM token usage, cost, context window utilisation and the active model name:
↑6.3k ↓30k R3.8M W144k $3.609 (sub) 34.1%/200k (auto) claude-opus-4-6
func (*StatusLine) Render ¶
func (sl *StatusLine) Render(ctx tuist.Context)
func (*StatusLine) SetData ¶
func (sl *StatusLine) SetData(d StatusLineData)
type StatusLineData ¶
type StatusLineData struct {
// Model is the active model identifier (e.g. "claude-opus-4-6").
Model string
// SubscriptionLabel is set when using an OAuth subscription (e.g. "sub").
SubscriptionLabel string
// InputTokens is cumulative input tokens across all turns.
InputTokens int
// OutputTokens is cumulative output tokens across all turns.
OutputTokens int
// CacheReads is cumulative cache read tokens.
CacheReads int
// CacheWrites is cumulative cache write tokens.
CacheWrites int
// TotalCost is the cumulative dollar cost across all models.
TotalCost float64
// ContextPercent is the current context window usage (0-100+).
// Negative means unknown.
ContextPercent float64
// ContextWindow is the model's context window size in tokens.
ContextWindow int
// AutoCompact indicates whether auto-compaction is enabled.
AutoCompact bool
}
StatusLineData carries structured token/cost/context data for the status line.
type TermOutput ¶ added in v0.16.3
type TermOutput interface {
io.Writer
String(...string) termenv.Style
ColorProfile() termenv.Profile
}
TermOutput is an interface that captures the methods we need from termenv.Output
type TestSpanChildrenView ¶ added in v0.21.0
func (*TestSpanChildrenView) CloseOrGoOut ¶ added in v0.21.0
func (v *TestSpanChildrenView) CloseOrGoOut(fe *frontendPretty) bool
func (*TestSpanChildrenView) FocusFirst ¶ added in v0.21.0
func (v *TestSpanChildrenView) FocusFirst(fe *frontendPretty) bool
func (*TestSpanChildrenView) FocusSpan ¶ added in v0.21.0
func (v *TestSpanChildrenView) FocusSpan(fe *frontendPretty, id dagui.SpanID) bool
func (*TestSpanChildrenView) FocusedSpan ¶ added in v0.21.0
func (v *TestSpanChildrenView) FocusedSpan() *dagui.Span
func (*TestSpanChildrenView) GoDown ¶ added in v0.21.0
func (v *TestSpanChildrenView) GoDown(fe *frontendPretty) bool
func (*TestSpanChildrenView) GoEnd ¶ added in v0.21.0
func (v *TestSpanChildrenView) GoEnd(fe *frontendPretty) bool
func (*TestSpanChildrenView) GoStart ¶ added in v0.21.0
func (v *TestSpanChildrenView) GoStart(fe *frontendPretty) bool
func (*TestSpanChildrenView) GoUp ¶ added in v0.21.0
func (v *TestSpanChildrenView) GoUp(fe *frontendPretty) bool
func (*TestSpanChildrenView) OpenOrGoIn ¶ added in v0.21.0
func (v *TestSpanChildrenView) OpenOrGoIn(fe *frontendPretty) bool
func (*TestSpanChildrenView) Render ¶ added in v0.21.0
func (v *TestSpanChildrenView) Render(ctx tuist.Context)
func (*TestSpanChildrenView) UpdateAll ¶ added in v0.21.0
func (v *TestSpanChildrenView) UpdateAll()
type TestView ¶ added in v0.21.0
type TestView struct {
tuist.Compo
Profile termenv.Profile
View func() *dagui.TestView
Logs map[dagui.SpanID]*Vterm
SpanChildren func(*dagui.Span) tuist.Component
// TraceID, when set (by 'dagger trace'), lets a failing entry's capped log
// tail point at 'dagger cloud logs <trace> <span>' for the full output.
TraceID string
// MaxHeight caps the rendered height. A zero value means fullscreen mode:
// use the terminal height, leaving room for the keymap sibling.
MaxHeight int
ScopeName string
// ListOnly forces passive embedded rendering: no selected row and no detail
// pane, even if focus were accidentally routed to this component.
ListOnly bool
// SummaryIndent is used by ListOnly test summaries. Anchored inline reports
// use it to offset beneath a trace row; global reports keep it at zero.
SummaryIndent int
// SummaryLogLines caps inline logs per failing/skipped summary entry.
SummaryLogLines int
// ShowTestViewerHint renders the pretty-live "T inspect" affordance next to
// the TESTS summary heading. Final/non-pretty reports leave it disabled.
ShowTestViewerHint bool
// SummaryTitle overrides the "TESTS" heading for ListOnly summaries, e.g.
// "ORPHANED TESTS" for the section of tests severed from their checks.
SummaryTitle string
// SummaryNote renders pre-styled lines directly beneath the heading, before
// the test rows -- used to explain why a section exists (e.g. the orphan
// warning). Subject to the same height budget as the rest of the summary.
SummaryNote []string
OnFocusSpan func(*dagui.Span)
// RequestLogs lazily fetches a span's logs when this view renders them, so a
// failing test case's rolled-up output is fetched only when its summary is
// actually on screen (the interactive lazy path) -- not eagerly for every
// failure in the trace. nil for live runs / when no provider is set.
RequestLogs func(dagui.SpanID)
// ForceInteractive keeps fullscreen tests interactive while Tuist focus is on
// a descendant in the detail pane. Embedded test views remain passive through
// ListOnly.
ForceInteractive bool
// contains filtered or unexported fields
}
func (*TestView) CurrentActionSpan ¶ added in v0.21.0
func (*TestView) CurrentActionTitle ¶ added in v0.21.0
func (tv *TestView) CurrentActionTitle() (string, dagui.TestCategory, bool)
func (*TestView) FocusedNode ¶ added in v0.21.0
func (*TestView) FocusedNodeCanFocusDetail ¶ added in v0.21.0
func (*TestView) FocusedPassedGroupExpanded ¶ added in v0.21.0
func (*TestView) FocusedSpan ¶ added in v0.21.0
func (*TestView) OnDismount ¶ added in v0.21.0
func (tv *TestView) OnDismount()
func (*TestView) SetFocused ¶ added in v0.21.0
func (*TestView) ToggleFocusedGroup ¶ added in v0.21.0
type TraceFrontend ¶
type TraceFrontend interface {
// SetTraceID lets the frontend point surfaced failure logs at
// 'dagger cloud logs <trace> <span>' for the full output.
SetTraceID(string)
// ImportSnapshots folds Cloud span snapshots (carrying ChildCount and
// Partial, which OTLP drops) into the frontend's DB.
ImportSnapshots([]dagui.SpanSnapshot)
// SetLogProvider/SetSpanProvider register the lazy fetchers fired when a
// span is expanded or a failure is surfaced.
SetLogProvider(func(id dagui.SpanID, descendants bool))
SetSpanProvider(func(id dagui.SpanID))
// SurfacedFailedCheckSpans lists the failed checks' spans (plus their
// error origins and links) whose subtrees the report needs prefetched.
SurfacedFailedCheckSpans() []dagui.SpanID
// RequestSurfacedLogs makes the frontend request logs for the failures it
// surfaces, so a single final report render includes their detail.
RequestSurfacedLogs()
// SetFetchWaiter lets the console block a request on in-flight fetches.
SetFetchWaiter(func())
// SetCIContext records the trace's source commit so the report can
// suggest commit-scoped re-run commands.
SetCIContext(commit string, isNativeCI bool)
// ResolveSpanTarget resolves a --check/--test name against the loaded
// view, matching the selection rules the report rendered with.
ResolveSpanTarget(check, test string) (dagui.SpanID, bool)
// ZoomToSpan scopes the view to a span; RequestZoomLogs fetches the
// logs the zoomed report will render.
ZoomToSpan(dagui.SpanID)
RequestZoomLogs(id dagui.SpanID, descendants bool)
}
TraceFrontend is the optional interface 'dagger trace' drives for incremental loading and report zooming: snapshot import, lazy span/log providers, surfaced-failure prefetch, and name-based zoom targets. Only the pretty frontend implements it; other frontends receive a plain OTLP span/log stream instead.
type Vterm ¶ added in v0.9.9
type Vterm struct {
Offset int
Height int
Width int
Prefix string
Profile termenv.Profile
// Search highlight state. When SearchQuery is non-empty, matching
// substrings in rendered lines are highlighted. SearchCurrentRow
// is the vterm row index of the "current" match (-1 for none),
// which gets a brighter highlight.
SearchQuery string
SearchCurrentRow int
// contains filtered or unexported fields
}
func (*Vterm) LastLine ¶ added in v0.9.9
LastLine returns the last line of visible text, with ANSI formatting, but without any trailing whitespace.
func (*Vterm) PrintRaw ¶ added in v0.21.0
PrintRaw prints the bytes written to the log terminal without applying any terminal wrapping or markdown rendering.
func (*Vterm) Render ¶ added in v0.9.9
Render writes the output for the given region of the terminal, with ANSI formatting. Search highlights are rendered natively by midterm.
func (*Vterm) ScrollPage ¶ added in v0.21.0
func (*Vterm) ScrollPercent ¶ added in v0.9.9
func (*Vterm) ScrollToBottom ¶ added in v0.21.0
func (term *Vterm) ScrollToBottom()
func (*Vterm) ScrollToRow ¶ added in v0.20.2
ScrollToRow scrolls the viewport so that the given row is centered (or as close as possible) within the visible area.
func (*Vterm) ScrollToTop ¶ added in v0.21.0
func (term *Vterm) ScrollToTop()
func (*Vterm) SetSearchHighlight ¶ added in v0.20.2
SetSearchHighlight sets the search highlight state using native midterm search. Pass an empty query to clear highlights. currentRow is the vterm row of the "current" match (-1 if none in this vterm).
Always re-runs the search so that new content is picked up.
func (*Vterm) UsedHeight ¶ added in v0.9.9
type WithDirectoryArgs ¶ added in v0.19.7
WithDirectoryArgs represents the arguments for withMountedDirectory calls
func (WithDirectoryArgs) Render ¶ added in v0.19.7
func (a WithDirectoryArgs) Render(out TermOutput) (string, []string, bool)
type WithEnvVariableArgs ¶ added in v0.19.7
WithEnvVariableArgs represents the arguments for withEnvVariable calls
func (WithEnvVariableArgs) Render ¶ added in v0.19.7
func (a WithEnvVariableArgs) Render(out TermOutput) (string, []string, bool)
type WithExecArgs ¶ added in v0.19.7
type WithExecArgs struct {
Args []string `json:"args"`
}
WithExecArgs represents the arguments for withExec calls
func (WithExecArgs) Render ¶ added in v0.19.7
func (a WithExecArgs) Render(out TermOutput) (string, []string, bool)
type WithFileArgs ¶ added in v0.19.7
WithFileArgs represents the arguments for withFile calls
func (WithFileArgs) Render ¶ added in v0.19.7
func (a WithFileArgs) Render(out TermOutput) (string, []string, bool)
type WithMountedDirectoryArgs ¶ added in v0.19.7
WithMountedDirectoryArgs represents the arguments for withMountedDirectory calls
func (WithMountedDirectoryArgs) Render ¶ added in v0.19.7
func (a WithMountedDirectoryArgs) Render(out TermOutput) (string, []string, bool)
type WithMountedFileArgs ¶ added in v0.19.7
WithMountedFileArgs represents the arguments for withMountedFile calls
func (WithMountedFileArgs) Render ¶ added in v0.19.7
func (a WithMountedFileArgs) Render(out TermOutput) (string, []string, bool)
type WithNewFileArgs ¶ added in v0.19.7
func (WithNewFileArgs) Render ¶ added in v0.19.7
func (a WithNewFileArgs) Render(out TermOutput) (string, []string, bool)
type WithUserArgs ¶ added in v0.19.7
type WithUserArgs struct {
Name string `json:"name"`
}
WithUserArgs represents the arguments for withUser calls
func (WithUserArgs) Render ¶ added in v0.19.7
func (a WithUserArgs) Render(out TermOutput) (string, []string, bool)
type WithWorkdirArgs ¶ added in v0.19.7
type WithWorkdirArgs struct {
Path string `json:"path"`
}
WithWorkdirArgs represents the arguments for withWorkdir calls
func (WithWorkdirArgs) Render ¶ added in v0.19.7
func (a WithWorkdirArgs) Render(out TermOutput) (string, []string, bool)
Source Files
¶
- checks_report.go
- chroma.go
- diff.go
- error_label.go
- exit.go
- frontend.go
- frontend_claims.go
- frontend_console.go
- frontend_dots.go
- frontend_log_pager.go
- frontend_logs.go
- frontend_logs_view.go
- frontend_mock.go
- frontend_plain.go
- frontend_pretty.go
- frontend_streaming_logs.go
- frontend_test_summary_logs.go
- frontend_tests.go
- frontend_trace_policy.go
- generate_report.go
- highlight.go
- huh.go
- keymap.go
- notification.go
- output.go
- partialjson.go
- patch.go
- queued_message.go
- rave.go
- render_dsl.go
- search.go
- statusline.go
- symbols.go
- sys_unix.go
- toolargs.go
- toolargs_render.go
- vterm.go
- vterm_lite.go