* 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')
| 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 { |
no test coverage detected