You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
output: add Bubble Tea spinner for wait polling (PRINFRA-140) (#39)
## Description
Adds an animated bubbletea spinner on stderr during `--wait` polling in `--human` mode. Replaces the plain text `Polling: status=processing (elapsed 12s)` lines with an in-place updating spinner.
**What it looks like:**
```
⠹ Processing... (12s)
```
The spinner character animates, elapsed time ticks up, and status text updates when the API reports a transition (e.g., `Pending...` → `Processing...`). On completion, the spinner line is cleared before the result renders to stdout.
**Colors:** Spinner character uses HeyGen brand purple (`#7559FF` from design tokens). Elapsed time uses dim gray (matching `hintStyle` in HumanFormatter).
**Behavior by mode:**
- `--human` + terminal stderr → animated spinner
- `--human` + piped stderr → plain text fallback (bubbletea can't render in-place without a TTY)
- JSON mode (default) → silent stderr (unchanged)
**TTY detection:** `isTerminal()` checks if stderr is a real terminal via `term.IsTerminal`. Tests use `bytes.Buffer` (non-TTY), so they automatically get the plain text fallback with no test changes needed.
**Lifecycle:** Spinner starts before `ExecuteAndPoll`, stops immediately after it returns (before any error handling or result rendering). `Stop()` uses `sync.Once` for safe double-call. Quit clears the terminal line via `\r\033[2K`.
Stacked on PR #38 (video download).
Linear: PRINFRA-140
## Testing
3 spinner model unit tests: view includes status and elapsed time, quit clears line, status humanization (`in_progress` → `In progress...`).
1 builder integration test: `--wait --human` with non-TTY stderr verifies plain text fallback (progress lines emitted, human-formatted stdout).
All tests use `httptest.Server` — no real API calls.
0 commit comments