Skip to content

[ax] Extract TerminalDetector helper for TTY detection - #8458

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-agentic-terminal-detector
Sep 4, 2026
Merged

[ax] Extract TerminalDetector helper for TTY detection#8458
TomasVotruba merged 1 commit into
mainfrom
tv-agentic-terminal-detector

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Why

TTY detection was inlined in three places, each hand-rolling stream_isatty(...):

As Rector grows more agent-aware, this check needs one home.

What

New Rector\Agentic\TerminalDetector with two static checks:

TerminalDetector::isOutputTty(); // STDOUT - progress bar, ANSI
TerminalDetector::isInputTty();  // STDIN  - interactive prompts

The three call sites now use it. Behavior is unchanged - static, matching the existing StaticPHPUnitEnvironment utility pattern, since SymfonyStyleFactory is built manually at bootstrap (no container).

New src/Agentic/ namespace is the home for agent-oriented helpers going forward.

Verification

  • Piped --ansi run still emits 0 ANSI escapes; non-TTY still skips the config prompt.
  • composer check-cs, composer phpstan clean.

@TomasVotruba
TomasVotruba merged commit ba5c25c into main Sep 4, 2026
43 checks passed
@TomasVotruba
TomasVotruba deleted the tv-agentic-terminal-detector branch September 4, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant