MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / getPlatformMapping

Function getPlatformMapping

scripts/postinstall.cjs:50–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48// --- Platform mapping ---
49
50function getPlatformMapping() {
51 const arch = process.arch
52 const platform = process.platform
53
54 if (platform === 'darwin') {
55 if (arch === 'arm64')
56 return { target: 'aarch64-apple-darwin', ext: 'tar.gz' }
57 if (arch === 'x64') return { target: 'x86_64-apple-darwin', ext: 'tar.gz' }
58 throw new Error(`Unsupported macOS arch: ${arch}`)
59 }
60
61 if (platform === 'win32') {
62 if (arch === 'x64') return { target: 'x86_64-pc-windows-msvc', ext: 'zip' }
63 if (arch === 'arm64')
64 return { target: 'aarch64-pc-windows-msvc', ext: 'zip' }
65 throw new Error(`Unsupported Windows arch: ${arch}`)
66 }
67
68 if (platform === 'linux') {
69 const isMusl = detectMusl()
70 if (arch === 'x64') {
71 return { target: 'x86_64-unknown-linux-musl', ext: 'tar.gz' }
72 }
73 if (arch === 'arm64') {
74 return isMusl
75 ? { target: 'aarch64-unknown-linux-musl', ext: 'tar.gz' }
76 : { target: 'aarch64-unknown-linux-gnu', ext: 'tar.gz' }
77 }
78 throw new Error(`Unsupported Linux arch: ${arch}`)
79 }
80
81 throw new Error(`Unsupported platform: ${platform}`)
82}
83
84function detectMusl() {
85 const muslArch = process.arch === 'x64' ? 'x86_64' : 'aarch64'

Callers 1

downloadAndExtractFunction · 0.85

Calls 1

detectMuslFunction · 0.85

Tested by

no test coverage detected