feat(vars): add interactive prompting for required variables by vmaerten · Pull Request #2579 · go-task/task

@vmaerten marked this pull request as ready for review

December 14, 2025 16:47

andreynering

Add support for interactive variable prompting using Bubble Tea.
Variables can be marked as `interactive: true` in the requires section,
and users will be prompted to enter values for missing variables when
running in a TTY.

Features:
- New `interactive` field on required variables
- Bubble Tea-based text input and select prompts
- --no-tty flag to disable interactive prompts
- Automatic skip when variable is already set

@vmaerten

@vmaerten

@vmaerten

@vmaerten

- Add SyncWriter to synchronize stdout/stderr writes with prompts
- Add promptMutex to serialize interactive prompts
- Keep rawStdout/rawStderr for BubbleTea to avoid deadlock
- Update test Taskfile with nested deps scenario
- Add collectAllRequiredVars to traverse dep tree and find missing vars
- Add promptForAllVars to prompt for all vars at once
- Store prompted vars on Executor and inject into all RunTask calls
- Remove redundant GetTask call in collectAllRequiredVars
- Make SyncWriter conditional on TTY presence

@vmaerten

@vmaerten

@vmaerten

@vmaerten

@vmaerten

@vmaerten

@vmaerten

@vmaerten

@vmaerten

Update Charm libraries to v2:
- charm.land/bubbletea/v2 v2.0.0-rc.2
- charm.land/bubbles/v2 v2.0.0-rc.1
- charm.land/lipgloss/v2 v2.0.0-beta.3

Adapt code to v2 API changes:
- tea.KeyMsg → tea.KeyPressMsg with msg.Keystroke()
- View() string → View() tea.View with tea.NewView()
- ti.Width field → ti.SetWidth() method
- ti.Focus() moved to Init() returning tea.Cmd

@vmaerten

@vmaerten

andreynering

vmaerten added a commit that referenced this pull request

Jan 22, 2026

Copilot AI pushed a commit to libor-m/task that referenced this pull request

Mar 27, 2026
…#2579)

Co-authored-by: libor-m <1497769+libor-m@users.noreply.github.com>

Copilot AI pushed a commit to libor-m/task that referenced this pull request

Mar 27, 2026
Co-authored-by: libor-m <1497769+libor-m@users.noreply.github.com>