feat: TTY detection and fail-fast for non-interactive mode#31
Merged
Conversation
Introduce internal/ui/tty.go with IsInteractive() and ErrNotInteractive so all interactive prompts fail fast with helpful error messages when stdin is not a terminal, preventing hangs in LLM/CI/pipe contexts. Guarded functions: SelectTarget, SelectSessions, ConfirmRevocation, SelectGroup, uiUnifiedSelector.SelectItem, surveyNamePrompter.PromptName. Promoted go-isatty v0.0.20 from indirect to direct dependency.
This was referenced Feb 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/ui/tty.gowithIsTerminalFunc,IsInteractive(), andErrNotInteractiveusinggo-isattySelectTarget,SelectSessions,ConfirmRevocation,SelectGroup,uiUnifiedSelector.SelectItem,surveyNamePrompter.PromptName) with TTY checks--target/--role,--all,--yes,--group,--favorite)go-isattyv0.0.20 from indirect to direct dependencyMotivation
Prevents the CLI from hanging on interactive prompts when stdin isn't a TTY (pipes, CI, LLM agents). Instead, the CLI fails fast with actionable guidance.
Test plan
TestIsInteractive_WhenTerminal/TestIsInteractive_WhenNotTerminal— unit tests for TTY detectionTestSelectTarget_NonTTY— verifiesErrNotInteractivewith--targetsuggestionTestSelectSessions_NonTTY— verifiesErrNotInteractivewith--allsuggestionTestConfirmRevocation_NonTTY— verifiesErrNotInteractivewith--yessuggestionTestSelectGroup_NonTTY— verifiesErrNotInteractivewith--groupsuggestionTestUnifiedSelector_NonTTY— verifiesErrNotInteractivewith--target/--role,--group,--favoritesuggestionsTestSurveyNamePrompter_NonTTY— verifiesErrNotInteractivewith argument suggestionmake test)make lint)