Skip to content

Commit d2c5609

Browse files
kochj23claude
andcommitted
refactor: Remove dead code, debug artifacts, and fix force unwraps
- Delete ContentView.swift (deprecated stub, never referenced) - Delete MLXSwiftBackend.swift (class never instantiated anywhere) - Remove handleDirectToolInvocation() which always returned false - Remove debug /tmp/mlx_debug.log writes from sendMessage() in production - Fix force unwrap on FileManager.urls().first! in ChatViewModel and ConversationManager - Replace print() with LogManager in ConversationManager - Strip ~15 noisy trace-level emoji log calls from generateResponse() - Remove redundant inline comments that restated what the code does Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 8b0775c commit d2c5609

5 files changed

Lines changed: 14 additions & 298 deletions

File tree

MLX Code.xcodeproj/project.pbxproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
24010C4728F24595AD26D82143BDCF89 /* ChatView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE711B1853DA4E2BA36640574B1F559C /* ChatView.swift */; };
2121
25BA6913200BB43C2F05DE0E /* ErrorDiagnosisTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D0656116F5396EF9D9A7065 /* ErrorDiagnosisTool.swift */; };
2222
2705EDF1704D46E28F243D58796430B0 /* Conversation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EF7425F0C774CFFA6C81D44B4EEF006 /* Conversation.swift */; };
23-
2B11CE0AB8B2456D938A90B4A87D235C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA83237D6D754FA5807B99D7C733E00B /* ContentView.swift */; };
2423
340D62553A7C42F2A58D1FEF72A108C1 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 705A916896E647D1B0382ABFCD69A97D /* SettingsView.swift */; };
2524
3603B426862ED1AF7B591E9D /* CodeNavigationTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = F723876CB29C9B2490C118FE /* CodeNavigationTool.swift */; };
2625
375B23CD55B79FC1C62A5B23 /* MemorySystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F90FA396C5680D706B96B9 /* MemorySystem.swift */; };
@@ -205,7 +204,6 @@
205204
E4F9AF5449DB574FF1AF0CC4 /* InteractivePromptView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InteractivePromptView.swift; path = "MLX Code/Views/InteractivePromptView.swift"; sourceTree = "<group>"; };
206205
E683FDA41933E9CBABE2AB4E /* GrepTool.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GrepTool.swift; path = Tools/GrepTool.swift; sourceTree = "<group>"; };
207206
F723876CB29C9B2490C118FE /* CodeNavigationTool.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Tools/CodeNavigationTool.swift; sourceTree = "<group>"; };
208-
FA83237D6D754FA5807B99D7C733E00B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
209207
FBF68411190D219F58CC40B0 /* ToolProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ToolProtocol.swift; path = Tools/ToolProtocol.swift; sourceTree = "<group>"; };
210208
FD5FD20620CC8E07FFA1428A /* BashTool.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BashTool.swift; path = Tools/BashTool.swift; sourceTree = "<group>"; };
211209
FDF863EF632E990FA28CCD29 /* MLX_Code_Widget.entitlements */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.entitlements; path = MLX_Code_Widget.entitlements; sourceTree = "<group>"; };
@@ -403,8 +401,7 @@
403401
isa = PBXGroup;
404402
children = (
405403
8BF344F827174583896C2F07BB4F77EF /* MLXCodeApp.swift */,
406-
FA83237D6D754FA5807B99D7C733E00B /* ContentView.swift */,
407-
841118D351D54AEDA122F17C77816B9D /* Views */,
404+
841118D351D54AEDA122F17C77816B9D /* Views */,
408405
BB2E8ECFF03340A5AA4C415F066EB765 /* ViewModels */,
409406
EAEFCCA240074A7FB65020791716A06B /* Models */,
410407
8D7B12981853422D971FCAD3B063E827 /* Services */,
@@ -632,8 +629,7 @@
632629
E2FCF04057F99E48BF46CCF3 /* CommandValidator.swift in Sources */,
633630
A0013163E03EA758655F244E /* ModelSecurityValidator.swift in Sources */,
634631
4A14B6380E9E4A44949059C9DE2D703A /* MLXCodeApp.swift in Sources */,
635-
2B11CE0AB8B2456D938A90B4A87D235C /* ContentView.swift in Sources */,
636-
24010C4728F24595AD26D82143BDCF89 /* ChatView.swift in Sources */,
632+
24010C4728F24595AD26D82143BDCF89 /* ChatView.swift in Sources */,
637633
406CEA4CA10F45879033D10841AF85C6 /* MessageRowView.swift in Sources */,
638634
340D62553A7C42F2A58D1FEF72A108C1 /* SettingsView.swift in Sources */,
639635
B7A5DD6AFF8A40D0ADEADF847F388274 /* ModelSelectorView.swift in Sources */,

MLX Code/ContentView.swift

Lines changed: 0 additions & 25 deletions
This file was deleted.

MLX Code/Services/ConversationManager.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ class ConversationManager: ObservableObject {
2424

2525
private let fileManager = FileManager.default
2626
private var conversationsDirectory: URL {
27-
let appSupport = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).first!
27+
guard let appSupport = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).first else {
28+
fatalError("Application Support directory unavailable")
29+
}
2830
let dir = appSupport.appendingPathComponent("MLX Code/Conversations")
2931
try? fileManager.createDirectory(at: dir, withIntermediateDirectories: true)
3032
return dir
3133
}
3234

3335
private var templatesDirectory: URL {
34-
let appSupport = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).first!
36+
guard let appSupport = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).first else {
37+
fatalError("Application Support directory unavailable")
38+
}
3539
let dir = appSupport.appendingPathComponent("MLX Code/Templates")
3640
try? fileManager.createDirectory(at: dir, withIntermediateDirectories: true)
3741
return dir
@@ -65,7 +69,7 @@ class ConversationManager: ObservableObject {
6569
}
6670
conversations.sort { $0.updatedAt > $1.updatedAt }
6771
} catch {
68-
print("Failed to load conversations: \(error)")
72+
Task { await LogManager.shared.error("Failed to load conversations: \(error)", category: "ConversationManager") }
6973
}
7074
}
7175

MLX Code/Services/MLXSwiftBackend.swift

Lines changed: 0 additions & 167 deletions
This file was deleted.

0 commit comments

Comments
 (0)