Skip to content

cliipboard#41

Merged
yaacov merged 1 commit into
mainfrom
clipboard
Jun 7, 2026
Merged

cliipboard#41
yaacov merged 1 commit into
mainfrom
clipboard

Conversation

@yaacov

@yaacov yaacov commented Jun 7, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Quit the TUI by typing exit or quit in chat input (case-insensitive)
    • Added system clipboard integration for copy/paste operations
  • UI/UX Updates

    • Updated quit keyboard shortcut from Ctrl+C to Ctrl+Q (and Super+Q)
    • Improved approval prompt layout and styling
    • Extended help documentation to include clipboard information

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@yaacov, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3c71860b-2d2e-44ea-afdc-188da4f662ae

📥 Commits

Reviewing files that changed from the base of the PR and between f653ac0 and f566e4c.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • mtv_agent/tui/app.py
  • mtv_agent/tui/clipboard.py
  • mtv_agent/tui/widgets/approval.py
  • mtv_agent/tui/widgets/input.py
📝 Walkthrough

Walkthrough

This PR enhances the TUI chat interface by adding system clipboard support, enabling exit/quit commands via direct chat input, changing the quit keyboard shortcut from ctrl+c to ctrl+q/super+q, and adjusting approval prompt layout and anchoring. The changes span clipboard helpers, chat input widgets, application bindings, and UI styling.

Changes

Chat Input and Exit Flow Enhancements

Layer / File(s) Summary
Clipboard System Infrastructure
mtv_agent/tui/clipboard.py
New module exports read_system_clipboard() and write_system_clipboard() using OS-specific subprocess calls (pbpaste/pbcopy on macOS, xclip elsewhere) with timeout and error handling.
Chat Input Clipboard Paste Integration
mtv_agent/tui/widgets/input.py
Input widget imports clipboard functions and introduces _ClipboardInput subclass binding ctrl+v/super+v to custom paste action pulling from system clipboard as fallback. ChatInput.compose() yields _ClipboardInput instead of base Input.
Exit/Quit Chat Commands and Help
mtv_agent/tui/app.py, mtv_agent/tui/widgets/input.py
App detects non-command chat messages "exit" or "quit" (case-insensitive) and calls self.exit() immediately. Help text extended with clipboard section and quit binding documentation. SLASH_COMMANDS updated to reflect available commands.
Keyboard Bindings and Approval Prompt Layout
mtv_agent/tui/app.py, mtv_agent/tui/widgets/approval.py
Quit action binding changed from ctrl+c to ctrl+q and super+q. ApprovalPrompt CSS adjusted: left margin reduced and max-height constraint removed. _handle_approval now mounts ApprovalPrompt unconditionally into ChatArea instead of conditionally onto active ToolCard.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ChatInput
  participant Clipboard as clipboard.py
  participant App as MTVApp
  User->>ChatInput: Press ctrl+v or paste action
  ChatInput->>Clipboard: read_system_clipboard()
  Clipboard-->>ChatInput: clipboard text
  ChatInput->>ChatInput: Insert first line at selection
Loading
sequenceDiagram
  participant User
  participant ChatInput
  participant App as MTVApp
  User->>ChatInput: Type "exit" or "quit"
  ChatInput->>App: on_chat_submitted(message)
  App->>App: Detect exit/quit keyword
  App->>App: self.exit()
  App-->>User: Application closes
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A rabbit hops through clipboards bright,
With ctrl+q to quit the night,
Paste commands flow from system deep,
Exit whispers, the UI takes a leap! 🌿

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'cliipboard' appears to be a typo and doesn't clearly describe the changes made in this pull request, which involve clipboard functionality, quit shortcuts, and UI improvements. Consider revising the title to be more descriptive, such as 'Add clipboard support and update quit shortcuts' or similar, to clearly communicate the main changes to reviewers.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch clipboard

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@mtv_agent/tui/app.py`:
- Around line 129-131: The bare-text exit handling calls self.exit() but never
closes self.client, creating inconsistent cleanup compared to action_quit()
which closes the client; update the handler that checks if
message.strip().lower() in ("exit","quit") to close or await closing of
self.client (same way action_quit() does) before calling self.exit(), or
refactor both the message handler and action_quit() to call a single cleanup
method (e.g., close_client_or_cleanup()) so all exit paths (the message branch,
slash commands, and action_quit()) perform the same client shutdown.
- Around line 230-235: Update the help text in mtv_agent/tui/app.py to
explicitly state that typing "exit" or "quit" (without a leading slash) will
also quit the application; add a short line alongside the existing "cmd+q /
ctrl+q       Quit the application" or near the "/quit" and "/exit" entries so
users see that bare exit/quit (which are included in SLASH_COMMANDS and handled
by the input handling logic that triggers immediate exit) will close the app.

In `@mtv_agent/tui/clipboard.py`:
- Around line 10-18: The clipboard handlers read_system_clipboard and
write_system_clipboard currently treat non-macOS platforms as using xclip
(silently failing on Windows); update these functions to detect sys.platform ==
"win32" and use the native Windows clipboard commands (e.g., PowerShell
Get-Clipboard for read and Set-Clipboard or clip for write) while keeping macOS
pbpaste/pbcopy and Linux xclip paths; add explicit error handling so missing
tooling raises/logs a clear message (and return the same fallback values) and
add a short note to the README or project docs stating that Linux requires xclip
(or xsel) as an external dependency and Windows uses PowerShell clipboard
commands.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c44c734a-06f6-4598-8fda-baf07ccf66c6

📥 Commits

Reviewing files that changed from the base of the PR and between f3a0809 and f653ac0.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • mtv_agent/tui/app.py
  • mtv_agent/tui/clipboard.py
  • mtv_agent/tui/widgets/approval.py
  • mtv_agent/tui/widgets/input.py

Comment thread mtv_agent/tui/app.py
Comment thread mtv_agent/tui/app.py
Comment thread mtv_agent/tui/clipboard.py
Signed-off-by: yaacov <yzamir@redhat.com>
@yaacov yaacov merged commit 25f2d37 into main Jun 7, 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.

1 participant