-
Notifications
You must be signed in to change notification settings - Fork 2
🎨 Palette: Add helpful feedback when CLI waits for stdin #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
🎨 Palette: Add helpful feedback when CLI waits for stdin #287
Conversation
- Detects interactive TTY sessions and prints a helpful message to stderr when the command is waiting for input. - Prevents user confusion when running commands without arguments or pipes. - Adds test case to verify the behavior (mocking isTTY).
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Detects interactive TTY sessions and prints a helpful message to stderr when the command is waiting for input. - Prevents user confusion when running commands without arguments or pipes. - Adds test case to verify the behavior (mocking isTTY). - Handles platform-specific EOF instructions (Ctrl+Z for Windows, Ctrl+D for others). - Verifies macOS behavior via specific test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves the CLI user experience by adding a helpful message when the CLI waits for standard input in an interactive TTY session. Users running commands like unipept pept2lca interactively will now see clear feedback instead of thinking the command has hung.
Changes:
- Added TTY detection and informative message when reading from stdin in interactive mode
- Added comprehensive test coverage for the new functionality including platform-specific EOF key instructions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/commands/unipept/unipept_subcommand.ts | Added TTY detection and user-friendly message with platform-specific EOF key instructions when reading from stdin |
| tests/commands/unipept/unipept_subcommand.test.ts | Added comprehensive tests for TTY message display across different platforms (Windows, Linux, macOS) and ensured no message appears for piped input |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Mock process.stderr.write | ||
| const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true); | ||
|
|
||
| const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable input.
|
|
||
| const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true); | ||
|
|
||
| const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable input.
|
|
||
| const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true); | ||
|
|
||
| const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable input.
|
|
||
| const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true); | ||
|
|
||
| const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable input.
| // Mock process.stderr.write | ||
| const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true); | ||
|
|
||
| const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable input.
- Detects interactive TTY sessions and prints a helpful message to stderr when the command is waiting for input. - Prevents user confusion when running commands without arguments or pipes. - Adds test case to verify the behavior (mocking isTTY). - Handles platform-specific EOF instructions (Ctrl+Z for Windows, Ctrl+D for others). - Verifies macOS behavior via specific test case. - Ensures all tests pass linting (no unused variables).
💡 What: Added a "Reading from standard input..." message when the CLI detects an interactive TTY session but no arguments or file input were provided.
🎯 Why: Users running commands interactively (e.g.,
unipept pept2lca) often think the command has hung because it silently waits for stdin. This provides immediate feedback.📸 Before: Command hangs silently.
📸 After: Command prints "> Reading from standard input... (Press Ctrl+D to finish)" to stderr.
♿ Accessibility: Improves usability for CLI users by clarifying the application state.
PR created automatically by Jules for task 3904062231665737540 started by @bmesuere