Conversation
- Invert TTY detection logic to run action directly when no TTY available - Add comprehensive test coverage for SpinWhile function - Prevents crashes in CI/CD and non-interactive environments Fixes logic from PR #499 Amp-Thread: https://ampcode.com/threads/T-c5d06564-9dec-49ca-9134-0733756f1e98 Co-authored-by: Amp <amp@ampcode.com>
- Invert TTY detection logic to run action directly when no TTY available - Add comprehensive test coverage for SpinWhile function - Prevents crashes in CI/CD and non-interactive environments Fixes logic from PR #499 Amp-Thread: https://ampcode.com/threads/T-c5d06564-9dec-49ca-9134-0733756f1e98 Co-authored-by: Amp <amp@ampcode.com>
- Replace spinner.New() calls in 13 files across the codebase - All spinners now use SpinWhile for TTY-aware behavior - Add comprehensive test coverage for TTY/non-TTY scenarios - Ensures CLI works reliably in both interactive and automated environments - Follows patterns from PR #499 for consistent spinner behavior Files updated: - pkg/cmd/job/retry.go - pkg/cmd/build/rebuild.go - pkg/cmd/build/cancel.go - pkg/cmd/build/view.go - pkg/cmd/build/new.go - pkg/cmd/agent/view.go - pkg/cmd/artifacts/download.go - pkg/cmd/build/download.go - pkg/cmd/artifacts/list.go - pkg/cmd/job/unblock.go - pkg/cmd/pipeline/create.go - pkg/cmd/cluster/view.go - internal/pipeline/resolver/repository.go - internal/io/spinner_test.go (enhanced test coverage) Amp-Thread: https://ampcode.com/threads/T-69a131f0-814d-4d1d-b0fc-f7f61f34b1a6 Co-authored-by: Amp <amp@ampcode.com>
|
@sj26 this looks good, did you want to rebase so we can merge in your PR? |
- Replace spinner.New() calls in 13 files across the codebase - All spinners now use SpinWhile for TTY-aware behavior - Add comprehensive test coverage for TTY/non-TTY scenarios - Ensures CLI works reliably in both interactive and automated environments - Follows patterns from PR #499 for consistent spinner behavior Files updated: - pkg/cmd/job/retry.go - pkg/cmd/build/rebuild.go - pkg/cmd/build/cancel.go - pkg/cmd/build/view.go - pkg/cmd/build/new.go - pkg/cmd/agent/view.go - pkg/cmd/artifacts/download.go - pkg/cmd/build/download.go - pkg/cmd/artifacts/list.go - pkg/cmd/job/unblock.go - pkg/cmd/pipeline/create.go - pkg/cmd/cluster/view.go - internal/pipeline/resolver/repository.go - internal/io/spinner_test.go (enhanced test coverage) Amp-Thread: https://ampcode.com/threads/T-69a131f0-814d-4d1d-b0fc-f7f61f34b1a6 Co-authored-by: Amp <amp@ampcode.com>
- Fix SpinWhile logic to properly handle non-TTY environments - Add TTY detection to Confirm and PromptForOne functions - Replace all spinner.New() calls with TTY-aware SpinWhile() calls - Add non-TTY fallback for agent stop command using direct API calls - Add comprehensive test coverage for TTY/non-TTY behavior - All spinner operations now gracefully degrade when no TTY is available Fixes #496 Amp-Thread: https://ampcode.com/threads/T-04774b89-5ae4-4839-830d-67c16e65acb6 Co-authored-by: Amp <amp@ampcode.com>
- Fix HasDataAvailable to use Len() instead of Size() for strings.Reader - Restructure agent stop command to check TTY before consuming stdin - Split agent stop logic into separate interactive/non-interactive functions - Fix error output destination to match test expectations All tests now pass including agent stop command tests. Amp-Thread: https://ampcode.com/threads/T-04774b89-5ae4-4839-830d-67c16e65acb6 Co-authored-by: Amp <amp@ampcode.com>
|
I've rebased this, but I think it needs a little bit more. I like the idea of making non-interaction confirmations reject by default, then adding a And the selection thingo and stop interactive/non-interactive also feels odd. Feels like when we need tty and no-tty versions we need a little abstraction, like SpinWhile, which does something sensible and intention-based in both scenarios. |
|
Oh man, I missed that it already has |
|
Extracted another little bit - just the clearer message when unconfirmed: #503 |
|
I'm pretty sure this has been handled with the migration to Kong, so I'll close this. Feel free to re-open or raise an issue if that's not the case. |
I prompted Amp to remove the dependency on the TTY from the CLI. It's done a reasonable job!
It fixed a bug from my attempt to make spinners work out of TTY: #409
I'm not sold on its decision to always confirm in non-TTY. I think apt style "-y" which fails without confirmation by default might be better.
I also don't think it's done enough testing. But it's a great starting point!
Amp:
Fixes #496
Amp-Thread: https://ampcode.com/threads/T-04774b89-5ae4-4839-830d-67c16e65acb6