ADE-92: Copy user-launched chat and CLI prompts to clipboard#506
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
📝 WalkthroughWalkthroughThis PR adds a complete "copy launch prompts to clipboard" feature to the desktop app. It introduces a persisted user preference, a clipboard utility, settings UI, a visual helper in the chat composer, and integrates clipboard copying across multiple send and launch paths including draft launches, parallel launches, Cursor Cloud submissions, and Linear batch operations. ChangesLaunch Prompt Clipboard Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@copilot review but do not make fixes |
a0d8ef0 to
36424ce
Compare
|
Review follow-up:
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/components/chat/AgentChatPane.tsx (1)
6522-6536:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid double-copying the prompt on foreground draft chat submits.
Line 6574 copies the draft before the branches at Lines 6522-6536 hand off to
launchDraftChat(), andlaunchDraftSession()already copies the same text at Line 5955. Foreground draft chat sends therefore hit the clipboard twice. Keep the copy in the delegated draft-launch path, or gate the shared-path copy so it only runs for the non-draft submit flow.Also applies to: 6574-6574
🤖 Prompt for 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. In `@apps/desktop/src/renderer/components/chat/AgentChatPane.tsx` around lines 6522 - 6536, The foreground draft-chat flow is copying the prompt twice: once in the shared-path clipboard copy and again inside the delegated launch functions; fix by removing or gating the redundant shared-path clipboard copy so it does not run when delegating to launchDraftChat (and similarly launchDraftSession), and ensure only the delegated path (launchDraftChat/launchDraftSession) performs the clipboard copy for draft launches.
🤖 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 `@apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx`:
- Around line 1099-1103: The helper is unmounting on input blur so keyboard
users can't tab to it; update AgentChatComposer to track focus-within the
composer region (e.g., add a boolean state like isComposerFocusWithin updated by
onFocusCapture/onBlurCapture on the composer container using event.relatedTarget
to detect leaving the region) and change the showLaunchClipboardHelper condition
to use isComposerFocusWithin (instead of only composerFocused) along with
launchPromptClipboardEnabled, composerInputLocked, and draft.trim().length > 0;
keep the helper mounted while isComposerFocusWithin is true and ensure the
helper button is keyboard-focusable (no preventDefault blocking focus events and
include proper tabIndex/role) so keyboard users can reach it.
---
Outside diff comments:
In `@apps/desktop/src/renderer/components/chat/AgentChatPane.tsx`:
- Around line 6522-6536: The foreground draft-chat flow is copying the prompt
twice: once in the shared-path clipboard copy and again inside the delegated
launch functions; fix by removing or gating the redundant shared-path clipboard
copy so it does not run when delegating to launchDraftChat (and similarly
launchDraftSession), and ensure only the delegated path
(launchDraftChat/launchDraftSession) performs the clipboard copy for draft
launches.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5b964b81-16f6-417b-9171-1ce9f72fe36e
📒 Files selected for processing (11)
apps/desktop/src/renderer/components/app/App.tsxapps/desktop/src/renderer/components/app/LinearQuickViewButton.tsxapps/desktop/src/renderer/components/app/SettingsPage.tsxapps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsxapps/desktop/src/renderer/components/chat/AgentChatComposer.tsxapps/desktop/src/renderer/components/chat/AgentChatPane.test.tsxapps/desktop/src/renderer/components/chat/AgentChatPane.tsxapps/desktop/src/renderer/components/settings/AppearanceSection.tsxapps/desktop/src/renderer/lib/launchPromptClipboard.tsapps/desktop/src/renderer/state/appStore.test.tsapps/desktop/src/renderer/state/appStore.ts
36424ce to
9c32204
Compare
|
CodeRabbit follow-up:
|
9c32204 to
3c10b46
Compare
Fixes ADE-92
Summary
Describe the change.
What Changed
Key files and behaviors.
Validation
How you tested.
Risks
Anything to watch.
Linked Linear issues
Summary by CodeRabbit
New Features
Improvements
Tests
Greptile Summary
This PR implements ADE-92, adding a user-controlled toggle to copy chat, CLI, and agent launch prompts to the system clipboard before ADE sends them. The feature spans a new
launchPromptClipboard.tsutility, a persistedlaunchPromptClipboardEnabledpreference, a settings checkbox with hash-based deep-linking, and a contextual hint bar in the chat composer.launchPromptClipboard.ts) writes to clipboard via the IPC bridge first, falling back to the browser Clipboard API, swallowing all errors so clipboard failures never block a launch.AgentChatPaneandLinearQuickViewButton.SettingsPageis generalised to support any hash-targeted section and now clears the hash on tab change to prevent spurious re-scrolls.Confidence Score: 5/5
Safe to merge — the clipboard write is entirely best-effort and cannot block any send path; the feature defaults on but is easily toggled off.
All changed paths have solid test coverage, the new utility defensively catches every error, and the preference is correctly round-tripped through localStorage. The one finding is a cosmetic silent no-op on the Setting link when the callback prop is omitted, which cannot occur in the current production wiring.
No files require special attention; the most complex changes are in AgentChatPane.tsx and AgentChatComposer.tsx, both of which are well-covered by the accompanying tests.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[User types prompt & clicks Send] --> B{launchPromptClipboardEnabled?} B -- No --> G[Normal send flow] B -- Yes --> C[copyLaunchPromptToClipboard] C --> D{window.ade.app.writeClipboardText?} D -- Yes --> E[IPC clipboard write] D -- No --> F{navigator.clipboard.writeText?} F -- Yes --> H[Browser clipboard write] F -- No --> I[Silent no-op] E --> G H --> G I --> G G --> J{New session?} J -- Yes --> K[Create session + send] J -- No --> L[Send to existing session]Prompt To Fix All With AI
Reviews (4): Last reviewed commit: "ADE-92 copy launch prompts to clipboard" | Re-trigger Greptile