feat(setup): copy wizard code blocks with c - #771
Merged
ffantl-ld merged 3 commits intoAug 5, 2026
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 163a677. Configure here.
ffantl-ld
force-pushed
the
ffantl/setup-ld/6-command
branch
from
August 5, 2026 18:06
eeb4ae7 to
cdc28f6
Compare
Code blocks are drawn with a left gutter bar, so selecting one by hand copies the gutter characters and the padding lipgloss squares the block off with. The wizard also owns the alternate screen, so the snippet is not in scrollback once it exits. Pressing c writes the raw content to the system clipboard with OSC 52, preferring the snippet over the install command when a screen shows both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
OSC 52 alone left the key unreliable: terminals are not required to implement it, Apple Terminal does not, and support cannot be queried, so the confirmation claimed a copy that may never have happened. The OS clipboard works in any terminal and returns an error, so try it first and keep OSC 52 for when it fails — which is the SSH case, where the OS clipboard belongs to the wrong machine. Word the two outcomes apart, since only the first can be confirmed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A remote host can have a working clipboard, so writing to it succeeds while putting the snippet on a machine the user is not pasting into — and the confirmation then claimed the copy was done. Detect an SSH session from the environment sshd sets and go straight to the terminal, which is the end the user is actually at. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ffantl-ld
force-pushed
the
ffantl/REL-15243/copy-snippet
branch
from
August 5, 2026 18:09
8da088a to
3341205
Compare
ffantl-ld
added a commit
that referenced
this pull request
Aug 5, 2026
* REL-15243: add a copy key for wizard code blocks Code blocks are drawn with a left gutter bar, so selecting one by hand copies the gutter characters and the padding lipgloss squares the block off with. The wizard also owns the alternate screen, so the snippet is not in scrollback once it exits. Pressing c writes the raw content to the system clipboard with OSC 52, preferring the snippet over the install command when a screen shows both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * REL-15243: copy through the OS clipboard before the terminal OSC 52 alone left the key unreliable: terminals are not required to implement it, Apple Terminal does not, and support cannot be queried, so the confirmation claimed a copy that may never have happened. The OS clipboard works in any terminal and returns an error, so try it first and keep OSC 52 for when it fails — which is the SSH case, where the OS clipboard belongs to the wrong machine. Word the two outcomes apart, since only the first can be confirmed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * REL-15243: skip the OS clipboard over SSH A remote host can have a working clipboard, so writing to it succeeds while putting the snippet on a machine the user is not pasting into — and the confirmation then claimed the copy was done. Detect an SSH session from the environment sshd sets and go straight to the terminal, which is the end the user is actually at. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
ffantl-ld
added a commit
that referenced
this pull request
Aug 6, 2026
* feat: add guided setup command ldcli setup walks a project through installing a LaunchDarkly SDK: detect the language and package manager, pick a project and environment, install the SDK with the project's own tool, create a flag, write or show initialization code, then poll until the SDK connects. Orchestration lives in internal/setup.Service so the wizard UI and the detect/install/init subcommands share one path. The wizard is split into model, update, view, and commands rather than one file. Environments gains List so the wizard can offer a choice of environments. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(setup): copy wizard code blocks with c (#771) * REL-15243: add a copy key for wizard code blocks Code blocks are drawn with a left gutter bar, so selecting one by hand copies the gutter characters and the padding lipgloss squares the block off with. The wizard also owns the alternate screen, so the snippet is not in scrollback once it exits. Pressing c writes the raw content to the system clipboard with OSC 52, preferring the snippet over the install command when a screen shows both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * REL-15243: copy through the OS clipboard before the terminal OSC 52 alone left the key unreliable: terminals are not required to implement it, Apple Terminal does not, and support cannot be queried, so the confirmation claimed a copy that may never have happened. The OS clipboard works in any terminal and returns an error, so try it first and keep OSC 52 for when it fails — which is the SSH case, where the OS clipboard belongs to the wrong machine. Word the two outcomes apart, since only the first can be confirmed. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
ffantl-ld
added a commit
that referenced
this pull request
Aug 7, 2026
* feat: add guided setup command ldcli setup walks a project through installing a LaunchDarkly SDK: detect the language and package manager, pick a project and environment, install the SDK with the project's own tool, create a flag, write or show initialization code, then poll until the SDK connects. Orchestration lives in internal/setup.Service so the wizard UI and the detect/install/init subcommands share one path. The wizard is split into model, update, view, and commands rather than one file. Environments gains List so the wizard can offer a choice of environments. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(setup): copy wizard code blocks with c (#771) * REL-15243: add a copy key for wizard code blocks Code blocks are drawn with a left gutter bar, so selecting one by hand copies the gutter characters and the padding lipgloss squares the block off with. The wizard also owns the alternate screen, so the snippet is not in scrollback once it exits. Pressing c writes the raw content to the system clipboard with OSC 52, preferring the snippet over the install command when a screen shows both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * REL-15243: copy through the OS clipboard before the terminal OSC 52 alone left the key unreliable: terminals are not required to implement it, Apple Terminal does not, and support cannot be queried, so the confirmation claimed a copy that may never have happened. The OS clipboard works in any terminal and returns an error, so try it first and keep OSC 52 for when it fails — which is the SSH case, where the OS clipboard belongs to the wrong machine. Word the two outcomes apart, since only the first can be confirmed. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Requirements
Related issues
REL-15243, under the CLI Onboarding Wizard A/B epic (REL-15183).
Stacked on #753, which introduces
cmd/setup.Describe the solution you've provided
ckeybinding at the wizard's final screen that copies the raw init snippet — or the install command, when there is no snippet — to the clipboardwizardModelso tests drive either path without a real clipboard or terminalThe code block is drawn with a left gutter bar, so selecting it with the mouse copies the gutter characters and the padding lipgloss squares the block off with, and pasting that fails on every line. The wizard also runs in the alternate screen, so the snippet is not in scrollback once it exits — the copy has to happen while the TUI is live, which is exactly when the gutter is in the way.
Describe alternatives you've considered
Additional context
github.com/atotto/clipboardmoves from an indirect to a direct dependency, andgithub.com/charmbracelet/x/ansilikewise forSetSystemClipboard. Both were already in the module graph; no new module is added.Residual gap: a Linux host with no clipboard tool installed (
xclip,xsel,wl-clipboard) and a terminal that ignores OSC 52 gets no copy. That combination reports "Asked your terminal to copy…" rather than claiming success.Testing approaches
cmd/setup/copy_test.go: the copied payload is byte-for-byte the raw snippet (asserted against the rendered view, which does contain the gutter bar the copy does not), snippet preferred over install command when both show, fallback to the command, no copy on screens with nothing to copy, hint switches to confirmation,cstill reaches the list filter while filtering, and a failing OS clipboard falls back to a well-formed OSC 52 sequence without claiming the copy completed.go build ./...,go vet,gofmt, andgo test ./...clean; 52 subtests incmd/setup;golangci-lintpassed via pre-commit.Note
Low Risk
TUI-only UX in the setup wizard with no auth or API changes; clipboard/OSC 52 behavior is well covered by unit tests.
Overview
Adds
con the setup wizard’sstepDonescreens so users can copy raw init snippets or failed install commands without the TUI gutter/padding.Copy tries the OS clipboard (
atotto/clipboard) locally, skips it when SSH env vars indicate a remote session, and falls back to OSC 52 viaansi.SetSystemClipboard. UI hints distinguish confirmed clipboard writes from “asked your terminal” requests.cis ignored while list filtering is active.wizardModelgains injectablenativeCopyandclipboardwriters pluscopyStatefor tests;copy_test.gocovers snippet vs command priority, OSC 52 fallback, and remote-session behavior.go.modpromotesclipboardandcharmbracelet/x/ansito direct requires.Reviewed by Cursor Bugbot for commit 3341205. Bugbot is set up for automated code reviews on this repo. Configure here.