Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pkg/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,27 @@ func FindClientsByProfile(ctx context.Context, profileID string) map[string]any
continue
}
clientCfg := processor.ParseConfig()
if clientCfg.WorkingSet == profileID {
if matchesProfile(clientCfg, profileID) {
clients[vendor] = clientCfg
}
}

gordonCfg := GetGordonSetup(ctx)
if gordonCfg.WorkingSet == profileID {
if matchesProfile(gordonCfg, profileID) {
clients[VendorGordon] = gordonCfg
}

codexCfg := GetCodexSetup(ctx)
if codexCfg.WorkingSet == profileID {
if matchesProfile(codexCfg, profileID) {
clients[VendorCodex] = codexCfg
}

return clients
}

func matchesProfile(cfg MCPClientCfg, profileID string) bool {
if cfg.IsMCPCatalogConnected && profileID == "default" && cfg.WorkingSet == "" {
return true
}
return cfg.WorkingSet == profileID
}
16 changes: 16 additions & 0 deletions pkg/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,18 @@ func TestFindClientsByProfile(t *testing.T) {
},
expectedVendors: []string{},
},
{
name: "find clients with default profile",
profileID: "default",
mockConfigs: map[string][]byte{
vendorCursor: readTestData(t, "find-profiles/cursor-with-profile.json"),
vendorClaudeDesktop: readTestData(t, "find-profiles/claude-desktop-with-profile.json"),
vendorZed: readTestData(t, "find-profiles/zed-without-profile.json"),
vendorKiro: readTestData(t, "find-profiles/kiro-without-profile.json"),
vendorContinueDev: readTestData(t, "find-profiles/continue-without-profile.yml"),
},
expectedVendors: []string{vendorZed, vendorKiro, vendorContinueDev},
},
{
name: "finds clients without profile when searching for empty string",
profileID: "",
Expand Down Expand Up @@ -377,6 +389,10 @@ func TestFindClientsByProfile(t *testing.T) {
}
clientCfg.setParseResult(lists, nil)

if matchesProfile(clientCfg, tc.profileID) {
clientCfg.WorkingSet = tc.profileID // Overwrite if matching
}

shouldMatch := expectedMap[vendor]

if shouldMatch {
Expand Down
Loading