diff --git a/Sources/XcodeMCPProxyKit/Internal/BuildInfo/ProxyBuildInfo.swift b/Sources/XcodeMCPProxyKit/Internal/BuildInfo/ProxyBuildInfo.swift deleted file mode 100644 index d4c5d591..00000000 --- a/Sources/XcodeMCPProxyKit/Internal/BuildInfo/ProxyBuildInfo.swift +++ /dev/null @@ -1,5 +0,0 @@ -enum ProxyBuildInfo { - static var version: String { - ProxyBuildGeneratedInfo.version - } -} diff --git a/Sources/XcodeMCPProxyKit/Internal/Support/DiscoveryClient.swift b/Sources/XcodeMCPProxyKit/Internal/Support/DiscoveryClient.swift index e3a29d4e..5071e8b6 100644 --- a/Sources/XcodeMCPProxyKit/Internal/Support/DiscoveryClient.swift +++ b/Sources/XcodeMCPProxyKit/Internal/Support/DiscoveryClient.swift @@ -43,7 +43,7 @@ struct DiscoveryClient: DependencyClient { static func live( defaultFileURL: @escaping @Sendable () -> URL = { - ProxyFilesystemLocations.discoveryFileURL() + Discovery.defaultFileURL(environment: ProcessInfo.processInfo.environment) }, loadRecord: @escaping @Sendable (_ url: URL) throws -> DiscoveryRecord = { try Discovery.loadRecord(from: $0) diff --git a/Sources/XcodeMCPProxyKit/Internal/Support/ProxyFilesystemLocations.swift b/Sources/XcodeMCPProxyKit/Internal/Support/ProxyFilesystemLocations.swift deleted file mode 100644 index 5517fe23..00000000 --- a/Sources/XcodeMCPProxyKit/Internal/Support/ProxyFilesystemLocations.swift +++ /dev/null @@ -1,14 +0,0 @@ -import XcodeMCPCore -import Foundation - -enum ProxyFilesystemLocations { - static let cacheRootEnv = Discovery.cacheRootEnvironmentVariable - static let discoveryFileEnv = Discovery.discoveryFileEnvironmentVariable - - static func discoveryFileURL( - environment: [String: String] = ProcessInfo.processInfo.environment, - fileManager: FileManager = .default - ) -> URL { - Discovery.defaultFileURL(environment: environment, fileManager: fileManager) - } -} diff --git a/Sources/XcodeMCPProxyKit/XcodeMCPProxyLogging.swift b/Sources/XcodeMCPProxyKit/XcodeMCPProxyLogging.swift deleted file mode 100644 index 0200f51c..00000000 --- a/Sources/XcodeMCPProxyKit/XcodeMCPProxyLogging.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Logging -import XcodeMCPProxyRuntime - -package enum XcodeMCPProxyLogging { - package static func bootstrap(environment: [String: String]) { - ProxyLogging.bootstrap(environment: environment) - } - - package static func make(_ label: String) -> Logger { - ProxyLogging.make(label) - } -} diff --git a/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+ExistingServerController.swift b/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+ExistingServerController.swift deleted file mode 100644 index bc304174..00000000 --- a/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+ExistingServerController.swift +++ /dev/null @@ -1,45 +0,0 @@ -import XcodeMCPCore - -extension XcodeMCPProxyServer { - /// High-level launcher dependency adapter. - /// - /// Proxy restart policy stays inside `XcodeMCPProxyKit`; low-level process - /// command and signal mechanics are owned by the internal process runtime. - struct ExistingServerController: DependencyClient { - var terminateExistingServer: - @Sendable (_ host: String, _ port: Int, _ emitWarning: (String) -> Void) -> Bool - var detectExistingServerProcessIDs: @Sendable (_ host: String, _ port: Int) -> [Int] - - init( - terminateExistingServer: @escaping @Sendable ( - _ host: String, - _ port: Int, - _ emitWarning: (String) -> Void - ) -> Bool, - detectExistingServerProcessIDs: @escaping @Sendable (_ host: String, _ port: Int) -> [Int] - ) { - self.terminateExistingServer = terminateExistingServer - self.detectExistingServerProcessIDs = detectExistingServerProcessIDs - } - - static let liveValue = live() - - static let testValue = Self( - terminateExistingServer: { _, _, _ in false }, - detectExistingServerProcessIDs: { _, _ in [] } - ) - - static func live( - processController: ExistingProxyServerProcessController = .liveValue - ) -> Self { - Self( - terminateExistingServer: { host, port, emitWarning in - processController.terminateExistingServer(host, port, emitWarning) - }, - detectExistingServerProcessIDs: { host, port in - processController.detectExistingServerProcessIDs(host, port) - } - ) - } - } -} diff --git a/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+Launch.swift b/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+Launch.swift index 2ae79d07..38e9e774 100644 --- a/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+Launch.swift +++ b/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+Launch.swift @@ -1,4 +1,6 @@ import Foundation +import XcodeMCPCore +import XcodeMCPProxyRuntime package struct XcodeMCPProxyProductMetadata: Equatable, Sendable { package let name: String @@ -18,7 +20,7 @@ extension XcodeMCPProxyServer { } package static var productMetadata: XcodeMCPProxyProductMetadata { - XcodeMCPProxyProductMetadata(version: ProxyBuildInfo.version) + XcodeMCPProxyProductMetadata(version: ProxyBuildGeneratedInfo.version) } package static var serverUsage: String { @@ -49,7 +51,7 @@ extension XcodeMCPProxyServer { } package static func bootstrapLogging(environment: [String: String]) { - XcodeMCPProxyLogging.bootstrap(environment: environment) + ProxyLogging.bootstrap(environment: environment) } } @@ -66,7 +68,7 @@ private extension ProxyServerCommand { maxBodyBytes: maxBodyBytes ?? 1_048_576, requestTimeout: requestTimeout.map { $0.duration } ?? XcodeMCPProxyServerConfiguration().requestTimeout, - discovery: .file(ProxyFilesystemLocations.discoveryFileURL(environment: environment)), + discovery: .file(Discovery.defaultFileURL(environment: environment)), approvalPolicy: autoApprove ? .automatic : .manual, enablesDebugEndpoints: debugEndpoints ) diff --git a/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+Launcher.swift b/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+Launcher.swift index bc0bc20b..d9ee613f 100644 --- a/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+Launcher.swift +++ b/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+Launcher.swift @@ -40,7 +40,7 @@ extension XcodeMCPProxyServer { } package static var live: Self { - let existingServerController = XcodeMCPProxyServer.ExistingServerController.liveValue + let existingServerController = ExistingProxyServerProcessController.liveValue return Self( makeServer: { configuration in XcodeMCPProxyServer(configuration: configuration) diff --git a/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+PermissionAutomation.swift b/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+PermissionAutomation.swift index 56856ace..edf69496 100644 --- a/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+PermissionAutomation.swift +++ b/Sources/XcodeMCPProxyKit/XcodeMCPProxyServer+PermissionAutomation.swift @@ -1,5 +1,6 @@ import Logging import XcodeMCPPermissionAutomation +import XcodeMCPProxyRuntime protocol ProxyServerPermissionDialogAutoApprover: Sendable { func start() @@ -20,7 +21,7 @@ extension XcodePermissionDialogAutomation.AutoApprover: ProxyServerPermissionDia agentProcessIDCandidates: { descendantProcessIDCandidates() }, agentScope: .allAgents ), - logger: XcodeMCPProxyLogging.make("xcode.permission") + logger: ProxyLogging.make("xcode.permission") ) } }