* Resolve the project root the daemon machinery should key on. Returns * `null` when no `.codegraph/` is reachable from the candidate path — in * that case the caller must run in direct mode, since the daemon lockfile * and socket both live under `.codegraph/`. * * The result is canonicalized w
(explicitPath: string | null)
| 117 | * fail to share the daemon. |
| 118 | */ |
| 119 | function resolveDaemonRoot(explicitPath: string | null): string | null { |
| 120 | const candidate = explicitPath ?? process.cwd(); |
| 121 | const root = findNearestCodeGraphRoot(candidate); |
| 122 | if (!root) return null; |
| 123 | try { return fs.realpathSync(root); } catch { return root; } |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Spawn the shared daemon as a fully detached background process: its own |
no test coverage detected