Skip to content

feat(session-ui): add a copy button to shell output - #58974

Merged
opencode-agent[bot] merged 2 commits into
devfrom
shell-output-copy
Oct 25, 2026
Merged

opencode-agent[bot] merged 2 commits into
devfrom
shell-output-copy

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Expanded shell and Code Mode execute cards now have a copy button on the output as well as the command.

  • Each section has its own button in its top-right corner: Copy for the command (unchanged) and Copy output for the result. Output is copied as shown, with ANSI codes stripped and line endings normalized.
  • Both buttons are sticky inside their own section, so Copy output stays reachable while you scroll a long result (the card still caps at 240px). Before, the single button sat outside the scroll area. Now each one scrolls away with its section once that section is out of view.
  • The buttons sit next to each section's <pre>, not inside it, so selecting text and copying by hand doesn't pick them up.
  • Layout at rest matches dev pixel for pixel; the only change is the new icon on hover. This is checked at 1376×464 (shell) and 1376×344 (execute) at 2x.

Tests

  • New component test: copies the command and the output separately and checks the clipboard for each.
  • The touch test now expects both buttons to be visible without hover.
  • Two specs that targeted bash-pre now target bash-result, because each section has its own <pre>.
  • bun typecheck (session-ui) passes. Component specs session-shell, session-timeline-mobile, session-lifecycle, tool-group and session-timeline pass, 46 tests. These ran locally against a warm Storybook, not cold.

Before/after screenshots are in the Slack thread (GitHub attachment upload isn't available to the bot).

Requested by: @vimtor (victor via Slack)

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change works as described and looks sound. I ran the shell, mobile, lifecycle and tool-group component specs against Storybook (39/39 pass, including the new copy test). tsc -b passes for packages/session-ui; its typecheck script couldn't run here because this Bun has no bun check. In the expanded-shell story the card at rest matches dev; on hover it shows a second copy button on the output, and that button stays pinned while a long output scrolls.

Public API: unchanged. The only addition is the ui.message.copyOutput UI string; other locales fall back through their Partial dictionaries.

No blocking concerns.

Before

After

@opencode-agent
opencode-agent Bot merged commit 5be4b16 into dev Oct 25, 2026
20 checks passed
@opencode-agent
opencode-agent Bot deleted the shell-output-copy branch October 25, 2026 12:46
@amrkmn amrkmn mentioned this pull request Oct 27, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant