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 / arch-of / arch-of.ts
18 lines · 664 BRaw
1/**
2 * The architecture as the CLI's runtime names it, from what `uname -m` or
3 * Windows' PROCESSOR_ARCHITECTURE says: `x64`, `arm64`, `ia32`, else as is.
4 *
5 * @param machine the architecture as the system spells it
6 * @returns the runtime's spelling
7 */
8export function archOf(machine: string) {
9 const spelled = machine.trim().toLowerCase()
10
11 const named: readonly (readonly [boolean, string])[] = [
12 [spelled === 'x86_64' || spelled === 'amd64', 'x64'],
13 [spelled === 'aarch64' || spelled === 'arm64', 'arm64'],
14 [spelled === 'x86' || /^i[3-6]86$/.test(spelled), 'ia32'],
15 ]
16
17 return named.find(([isIt]) => isIt)?.[1] ?? (spelled || 'unknown')
18}