Skip to content

Quiet mode. A --quiet option to get only the AI output in a non-interactive way #2529

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

omansour
Copy link

@omansour omansour commented Aug 8, 2025

--quiet / -q option to be like a --non-interactive option with only the AI output

⚠️ diff are long, but i cant figure another way to achieve this feature

SCR-20250808-nyva SCR-20250808-nztn

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@omansour omansour marked this pull request as ready for review August 8, 2025 13:53
Olivier Mansour added 4 commits August 11, 2025 16:06
Add comprehensive quiet mode support that suppresses all UI elements
while preserving AI responses and tool outputs for automation use cases.

Changes:
- Add --quiet/-q flag that implies --no-interactive
- Suppress welcome banner, tips, shortcuts, and separators
- Suppress model information and trust messages
- Suppress tool execution UI (headers, completion messages, descriptions)
- Suppress response prefix ('> ')
- Suppress MCP/agent loading messages
- Suppress tool UI feedback messages

The --quiet flag enables clean output suitable for:
- Scripting and automation
- CI/CD pipelines
- Programmatic consumption
- Integration with other tools

Only AI responses and actual tool outputs are displayed in quiet mode.
Add comprehensive test coverage for the quiet mode feature:

- Add test_quiet_mode_suppresses_ui_elements() integration test
- Verify ChatSession creation with quiet=true parameter
- Ensure quiet flag properly implies non-interactive mode
- Update all existing ChatSession::new calls with quiet parameter
- Fix ChatArgs initializations in CLI parsing tests

The integration test validates that:
- Quiet mode can be enabled during session creation
- The quiet flag is correctly stored in the session
- Non-interactive behavior is automatically enabled

All existing tests continue to pass, ensuring no regression
in current functionality while adding test coverage for the
new --quiet flag feature.
- Suppress spinner cleanup operations in quiet mode
- Suppress cursor operations and terminal clearing
- Suppress notification bells and color resets to stderr
- Suppress newlines during tool execution flow
- Force disable markdown rendering to eliminate ANSI codes
- Maintain complete response output and proper termination

Result: Clean, minimal output perfect for scripting and automation
- Suppress spinner cleanup operations in quiet mode
- Suppress cursor operations and terminal clearing
- Suppress notification bells and color resets to stderr
- Suppress tool execution UI elements (tool messages, continuation lines)
- Suppress startup warnings (profile deprecation, MCP safety, trust-tools)
- Suppress input handling newline in quiet mode
- Force disable markdown rendering to eliminate ANSI codes
- Maintain complete response output and proper termination

Result: Clean, minimal output for scripting and automation
- Regular chat: No blank lines
- Tool execution: Reduced from 4+ blank lines to 1 blank line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant