fix(mobile): allow terminal paste from the device clipboard - #7239
fix(mobile): allow terminal paste from the device clipboard#7239DavidIlie wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
ApprovabilityVerdict: Needs human review This PR introduces a new user-facing feature (terminal paste from device clipboard) with new UI elements and behavior. While the implementation is well-scoped with unit tests, new user-facing capabilities warrant human review. You can customize Macroscope's approvability policy. Learn more. |
What?
Adds an explicit Paste action to the mobile terminal shortcut bar and the iOS and Android terminal menus.
Why?
The custom terminal surface does not expose the phone's native text-selection menu, so users controlling a remote terminal from mobile could copy commands but had no reliable way to paste them into the session.
How?
Clipboard text is read only after the user presses Paste, then sent through the existing terminal input path. Empty and unavailable clipboards produce a user-facing alert instead of an unhandled rejection, and pasting clears any pending terminal modifier before writing the text.
The clipboard read is isolated behind a small result-based helper so the success, non-text, and failure paths are covered without a native runtime.
Verification
pnpm exec vp test run apps/mobile/src/features/terminal/terminalClipboard.test.tspnpm --filter @t3tools/mobile typecheckgit diff --checkA native screenshot was not captured because this machine has no compatible T3 Code Dev client or reusable app artifact installed. The repository mobile-test workflow explicitly avoids rebuilding native code for a TypeScript-only change.
Generated with GPT-5.6 Sol via the Codex harness.
Note
Low Risk
User-initiated clipboard read and terminal input only; no auth or server changes, with tests on the helper.
Overview
Adds Paste to the mobile thread terminal so clipboard text can reach the remote shell without the native text-selection menu.
A new
readTerminalClipboardTexthelper reads fromexpo-clipboardonly when the user taps Paste (to limit surprise iOS paste prompts). It returnstext,empty, orunavailableinstead of throwing. Successful paste clears any pending ctrl/meta modifier and sends the string through the existing terminalwriteInputpath.Paste is wired in three places: the keyboard accessory toolbar, the iOS terminal header menu, and the Android terminal overflow menu. It is disabled while the session is not running. Empty or failed reads show an alert; an
activePasteTargetRefdrops stale async results if the user leaves the screen before the read finishes.Unit tests cover the clipboard helper’s success, non-text, and error paths.
Reviewed by Cursor Bugbot for commit f3669e8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add clipboard paste action to the mobile terminal screen
ThreadTerminalRouteScreenfor both iOS and Android; paste is disabled when the terminal session is not running.terminalClipboard.tswithreadTerminalClipboardText, which wrapsexpo-clipboardand returns a tagged result (text,empty, orunavailable) instead of throwing.Macroscope summarized f3669e8.