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

Method readConfig

src/telemetry/index.ts:414–428  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

412 }
413
414 private readConfig(): ConfigFile | null {
415 // A process-lifetime cache misses another CLI's opt-out. Read the tiny file
416 // before recording, persistence and sending, including between HTTP chunks.
417 let config: ConfigFile | null = null;
418 try {
419 const raw = JSON.parse(fs.readFileSync(this.configPath, 'utf8')) as ConfigFile;
420 if (typeof raw.enabled === 'boolean' && (typeof raw.machine_id === 'string' ||
421 (!raw.enabled && raw.machine_id === null))) config = raw;
422 } catch { /* absent config retains the documented default */ }
423 if (this.configCache !== undefined &&
424 (this.configCache?.machine_id !== config?.machine_id ||
425 (this.configCache?.enabled && !config?.enabled))) this.clearPending();
426 this.configCache = config;
427 return config;
428 }
429
430 private writeConfig(config: ConfigFile): void {
431 const temp = `${this.configPath}.${process.pid}.${randomUUID()}.tmp`;

Callers 4

getStatusMethod · 0.95
setEnabledMethod · 0.95
hasStoredChoiceMethod · 0.95
firstRunNoticeMethod · 0.95

Calls 2

clearPendingMethod · 0.95
parseMethod · 0.80

Tested by

no test coverage detected