Skip to content

Commit 3305d17

Browse files
malpernclaude
andcommitted
Implement TCP reload for reset to default functionality
- Modified resetToDefaultConfig() to use TCP reload instead of service restart - Added immediate configuration application via TCP with fallback to restart - Created comprehensive test script for reset functionality validation - Enhanced error handling and logging for reset operations Benefits: - Faster config application (TCP reload vs full service restart) - Better user experience with immediate feedback - Maintains service stability during reset operations - Robust fallback mechanism if TCP reload fails Test Results: - Service stability: PASS - TCP server functionality: PASS - Configuration reset: PASS - TCP reload detection: PASS 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent fd187c6 commit 3305d17

10 files changed

Lines changed: 803 additions & 6 deletions

Sources/KeyPath/InstallationWizard/Core/WizardNavigationEngine.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ class WizardNavigationEngine: WizardNavigating {
198198
false // Can manage service state
199199
case .fullDiskAccess:
200200
false // Optional, not blocking
201+
case .tcpServer:
202+
false // Optional, not blocking
201203
case .summary:
202204
false // Final state
203205
}
@@ -236,6 +238,8 @@ class WizardNavigationEngine: WizardNavigating {
236238
"Install Karabiner Components"
237239
case .kanataComponents:
238240
"Install Kanata Components"
241+
case .tcpServer:
242+
"Check TCP Server"
239243
case .service:
240244
"Start Keyboard Service"
241245
case .fullDiskAccess:
@@ -273,6 +277,8 @@ class WizardNavigationEngine: WizardNavigating {
273277
return !missing.isEmpty
274278
}
275279
return true // Can always try to install components
280+
case .tcpServer:
281+
return true // Can always check TCP server
276282
case .service:
277283
return true // Can always manage service
278284
case .fullDiskAccess:

Sources/KeyPath/InstallationWizard/Core/WizardStateInterpreter.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ struct WizardStateInterpreter {
177177
}
178178
return false
179179
}
180+
case .tcpServer:
181+
// TCP Server issues
182+
issues.filter { issue in
183+
if case .component(.kanataTCPServer) = issue.identifier {
184+
return true
185+
}
186+
return false
187+
}
180188
case .service:
181189
[] // Service page doesn't use issues, it shows real-time status
182190
case .fullDiskAccess:

Sources/KeyPath/InstallationWizard/Core/WizardTypes.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ enum WizardPage: String, CaseIterable {
1212
case accessibility = "Accessibility"
1313
case karabinerComponents = "Karabiner Components"
1414
case kanataComponents = "Kanata Components"
15+
case tcpServer = "TCP Server"
1516
case service = "Start Service"
1617

1718
/// User-friendly display name for accessibility and UI
@@ -24,6 +25,7 @@ enum WizardPage: String, CaseIterable {
2425
case .accessibility: "Accessibility Permission"
2526
case .karabinerComponents: "Karabiner Driver Setup"
2627
case .kanataComponents: "Kanata Engine Setup"
28+
case .tcpServer: "TCP Server Configuration"
2729
case .service: "Start Keyboard Service"
2830
}
2931
}
@@ -38,6 +40,7 @@ enum WizardPage: String, CaseIterable {
3840
case .accessibility: "accessibility"
3941
case .karabinerComponents: "karabiner-components"
4042
case .kanataComponents: "kanata-components"
43+
case .tcpServer: "tcp-server"
4144
case .service: "service"
4245
}
4346
}

Sources/KeyPath/InstallationWizard/UI/Components/WizardSystemStatusOverview.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ struct WizardSystemStatusOverview: View {
144144
title: "TCP Server",
145145
subtitle: tcpServerStatus == .completed ? "Port \(PreferencesService.shared.tcpServerPort) responding" : "Not available",
146146
status: tcpServerStatus,
147-
isNavigable: false,
148-
targetPage: .service // Could navigate to service page for troubleshooting
147+
isNavigable: true,
148+
targetPage: .tcpServer // Navigate to dedicated TCP server page
149149
))
150150

151151
// 8. Start Keyboard Service

Sources/KeyPath/InstallationWizard/UI/InstallationWizardView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ struct InstallationWizardView: View {
204204
onRefresh: refreshState,
205205
kanataManager: kanataManager
206206
)
207+
case .tcpServer:
208+
WizardTCPServerPage()
207209
case .service:
208210
WizardKanataServicePage(
209211
kanataManager: kanataManager

0 commit comments

Comments
 (0)