Skip to content

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.

TypeScript
648 B
Raw Blame
import type { DeploymentSignal } from './deployment-signal'
import { DEPLOYMENTS } from './deployments'

/**
 * The row's `deployment_environment`: the first deployment in the CLI's
 * order whose signal holds, else `unknown-<platform>` as it names none.
 *
 * @param signals each deployment read, with whether its signal holds
 * @param platform the row's platform, for the fallback
 * @returns the deployment's name
 */
export const deploymentOf = (
  signals: readonly DeploymentSignal[],
  platform: string,
) =>
  DEPLOYMENTS.find(deployment =>
    signals.some(([name, isHeld]) => isHeld && name === deployment),
  ) ?? `unknown-${platform}`