(commandName: string, version: string)
| 113 | * @param version - The OpenSpec version |
| 114 | */ |
| 115 | export async function trackCommand(commandName: string, version: string): Promise<void> { |
| 116 | if (!isTelemetryEnabled()) { |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | try { |
| 121 | const userId = await getOrCreateAnonymousId(); |
| 122 | const client = getClient(); |
| 123 | |
| 124 | client.capture({ |
| 125 | distinctId: userId, |
| 126 | event: 'command_executed', |
| 127 | properties: { |
| 128 | command: commandName, |
| 129 | version: version, |
| 130 | surface: 'cli', |
| 131 | $ip: null, // Explicitly disable IP tracking |
| 132 | }, |
| 133 | }); |
| 134 | } catch { |
| 135 | // Silent failure - telemetry should never break CLI |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * Show first-run telemetry notice if not already seen. |
no test coverage detected