MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / NewProgram

Function NewProgram

internal/ui/program.go:194–205  ·  view source on GitHub ↗

NewProgram builds the Bubble Tea program. Wire the returned program to a Confirm callback and a stdout-pipe forwarder before calling Run. Pass nil for usageFunc to omit the token-usage line on the status bar. We capture the terminal width here, before main.go redirects os.Stdout to the alt-screen p

(runner AgentRunner, usageFunc UsageFunc)

Source from the content-addressed store, hash-verified

192// zero, which is too late for the banner animation to detect "this
193// terminal can render the wide wordmark."
194func NewProgram(runner AgentRunner, usageFunc UsageFunc) *tea.Program {
195 width := TermWidth()
196 banner := BannerText(width)
197 m := newHarness(runner, usageFunc, banner)
198 m.usageFunc = usageFunc
199 m.bannerWidth = width
200 return tea.NewProgram(
201 m,
202 tea.WithAltScreen(),
203 tea.WithMouseAllMotion(),
204 )
205}
206
207func (m harness) Init() tea.Cmd {
208 // Animate the banner only when the wide variant is in play; the narrow

Callers 1

mainFunction · 0.92

Calls 3

TermWidthFunction · 0.85
BannerTextFunction · 0.85
newHarnessFunction · 0.85

Tested by

no test coverage detected