spacehub

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

claude-code / mods / telemetry / hooks / deployment / deployment-of.ts
18 lines · 648 BRaw
1import type { DeploymentSignal } from './deployment-signal'
2import { DEPLOYMENTS } from './deployments'
3
4/**
5 * The row's `deployment_environment`: the first deployment in the CLI's
6 * order whose signal holds, else `unknown-<platform>` as it names none.
7 *
8 * @param signals each deployment read, with whether its signal holds
9 * @param platform the row's platform, for the fallback
10 * @returns the deployment's name
11 */
12export const deploymentOf = (
13 signals: readonly DeploymentSignal[],
14 platform: string,
15) =>
16 DEPLOYMENTS.find(deployment =>
17 signals.some(([name, isHeld]) => isHeld && name === deployment),
18 ) ?? `unknown-${platform}`