MCPcopy
hub / github.com/Fission-AI/OpenSpec / trackCommand

Function trackCommand

src/telemetry/index.ts:115–137  ·  view source on GitHub ↗
(commandName: string, version: string)

Source from the content-addressed store, hash-verified

113 * @param version - The OpenSpec version
114 */
115export 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.

Callers 2

index.test.tsFile · 0.85
index.tsFile · 0.85

Calls 3

isTelemetryEnabledFunction · 0.85
getOrCreateAnonymousIdFunction · 0.85
getClientFunction · 0.85

Tested by

no test coverage detected