-
Notifications
You must be signed in to change notification settings - Fork 0
feat(cli): add paste request command for clipboard capture #63
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
feat(cli): add paste request command for clipboard capture #63
Conversation
Adds `plx paste request` command that captures clipboard content to `workspace/drafts/request.md`. The proposal workflow now detects this file and moves it to the change directory when scaffolding a new proposal. ### How It Works Users copy their requirements to the clipboard, run `plx paste request`, then start the proposal workflow. The raw request is preserved unedited in the change directory as `request.md`, providing context for the proposal. ### Manual Testing Plan 1. Copy text to clipboard: `echo "Your request" | pbcopy` 2. Run `plx paste request` 3. Verify file created at `workspace/drafts/request.md` 4. Run `plx paste request --json` to verify JSON output 5. Clear clipboard and run again to verify error handling ### Technical Details - ClipboardUtils class in `src/utils/clipboard.ts` handles cross-platform clipboard reading (macOS: pbpaste, Windows: PowerShell, Linux: xclip/xsel fallback) - PasteCommand class in `src/commands/paste.ts` writes clipboard to drafts using FileSystemUtils.writeFile - Proposal workflow updated to check for and move `drafts/request.md` to change directory - New cli-paste spec with 3 requirements and 12 scenarios
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
This PR adds a new plx paste request command that enables users to capture clipboard content directly into the PLX workflow by saving it to workspace/drafts/request.md. The proposal workflow is updated to automatically detect and move this file into change directories, streamlining the process of starting new proposals from copied content.
Key Changes
- New cross-platform clipboard reading utility supporting macOS, Windows, and Linux
- CLI command
plx paste requestwith JSON output mode for machine-readable responses - Integration with proposal workflow to automatically relocate draft requests into change directories
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/clipboard.ts | Implements cross-platform clipboard reading with platform-specific commands (pbpaste, PowerShell Get-Clipboard, xclip/xsel) |
| src/commands/paste.ts | Defines PasteCommand class with request() method for saving clipboard to drafts directory |
| src/cli/index.ts | Registers new paste command with request subcommand and --json flag support |
| test/utils/clipboard.test.ts | Unit tests for ClipboardUtils with mocked child_process for all platforms |
| test/commands/paste.test.ts | Integration tests for paste request command functionality |
| workspace/AGENTS.md | Documents request.md as a recognized file type in change directories |
| .claude/commands/plx/proposal.md | Adds workflow step to detect and move drafts/request.md into change directories |
| workspace/changes/add-paste-request-command/proposal.md | Change proposal documenting the why, what, and impact |
| workspace/changes/add-paste-request-command/specs/cli-paste/spec.md | Specification with 3 requirements and 12 scenarios covering command behavior |
| workspace/changes/add-paste-request-command/tasks/*.md | Task breakdown files for implementation, testing, and validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes issues raised in PR #63 code review: removes redundant step 0 from proposal workflow, simplifies Linux clipboard error handling, improves test reliability for empty clipboard detection. ### How It Works The paste command now exits properly on errors and Linux clipboard reading uses a cleaner try/fallback/check pattern instead of nested error message inspection. ### Manual Testing Plan 1. Run `plx paste request` with empty clipboard - verify error message 2. Run `plx paste request --json` with empty clipboard - verify JSON error output and exit code 1 3. Run `npm test` - verify all 1053 tests pass ### Technical Details - proposal.md: Removed step 0, integrated request.md move instruction into step 2 - clipboard.ts: Simplified readLinux() to try xclip, fallback to xsel, then check empty - paste.ts: Changed process.exitCode to process.exit(1) for proper execSync error handling - paste.test.ts: Removed unused vi import, use pbcopy < /dev/null for reliable clipboard clearing - clipboard.test.ts: Added test case for empty clipboard with xsel fallback
The paste command integration tests use pbcopy/pbpaste which are macOS-only. CI runs on Linux where these commands don't exist. Added platform detection to skip the entire test suite on non-macOS systems.
Add clipboard capture for draft requests with cross-platform support (macOS, Windows, Linux).
Summary
plx paste requestcommand to capture clipboard content toworkspace/drafts/request.mddrafts/request.mdinto change directoriescli-pastespecification with 3 requirements and 12 scenariosTest plan
plx paste requestworkspace/drafts/request.mdplx paste request --jsonto verify JSON output formatpnpm testto verify all tests passplx validate add-paste-request-command --strictto verify change is validNote
Adds a new draft-capture flow and wires it into the CLI and docs.
PasteCommandandClipboardUtilsenableplx paste requestto write clipboard text toworkspace/drafts/request.mdwith--jsonsupport (macOSpbpaste, Windows PowerShellGet-Clipboard, Linuxxclip→xselfallback)src/cli/index.ts; errors surfaced viaorawith JSON error structureClipboardUtils(mocked OS/exec) and macOS-only integration tests for paste (skipped on non-macOS)ARCHITECTURE.md,README.md,workspace/AGENTS.md, and.claude/commands/plx/proposal.mdto document the paste flow and movingdrafts/request.md0.7.0and updateCHANGELOG.mdWritten by Cursor Bugbot for commit b027c45. This will update automatically on new commits. Configure here.