MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / installChangedReason

Function installChangedReason

src/mcp/daemon.ts:186–203  ·  view source on GitHub ↗
(packageJsonPath: string, runningVersion: string)

Source from the content-addressed store, hash-verified

184 * answers null: the next check looks again. Exported for testing.
185 */
186export function installChangedReason(packageJsonPath: string, runningVersion: string): string | null {
187 let raw: string;
188 try {
189 raw = fs.readFileSync(packageJsonPath, 'utf8');
190 } catch (err) {
191 const code = (err as NodeJS.ErrnoException).code;
192 return code === 'ENOENT' || code === 'ENOTDIR' ? `Install removed (${packageJsonPath} is gone)` : null;
193 }
194 let version: unknown;
195 try {
196 version = (JSON.parse(raw) as { version?: unknown } | null)?.version;
197 } catch {
198 return null;
199 }
200 return typeof version === 'string' && version !== runningVersion
201 ? `Install replaced by v${version} (this daemon is v${runningVersion})`
202 : null;
203}
204
205/** How long the daemon waits for the optional client-hello before proceeding without it. */
206const CLIENT_HELLO_TIMEOUT_MS = 3_000;

Callers 3

makeFallbackEngineFunction · 0.90
checkInstallMethod · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected