MCPcopy
hub / github.com/colbymchenry/codegraph / setEnabled

Method setEnabled

src/telemetry/index.ts:214–226  ·  view source on GitHub ↗

* Persist an explicit user choice (installer toggle or `codegraph * telemetry on|off`). Turning telemetry off also deletes any buffered, * unsent data — off means off.

(enabled: boolean, source: 'installer' | 'cli')

Source from the content-addressed store, hash-verified

212 * unsent data — off means off.
213 */
214 setEnabled(enabled: boolean, source: 'installer' | 'cli'): void {
215 const existing = this.readConfig();
216 this.writeConfig({
217 enabled,
218 machine_id: existing?.machine_id ?? randomUUID(),
219 consent_source: source,
220 first_run_notice_shown: true,
221 updated_at: this.now().toISOString(),
222 });
223 if (!enabled) {
224 try { fs.rmSync(this.queuePath, { force: true }); } catch { /* fail silent */ }
225 }
226 }
227
228 /** True once any consent decision (or the first-run notice) is on disk. */
229 hasStoredChoice(): boolean {

Callers 3

runInstallerWithOptionsFunction · 0.80
mainFunction · 0.80
telemetry.test.tsFile · 0.80

Calls 2

readConfigMethod · 0.95
writeConfigMethod · 0.95

Tested by

no test coverage detected