Skip to content

feat: add guided setup command - #753

Open
ffantl-ld wants to merge 3 commits into
ffantl/setup-ld/4-verifierfrom
ffantl/setup-ld/6-command
Open

feat: add guided setup command#753
ffantl-ld wants to merge 3 commits 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 managers, writes project files, and creates flags via the API—high user impact but scoped to an explicit setup flow with tests; root auth-flag behavior changes affect all exempt commands.

Overview
ldcli setup is now the primary guided onboarding flow: an interactive Bubble Tea wizard that picks project/environment, auto-detects the repo, lets you confirm or override the SDK, shows a plan preview, then installs the package, creates a starter flag (my-new-flag), injects init code, and optionally verifies SDK activity. It fails fast with login guidance when no access token is set.

Hidden subcommands setup detect, setup install, and setup init expose the same internal/setup building blocks for scripting (plaintext/JSON output, dry-run install).

Root wiring: APIClients gains injectable Detector and Installer (defaults: FileDetector, PackageInstaller). quickstart is hidden and deprecated in favor of setup. --access-token exemption for auth-light commands now uses clearAccessTokenRequirement (including setup) instead of DisableFlagParsing, so subcommand required flags still validate.

Other: InstallResult adds failure_reason for failed auto-installs; usage template updates; symbols is dropped from root command registration and top-level help (package may still exist elsewhere).

Reviewed by Cursor Bugbot for commit fa402b8. 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

@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 97c6a7d. Configure here.

Comment thread cmd/root.go
quickStartCmd.Use = "quickstart"
quickStartCmd.Hidden = true
quickStartCmd.Deprecated = "use 'ldcli setup' for the new guided setup experience"
cmd.AddCommand(quickStartCmd)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Symbols command registration removed

High Severity

The symbols command import and AddCommand wiring were dropped from the root command, and its help entry was removed from the usage template, while cmd/symbols still exists and was recently shipped. Users can no longer run ldcli symbols.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 97c6a7d. Configure here.

Comment thread cmd/setup/wizard.go
}
// Compute the plan preview shown before any action is taken.
args, _ := setup.InstallArgs(chosen.id, "")
m.planInstallCmd = strings.Join(args, " ")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Detected package manager discarded

High Severity

Detection finds PackageManager (yarn/pnpm/bun/npm), but the wizard only caches SDK id and entry point, then builds detectResult without it and previews install with an empty package manager. Node installs fall back to npm even in yarn/pnpm/bun projects.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 97c6a7d. Configure here.

Comment thread cmd/setup/wizard.go
SDKID: chosen.id,
Language: chosen.language,
EntryPoint: m.detectedEntryPoint,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong entry point after SDK override

Medium Severity

When the user picks a different SDK than the one detected, detectResult still reuses detectedEntryPoint. For append-safe SDKs, runInit then injects that SDK’s code into the original language’s file, which can corrupt the wrong source file.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 97c6a7d. Configure here.

@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 and others added 3 commits July 31, 2026 14:24
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address two review findings on the setup wizard:

- runInstall discarded the underlying install error, so the manual-install
  screen showed only the command with no indication of why the automatic
  install failed. Carry the error onto InstallResult.FailureReason and render
  it on the failure screen.
- The "toggle your flag" link hardcoded https://app.launchdarkly.com, which is
  wrong on federal/custom instances. Derive the host from the configured
  --base-uri.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A file we create is not loaded by the project, so the user needs the chance to
back out at the confirm gate and point setup at the real entry point.

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 73cc570 to fa402b8 Compare July 31, 2026 18:25
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