Problem
When command-pipeline capture fails, restoreClipboard(_:) writes an empty string if the previous clipboard content was not a string (nil). This can erase existing non-text clipboard payloads (images/files/rich content).
Impact
- Unexpected clipboard data loss for users.
- Usability regression for workflows relying on non-text clipboard items.
Evidence
- Previous clipboard read as string only:
PromptRefactorApp/PromptRefactorApp/AppRuntimeController.swift:306
- Restore behavior writing empty string on nil:
PromptRefactorApp/PromptRefactorApp/AppRuntimeController.swift:423
Recommendation
- Preserve full pasteboard state (types/items), not just plain string.
- If full restoration is not feasible, avoid clearing clipboard when original content is non-string.
- Add regression tests for non-text clipboard before/after failed capture.
Problem
When command-pipeline capture fails,
restoreClipboard(_:)writes an empty string if the previous clipboard content was not a string (nil). This can erase existing non-text clipboard payloads (images/files/rich content).Impact
Evidence
PromptRefactorApp/PromptRefactorApp/AppRuntimeController.swift:306PromptRefactorApp/PromptRefactorApp/AppRuntimeController.swift:423Recommendation