Skip to content

Conversation

@ryanfowler
Copy link
Owner

Replace the upfront rejection of --copy for streaming content types with a limitedBuffer writer that captures up to 1 MiB as the stream is consumed. If the response exceeds the limit, a warning is printed and the copy is skipped instead of silently truncating data.

Replace the upfront rejection of --copy for streaming content types with
a limitedBuffer writer that captures up to 1 MiB as the stream is
consumed. If the response exceeds the limit, a warning is printed and
the copy is skipped instead of silently truncating data.
@ryanfowler ryanfowler requested a review from Copilot February 1, 2026 21:55
Copy link

Copilot AI left a 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 enables clipboard copying for streaming responses (SSE, NDJSON, gRPC) by replacing the upfront rejection with a buffered capture approach. Previously, --copy would fail immediately for streaming content types; now it captures up to 1 MiB of the response as it streams, warning users only if the limit is exceeded.

Changes:

  • Introduced limitedBuffer writer to capture streaming data up to 1 MiB without blocking or truncating
  • Removed content-type checks that prevented --copy for streaming responses
  • Added comprehensive unit tests for the limitedBuffer behavior
  • Updated documentation to reflect support for streaming responses

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/fetch/clipboard.go Implements limitedBuffer and integrates it into clipboard copying logic to support streaming responses
internal/fetch/clipboard_test.go Adds unit tests for limitedBuffer covering various overflow and boundary scenarios
integration/integration_test.go Adds integration tests verifying --copy works with SSE and NDJSON responses
docs/cli-reference.md Updates documentation to note streaming support and the 1 MiB limit

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ryanfowler ryanfowler merged commit 4f455e6 into main Feb 1, 2026
10 checks passed
@ryanfowler ryanfowler deleted the copy-streaming-support branch February 1, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant