Skip to content

feat: add guided setup command - #753

Open
ffantl-ld wants to merge 1 commit into
ffantl/setup-ld/4-verifierfrom
ffantl/setup-ld/6-command
Open

feat: add guided setup command#753
ffantl-ld wants to merge 1 commit into
ffantl/setup-ld/4-verifierfrom
ffantl/setup-ld/6-command

Conversation

@ffantl-ld

@ffantl-ld ffantl-ld commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Describe the solution you've provided

Final layer: the user-facing setup command. Adds the cmd/setup package (detect, install, init subcommands and the interactive wizard) over the internal/setup library, wires it into the root command, and deprecates quickstart in favor of setup.

The ldcli setup wizard walks a user through detecting their project, installing the SDK, creating a first flag, injecting init code, and verifying an evaluation.

Related issues

Top of the setup-ld feature stack. Stacked PR — base is ffantl/setup-ld/4-verifier.

Note: this branch's cmd/root.go also carries the PersistentPreRun change from #748; that diff drops out once #748 merges to main and this stack is rebased.

Requirements

  • I have added test coverage for new or changed functionality

Note

Medium Risk
The wizard runs package installs and may modify project files via injection, and creates flags via the API; auth-exempt flag behavior changed globally for setup/login paths, though covered by tests.

Overview
Introduces ldcli setup as the primary onboarding path: an interactive Bubble Tea wizard (project/environment selection, local detection, SDK choice with override safeguards, plan preview, install, flag creation, code injection, optional SDK-active verification) backed by new internal/setup.Service orchestration and injectable detector/installer on APIClients.

Also adds hidden subcommands setup detect, setup install, and setup init for scripted/JSON workflows. quickstart remains registered but is hidden and deprecated in favor of setup; root usage text and registration tests were updated so setup/quickstart/symbols stay in sync.

Auth handling for exempt commands (including setup) no longer uses DisableFlagParsing; it clears the --access-token required annotation via clearAccessTokenRequirement, so subcommand required flags still validate. The wizard fails fast with login guidance when no token is set.

environments.Client gains List for the wizard’s environment picker.

Reviewed by Cursor Bugbot for commit eeb4ae7. Bugbot is set up for automated code reviews on this repo. Configure here.

@ffantl-ld
ffantl-ld force-pushed the ffantl/setup-ld/6-command branch from 56fef68 to 3680877 Compare July 23, 2026 15:16
@ffantl-ld
ffantl-ld marked this pull request as ready for review July 27, 2026 17:23
@ffantl-ld
ffantl-ld requested review from Vadman97 and erangeles July 27, 2026 17:23
Comment thread cmd/root.go
Comment thread cmd/setup/wizard.go Outdated
Comment thread cmd/setup/wizard.go Outdated
@ffantl-ld

ffantl-ld commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Review resolution map — the 8 inline findings from the original review on the superseded #744 were migrated and resolved as follows (that PR was closed when this work was split into the #748–753 stack, so the threads were stranded there):

Finding File Disposition
Flag-skip affects 6 commands, not just setup cmd/root.go Verified — go test ./cmd/... green, completion/config/whoami smoked clean (#748)
Install-failure reason swallowed cmd/setup/wizard.go Fixed97c6a7d (this PR): InstallResult.FailureReason rendered on failure screen
Hardcoded app.launchdarkly.com cmd/setup/wizard.go Fixed97c6a7d (this PR): derives host from --base-uri
No pagination on project/env lists cmd/setup/wizard.go Deferred — REL-15105
node template assumes CommonJS (ESM breaks) internal/setup/sdk_init_templates/node-server.tmpl Deferred — REL-15106
parseJSONError string-coupling cmd/setup/wizard.go Deferred — REL-15107
Python pkg-manager arg inconsistency internal/setup/installer.go Won't fix — low-risk, exec not shell, author-intended
Guessed Android entry-point path internal/setup/detector.go Won't fix — guidance-only, cosmetic

via LD Research 🤖

@ffantl-ld
ffantl-ld requested review from a team and removed request for Vadman97 July 28, 2026 16:38
@ffantl-ld
ffantl-ld force-pushed the ffantl/setup-ld/6-command branch from 97c6a7d to 73cc570 Compare July 31, 2026 17:48
@ffantl-ld
ffantl-ld force-pushed the ffantl/setup-ld/6-command branch from 73cc570 to fa402b8 Compare July 31, 2026 18:25
@ffantl-ld
ffantl-ld force-pushed the ffantl/setup-ld/6-command branch from fa402b8 to 4799b3e Compare August 3, 2026 18:56

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ 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 4799b3e. Configure here.

Comment thread cmd/setup/view.go
if len(m.environments) == 0 {
return m.spinner.View() + " Loading environments..."
}
return m.envList.View() + "\n" + mutedStyle.Render("← back · esc quit")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty lists spin forever

Medium Severity

The project and environment screens treat an empty slice the same as “still loading,” so a successful fetch with no items leaves the wizard stuck on the spinner. Users can only quit; there is no empty-state message or way to continue.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4799b3e. Configure here.

Comment thread cmd/setup/update.go
Comment thread cmd/setup/update.go
switch msg := msg.(type) {
case tea.WindowSizeMsg:
m.width = msg.Width
m.height = msg.Height

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lists ignore terminal resize

Low Severity

WindowSizeMsg updates width/height but never calls SetSize on the project, environment, or SDK lists. If the size message arrives after those lists are built, or the terminal is resized, the lists keep stale or zero dimensions (height-4 can be negative when height is still 0).

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4799b3e. Configure here.

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>
@ffantl-ld
ffantl-ld force-pushed the ffantl/setup-ld/6-command branch from 4799b3e to eeb4ae7 Compare August 3, 2026 19:48
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.

2 participants