deprecopilot
Version:
Automated dependency management with AI-powered codemods
26 lines (25 loc) • 1.19 kB
JavaScript
import { getTelemetryConfig, setTelemetryConfig } from '../lib/telemetryConfig.js';
export async function telemetry(args) {
const sub = args[0];
if (sub === 'enable') {
const ok = await setTelemetryConfig(true);
process.stdout.write(ok ? 'Telemetry enabled. Thank you for helping us improve deprecopilot.\n' : 'Failed to enable telemetry.\n');
return ok ? 0 : 1;
}
if (sub === 'disable') {
const ok = await setTelemetryConfig(false);
process.stdout.write(ok ? 'Telemetry disabled.\n' : 'Failed to disable telemetry.\n');
return ok ? 0 : 1;
}
if (sub === 'status') {
const cfg = await getTelemetryConfig();
process.stdout.write(cfg.telemetryEnabled ? 'Telemetry is enabled.\n' : 'Telemetry is disabled.\n');
return 0;
}
process.stdout.write(`Usage: deprecopilot telemetry <enable|disable|status>\n\n` +
`Telemetry is strictly opt-in and disabled by default.\n` +
`Collected data: command name, non-sensitive args, CLI version, OS, timestamp, duration.\n` +
`No personal or project data is ever collected.\n` +
`See README for details.\n`);
return 1;
}