surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | import type { Environment } from '../environment' |
| 2 | import { isEnvSet } from './is-env-set' |
| 3 | import { isEnvTruthy } from './is-env-truthy' |
| 4 | |
| 5 | /** |
| 6 | * Whether the CLI's own analytics would be off here, read off the |
| 7 | * environment alone: then the plugin sends nothing either. |
| 8 | * |
| 9 | * Off when DISABLE_TELEMETRY or the nonessential-traffic switch is set at |
| 10 | * all or DO_NOT_TRACK is on, on any third-party provider (no first-party |
| 11 | * credential rides there), and on a deployment with its own OAuth URL. |
| 12 | * |
| 13 | * @param environment the variables as read once for the session |
| 14 | * @returns true when no row may be sent |
| 15 | */ |
| 16 | export function isAnalyticsOff(environment: Environment) { |
| 17 | const isPrivate = |
| 18 | isEnvSet(environment.disableTelemetry) || |
| 19 | isEnvSet(environment.disableNonessentialTraffic) || |
| 20 | isEnvTruthy(environment.doNotTrack) |
| 21 | |
| 22 | const isThirdParty = [ |
| 23 | environment.useBedrock, |
| 24 | environment.useVertex, |
| 25 | environment.useFoundry, |
| 26 | environment.useAnthropicAws, |
| 27 | environment.useAnthropicGoogleCloud, |
| 28 | environment.useMantle, |
| 29 | ].some(isEnvTruthy) |
| 30 | |
| 31 | const isCustomDeployment = isEnvSet(environment.customOauthUrl?.trim()) |
| 32 | |
| 33 | return isPrivate || isThirdParty || isCustomDeployment |
| 34 | } |