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
1 change: 1 addition & 0 deletions docs/cli/thv_client_register.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/cli/thv_client_remove.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions docs/server/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions docs/server/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/server/swagger.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions pkg/client/config.go
Comment thread
jerm-dro marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const (
Factory ClientApp = "factory"
// CopilotCli represents the GitHub Copilot CLI.
CopilotCli ClientApp = "copilot-cli"
// Qoder represents the Qoder IDE.
Qoder ClientApp = "qoder"
)

const (
Expand Down Expand Up @@ -1005,6 +1007,33 @@ var supportedClientIntegrations = []clientAppConfig{
types.TransportTypeStreamableHTTP: defaultURLFieldName,
},
},
{
ClientType: Qoder,
Description: "Qoder IDE",
SettingsFile: "mcp.json",
MCPServersPathPrefix: "/mcpServers",
RelPath: []string{},
PlatformPrefix: map[Platform][]string{
PlatformDarwin: {".qoder"},
PlatformLinux: {".qoder"},
PlatformWindows: {"AppData", "Roaming", "Qoder", "SharedClientCache"},
},
Extension: JSON,
IsTransportTypeFieldSupported: true,
SupportedTransportTypesMap: map[types.TransportType]string{
types.TransportTypeStdio: httpTransportLabel,
types.TransportTypeSSE: "sse",
types.TransportTypeStreamableHTTP: httpTransportLabel,
},
MCPServersUrlLabelMap: map[types.TransportType]string{
types.TransportTypeStdio: defaultURLFieldName,
types.TransportTypeSSE: defaultURLFieldName,
types.TransportTypeStreamableHTTP: defaultURLFieldName,
},
SupportsSkills: true,
SkillsGlobalPath: []string{".qoder", skillsDirName},
SkillsProjectPath: []string{".qoder", skillsDirName},
},
{
// Xcode does not support MCP; it is an LLM-gateway-only entry.
// Cast LLMClientApp → ClientApp for internal config storage; the type
Expand Down
21 changes: 15 additions & 6 deletions pkg/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ func createMockClientConfigs() []clientAppConfig {
MCPServersPathPrefix: "/mcpServers",
Extension: JSON,
},
{
ClientType: Qoder,
Description: "Qoder (Mock)",
RelPath: []string{"mock_qoder"},
SettingsFile: "mcp.json",
MCPServersPathPrefix: "/mcpServers",
Extension: JSON,
},
}
}

