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

Function detectCpuLabel

src/setup/hardware-profile.ts:74–91  ·  view source on GitHub ↗
(osKind: HardwareProfile['os'])

Source from the content-addressed store, hash-verified

72// ── CPU label ────────────────────────────────────────────────────────────────
73
74function detectCpuLabel(osKind: HardwareProfile['os']): string {
75 // os.cpus()[0].model works on every platform but the strings are wildly different.
76 // We do a tiny per-OS cleanup so the wizard line looks reasonable.
77 const raw = os.cpus()[0]?.model?.trim() ?? 'Unknown CPU';
78
79 if (osKind === 'macos') {
80 // macOS gives strings like "Apple M2 Pro" already — good as-is.
81 return raw;
82 }
83 if (osKind === 'linux') {
84 // Linux gives the full Intel/AMD marketing name. Trim the trailing speed parens / @ if any.
85 return raw.replace(/\s*@\s*[\d.]+\s*[GMK]?Hz/i, '').replace(/\s+CPU\s*/i, ' ').trim();
86 }
87 if (osKind === 'windows') {
88 return raw;
89 }
90 return raw;
91}
92
93// ── GPU ──────────────────────────────────────────────────────────────────────
94

Callers 1

detectHardwareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected