Skip to content

Commit 6d2ee08

Browse files
author
DeepWiki Dev
committed
fix(cli): remove telemetry collection
1 parent 7dcef6d commit 6d2ee08

14 files changed

Lines changed: 0 additions & 134 deletions

File tree

docs/clients/cli.mdx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,6 @@ export CONTEXT7_API_KEY=your_key
225225

226226
---
227227

228-
## Telemetry
229-
230-
The CLI collects anonymous usage data to help improve the product. To disable:
231-
232-
```bash
233-
# For a single command
234-
CTX7_TELEMETRY_DISABLED=1 ctx7 docs /facebook/react "useEffect examples"
235-
236-
# Permanently — add to ~/.bashrc or ~/.zshrc
237-
export CTX7_TELEMETRY_DISABLED=1
238-
```
239-
240-
---
241-
242228
## Next Steps
243229

244230
<CardGroup cols={2}>

packages/cli/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,6 @@ The CLI automatically detects which AI coding assistants you have installed and
141141
| Cursor | `.cursor/skills/` |
142142
| Antigravity | `.agent/skills/` |
143143

144-
## Disabling Telemetry
145-
146-
The CLI collects anonymous usage data to help improve the product. To disable telemetry, set the `CTX7_TELEMETRY_DISABLED` environment variable:
147-
148-
```bash
149-
# For a single command
150-
CTX7_TELEMETRY_DISABLED=1 ctx7 docs /facebook/react "useEffect examples"
151-
152-
# Or export in your shell profile (~/.bashrc, ~/.zshrc, etc.)
153-
export CTX7_TELEMETRY_DISABLED=1
154-
```
155-
156144
## Learn More
157145

158146
Visit [context7.com](https://context7.com) for documentation lookup and setup guides.

packages/cli/src/__tests__/auth-commands.test.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ vi.mock("../utils/auth.js", () => ({
1616
DEFAULT_DEVICE_POLL_INTERVAL_SECONDS: 5,
1717
}));
1818

19-
vi.mock("../utils/tracking.js", () => ({
20-
trackEvent: vi.fn(),
21-
}));
22-
2319
const mockSpinner = {
2420
start: vi.fn().mockReturnThis(),
2521
stop: vi.fn().mockReturnThis(),
@@ -36,7 +32,6 @@ vi.mock("../constants.js", () => ({ CLI_CLIENT_ID: "test-client-id" }));
3632
vi.mock("../utils/api.js", () => ({ getBaseUrl: () => "https://test.context7.com" }));
3733

3834
import { registerAuthCommands, performLogin } from "../commands/auth.js";
39-
import { trackEvent } from "../utils/tracking.js";
4035

4136
let logOutput: string[];
4237
let errorOutput: string[];
@@ -83,12 +78,6 @@ describe("login command", () => {
8378
expect(logOutput.some((l) => l.includes("already logged in"))).toBe(true);
8479
});
8580

86-
test("tracks login event", async () => {
87-
mockGetValidAccessToken.mockResolvedValue("existing-token");
88-
await runCommand("login");
89-
expect(trackEvent).toHaveBeenCalledWith("command", { name: "login" });
90-
});
91-
9281
test("calls process.exit(1) when login fails", async () => {
9382
mockGetValidAccessToken.mockResolvedValue(null);
9483
mockClearTokens.mockReturnValue(false);
@@ -112,11 +101,6 @@ describe("logout command", () => {
112101
expect(logOutput.some((l) => l.includes("You are not logged in"))).toBe(true);
113102
});
114103

115-
test("tracks logout event", async () => {
116-
mockClearTokens.mockReturnValue(false);
117-
await runCommand("logout");
118-
expect(trackEvent).toHaveBeenCalledWith("command", { name: "logout" });
119-
});
120104
});
121105

122106
describe("whoami command", () => {
@@ -162,11 +146,6 @@ describe("whoami command", () => {
162146
expect(logOutput.some((l) => l.includes("Session may be expired"))).toBe(true);
163147
});
164148

165-
test("tracks whoami event", async () => {
166-
mockGetValidAccessToken.mockResolvedValue(null);
167-
await runCommand("whoami");
168-
expect(trackEvent).toHaveBeenCalledWith("command", { name: "whoami" });
169-
});
170149
});
171150

172151
describe("performLogin", () => {

packages/cli/src/__tests__/remove.test.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@ import { mkdir, readFile, writeFile, rm, access } from "fs/promises";
44
import { join } from "path";
55
import { tmpdir } from "os";
66

7-
const trackEvent = vi.fn();
87
const mockCheckboxWithHover = vi.fn();
98
let logOutput: string[];
109

11-
vi.mock("../utils/tracking.js", () => ({
12-
trackEvent: (...args: unknown[]) => trackEvent(...args),
13-
}));
14-
1510
vi.mock("../utils/prompts.js", () => ({
1611
checkboxWithHover: (...args: unknown[]) => mockCheckboxWithHover(...args),
1712
}));
@@ -83,12 +78,6 @@ describe("remove command", () => {
8378
expect(await exists(rulePath)).toBe(false);
8479
expect(await exists(join(tempDir, ".cursor", "skills", "find-docs"))).toBe(false);
8580
expect(await exists(mcpSkillPath)).toBe(true);
86-
expect(trackEvent).toHaveBeenCalledWith("command", { name: "remove" });
87-
expect(trackEvent).toHaveBeenCalledWith("remove", {
88-
agents: ["cursor"],
89-
scope: "project",
90-
modes: ["cli"],
91-
});
9281
});
9382

9483
test("removes only MCP artifacts for codex project setup", async () => {
@@ -123,11 +112,6 @@ describe("remove command", () => {
123112
expect(tomlContent).not.toContain("[mcp_servers.context7]");
124113
expect(await exists(join(tempDir, ".agents", "skills", "context7-mcp"))).toBe(false);
125114
expect(await exists(cliSkillPath)).toBe(true);
126-
expect(trackEvent).toHaveBeenCalledWith("remove", {
127-
agents: ["codex"],
128-
scope: "project",
129-
modes: ["mcp"],
130-
});
131115
});
132116

133117
test("supports uninstall alias and --all to remove both setup modes", async () => {
@@ -159,11 +143,6 @@ describe("remove command", () => {
159143
expect(await exists(join(tempDir, ".agents", "skills", "context7-mcp"))).toBe(false);
160144
expect(await exists(join(tempDir, ".agents", "skills", "find-docs"))).toBe(false);
161145
expect(await readFile(tomlPath, "utf-8")).not.toContain("[mcp_servers.context7]");
162-
expect(trackEvent).toHaveBeenCalledWith("remove", {
163-
agents: ["codex"],
164-
scope: "project",
165-
modes: ["mcp", "cli"],
166-
});
167146
});
168147

169148
test("skips mode prompt when only one setup mode exists", async () => {
@@ -186,11 +165,6 @@ describe("remove command", () => {
186165
expect(await exists(rulePath)).toBe(false);
187166
expect(await exists(join(tempDir, ".cursor", "skills", "find-docs"))).toBe(false);
188167
expect(await exists(mcpSkillPath)).toBe(false);
189-
expect(trackEvent).toHaveBeenCalledWith("remove", {
190-
agents: ["cursor"],
191-
scope: "project",
192-
modes: ["cli"],
193-
});
194168
});
195169

196170
test("prompts for setup mode when both MCP and CLI artifacts exist", async () => {
@@ -225,11 +199,6 @@ describe("remove command", () => {
225199
expect(await exists(join(tempDir, ".agents", "skills", "find-docs"))).toBe(false);
226200
expect(await exists(mcpSkillPath)).toBe(true);
227201
expect(await readFile(tomlPath, "utf-8")).toContain("[mcp_servers.context7]");
228-
expect(trackEvent).toHaveBeenCalledWith("remove", {
229-
agents: ["codex"],
230-
scope: "project",
231-
modes: ["cli"],
232-
});
233202
});
234203

235204
test("does not log not found items when other artifacts were removed", async () => {

packages/cli/src/__tests__/skill-list.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ import { mkdir, rm, realpath } from "fs/promises";
44
import { join } from "path";
55
import { tmpdir } from "os";
66

7-
const trackEvent = vi.fn();
87
let logOutput: string[];
98

10-
vi.mock("../utils/tracking.js", () => ({
11-
trackEvent: (...args: unknown[]) => trackEvent(...args),
12-
}));
13-
149
import { registerSkillCommands } from "../commands/skill.js";
1510

1611
let tempDir: string;
@@ -64,7 +59,6 @@ describe("skills list command", () => {
6459
},
6560
],
6661
});
67-
expect(trackEvent).toHaveBeenCalledWith("command", { name: "list" });
6862
});
6963

7064
test("outputs an empty JSON list when no skills are installed", async () => {

packages/cli/src/__tests__/upgrade-command.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { beforeEach, describe, expect, test, vi } from "vitest";
22
import { Command } from "commander";
33

4-
const trackEvent = vi.fn();
54
const checkForUpdates = vi.fn();
65
const getUpgradePlan = vi.fn();
76
const markUpdateNotificationShown = vi.fn();
@@ -10,10 +9,6 @@ const shouldSkipUpdateNotifier = vi.fn();
109
const confirm = vi.fn();
1110
const spawn = vi.fn();
1211

13-
vi.mock("../utils/tracking.js", () => ({
14-
trackEvent: (...args: unknown[]) => trackEvent(...args),
15-
}));
16-
1712
vi.mock("../utils/update-check.js", () => ({
1813
checkForUpdates: (...args: unknown[]) => checkForUpdates(...args),
1914
getUpgradePlan: (...args: unknown[]) => getUpgradePlan(...args),
@@ -81,7 +76,6 @@ describe("upgrade command", () => {
8176
await runCommand("upgrade");
8277

8378
expect(plainLogOutput().some((line) => line.includes("ctx7 is up to date"))).toBe(true);
84-
expect(trackEvent).toHaveBeenCalledWith("command", { name: "upgrade" });
8579
});
8680

8781
test("prints upgrade instructions in check mode", async () => {

packages/cli/src/commands/auth.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
DEFAULT_DEVICE_POLL_INTERVAL_SECONDS,
1313
} from "../utils/auth.js";
1414

15-
import { trackEvent } from "../utils/tracking.js";
1615
import { CLI_CLIENT_ID } from "../constants.js";
1716
import { getBaseUrl } from "../utils/api.js";
1817

@@ -190,7 +189,6 @@ export async function performLogin(openBrowser = true): Promise<string | null> {
190189
}
191190

192191
async function loginCommand(options: { browser: boolean }): Promise<void> {
193-
trackEvent("command", { name: "login" });
194192
const existingToken = await getValidAccessToken();
195193
if (existingToken) {
196194
console.log(pc.yellow("You are already logged in."));
@@ -208,7 +206,6 @@ async function loginCommand(options: { browser: boolean }): Promise<void> {
208206
}
209207

210208
function logoutCommand(): void {
211-
trackEvent("command", { name: "logout" });
212209
if (clearTokens()) {
213210
console.log(pc.green("Logged out successfully."));
214211
} else {
@@ -217,7 +214,6 @@ function logoutCommand(): void {
217214
}
218215

219216
async function whoamiCommand(): Promise<void> {
220-
trackEvent("command", { name: "whoami" });
221217
const accessToken = await getValidAccessToken();
222218

223219
if (!accessToken) {

packages/cli/src/commands/docs.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import ora from "ora";
55
import { resolveLibrary, getLibraryContext } from "../utils/api.js";
66
import { recoverLibraryId } from "../utils/library-id.js";
77
import { log } from "../utils/logger.js";
8-
import { trackEvent } from "../utils/tracking.js";
98
import { loadTokens, isTokenExpired } from "../utils/auth.js";
109
import type { LibrarySearchResult, ContextResponse } from "../types.js";
1110

@@ -54,7 +53,6 @@ async function resolveCommand(
5453
query: string | undefined,
5554
options: { json?: boolean }
5655
): Promise<void> {
57-
trackEvent("command", { name: "library" });
5856

5957
const spinner = isTTY ? ora(`Searching for "${library}"...`).start() : null;
6058
const accessToken = getAccessToken();
@@ -119,7 +117,6 @@ async function queryCommand(
119117
query: string,
120118
options: { json?: boolean }
121119
): Promise<void> {
122-
trackEvent("command", { name: "docs" });
123120

124121
// Git Bash on Windows rewrites "/owner/repo" into a Windows path; recover it.
125122
libraryId = recoverLibraryId(libraryId);

packages/cli/src/commands/generate.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { log } from "../utils/logger.js";
1919
import { promptForInstallTargets, getTargetDirs } from "../utils/ide.js";
2020
import selectOrInput from "../utils/selectOrInput.js";
2121
import { checkboxWithHover, terminalLink } from "../utils/prompts.js";
22-
import { trackEvent } from "../utils/tracking.js";
2322
import { getPreviewsDir } from "../utils/storage-paths.js";
2423
import type {
2524
GenerateOptions,
@@ -57,7 +56,6 @@ export function registerGenerateCommand(skillCommand: Command): void {
5756
}
5857

5958
async function generateCommand(options: GenerateOptions): Promise<void> {
60-
trackEvent("command", { name: "generate" });
6159
log.blank();
6260

6361
let accessToken: string | null = null;
@@ -485,7 +483,6 @@ async function generateCommand(options: GenerateOptions): Promise<void> {
485483
log.warn("Generation cancelled");
486484
return;
487485
} else if (action === "feedback") {
488-
trackEvent("gen_feedback");
489486
feedback = await input({
490487
message: "What changes would you like? (press Enter to skip)",
491488
});
@@ -550,7 +547,6 @@ async function generateCommand(options: GenerateOptions): Promise<void> {
550547
}
551548

552549
writeSpinner.succeed(pc.green(`Created skill in ${targetDirs.length} location(s)`));
553-
trackEvent("gen_install");
554550

555551
log.blank();
556552
console.log(pc.green("Skill saved successfully"));

packages/cli/src/commands/remove.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import pc from "picocolors";
33
import ora from "ora";
44
import { checkboxWithHover } from "../utils/prompts.js";
55
import { log } from "../utils/logger.js";
6-
import { trackEvent } from "../utils/tracking.js";
76
import { ALL_AGENT_NAMES, SETUP_AGENT_NAMES, getAgent, type SetupAgent } from "../setup/agents.js";
87
import {
98
readJsonConfig,
@@ -503,7 +502,6 @@ function printResults(results: AgentCleanupResult[], modes: UninstallMode[]): vo
503502
}
504503

505504
async function removeCommand(options: UninstallOptions): Promise<void> {
506-
trackEvent("command", { name: "remove" });
507505

508506
const scope: Scope = options.project ? "project" : "global";
509507
const agents = await resolveAgents(options, scope);
@@ -523,5 +521,4 @@ async function removeCommand(options: UninstallOptions): Promise<void> {
523521
spinner.succeed("Context7 cleanup complete");
524522
printResults(results, modes);
525523

526-
trackEvent("remove", { agents, scope, modes });
527524
}

0 commit comments

Comments
 (0)