Expand Down Expand Up @@ -376,6 +384,7 @@ func TestSuccessfulClientConfigOperations(t *testing.T) {
string(Codex),
string(KimiCli),
string(Factory),
string(Qoder),
},
},
}
Expand Down Expand Up @@ -456,7 +465,7 @@ func TestSuccessfulClientConfigOperations(t *testing.T) {
case AmpCli:
assert.Contains(t, string(content), `"mcpServers":`,
"AmpCli config should contain mcpServers key")
case LMStudio, Trae, Kiro, Antigravity, GeminiCli, KimiCli, Factory, CopilotCli:
case Qoder, LMStudio, Trae, Kiro, Antigravity, GeminiCli, KimiCli, Factory, CopilotCli:
assert.Contains(t, string(content), `"mcpServers":`,
"Config should contain mcpServers key")
case VSCodeServer:
Expand Down Expand Up @@ -515,7 +524,7 @@ func TestSuccessfulClientConfigOperations(t *testing.T) {
"VSCode config should contain the server URL")
case Cursor, RooCode, ClaudeCode, Cline, Windsurf, WindsurfJetBrains, AmpCli,
LMStudio, Goose, Trae, Continue, OpenCode, Kiro, Antigravity, Zed, GeminiCli, VSCodeServer,
MistralVibe, Codex, KimiCli, Factory, CopilotCli:
MistralVibe, Codex, Qoder, KimiCli, Factory, CopilotCli:
assert.Contains(t, string(content), testURL,
"Config should contain the server URL")
}
Expand Down Expand Up @@ -1244,8 +1253,8 @@ func TestGetAllClients(t *testing.T) {

clients := GetAllClients()

// Should return all 24 supported clients
assert.Len(t, clients, 24, "Expected 24 supported clients")
// Should return all 25 supported clients
assert.Len(t, clients, 25, "Expected 25 supported clients")

// Verify the list is sorted alphabetically
for i := 1; i < len(clients); i++ {
Expand Down Expand Up @@ -1459,7 +1468,7 @@ func TestGetClientListCSV(t *testing.T) {
clientNames[i-1], clientNames[i])
}

// Count the number of clients (should be 24)
// Count the number of clients (should be 25)
clients := strings.Split(csv, ", ")
assert.Len(t, clients, 24, "Expected 24 clients in CSV list")
assert.Len(t, clients, 25, "Expected 25 clients in CSV list")
}
5 changes: 3 additions & 2 deletions pkg/client/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ type ClientAppStatus struct {

// IsClientInstalled reports whether the given client appears to be installed on
// the current system. Detection is based on the presence of the client's
// configuration directory (or settings file when no relative path is defined).
// configuration directory (or settings file when neither a relative path nor a
// platform prefix is defined).
func (cm *ClientManager) IsClientInstalled(clientType ClientApp) bool {
cfg := cm.lookupClientAppConfig(clientType)
if cfg == nil || cfg.LLMGatewayOnly {
return false
}
var pathToCheck string
if len(cfg.RelPath) == 0 {
if len(cfg.RelPath) == 0 && len(cfg.PlatformPrefix) == 0 {
Comment thread
jerm-dro marked this conversation as resolved.
pathToCheck = filepath.Join(cm.homeDir, cfg.SettingsFile)
} else {
pathToCheck = buildConfigDirectoryPath(cfg.RelPath, cfg.PlatformPrefix, []string{cm.homeDir})
Expand Down
55 changes: 55 additions & 0 deletions pkg/client/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"os"
"path/filepath"
"runtime"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -215,6 +216,17 @@ func TestIsClientInstalled(t *testing.T) {

// VSCode path (.config/Code/User) is intentionally not created

// Qoder resolves via PlatformPrefix only (empty RelPath). Resolve its
// directory for the current OS and create it to simulate an install.
qoderPlatformPrefix := map[Platform][]string{
PlatformDarwin: {".qoder"},
PlatformLinux: {".qoder"},
PlatformWindows: {"AppData", "Roaming", "Qoder", "SharedClientCache"},
}
qoderDir := buildConfigDirectoryPath([]string{}, qoderPlatformPrefix, []string{tempHome})
err = os.MkdirAll(qoderDir, 0700)
require.NoError(t, err)

clientIntegrations := []clientAppConfig{
{
ClientType: ClaudeCode,
Expand All @@ -231,6 +243,22 @@ func TestIsClientInstalled(t *testing.T) {
SettingsFile: "mcp.json",
RelPath: []string{".config", "Code", "User"}, // not created
},
{
// PlatformPrefix-only client whose directory is present
ClientType: Qoder,
SettingsFile: "mcp.json",
PlatformPrefix: qoderPlatformPrefix,
},
{
// PlatformPrefix-only client whose directory is absent
ClientType: ClientApp("qoder-missing"),
SettingsFile: "mcp.json",
PlatformPrefix: map[Platform][]string{
PlatformDarwin: {".qoder-missing"},
PlatformLinux: {".qoder-missing"},
PlatformWindows: {"AppData", "Roaming", "QoderMissing", "SharedClientCache"},
},
},
{
// unknown client, no config
ClientType: ClientApp("nonexistent"),
Expand All @@ -249,6 +277,8 @@ func TestIsClientInstalled(t *testing.T) {
{name: "ClaudeCode settings file present", clientType: ClaudeCode, want: true},
{name: "Cursor directory present", clientType: Cursor, want: true},
{name: "VSCode directory absent", clientType: VSCode, want: false},
{name: "PlatformPrefix-only directory present", clientType: Qoder, want: true},
{name: "PlatformPrefix-only directory absent", clientType: ClientApp("qoder-missing"), want: false},
{name: "client not in integrations", clientType: ClientApp("not-registered"), want: false},
}

Expand Down Expand Up @@ -341,3 +371,28 @@ func TestGetClientStatus_WithGroups(t *testing.T) {
assert.True(t, cursorStatus.Installed)
assert.True(t, cursorStatus.Registered, "Cursor should be registered via groups")
}

func TestQoderConfigPathsResolveCorrectly(t *testing.T) {
t.Parallel()

cfg := NewTestClientManager(t.TempDir(), nil, supportedClientIntegrations, nil).lookupClientAppConfig(Qoder)
require.NotNil(t, cfg, "Qoder config should exist")
require.Empty(t, cfg.RelPath, "Qoder uses PlatformPrefix only")

home := t.TempDir()

// The documented Qoder config locations (verified on a real install):
// macOS/Linux: ~/.qoder/mcp.json
// Windows: %APPDATA%\Qoder\SharedClientCache\mcp.json
expected := map[Platform]string{
PlatformDarwin: filepath.Join(home, ".qoder"),
PlatformLinux: filepath.Join(home, ".qoder"),
PlatformWindows: filepath.Join(home, "AppData", "Roaming", "Qoder", "SharedClientCache"),
}

want, ok := expected[Platform(runtime.GOOS)]
require.True(t, ok, "Qoder config must define a PlatformPrefix for the current platform")

got := buildConfigDirectoryPath(cfg.RelPath, cfg.PlatformPrefix, []string{home})
assert.Equal(t, want, got)
}
Loading