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 under test, when DISABLE_TELEMETRY or the nonessential-traffic switch |
| 10 | * is set at all or DO_NOT_TRACK is on, on a third-party provider the host |
| 11 | * does not manage, 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 isTest = environment.nodeEnv === 'test' |
| 18 | const isPrivate = |
| 19 | isEnvSet(environment.disableTelemetry) || |
| 20 | isEnvSet(environment.disableNonessentialTraffic) || |
| 21 | isEnvTruthy(environment.doNotTrack) |
| 22 | const isThirdParty = |
| 23 | !isEnvTruthy(environment.providerManagedByHost) && |
| 24 | [ |
| 25 | environment.useBedrock, |
| 26 | environment.useVertex, |
| 27 | environment.useFoundry, |
| 28 | environment.useAnthropicAws, |
| 29 | environment.useAnthropicGoogleCloud, |
| 30 | environment.useMantle, |
| 31 | ].some(isEnvTruthy) |
| 32 | const isCustomDeployment = isEnvSet(environment.customOauthUrl?.trim()) |
| 33 | |
| 34 | return isTest || isPrivate || isThirdParty || isCustomDeployment |
| 35 | } |