Skip to content

Conversation

@panwalas
Copy link

Fixes #65

Changes

  • Added output capture for all pdd sync operations using redirect_stdout/redirect_stderr
  • Created _display_operation_output() to display captured output after each operation
  • Output is shown with clear section headers for STDOUT/STDERR
  • Animation pauses during output display and resumes after
  • Respects --quiet flag to suppress output when needed

Implementation Details

  • Uses Python's io.StringIO() and contextlib.redirect_stdout/stderr
  • Temporarily pauses animation thread using stop_event
  • Rich Console for formatted output display
  • All operations wrapped: auto-deps, generate, example, crash, verify, test, fix, update

Testing

  • Added 7 comprehensive tests in test_sync_orchestration.py
  • All 30 tests in test suite pass
  • Tested with pytest --cov for coverage verification
  • Tests cover: basic functionality, quiet mode, empty output, integration with operations, and failure scenarios

Swapnil Panwala added 4 commits November 18, 2025 16:01
Previously, pdd sync hid all interactive prompts and error messages
because the animation used screen=True mode which created an alternate
screen that captured all output. This made debugging difficult as users
could not see what was happening during operations.

Changes:
- Added output capture using io.StringIO and redirect_stdout/stderr
- Created _display_operation_output() function to show captured output
- Wrapped all 7 operations (auto-deps, generate, example, crash, verify,
  test, fix, update) with output capture and display
- Animation temporarily pauses to show output, then resumes
- Output displayed in formatted Rich panels (green for STDOUT, red for STDERR)
- Clear operation headers and footers for better readability

Benefits:
- Users can now see detailed command output during sync
- Error messages are visible for debugging
- Interactive prompts are no longer hidden
- Separate sections for STDOUT and STDERR when present
- Animation still provides nice visual progress feedback

Fixes promptdriven#65
Long file paths and output were breaking panel layout with expand=False.
Changed to expand=True so panels use full terminal width and wrap text
properly for better readability.
Removed Rich Panel wrapper for stdout/stderr display to avoid
nested formatting conflicts. The output now uses simple headers
with raw content printing, which:
- Avoids broken nested box characters
- Preserves original Rich formatting from operations
- Provides cleaner, more readable output
- Reduces pause time from 1.0s to 0.5s for better UX

Also removed unused Panel import.
…tdriven#65)

- Add unit tests for _display_operation_output function
  * Test basic stdout/stderr display functionality
  * Test quiet flag is respected
  * Test empty output is handled gracefully

- Add integration tests for output capture
  * Test output capture works during operations
  * Test operation success detection is preserved
  * Test quiet mode suppresses output throughout workflow
  * Test output is displayed even when operations fail

All tests pass successfully (30 tests in test_sync_orchestration.py)
@gltanaka gltanaka requested review from Copilot November 19, 2025 02:50
Copy link
Contributor

Copilot AI left a 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 implements output capture and display functionality for PDD sync operations to address issue #65. The changes enable users to see stdout/stderr from operations like generate, test, and fix, which were previously hidden during the animated sync process.

Key Changes:

  • Added _display_operation_output() function to pause animation and display captured output with formatted headers
  • Wrapped all 8 sync operations (auto-deps, generate, example, crash, verify, test, fix, update) with stdout/stderr capture using io.StringIO and context managers
  • Output display respects the --quiet flag and resumes animation after showing results

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pdd/sync_orchestration.py Added output capture infrastructure and wrapped all sync operations with stdout/stderr redirection
tests/test_sync_orchestration.py Added 7 comprehensive tests covering basic functionality, quiet mode, empty output, integration scenarios, and failure cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# Signal animation to pause
stop_event.set()
time.sleep(0.3) # Give animation time to clean up
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 0.3 should be documented or extracted to a constant explaining why this specific duration is needed for animation cleanup.

Copilot uses AI. Check for mistakes.
console.print(f"{'='*80}\n")

# Small pause so user can see the output
time.sleep(0.5) # Reduced from 1.0s
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment 'Reduced from 1.0s' implies this was changed but doesn't explain why 0.5s is the appropriate value. Consider documenting the rationale or extracting to a named constant.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

Right now pdd sync hides all the messages and interactive prompts. Modify this so that it shows the stdout/error messages at the bottom

2 participants