[ax] Extract TerminalDetector helper for TTY detection - #8458
Merged
Conversation
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.
Why
TTY detection was inlined in three places, each hand-rolling
stream_isatty(...):ConfigurationFactory(progress bar off on non-TTY, [ax] Disable progress bar when output is not a TTY #8444)SymfonyStyleFactory(no ANSI on non-TTY, [ax] Never emit ANSI when output is not a TTY, even with --ansi #8453)ConfigInitializer(no config prompt on non-TTY, [ax] Do not prompt or auto-create config on non-TTY #8454)As Rector grows more agent-aware, this check needs one home.
What
New
Rector\Agentic\TerminalDetectorwith two static checks:The three call sites now use it. Behavior is unchanged - static, matching the existing
StaticPHPUnitEnvironmentutility pattern, sinceSymfonyStyleFactoryis built manually at bootstrap (no container).New
src/Agentic/namespace is the home for agent-oriented helpers going forward.Verification
--ansirun still emits 0 ANSI escapes; non-TTY still skips the config prompt.composer check-cs,composer phpstanclean.