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 / context / machine / platform-of / platform-of.ts
17 lines · 638 BRaw
1/**
2 * The row's `platform` as the CLI's own rows have it: the host platform the
3 * environment names when it is one of the three, else by the system's name.
4 *
5 * @param hostPlatform CLAUDE_CODE_HOST_PLATFORM, when set
6 * @param platformRaw the system's own name lowercased
7 * @returns `win32`, `darwin`, or `linux` for anything else
8 */
9export function platformOf(
10 hostPlatform: string | undefined,
11 platformRaw: string,
12) {
13 const named = ['win32', 'darwin', 'linux'].find(one => one === hostPlatform)
14 const isOwnName = platformRaw === 'win32' || platformRaw === 'darwin'
15
16 return named ?? (isOwnName ? platformRaw : 'linux')
17}