From 886bba28365d876479c8edd900d14d0f1e27bd87 Mon Sep 17 00:00:00 2001 From: Bruno Guidolim Date: Fri, 27 Mar 2026 23:16:50 +0100 Subject: [PATCH] #238: Replace stringly-typed MCP scope and settings file references - Use Constants.MCPScope.user/.local instead of bare "user"/"local" strings in ConfigurationDiscovery - Use scope.settingsPath.lastPathComponent instead of hardcoded "settings.local.json" in ProjectSyncStrategy display messages --- Sources/mcs/Export/ConfigurationDiscovery.swift | 4 ++-- Sources/mcs/Sync/ProjectSyncStrategy.swift | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/mcs/Export/ConfigurationDiscovery.swift b/Sources/mcs/Export/ConfigurationDiscovery.swift index 151526c..0d2c1fc 100644 --- a/Sources/mcs/Export/ConfigurationDiscovery.swift +++ b/Sources/mcs/Export/ConfigurationDiscovery.swift @@ -156,7 +156,7 @@ struct ConfigurationDiscovery { if let servers = json[Constants.JSONKeys.mcpServers] as? [String: Any] { for (name, value) in servers { if let serverDict = value as? [String: Any] { - config.mcpServers.append(parseMCPServer(name: name, dict: serverDict, scope: "user")) + config.mcpServers.append(parseMCPServer(name: name, dict: serverDict, scope: Constants.MCPScope.user)) } } } @@ -167,7 +167,7 @@ struct ConfigurationDiscovery { let servers = projectEntry[Constants.JSONKeys.mcpServers] as? [String: Any] { for (name, value) in servers { if let serverDict = value as? [String: Any] { - config.mcpServers.append(parseMCPServer(name: name, dict: serverDict, scope: "local")) + config.mcpServers.append(parseMCPServer(name: name, dict: serverDict, scope: Constants.MCPScope.local)) } } } diff --git a/Sources/mcs/Sync/ProjectSyncStrategy.swift b/Sources/mcs/Sync/ProjectSyncStrategy.swift index 1dc8c67..71ab500 100644 --- a/Sources/mcs/Sync/ProjectSyncStrategy.swift +++ b/Sources/mcs/Sync/ProjectSyncStrategy.swift @@ -158,9 +158,9 @@ struct ProjectSyncStrategy: SyncStrategy { if hasContent { do { try settings.save(to: scope.settingsPath, dropKeys: dropKeys) - output.success("Composed settings.local.json") + output.success("Composed \(scope.settingsPath.lastPathComponent)") } catch { - output.error("Could not write settings.local.json: \(error.localizedDescription)") + output.error("Could not write \(scope.settingsPath.lastPathComponent): \(error.localizedDescription)") output.error("Hooks and plugins will not be active. Re-run '\(scope.syncHint)' after fixing the issue.") throw MCSError.fileOperationFailed( path: Constants.FileNames.settingsLocal, @@ -170,9 +170,9 @@ struct ProjectSyncStrategy: SyncStrategy { } else if FileManager.default.fileExists(atPath: scope.settingsPath.path) { do { try FileManager.default.removeItem(at: scope.settingsPath) - output.dimmed("Removed empty settings.local.json") + output.dimmed("Removed empty \(scope.settingsPath.lastPathComponent)") } catch { - output.warn("Could not remove stale settings.local.json: \(error.localizedDescription)") + output.warn("Could not remove stale \(scope.settingsPath.lastPathComponent): \(error.localizedDescription)") } }