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 type { PolicyPins } from '../policy-pins' |
| 3 | import { isEnvSet } from './is-env-set' |
| 4 | import { isEnvTruthy } from './is-env-truthy' |
| 5 | |
| 6 | /** |
| 7 | * Whether the CLI's own analytics would be off here, read off the |
| 8 | * environment and the managed policy: then the plugin sends nothing either. |
| 9 | * |
| 10 | * Off under test, when DISABLE_TELEMETRY or the nonessential-traffic switch |
| 11 | * is set at all or DO_NOT_TRACK is on, on a third-party provider the host |
| 12 | * does not manage, on a gateway, and on a deployment with its own OAuth URL. |
| 13 | * |
| 14 | * @param environment the switches as read for this batch |
| 15 | * @param policy the managed settings' gateway pins |
| 16 | * @returns true when no row may be sent |
| 17 | */ |
| 18 | export function isAnalyticsOff(environment: Environment, policy: PolicyPins) { |
| 19 | const isPrivate = |
| 20 | environment.nodeEnv === 'test' || |
| 21 | isEnvSet(environment.disableTelemetry) || |
| 22 | isEnvSet(environment.disableNonessentialTraffic) || |
| 23 | isEnvTruthy(environment.doNotTrack) |
| 24 | |
| 25 | const isThirdParty = |
| 26 | !isEnvTruthy(environment.providerManagedByHost) && |
| 27 | [ |
| 28 | environment.useBedrock, |
| 29 | environment.useVertex, |
| 30 | environment.useFoundry, |
| 31 | environment.useAnthropicAws, |
| 32 | environment.useAnthropicGoogleCloud, |
| 33 | environment.useMantle, |
| 34 | ].some(isEnvTruthy) |
| 35 | |
| 36 | const isGateway = |
| 37 | isEnvTruthy(environment.useGateway) || |
| 38 | policy.forceLoginMethod === 'gateway' || |
| 39 | policy.forceLoginGatewayUrl !== undefined |
| 40 | |
| 41 | const isCustomDeployment = isEnvSet(environment.customOauthUrl?.trim()) |
| 42 | |
| 43 | return isPrivate || isThirdParty || isGateway || isCustomDeployment |
| 44 | } |