-
Notifications
You must be signed in to change notification settings - Fork 964
feat: add '/cp' command to copy last response to clipboard #2049
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?
Conversation
PR Change SummaryAdded a new command to the clai package that allows users to copy the last response to the clipboard.
Modified Files
How can I customize these reviews?Check out the Hyperlint AI Reviewer docs for more information on how to customize the review. If you just want to ignore it on this PR, you can add the Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add |
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
Adds a new /cp
command to copy the last chat response to the clipboard, including dependency updates, CLI handling, documentation, and tests.
- Introduces
pyperclip
as a new CLI dependency - Implements
/cp
inhandle_slash_command
and updates auto-suggestions - Updates docs, adds unit tests for the new behavior
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/test_cli.py | Imported pyperclip , added tests for /cp command |
pydantic_ai_slim/pyproject.toml | Added pyperclip>=1.9.0 to the cli dependencies |
pydantic_ai_slim/pydantic_ai/_cli.py | Imported pyperclip , updated help and handler for /cp , modified auto-suggestions |
docs/cli.md | Documented the /cp command |
clai/README.md | Documented the /cp command |
Comments suppressed due to low confidence (1)
tests/test_cli.py:215
- [nitpick] Consider adding a test case where
messages[-1].parts
contains only non-text parts to cover the 'No text content to copy.' branch and ensure that no clipboard write occurs.
def test_handle_slash_command_copy():
b32f526
to
620e858
Compare
620e858
to
ccc9422
Compare
except IndexError: | ||
console.print('[dim]No output available to copy.[/dim]') | ||
else: | ||
text_to_copy = ''.join(part.content for part in parts if part.part_kind == 'text') |
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.
I think we'll want to put 1 or 2 newlines in between text from different parts, as they may not join cleanly.
@07pepa Thanks, nice feature! |
This feature is for
clai
package.It adds
/cp
command (analogus to linux cp command) to clai that coppies model output to clipboard as is.TL DR what was done:
clai
dependency:pyperclip
clai
for comand/cp
to store data to clipboard