Skip to content

feat(cli): add --stdout flag to output export to stdout#142

Merged
agavra merged 1 commit intoagavra:mainfrom
keymon:feature/stdout-export
Jan 24, 2026
Merged

feat(cli): add --stdout flag to output export to stdout#142
agavra merged 1 commit intoagavra:mainfrom
keymon:feature/stdout-export

Conversation

@keymon
Copy link
Copy Markdown
Contributor

@keymon keymon commented Jan 24, 2026

Summary

When --stdout is passed, the export command (E key or :clip/:export) prints the review markdown to stdout and exits, instead of copying to the clipboard. This is useful for piping to other tools or redirecting to a file.

Motivation

This enables running tuicr programmatically from AI coding assistants like Claude Code, leveraging tmux to open a split pane for the interactive review while capturing the exported comments via stdout. I'll be raising a follow-up PR with a complementary Claude Code skill that uses this feature.

First of all, kudos on this tool - it's incredibly handy for reviewing AI-generated diffs in a structured way. The GitHub PR-style interface makes it easy to leave contextual comments, and the vim-like keybindings feel natural. This --stdout flag is a small addition that opens up powerful automation possibilities.

Changes

  • Add CliArgs struct and parse_cli_args() for CLI argument handling
  • Add output_to_stdout and pending_stdout_output fields to App
  • Extract generate_export_content() from export_to_clipboard()
  • Render TUI to /dev/tty when --stdout is used (keeps stdout clean for capture)
  • Skip the "Copy to clipboard?" confirmation dialog when --stdout is set
  • Print pending output after TUI cleanup

Usage

# Export review to stdout instead of clipboard
tuicr --stdout > review.md

# Pipe to another tool
tuicr --stdout | pbcopy

# Use from tmux (e.g., from an AI assistant)
tmux split-window -h "tuicr --stdout > /tmp/review.md"

Test plan

  • tuicr --help shows the new --stdout option
  • Running with --stdout, adding comments, and pressing E outputs markdown to stdout
  • TUI renders correctly (to /dev/tty) while stdout captures only the export
  • Without --stdout, behavior unchanged (copies to clipboard)

🤖 Generated with Claude Code

@keymon keymon marked this pull request as ready for review January 24, 2026 01:32
When --stdout is passed, the export command (E key or :clip/:export)
prints the review markdown to stdout and exits, instead of copying
to the clipboard. Useful for piping to other tools or redirecting
to a file.

- Add CliArgs struct and parse_cli_args() for CLI argument handling
- Add output_to_stdout and pending_stdout_output fields to App
- Extract generate_export_content() from export_to_clipboard()
- Print pending output after TUI cleanup when --stdout is used

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@keymon keymon force-pushed the feature/stdout-export branch from 1d34249 to 8226ed6 Compare January 24, 2026 01:50
Copy link
Copy Markdown
Owner

@agavra agavra left a comment

Choose a reason for hiding this comment

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

Very cool! Thanks for the contribution @keymon and for the kind words :)

As a follow up we may want to always output to stdout if --stdout is passed when we close (instead of only when y is pressed or :clip/:export)

@agavra agavra merged commit 24db196 into agavra:main Jan 24, 2026
4 checks passed
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.

2 participants