diff --git a/apps/ios/Sources/Model/NodeAppModel.swift b/apps/ios/Sources/Model/NodeAppModel.swift index 8fd76d643..e93735621 100644 --- a/apps/ios/Sources/Model/NodeAppModel.swift +++ b/apps/ios/Sources/Model/NodeAppModel.swift @@ -113,7 +113,7 @@ final class NodeAppModel { contextJSON: contextJSON) let ok: Bool - var errorText: String? = nil + var errorText: String? if await !self.isBridgeConnected() { ok = false errorText = "bridge not connected" @@ -362,6 +362,7 @@ final class NodeAppModel { return false } + // swiftlint:disable:next function_body_length cyclomatic_complexity private func handleInvoke(_ req: BridgeInvokeRequest) async -> BridgeInvokeResponse { let command = req.command diff --git a/apps/macos/Sources/Clawdis/CanvasManager.swift b/apps/macos/Sources/Clawdis/CanvasManager.swift index f88593bde..68103a8c1 100644 --- a/apps/macos/Sources/Clawdis/CanvasManager.swift +++ b/apps/macos/Sources/Clawdis/CanvasManager.swift @@ -33,7 +33,11 @@ final class CanvasManager { placement: CanvasPlacement? = nil) throws -> CanvasShowResult { Self.logger.debug( - "showDetailed start session=\(sessionKey, privacy: .public) target=\(target ?? "", privacy: .public) placement=\(placement != nil)") + """ + showDetailed start session=\(sessionKey, privacy: .public) \ + target=\(target ?? "", privacy: .public) \ + placement=\(placement != nil) + """) let anchorProvider = self.defaultAnchorProvider ?? Self.mouseAnchorProvider let session = sessionKey.trimmingCharacters(in: .whitespacesAndNewlines) let normalizedTarget = target? diff --git a/apps/macos/Sources/Clawdis/CanvasWindow.swift b/apps/macos/Sources/Clawdis/CanvasWindow.swift index 11af1b017..0a0d7882b 100644 --- a/apps/macos/Sources/Clawdis/CanvasWindow.swift +++ b/apps/macos/Sources/Clawdis/CanvasWindow.swift @@ -685,7 +685,10 @@ private final class CanvasA2UIActionMessageHandler: NSObject, WKScriptMessageHan } if !result.ok { canvasWindowLogger.error( - "A2UI action send failed name=\(name, privacy: .public) error=\(result.error ?? "unknown", privacy: .public)") + """ + A2UI action send failed name=\(name, privacy: .public) \ + error=\(result.error ?? "unknown", privacy: .public) + """) } } } diff --git a/apps/macos/Sources/Clawdis/ControlRequestHandler.swift b/apps/macos/Sources/Clawdis/ControlRequestHandler.swift index 6210ad916..30a989cde 100644 --- a/apps/macos/Sources/Clawdis/ControlRequestHandler.swift +++ b/apps/macos/Sources/Clawdis/ControlRequestHandler.swift @@ -433,7 +433,7 @@ enum ControlRequestHandler { logger: Logger) async -> Response { do { - var paramsObj: Any? = nil + var paramsObj: Any? let raw = (paramsJSON ?? "").trimmingCharacters(in: .whitespacesAndNewlines) if !raw.isEmpty { if let data = raw.data(using: .utf8) { diff --git a/apps/macos/Sources/Clawdis/GatewayEnvironment.swift b/apps/macos/Sources/Clawdis/GatewayEnvironment.swift index ef6cdf0cd..60343ea31 100644 --- a/apps/macos/Sources/Clawdis/GatewayEnvironment.swift +++ b/apps/macos/Sources/Clawdis/GatewayEnvironment.swift @@ -100,12 +100,15 @@ enum GatewayEnvironment { if let bundled = self.bundledGatewayExecutable() { let installed = self.readGatewayVersion(binary: bundled) if let expected, let installed, !installed.compatible(with: expected) { + let message = + "Bundled gateway \(installed.description) is incompatible with app " + + "\(expected.description); rebuild the app bundle." return GatewayEnvironmentStatus( kind: .incompatible(found: installed.description, required: expected.description), nodeVersion: nil, gatewayVersion: installed.description, requiredGateway: expected.description, - message: "Bundled gateway \(installed.description) is incompatible with app \(expected.description); rebuild the app bundle.") + message: message) } let gatewayVersionText = installed?.description ?? "unknown" return GatewayEnvironmentStatus( @@ -258,18 +261,29 @@ enum GatewayEnvironment { let elapsedMs = Int(Date().timeIntervalSince(start) * 1000) if elapsedMs > 500 { self.logger.warning( - "gateway --version slow (\(elapsedMs, privacy: .public)ms) bin=\(binary, privacy: .public)") + """ + gateway --version slow (\(elapsedMs, privacy: .public)ms) \ + bin=\(binary, privacy: .public) + """) } else { self.logger.debug( - "gateway --version ok (\(elapsedMs, privacy: .public)ms) bin=\(binary, privacy: .public)") + """ + gateway --version ok (\(elapsedMs, privacy: .public)ms) \ + bin=\(binary, privacy: .public) + """) } let data = pipe.fileHandleForReading.readToEndSafely() - let raw = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) + let raw = String(data: data, encoding: .utf8)? + .trimmingCharacters(in: .whitespacesAndNewlines) return Semver.parse(raw) } catch { let elapsedMs = Int(Date().timeIntervalSince(start) * 1000) self.logger.error( - "gateway --version failed (\(elapsedMs, privacy: .public)ms) bin=\(binary, privacy: .public) err=\(error.localizedDescription, privacy: .public)") + """ + gateway --version failed (\(elapsedMs, privacy: .public)ms) \ + bin=\(binary, privacy: .public) \ + err=\(error.localizedDescription, privacy: .public) + """) return nil } } diff --git a/apps/macos/Sources/Clawdis/GatewayProcessManager.swift b/apps/macos/Sources/Clawdis/GatewayProcessManager.swift index 4ffd1f420..f46e0a9ee 100644 --- a/apps/macos/Sources/Clawdis/GatewayProcessManager.swift +++ b/apps/macos/Sources/Clawdis/GatewayProcessManager.swift @@ -94,7 +94,12 @@ final class GatewayProcessManager { self.lastFailureReason = nil self.status = .stopped let bundlePath = Bundle.main.bundleURL.path - Task { _ = await GatewayLaunchAgentManager.set(enabled: false, bundlePath: bundlePath, port: GatewayEnvironment.gatewayPort()) } + Task { + _ = await GatewayLaunchAgentManager.set( + enabled: false, + bundlePath: bundlePath, + port: GatewayEnvironment.gatewayPort()) + } } func refreshEnvironmentStatus(force: Bool = false) { diff --git a/apps/macos/Sources/Clawdis/GeneralSettings.swift b/apps/macos/Sources/Clawdis/GeneralSettings.swift index a1fbc56e1..ee03ed068 100644 --- a/apps/macos/Sources/Clawdis/GeneralSettings.swift +++ b/apps/macos/Sources/Clawdis/GeneralSettings.swift @@ -7,7 +7,6 @@ struct GeneralSettings: View { @AppStorage(cameraEnabledKey) private var cameraEnabled: Bool = false private let healthStore = HealthStore.shared private let gatewayManager = GatewayProcessManager.shared - // swiftlint:disable:next inclusive_language @State private var gatewayDiscovery = GatewayDiscoveryModel() @State private var isInstallingCLI = false @State private var cliStatus: String? @@ -598,7 +597,6 @@ extension GeneralSettings { alert.runModal() } - // swiftlint:disable:next inclusive_language private func applyDiscoveredGateway(_ gateway: GatewayDiscoveryModel.DiscoveredGateway) { MacNodeModeCoordinator.shared.setPreferredBridgeStableID(gateway.stableID) diff --git a/apps/macos/Sources/Clawdis/NodeMode/MacNodeModeCoordinator.swift b/apps/macos/Sources/Clawdis/NodeMode/MacNodeModeCoordinator.swift index cd2f02d98..8ec9accc3 100644 --- a/apps/macos/Sources/Clawdis/NodeMode/MacNodeModeCoordinator.swift +++ b/apps/macos/Sources/Clawdis/NodeMode/MacNodeModeCoordinator.swift @@ -35,7 +35,7 @@ final class MacNodeModeCoordinator { private func run() async { var retryDelay: UInt64 = 1_000_000_000 - var lastCameraEnabled: Bool? = nil + var lastCameraEnabled: Bool? let defaults = UserDefaults.standard while !Task.isCancelled { if await MainActor.run(body: { AppStateStore.shared.isPaused }) { diff --git a/apps/macos/Sources/Clawdis/NodeMode/MacNodeRuntime.swift b/apps/macos/Sources/Clawdis/NodeMode/MacNodeRuntime.swift index da890ff1d..a117b20c6 100644 --- a/apps/macos/Sources/Clawdis/NodeMode/MacNodeRuntime.swift +++ b/apps/macos/Sources/Clawdis/NodeMode/MacNodeRuntime.swift @@ -7,6 +7,7 @@ actor MacNodeRuntime { private let cameraCapture = CameraCaptureService() @MainActor private let screenRecorder = ScreenRecordService() + // swiftlint:disable:next function_body_length func handleInvoke(_ req: BridgeInvokeRequest) async -> BridgeInvokeResponse { let command = req.command if command.hasPrefix("canvas.") || command.hasPrefix("canvas.a2ui."), !Self.canvasEnabled() { diff --git a/apps/macos/Sources/Clawdis/NodePairingApprovalPrompter.swift b/apps/macos/Sources/Clawdis/NodePairingApprovalPrompter.swift index d9f44752b..679e0d759 100644 --- a/apps/macos/Sources/Clawdis/NodePairingApprovalPrompter.swift +++ b/apps/macos/Sources/Clawdis/NodePairingApprovalPrompter.swift @@ -189,13 +189,20 @@ final class NodePairingApprovalPrompter { if self.activeRequestId == req.requestId, self.activeAlert != nil { self.remoteResolutionsByRequestId[req.requestId] = resolution self.logger.info( - "pairing request resolved elsewhere; closing dialog requestId=\(req.requestId, privacy: .public) resolution=\(resolution.rawValue, privacy: .public)") + """ + pairing request resolved elsewhere; closing dialog \ + requestId=\(req.requestId, privacy: .public) \ + resolution=\(resolution.rawValue, privacy: .public) + """) self.endActiveAlert() continue } self.logger.info( - "pairing request resolved elsewhere requestId=\(req.requestId, privacy: .public) resolution=\(resolution.rawValue, privacy: .public)") + """ + pairing request resolved elsewhere requestId=\(req.requestId, privacy: .public) \ + resolution=\(resolution.rawValue, privacy: .public) + """) self.queue.removeAll { $0 == req } Task { @MainActor in await self.notify(resolution: resolution, request: req, via: "remote") @@ -623,7 +630,11 @@ final class NodePairingApprovalPrompter { if self.activeRequestId == resolved.requestId, self.activeAlert != nil { self.remoteResolutionsByRequestId[resolved.requestId] = resolution self.logger.info( - "pairing request resolved elsewhere; closing dialog requestId=\(resolved.requestId, privacy: .public) resolution=\(resolution.rawValue, privacy: .public)") + """ + pairing request resolved elsewhere; closing dialog \ + requestId=\(resolved.requestId, privacy: .public) \ + resolution=\(resolution.rawValue, privacy: .public) + """) self.endActiveAlert() return } diff --git a/apps/macos/Sources/Clawdis/Onboarding.swift b/apps/macos/Sources/Clawdis/Onboarding.swift index ead25547f..68821abf8 100644 --- a/apps/macos/Sources/Clawdis/Onboarding.swift +++ b/apps/macos/Sources/Clawdis/Onboarding.swift @@ -77,7 +77,6 @@ struct OnboardingView: View { @State private var gatewayInstallMessage: String? @State private var showAdvancedConnection = false @State private var preferredGatewayID: String? - // swiftlint:disable:next inclusive_language @State private var gatewayDiscovery: GatewayDiscoveryModel @Bindable private var state: AppState private var permissionMonitor: PermissionMonitor @@ -489,8 +488,8 @@ struct OnboardingView: View { } Text( - "This lets Pi use Claude immediately. Credentials are stored at `~/.pi/agent/oauth.json` (owner-only). " + - "You can redo this anytime.") + "This lets Pi use Claude immediately. Credentials are stored at " + + "`~/.pi/agent/oauth.json` (owner-only). You can redo this anytime.") .font(.subheadline) .foregroundStyle(.secondary) .fixedSize(horizontal: false, vertical: true) @@ -993,7 +992,8 @@ struct OnboardingView: View { } else { Text( "Tip: edit AGENTS.md in this folder to shape the assistant’s behavior. " + - "For backup, make the workspace a private git repo so your agent’s “memory” is versioned.") + "For backup, make the workspace a private git repo so your agent’s " + + "“memory” is versioned.") .font(.caption) .foregroundStyle(.secondary) .lineLimit(2) diff --git a/apps/macos/Sources/Clawdis/RuntimeLocator.swift b/apps/macos/Sources/Clawdis/RuntimeLocator.swift index c7c957253..95f764b9b 100644 --- a/apps/macos/Sources/Clawdis/RuntimeLocator.swift +++ b/apps/macos/Sources/Clawdis/RuntimeLocator.swift @@ -138,17 +138,27 @@ enum RuntimeLocator { let elapsedMs = Int(Date().timeIntervalSince(start) * 1000) if elapsedMs > 500 { self.logger.warning( - "runtime --version slow (\(elapsedMs, privacy: .public)ms) bin=\(binary, privacy: .public)") + """ + runtime --version slow (\(elapsedMs, privacy: .public)ms) \ + bin=\(binary, privacy: .public) + """) } else { self.logger.debug( - "runtime --version ok (\(elapsedMs, privacy: .public)ms) bin=\(binary, privacy: .public)") + """ + runtime --version ok (\(elapsedMs, privacy: .public)ms) \ + bin=\(binary, privacy: .public) + """) } let data = pipe.fileHandleForReading.readToEndSafely() return String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) } catch { let elapsedMs = Int(Date().timeIntervalSince(start) * 1000) self.logger.error( - "runtime --version failed (\(elapsedMs, privacy: .public)ms) bin=\(binary, privacy: .public) err=\(error.localizedDescription, privacy: .public)") + """ + runtime --version failed (\(elapsedMs, privacy: .public)ms) \ + bin=\(binary, privacy: .public) \ + err=\(error.localizedDescription, privacy: .public) + """) return nil } } diff --git a/apps/macos/Sources/ClawdisCLI/ClawdisCLI.swift b/apps/macos/Sources/ClawdisCLI/ClawdisCLI.swift index dd0218b27..a319491f6 100644 --- a/apps/macos/Sources/ClawdisCLI/ClawdisCLI.swift +++ b/apps/macos/Sources/ClawdisCLI/ClawdisCLI.swift @@ -2,6 +2,7 @@ import ClawdisIPC import Darwin import Foundation +// swiftlint:disable type_body_length @main struct ClawdisCLI { static func main() async { @@ -535,6 +536,7 @@ struct ClawdisCLI { return CanvasPlacement(x: x, y: y, width: width, height: height) } + // swiftlint:disable:next cyclomatic_complexity private static func printText(parsed: ParsedCLIRequest, response: Response) throws { guard response.ok else { let msg = response.message ?? "failed" @@ -1056,6 +1058,7 @@ struct ClawdisCLI { try? await Task.sleep(nanoseconds: 100_000_000) } } +// swiftlint:enable type_body_length enum CLIError: Error { case help, version }