From 9315b7ce5ad0334eb5a2f7f0703e68e5694e9e14 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 14 Jun 2026 10:21:42 +0300 Subject: [PATCH 1/3] feat: add prompt composer to terminal context menu (TASK-180) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a notepad-style scratchpad to each terminal pane, accessible from the pane right-click menu (📝 Prompt composer). Lets users compose long, multi-line prompts in a real text editor before sending them - avoids the fiddliness of editing multi-line input directly in the terminal and stops stray Enter keys from submitting half-written messages. The modal has three footer buttons: - Copy: writes the draft to the clipboard. - Submit: bracketed-pastes the draft into the focused terminal. We do not also send Enter - the user reviews in the terminal and presses Enter themselves. Intentional: avoids accidental submission and Ink-based AI CLIs handle programmatic \r post-paste inconsistently. - Close: dismiss (also bound to Esc and backdrop click). Drafts are per-terminal and persist for the session; they're dropped when the owning pane closes (and the composer auto-dismisses if its target pane goes away). Reuses the existing prepareClipboardPaste helper for bracketed-paste wrapping + CRLF→LF normalization (so Windows-CRLF drafts work cleanly). Pure draft-map helpers (updateComposerDrafts, dropComposerDraft) extracted to src/renderer/utils/prompt-composer.ts and covered by 14 focused tests in tests/e2e/task-180-prompt-composer.spec.ts. All tests pass; tsc error count unchanged vs main; renderer vite build succeeds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- ...rompt-composer-to-terminal-context-menu.md | 107 ++++++++++++ src/renderer/App.tsx | 2 + src/renderer/components/PromptComposer.tsx | 160 ++++++++++++++++++ src/renderer/components/TerminalPanel.tsx | 4 + src/renderer/state/terminal-store.ts | 33 ++++ src/renderer/styles/global.css | 103 +++++++++++ src/renderer/utils/prompt-composer.ts | 46 +++++ tests/e2e/task-180-prompt-composer.spec.ts | 98 +++++++++++ 8 files changed, 553 insertions(+) create mode 100644 backlog/tasks/task-180 - Add-prompt-composer-to-terminal-context-menu.md create mode 100644 src/renderer/components/PromptComposer.tsx create mode 100644 src/renderer/utils/prompt-composer.ts create mode 100644 tests/e2e/task-180-prompt-composer.spec.ts diff --git a/backlog/tasks/task-180 - Add-prompt-composer-to-terminal-context-menu.md b/backlog/tasks/task-180 - Add-prompt-composer-to-terminal-context-menu.md new file mode 100644 index 00000000..15b81e13 --- /dev/null +++ b/backlog/tasks/task-180 - Add-prompt-composer-to-terminal-context-menu.md @@ -0,0 +1,107 @@ +--- +id: TASK-180 +title: Add prompt composer to terminal context menu +status: In Progress +assignee: + - '@mpmisha' +created_date: '2026-06-14 06:39' +updated_date: '2026-06-14 06:54' +labels: + - feature + - frontend + - ux +dependencies: [] +priority: medium +--- + +## Description + + +Add a new option to each terminal's context (pane) menu that opens a lightweight notepad-style text editor, similar in style/placement to the existing transcript/prompts and SessionSummary popovers. + +Motivation: composing multi-line prompts directly in the terminal is awkward - newlines/paste are fiddly and a stray Enter submits a half-written message. A scratch composer lets the user write/edit freely, then copy the whole thing to paste into the terminal as a single prompt. + +Scope (v1): +- New context menu item in the pane menu (TerminalPanel right-click menu) labeled something like "📝 Prompt composer". +- Opens a modal dialog (palette-backdrop pattern, like SessionSummary) with a multi-line