refactor(setup): move orchestration out of the wizard UI - #759
Open
ffantl-ld wants to merge 5 commits into
Open
Conversation
ffantl-ld
force-pushed
the
ffantl/setup-ld/7-wizard-extraction
branch
from
July 27, 2026 20:39
c808955 to
f320691
Compare
ffantl-ld
marked this pull request as ready for review
July 28, 2026 17:37
ari-launchdarkly
left a comment
Contributor
There was a problem hiding this comment.
Why not use the existing projects / environment commands?
Contributor
Author
|
Good call — done in df96562.
Two notes:
Verified by walking the full wizard against a real project in a clean container. |
ffantl-ld
commented
Jul 30, 2026
| func NewSetupCmd( | ||
| analyticsTrackerFn analytics.TrackerFn, | ||
| resourcesClient resources.Client, | ||
| clients setup.Clients, |
Contributor
Author
There was a problem hiding this comment.
I'm not married to the idea of a struct here for these interfaces, btw. There are pros and cons between passing the interfaces as params, or just bundling them in a struct.
ffantl-ld
force-pushed
the
ffantl/setup-ld/6-command
branch
from
July 31, 2026 17:48
97c6a7d to
73cc570
Compare
ffantl-ld
force-pushed
the
ffantl/setup-ld/7-wizard-extraction
branch
from
July 31, 2026 17:48
df96562 to
aec0163
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The setup service built its API requests by hand: url.JoinPath paths, inline response structs, and no shared error handling. Projects, environments, and flags have typed clients wrapping the generated SDK, so use those. Add environments.List, which the client did not expose, and group the service's clients in a setup.Clients struct. Verify keeps using resources.Client because its sdk-active endpoint has no method in the generated SDK. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ffantl-ld
force-pushed
the
ffantl/setup-ld/6-command
branch
from
July 31, 2026 18:25
73cc570 to
fa402b8
Compare
ffantl-ld
force-pushed
the
ffantl/setup-ld/7-wizard-extraction
branch
from
July 31, 2026 18:25
aec0163 to
f9f0996
Compare
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.
Describe the solution you've provided
Moves the setup orchestration out of the UI layer. Adds a
Serviceininternal/setup(with anAuthvalue for credentials, so it never readsviper) that owns every step — list projects/environments, fetch env keys, detect, install, create flag, inject, verify. The Bubble Tea wizard
becomes a thin adapter over the service, and the
detect/install/initsubcommands call the sameservice, removing the wizard-vs-subcommand duplication. The flow is now unit-testable without driving
the TUI.
wizard.go(871 lines) is split intomodel.go/update.go/view.go/commands.go. TheUpdatestate machine (screen sequencing) is unchanged.Related issues
Top of the
setup-ldfeature stack — cleanup on top of the setup command. Stacked PR: base isffantl/setup-ld/6-command.Additional context
resources.Client(drops the unusedflags.Clientarg fromNewSetupCmd; one-line change incmd/root.go).non-interactive
installsubcommand still returns a real error.Requirements
Note
Medium Risk
Touches authenticated API flows, local file injection, and package install execution; behavior is largely preserved but centralized, with new unit tests reducing regression risk.
Overview
Moves setup orchestration into
internal/setup.Service, with anAuthstruct so the layer never readsviper. The service owns listing projects/environments, env SDK keys, detect/install, flag creation (including conflict-as-success), inject, and verify.NewSetupCmdnow takessetup.Clients(projects, environments, flags, resources);cmd/root.gowires all four instead of passing resources/flags alone.The Bubble Tea wizard is a thin adapter:
commands.gomapstea.Cmdhandlers to service methods; the monolithicwizard.gois split intomodel.go/update.go/view.go/commands.gowithout changing the step flow. Install-failure “continue with manual command” stays in the wizard;detect/install/initcall the same service (non-interactive install still returns errors).Adds
EnvironmentsClient.List(and mock) for environment listing.service_test.gocovers API parsing, flag conflict handling, and passthrough steps with mocks/fakes.Reviewed by Cursor Bugbot for commit f9f0996. Bugbot is set up for automated code reviews on this repo. Configure here.