@@ -51,31 +51,51 @@ class ServerManager: ObservableObject {
51
51
print ( " [ServerManager] Bundle.main.bundlePath: \( Bundle . main. bundlePath) " )
52
52
print ( " [ServerManager] Bundle.main.resourcePath: \( Bundle . main. resourcePath ?? " nil " ) " )
53
53
54
- if let bundledServerPath = Bundle . main. path ( forResource: " server " , ofType: nil ) {
55
- serverPath = bundledServerPath
56
- print ( " [ServerManager] Using bundled server at: \( bundledServerPath) " )
57
-
58
- // Verify server.js exists
59
- let serverJsPath = ( bundledServerPath as NSString ) . appendingPathComponent ( " server.js " )
60
- if FileManager . default. fileExists ( atPath: serverJsPath) {
61
- print ( " [ServerManager] server.js found at: \( serverJsPath) " )
62
- } else {
63
- print ( " [ServerManager] ERROR: server.js not found at: \( serverJsPath) " )
54
+ // Check for server directory in Resources
55
+ if let resourcePath = Bundle . main. resourcePath {
56
+ let bundledServerPath = ( resourcePath as NSString ) . appendingPathComponent ( " server " )
57
+ if FileManager . default. fileExists ( atPath: bundledServerPath) {
58
+ serverPath = bundledServerPath
59
+ print ( " [ServerManager] Using bundled server at: \( bundledServerPath) " )
60
+
61
+ // Verify server.js exists
62
+ let serverJsPath = ( bundledServerPath as NSString ) . appendingPathComponent ( " server.js " )
63
+ if FileManager . default. fileExists ( atPath: serverJsPath) {
64
+ print ( " [ServerManager] server.js found at: \( serverJsPath) " )
65
+ } else {
66
+ print ( " [ServerManager] ERROR: server.js not found at: \( serverJsPath) " )
67
+ }
64
68
}
65
- } else {
66
- // Fallback to development location
67
- let appPath = Bundle . main. bundlePath
68
- let devServerPath = ( appPath as NSString ) . deletingLastPathComponent
69
- . appending ( " /server " )
70
- if FileManager . default. fileExists ( atPath: devServerPath) {
71
- serverPath = devServerPath
72
- print ( " [ServerManager] Using development server at: \( devServerPath) " )
69
+ }
70
+
71
+ // Fallback to development location if not found in bundle
72
+ if serverPath == nil {
73
+ // Try multiple possible locations
74
+ let possiblePaths = [
75
+ // Development location (when running from Xcode)
76
+ ( Bundle . main. bundlePath as NSString ) . deletingLastPathComponent. appending ( " /server " ) ,
77
+ // Project root location
78
+ " /Users/kotahayashi/Workspace/ClaudeCodeMonitor/server " ,
79
+ // Alternative development location
80
+ ( ( Bundle . main. bundlePath as NSString ) . deletingLastPathComponent as NSString )
81
+ . deletingLastPathComponent
82
+ . replacingOccurrences ( of: " /Build/Products/Debug " , with: " " )
83
+ . appending ( " /server " )
84
+ ]
85
+
86
+ for path in possiblePaths {
87
+ if FileManager . default. fileExists ( atPath: path) {
88
+ serverPath = path
89
+ print ( " [ServerManager] Using development server at: \( path) " )
90
+ break
91
+ }
73
92
}
74
93
}
75
94
76
95
// Check if server directory exists
77
96
guard let validServerPath = serverPath else {
78
- print ( " [ServerManager] Server directory not found " )
97
+ print ( " [ServerManager] Server directory not found - server will not start " )
98
+ print ( " [ServerManager] This is expected in development mode. npx will be used directly. " )
79
99
NSLog ( " [ServerManager] Server directory not found " )
80
100
return false
81
101
}
@@ -87,6 +107,7 @@ class ServerManager: ObservableObject {
87
107
var nodePath : String ?
88
108
let systemNodePaths = [
89
109
" /Users/ \( NSUserName ( ) ) /.local/share/mise/shims/node " ,
110
+ " /Users/ \( NSUserName ( ) ) /.local/share/mise/installs/node/22.16.0/bin/node " ,
90
111
" /opt/homebrew/bin/node " ,
91
112
" /usr/local/bin/node " ,
92
113
" /usr/bin/node "
0 commit comments