MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / detectHardware

Function detectHardware

src/setup/hardware-profile.ts:45–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43
44/** The single public entry point. */
45export function detectHardware(): HardwareProfile {
46 const platform = os.platform();
47 const osKind: HardwareProfile['os'] =
48 platform === 'darwin' ? 'macos' :
49 platform === 'linux' ? 'linux' :
50 platform === 'win32' ? 'windows' : 'other';
51 const arch: HardwareProfile['arch'] =
52 os.arch() === 'arm64' ? 'arm64' :
53 os.arch() === 'x64' ? 'x64' : 'other';
54 const appleSilicon = osKind === 'macos' && arch === 'arm64';
55
56 const ramGb = Math.round(os.totalmem() / 1024 / 1024 / 1024);
57 const cpuCores = os.cpus().length;
58 const cpuLabel = detectCpuLabel(osKind);
59 const gpu = detectGpu(osKind, appleSilicon, ramGb);
60 const diskFreeGb = detectFreeDisk(osKind);
61 const tier = chooseTier(ramGb, gpu);
62 const recommendedModels = recommendModels(tier, appleSilicon);
63
64 return {
65 os: osKind, arch, appleSilicon,
66 cpuLabel, cpuCores, ramGb,
67 gpu, diskFreeGb,
68 tier, recommendedModels,
69 };
70}
71
72// ── CPU label ────────────────────────────────────────────────────────────────
73

Callers 2

runSetupFunction · 0.85

Calls 5

detectCpuLabelFunction · 0.85
detectGpuFunction · 0.85
detectFreeDiskFunction · 0.85
chooseTierFunction · 0.85
recommendModelsFunction · 0.85

Tested by

no test coverage detected