chore(setup): add SDK installer library - #750
Conversation
536ddf1 to
fb2c630
Compare
fb2c630 to
1f13de3
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ 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 1f13de3. Configure here.
| case "python-server-sdk": | ||
| manifests = []string{"requirements.txt", "pyproject.toml", "setup.py", "Pipfile", "uv.lock"} | ||
| case "ruby-server-sdk": | ||
| manifests = []string{"Gemfile", "Gemfile.lock"} |
There was a problem hiding this comment.
Lockfiles fake installed status
Low Severity
IsInstalled treats go.sum, Gemfile.lock, and uv.lock as proof the SDK is a project dependency. Those lockfiles can retain package names after removal from go.mod / Gemfile / pyproject.toml, or list transitive-only hits, so setup can set AlreadyInstalled and skip adding a direct dependency the app still needs. Node correctly checks only package.json.
Reviewed by Cursor Bugbot for commit 1f13de3. Configure here.
1f13de3 to
220b32e
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`gem install` left the Gemfile untouched, so the SDK stayed unavailable under bundler and IsInstalled kept returning false. Use `bundle add` when the project is Bundler-managed, and poetry, uv or pipenv when one of those manages the Python dependencies. Unrecognised package managers fall back to pip rather than being run as a command, since the value reaches InstallArgs from the detector. InstallArgs added launchdarkly-react-native-client-sdk, which npm marks deprecated in favour of @launchdarkly/react-native-client-sdk. The unscoped launchdarkly-js-client-sdk is the v3 package whose initialize API the init template uses; the scoped one is v4 and exposes createClient. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
IsInstalled tested for its package name as a substring, so @launchdarkly/node-server-sdk-redis, launchdarkly-server-sdk-otel, and LaunchDarkly.ServerSdk.Telemetry each counted as the SDK itself and the real install was skipped. Require a non-name character on both sides, which every manifest format supplies. Detection accepts a solution with no project file beside it, but install ran a bare `dotnet add package`, which needs the working directory to hold exactly one project. Resolve the project the solution refers to and pass --project; with none or several, stop and say so rather than adding the SDK to an arbitrary assembly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
220b32e to
45e5847
Compare


Describe the solution you've provided
Second layer of the guided
setupcommand: the SDK installer. Given a detection result, installs the SDK via the project's package manager (Installerinterface,PackageInstaller,InstallArgs,IsInstalled), and flags SDKs that require manual install.Builds on the detection library (
DetectResult).Related issues
Part of the
setup-ldfeature. Stacked PR — base isffantl/setup-ld/1-detector.Requirements
Note
Medium Risk
Runs real package-manager commands via
execon user projects; incorrect install targeting or falseIsInstalledpositives could skip needed SDK installs or modify the wrong .NET project.Overview
Adds
internal/setupinstaller layer for the guided setup flow: given aDetectResult, it can install the matching LaunchDarkly SDK via the project’s package manager or surface manual-install guidance.PackageInstallerimplementsInstallerby mapping SDK IDs to install commands (InstallArgs) for Node (npm/yarn/pnpm/bun), Python (pip/poetry/uv/pipenv), Go, Ruby (bundle addwhen Bundler is detected), and .NET. Java, Android, and Swift/iOS return package coordinates withSuccess=falseand no error viaRequiresManualInstall; unknown SDK IDs error.Before running a command,
IsInstalledscans manifests (and nested.csprojfiles) using boundary-awarementionsPackagematching so related packages (e.g.*-redis) are not treated as the core SDK. .NET installs add--projectwhen needed, or returnFailedwithFailureReasonwhen there are zero or multiple projects.Includes broad unit tests for command selection, install outcomes, and edge cases.
Reviewed by Cursor Bugbot for commit 45e5847. Bugbot is set up for automated code reviews on this repo. Configure here.