on main help sign in
feat: allow to disable indeterminate progress bar (#2048)
c0a8c7eCarlos Alexandro Becker
internal/app/app.go+5−2
@@ -152,6 +152,7 @@ func (app *App) RunNonInteractive(ctx context.Context, output io.Writer, prompt,
152 stdoutTTY bool
152 stdoutTTY bool
153 stderrTTY bool
153 stderrTTY bool
154 stdinTTY bool
154 stdinTTY bool
155+ progress bool
155 )
156 )
156
157
157 if f, ok := output.(*os.File); ok {
158 if f, ok := output.(*os.File); ok {
@@ -160,6 +161,8 @@ func (app *App) RunNonInteractive(ctx context.Context, output io.Writer, prompt,
160 stderrTTY = term.IsTerminal(os.Stderr.Fd())
161 stderrTTY = term.IsTerminal(os.Stderr.Fd())
161 stdinTTY = term.IsTerminal(os.Stdin.Fd())
162 stdinTTY = term.IsTerminal(os.Stdin.Fd())
162
163
164+ progress = app.config.Options.Progress == nil || *app.config.Options.Progress
165+
163 if !quiet && stderrTTY {
166 if !quiet && stderrTTY {
164 t := styles.CurrentTheme()
167 t := styles.CurrentTheme()
165
168
@@ -244,7 +247,7 @@ func (app *App) RunNonInteractive(ctx context.Context, output io.Writer, prompt,
244 messageReadBytes := make(map[string]int)
247 messageReadBytes := make(map[string]int)
245
248
246 defer func() {
249 defer func() {
247− if stderrTTY {
250+ if progress && stderrTTY {
248 _, _ = fmt.Fprintf(os.Stderr, ansi.ResetProgressBar)
251 _, _ = fmt.Fprintf(os.Stderr, ansi.ResetProgressBar)
249 }
252 }
250
253
@@ -254,7 +257,7 @@ func (app *App) RunNonInteractive(ctx context.Context, output io.Writer, prompt,
254 }()
257 }()
255
258
256 for {
259 for {
257− if stderrTTY {
260+ if progress && stderrTTY {
258 // HACK: Reinitialize the terminal progress bar on every iteration
261 // HACK: Reinitialize the terminal progress bar on every iteration
259 // so it doesn't get hidden by the terminal due to inactivity.
262 // so it doesn't get hidden by the terminal due to inactivity.
260 _, _ = fmt.Fprintf(os.Stderr, ansi.SetIndeterminateProgressBar)
263 _, _ = fmt.Fprintf(os.Stderr, ansi.SetIndeterminateProgressBar)
internal/config/config.go+2−1
@@ -257,7 +257,8 @@ type Options struct {
257 Attribution *Attribution `json:"attribution,omitempty" jsonschema:"description=Attribution settings for generated content"`
257 Attribution *Attribution `json:"attribution,omitempty" jsonschema:"description=Attribution settings for generated content"`
258 DisableMetrics bool `json:"disable_metrics,omitempty" jsonschema:"description=Disable sending metrics,default=false"`
258 DisableMetrics bool `json:"disable_metrics,omitempty" jsonschema:"description=Disable sending metrics,default=false"`
259 InitializeAs string `json:"initialize_as,omitempty" jsonschema:"description=Name of the context file to create/update during project initialization,default=AGENTS.md,example=AGENTS.md,example=CRUSH.md,example=CLAUDE.md,example=docs/LLMs.md"`
259 InitializeAs string `json:"initialize_as,omitempty" jsonschema:"description=Name of the context file to create/update during project initialization,default=AGENTS.md,example=AGENTS.md,example=CRUSH.md,example=CLAUDE.md,example=docs/LLMs.md"`
260− AutoLSP *bool `json:"auto_lsp,omitempty" jsonschema:"description=Automatically setup LSPs based on root markers"`
260+ AutoLSP *bool `json:"auto_lsp,omitempty" jsonschema:"description=Automatically setup LSPs based on root markers,default=true"`
261+ Progress *bool `json:"progress,omitempty" jsonschema:"description=Show indeterminate progress updates during long operations,default=true"`
261}
262}
262
263
263type MCPs map[string]MCPConfig
264type MCPs map[string]MCPConfig
internal/ui/model/ui.go+6−2
@@ -144,7 +144,8 @@ type UI struct {
144
144
145 // sendProgressBar instructs the TUI to send progress bar updates to the
145 // sendProgressBar instructs the TUI to send progress bar updates to the
146 // terminal.
146 // terminal.
147− sendProgressBar bool
147+ sendProgressBar bool
148+ progressBarEnabled bool
148
149
149 // caps hold different terminal capabilities that we query for.
150 // caps hold different terminal capabilities that we query for.
150 caps common.Capabilities
151 caps common.Capabilities
@@ -295,6 +296,9 @@ func New(com *common.Common) *UI {
295 // set initial state
296 // set initial state
296 ui.setState(desiredState, desiredFocus)
297 ui.setState(desiredState, desiredFocus)
297
298
299+ // disable indeterminate progress bar
300+ ui.progressBarEnabled = com.Config().Options.Progress == nil || *com.Config().Options.Progress
301+
298 return ui
302 return ui
299}
303}
300
304
@@ -1854,7 +1858,7 @@ func (m *UI) View() tea.View {
1854 content = strings.Join(contentLines, "\n")
1858 content = strings.Join(contentLines, "\n")
1855
1859
1856 v.Content = content
1860 v.Content = content
1857− if m.sendProgressBar && m.isAgentBusy() {
1861+ if m.progressBarEnabled && m.sendProgressBar && m.isAgentBusy() {
1858 // HACK: use a random percentage to prevent ghostty from hiding it
1862 // HACK: use a random percentage to prevent ghostty from hiding it
1859 // after a timeout.
1863 // after a timeout.
1860 v.ProgressBar = tea.NewProgressBar(tea.ProgressBarIndeterminate, rand.Intn(100))
1864 v.ProgressBar = tea.NewProgressBar(tea.ProgressBarIndeterminate, rand.Intn(100))