From 0576f3409dacef05a354e1bbbfe0311ae045cfe2 Mon Sep 17 00:00:00 2001 From: David Ragot <35502263+Dav-14@users.noreply.github.com> Date: Fri, 20 Mar 2026 12:06:41 +0100 Subject: [PATCH] fix(ui): bypass organization selection for ui command The ui command only needs server info to get the console URL, not a full organization-scoped client. Create the membership client directly to avoid forcing users through organization selection. Co-Authored-By: Claude Opus 4.6 --- cmd/ui/ui.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/ui/ui.go b/cmd/ui/ui.go index 0f692721..3da1a106 100644 --- a/cmd/ui/ui.go +++ b/cmd/ui/ui.go @@ -8,6 +8,7 @@ import ( "github.com/spf13/cobra" + membershipclient "github.com/formancehq/fctl/internal/membershipclient/v3" fctl "github.com/formancehq/fctl/v3/pkg" ) @@ -64,21 +65,20 @@ func (c *UiController) GetStore() *UiStruct { func (c *UiController) Run(cmd *cobra.Command, args []string) (fctl.Renderable, error) { - _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + _, profile, _, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) if err != nil { return nil, err } - _, apiClient, err := fctl.NewMembershipClientForOrganizationFromFlags(cmd, relyingParty, fctl.NewPTermDialog(), profileName, *profile) - if err != nil { - return nil, err - } + cli := membershipclient.New( + membershipclient.WithServerURL(profile.GetMembershipURI()), + membershipclient.WithClient(relyingParty.HttpClient()), + ) - serverInfo, err := fctl.MembershipServerInfo(cmd.Context(), apiClient) + serverInfo, err := fctl.MembershipServerInfo(cmd.Context(), cli) if err != nil { return nil, err } - if v := serverInfo.GetConsoleURL(); v != nil { c.store.UIUrl = *v } @@ -97,7 +97,7 @@ func (c *UiController) Render(cmd *cobra.Command, args []string) error { } func NewCommand() *cobra.Command { - return fctl.NewStackCommand("ui", + return fctl.NewCommand("ui", fctl.WithShortDescription("Open UI"), fctl.WithArgs(cobra.ExactArgs(0)), fctl.WithValidArgsFunction(cobra.NoFileCompletions),