[DEV-40] Capture ideas from anywhere into a new pm-desktop ticket with one shortcut - #50
Merged
Conversation
…sktop ticket with one shortcut
- Quick Capture (main): replace the pending-delivery WeakSet flag with a WeakMap holding the latest payload, so a second invocation while the window is still loading overwrites (not drops) the pending capture and settle delivers exactly once whatever snapshot is most recent. Regression-tested via deliverQuickCapture and invokeQuickCapture; the FakeWindow test double now keeps a stable webContents identity to match Electron. - Quick Capture wiring (renderer): extract App's onQuickCapture handler into state/quick-capture-handler.ts (handleQuickCaptureEvent) and move defaultComposerForProject into state/composer-values.ts. The handler is unit-tested for both paths: fresh ticket opened prefilled from the capture (inferred source tab, cached issue types, project defaults) and no-op when no configured project is ready. App now bumps the composer focus signal only when a workspace actually opened.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements DEV-40: a Quick Capture feature for pm-desktop that opens a new ticket pre-filled from the clipboard via a global OS shortcut.
What was built
Shared pure logic —
packages/pm-desktop/src/shared/quick-capture.tsCommandOrControl+Shift+Space, accelerator validation, clipboard-text sanitizer (50k-char cap; huge/empty/noise → "not useful"), source-tab inference (Figma URL → Figma, stack-trace-like → Error log, else Prompt), keyboard-event→accelerator mapping for the in-app recorder.Main process —
src/main/quick-capture.ts(Electron injected as ports, auto-update.ts pattern)quickCaptureEnabled, default off — opt-in); disabled state never holds a hotkey.app.focus({steal:true})for macOS background), defers delivery until page load completes. Registration failures return a clear conflict message instead of failing silently.index.ts(startup sync + dispose on quit) andipc.ts(pm:get-quick-capture-status,pm:set-quick-capture-settings, push channelpm:quick-capture).Renderer
composerForCapture; without one it leaves the Welcome/setup path visible. A focus token moves the caret into the composer's source editor.Tests — shared helpers, main registration + delivery (conflict, invalid binding, rebind releases old key, deferred delivery to a freshly created window, empty clipboard), preload early-event latch, ComposerForm focus signal,
composerForCapture. 544 pm-desktop tests pass, plus monorepo-wide typecheck, lint, format, and build.Docs — README section and
docs/pm/usage.mdQuick Capture guide.Note: ships off by default (an OS-wide hotkey felt like opt-in territory); flipping it on registers the documented default immediately.