| 72 | // ── CPU label ──────────────────────────────────────────────────────────────── |
| 73 | |
| 74 | function 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 | |