(searchFrom: string)
| 199 | } |
| 200 | |
| 201 | private async doInitialize(searchFrom: string): Promise<void> { |
| 202 | this.toolHandler.setDefaultProjectHint(searchFrom); |
| 203 | |
| 204 | const resolvedRoot = findNearestCodeGraphRoot(searchFrom); |
| 205 | if (!resolvedRoot) { |
| 206 | // No .codegraph/ above searchFrom. Sessions may still discover one later via roots/list |
| 207 | this.projectPath = searchFrom; |
| 208 | return; |
| 209 | } |
| 210 | |
| 211 | this.projectPath = resolvedRoot; |
| 212 | try { |
| 213 | this.cg = await loadCodeGraph().open(resolvedRoot); |
| 214 | this.toolHandler.setDefaultCodeGraph(this.cg); |
| 215 | this.startWatching(); |
| 216 | this.catchUpSync(); |
| 217 | this.maybeStartPool(resolvedRoot); |
| 218 | } catch (err) { |
| 219 | const msg = err instanceof Error ? err.message : String(err); |
| 220 | process.stderr.write(`[CodeGraph MCP] Failed to open project at ${resolvedRoot}: ${msg}\n`); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Start file watching on the active CodeGraph instance. Idempotent — the |
no test coverage detected