From 3554e5b2e4694e74cf55262776d50f4251c46344 Mon Sep 17 00:00:00 2001 From: thoroc Date: Mon, 11 May 2026 12:11:20 +0100 Subject: [PATCH] fix(providers): make cline config path cross-platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hardcoded Library/Application Support (macOS-only) with io.UserConfigDir(), which resolves to the correct OS-specific base: macOS → ~/Library/Application Support Linux → ~/.config (XDG) Windows → %APPDATA% Add a test asserting the default path is rooted at UserConfigDir(). Update docs to document the OS-specific resolved paths. --- docs/providers/cline.md | 10 +++++++++- internal/providers/cline.go | 7 +++++-- internal/providers/cline_test.go | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/docs/providers/cline.md b/docs/providers/cline.md index 72eee46..04283b2 100644 --- a/docs/providers/cline.md +++ b/docs/providers/cline.md @@ -7,10 +7,18 @@ | Scope | Path | |---------|------| | Project | — | -| Global | `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` | +| Global | See OS-specific paths below | Project-level config is not supported. +### OS-specific global config paths + +| OS | Path | +|---------|------| +| macOS | `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` | +| Linux | `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` | +| Windows | `%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json` | + ## Format ```json diff --git a/internal/providers/cline.go b/internal/providers/cline.go index 1d9e05e..25dcabc 100644 --- a/internal/providers/cline.go +++ b/internal/providers/cline.go @@ -1,6 +1,8 @@ package providers import ( + "path/filepath" + "github.com/pantheon-org/iris/internal/io" "github.com/pantheon-org/iris/internal/types" ) @@ -10,8 +12,9 @@ type ClineProvider struct { } func clineConfigPath() string { - return io.UserHomePath( - "Library", "Application Support", "Code", "User", "globalStorage", + return filepath.Join( + io.UserConfigDir(), + "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json", ) } diff --git a/internal/providers/cline_test.go b/internal/providers/cline_test.go index e291d5c..15aa6dd 100644 --- a/internal/providers/cline_test.go +++ b/internal/providers/cline_test.go @@ -3,11 +3,27 @@ package providers_test import ( "os" "path/filepath" + "strings" "testing" "github.com/pantheon-org/iris/internal/providers" ) +func TestClineProvider_DefaultPath_RootedAtUserConfigDir(t *testing.T) { + configDir, err := os.UserConfigDir() + if err != nil { + t.Skip("os.UserConfigDir() unavailable:", err) + } + p := providers.NewClineProvider() + got := p.ConfigFilePath("") + if !strings.HasPrefix(got, configDir) { + t.Errorf("default path %q does not start with UserConfigDir %q", got, configDir) + } + if !strings.HasSuffix(got, "cline_mcp_settings.json") { + t.Errorf("default path %q does not end with cline_mcp_settings.json", got) + } +} + func TestClineProvider_Config(t *testing.T) { tmp := t.TempDir() p := providers.NewClineProviderWithPath(filepath.Join(tmp, "cline_mcp_settings.json"))