Add interactive terminal detection to setup wizard#196
Conversation
The setup wizard crashed with "EPERM: operation not permitted, read fd: 0" when running in non-interactive environments (containers, piped input, etc). Root cause: readline was created with `terminal: true` unconditionally, which fails when stdin is not a TTY in Bun runtime. Changes: - Add `isInteractiveTerminal()` function to detect TTY availability - Check for TTY at start of setup wizard with helpful error message - Use `terminal: process.stdin.isTTY ?? false` in readline creation - Add tests for non-TTY scenario detection Fixes #167
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #196 +/- ##
=======================================
Coverage 44.91% 44.91%
=======================================
Files 76 76
Lines 22077 22091 +14
=======================================
+ Hits 9915 9923 +8
- Misses 12162 12168 +6
🚀 New features to boost your workflow:
|
…IQcgA Add interactive terminal detection to setup wizard
Summary
Add TTY detection to the setup wizard to provide a better user experience when running in non-interactive environments (containers, CI/CD, piped input). The wizard now checks if it's running in an interactive terminal and fails gracefully with a helpful error message if not.
Changes
isInteractiveTerminal()inprompts.ts: Detects if both stdin and stdout are TTYsterminal: trueto use actual TTY detection (process.stdin.isTTY ?? false)runSetupWizard()that returns a helpful error message when not in an interactive terminal, including guidance on manual configurationprompts.test.tsfor TTY detection functionwizard.test.tsvalidating the non-interactive terminal error pathisInteractiveTerminal()functionImplementation Details
isInteractiveTerminal()function usesBoolean()to safely convert the TTY check result to a boolean.ralph-tui/config.tomlmockIsInteractiveTerminaltotrueby default to maintain existing test behavior