about-system 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ declare function battery(context: InfoContext): string;
15
15
  * Uses fuzzy matching to find similar CPU models
16
16
  * @param context - Info context with cache
17
17
  * @returns Benchmark info with score and rank, or empty string
18
- * @example "37.9k #1", "20.5k #68"
18
+ * @example "38k #1 top 1%", "21k #68 top 7%"
19
19
  */
20
20
  declare function bench(context: InfoContext): string;
21
21
 
@@ -89,7 +89,7 @@ declare function cpu(context: InfoContext): string;
89
89
  * Includes score, rank, and architecture type (ARM/Intel/AMD)
90
90
  * @param context - Info context with cache
91
91
  * @returns Detailed benchmark info with architecture, or empty string
92
- * @example "Geekbench 6: 37.9k (Rank #1) - ARM", "Geekbench 6: 20.5k (Rank #68) - Intel"
92
+ * @example "Geekbench 6: 38k (Rank #1, top 1%) - ARM", "Geekbench 6: 21k (Rank #68, top 7%) - Intel"
93
93
  */
94
94
  declare function cpu_bench_info(context: InfoContext): string;
95
95
 
@@ -153,7 +153,7 @@ declare function gpu(context: InfoContext): string;
153
153
  * Uses fuzzy matching to find similar GPU models
154
154
  * @param context - Info context with cache
155
155
  * @returns Benchmark info with score and rank, or empty string
156
- * @example "37.9k #1", "20.5k #68"
156
+ * @example "38k #1 top 1%", "21k #68 top 7%"
157
157
  */
158
158
  declare function gpu_bench(context: InfoContext): string;
159
159
 
@@ -162,7 +162,7 @@ declare function gpu_bench(context: InfoContext): string;
162
162
  * Includes score, rank, and vendor detection
163
163
  * @param context - Info context with cache
164
164
  * @returns Detailed benchmark info with vendor, or empty string
165
- * @example "Geekbench 6: 37.9k (Rank #1) - NVIDIA", "Geekbench 6: 20.5k (Rank #68) - AMD"
165
+ * @example "Geekbench 6: 38k (Rank #1, top 1%) - NVIDIA", "Geekbench 6: 21k (Rank #68, top 7%) - AMD"
166
166
  */
167
167
  declare function gpu_bench_info(context: InfoContext): string;
168
168
 
@@ -2,7 +2,7 @@ import "os";
2
2
  import "fs";
3
3
  import "https";
4
4
  import "path";
5
- import { g as m, i as r, l as p, s as n } from "./system-info-api-C_y-O4VW.js";
5
+ import { g as m, i as r, l as p, s as n } from "./system-info-api-NgTm8Gzo.js";
6
6
  export {
7
7
  m as getSystemInfo,
8
8
  r as infoFunctions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "about-system",
3
- "version": "0.10.6",
3
+ "version": "0.10.7",
4
4
  "description": "A Node.js script to display key system information with emojis. Cross-platform support for Windows, macOS, and Linux with customizable output and caching.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -478,7 +478,7 @@ Available display blocks:
478
478
  Basic: user, hostname, uptime, shell, os, kernel, device
479
479
  Resources: disk_used, ram_used, memory_available, swap_used, top_process
480
480
  Network: ip, iplocal, city, domain, isp, network_interfaces
481
- Hardware: cpu, gpu, temperature, battery, screen_resolution
481
+ Hardware: cpu, bench, gpu, gpu_bench, temperature, battery, screen_resolution
482
482
  System: load_average, users_logged_in, mount_points, services_running
483
483
  Tools: pacman, ports, containers
484
484
  `);
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { formatBench, topPercent } from "./hardware";
3
+
4
+ describe("topPercent", () => {
5
+ it("rounds up so the fastest entry reads top 1%", () => {
6
+ expect(topPercent(1, 1000)).toBe(1);
7
+ expect(topPercent(68, 1000)).toBe(7);
8
+ expect(topPercent(50, 1000)).toBe(5);
9
+ });
10
+
11
+ it("stays within 1..100", () => {
12
+ expect(topPercent(1000, 1000)).toBe(100);
13
+ expect(topPercent(1200, 1000)).toBe(100);
14
+ expect(topPercent(5, 0)).toBe(100);
15
+ });
16
+ });
17
+
18
+ describe("formatBench", () => {
19
+ it("rounds the score to whole thousands and appends the percentile", () => {
20
+ expect(formatBench(37967, 1, 1000)).toBe("38k #1 top 1%");
21
+ expect(formatBench(20512, 68, 1000)).toBe("21k #68 top 7%");
22
+ expect(formatBench(386779, 5, 1026)).toBe("387k #5 top 1%");
23
+ });
24
+
25
+ it("never prints a decimal in the score", () => {
26
+ expect(formatBench(19249, 91, 1000)).not.toMatch(/\d\.\d/);
27
+ });
28
+ });
@@ -11,6 +11,30 @@ import { execCommand } from "../utils/command";
11
11
  import { getCachedValue, setCachedValue } from "../cache/cache";
12
12
  import Fuse from "fuse.js";
13
13
 
14
+ /**
15
+ * Formats a Geekbench score in whole thousands with its rank and how far up
16
+ * the table that rank sits.
17
+ * @param score - Raw Geekbench score
18
+ * @param rank - Rank in the benchmark table (1 = fastest)
19
+ * @param total - Number of entries in the benchmark table
20
+ * @returns Score, rank and top percentile
21
+ * @example formatBench(20512, 68, 1500) // "21k #68 top 7%"
22
+ */
23
+ export function formatBench(score: number, rank: number, total: number): string {
24
+ return `${Math.round(score / 1000)}k #${rank} top ${topPercent(rank, total)}%`;
25
+ }
26
+
27
+ /**
28
+ * Percentile bucket a rank falls in, rounded up so rank 1 reads "top 1%"
29
+ * @param rank - Rank in the benchmark table (1 = fastest)
30
+ * @param total - Number of entries in the benchmark table
31
+ * @returns Whole percentage between 1 and 100
32
+ */
33
+ export function topPercent(rank: number, total: number): number {
34
+ if (!total || total < 1) return 100;
35
+ return Math.min(100, Math.max(1, Math.ceil((rank / total) * 100)));
36
+ }
37
+
14
38
  /**
15
39
  * Gets CPU model name and specifications
16
40
  * Uses platform-specific commands (wmic/lscpu/cpuinfo)
@@ -222,7 +246,7 @@ export function screen_resolution(): string {
222
246
  * Uses fuzzy matching to find similar CPU models
223
247
  * @param context - Info context with cache
224
248
  * @returns Benchmark info with score and rank, or empty string
225
- * @example "37.9k #1", "20.5k #68"
249
+ * @example "38k #1 top 1%", "21k #68 top 7%"
226
250
  */
227
251
  export function bench(context: InfoContext): string {
228
252
  const cached = getCachedValue(context.cache, "bench");
@@ -274,9 +298,7 @@ export function bench(context: InfoContext): string {
274
298
  const results = fuse.search(cpuName);
275
299
  if (results.length > 0) {
276
300
  const match = results[0].item;
277
- const score = Math.round(match.score / 100) / 10;
278
- const rank = match.rank;
279
- const result = `${score}k #${rank}`;
301
+ const result = formatBench(match.score, match.rank, scores.length);
280
302
  setCachedValue(context.cache, "bench", result);
281
303
  return result;
282
304
  }
@@ -293,7 +315,7 @@ export function bench(context: InfoContext): string {
293
315
  * Includes score, rank, and architecture type (ARM/Intel/AMD)
294
316
  * @param context - Info context with cache
295
317
  * @returns Detailed benchmark info with architecture, or empty string
296
- * @example "Geekbench 6: 37.9k (Rank #1) - ARM", "Geekbench 6: 20.5k (Rank #68) - Intel"
318
+ * @example "Geekbench 6: 38k (Rank #1, top 1%) - ARM", "Geekbench 6: 21k (Rank #68, top 7%) - Intel"
297
319
  */
298
320
  export function cpu_bench_info(context: InfoContext): string {
299
321
  const cached = getCachedValue(context.cache, "cpu_bench_info");
@@ -349,8 +371,9 @@ export function cpu_bench_info(context: InfoContext): string {
349
371
  const results = fuse.search(cpuName);
350
372
  if (results.length > 0) {
351
373
  const match = results[0].item;
352
- const score = Math.round(match.score / 100) / 10;
374
+ const score = Math.round(match.score / 1000);
353
375
  const rank = match.rank;
376
+ const top = topPercent(rank, scores.length);
354
377
 
355
378
  // Detect architecture type
356
379
  let arch = "Unknown";
@@ -364,7 +387,7 @@ export function cpu_bench_info(context: InfoContext): string {
364
387
  arch = "ARM";
365
388
  }
366
389
 
367
- const result = `Geekbench 6: ${score}k (Rank #${rank}) - ${arch}`;
390
+ const result = `Geekbench 6: ${score}k (Rank #${rank}, top ${top}%) - ${arch}`;
368
391
  setCachedValue(context.cache, "cpu_bench_info", result);
369
392
  return result;
370
393
  }
@@ -381,7 +404,7 @@ export function cpu_bench_info(context: InfoContext): string {
381
404
  * Uses fuzzy matching to find similar GPU models
382
405
  * @param context - Info context with cache
383
406
  * @returns Benchmark info with score and rank, or empty string
384
- * @example "37.9k #1", "20.5k #68"
407
+ * @example "38k #1 top 1%", "21k #68 top 7%"
385
408
  */
386
409
  export function gpu_bench(context: InfoContext): string {
387
410
  const cached = getCachedValue(context.cache, "gpu_bench");
@@ -433,9 +456,7 @@ export function gpu_bench(context: InfoContext): string {
433
456
  const results = fuse.search(gpuName);
434
457
  if (results.length > 0) {
435
458
  const match = results[0].item;
436
- const score = Math.round(match.score / 100) / 10;
437
- const rank = match.rank;
438
- const result = `${score}k #${rank}`;
459
+ const result = formatBench(match.score, match.rank, scores.length);
439
460
  setCachedValue(context.cache, "gpu_bench", result);
440
461
  return result;
441
462
  }
@@ -452,7 +473,7 @@ export function gpu_bench(context: InfoContext): string {
452
473
  * Includes score, rank, and vendor detection
453
474
  * @param context - Info context with cache
454
475
  * @returns Detailed benchmark info with vendor, or empty string
455
- * @example "Geekbench 6: 37.9k (Rank #1) - NVIDIA", "Geekbench 6: 20.5k (Rank #68) - AMD"
476
+ * @example "Geekbench 6: 38k (Rank #1, top 1%) - NVIDIA", "Geekbench 6: 21k (Rank #68, top 7%) - AMD"
456
477
  */
457
478
  export function gpu_bench_info(context: InfoContext): string {
458
479
  const cached = getCachedValue(context.cache, "gpu_bench_info");
@@ -508,8 +529,9 @@ export function gpu_bench_info(context: InfoContext): string {
508
529
  const results = fuse.search(gpuName);
509
530
  if (results.length > 0) {
510
531
  const match = results[0].item;
511
- const score = Math.round(match.score / 100) / 10;
532
+ const score = Math.round(match.score / 1000);
512
533
  const rank = match.rank;
534
+ const top = topPercent(rank, scores.length);
513
535
 
514
536
  // Detect vendor from GPU name
515
537
  let vendor = "Unknown";
@@ -532,7 +554,7 @@ export function gpu_bench_info(context: InfoContext): string {
532
554
  vendor = "Intel";
533
555
  }
534
556
 
535
- const result = `Geekbench 6: ${score}k (Rank #${rank}) - ${vendor}`;
557
+ const result = `Geekbench 6: ${score}k (Rank #${rank}, top ${top}%) - ${vendor}`;
536
558
  setCachedValue(context.cache, "gpu_bench_info", result);
537
559
  return result;
538
560
  }
@@ -59,7 +59,17 @@ export const backgrounds = {
59
59
  // Default settings
60
60
  export const DEFAULT_SETTINGS = {
61
61
  display_order: [
62
- ["user", "hostname", "os", "device", "kernel", "cpu", "gpu", "bench"],
62
+ [
63
+ "user",
64
+ "hostname",
65
+ "os",
66
+ "device",
67
+ "kernel",
68
+ "cpu",
69
+ "bench",
70
+ "gpu",
71
+ "gpu_bench",
72
+ ],
63
73
  [
64
74
  "disk_used",
65
75
  "disk_size",
@@ -90,6 +100,7 @@ export const DEFAULT_SETTINGS = {
90
100
  cpu: "orange",
91
101
  gpu: "yellow",
92
102
  bench: "red",
103
+ gpu_bench: "red",
93
104
  device: "yellow",
94
105
  kernel: "green",
95
106
  shell: "orange",
@@ -119,6 +130,7 @@ export const DEFAULT_SETTINGS = {
119
130
  cpu: "📈 ",
120
131
  gpu: "🎮 ",
121
132
  bench: "💪 ",
133
+ gpu_bench: "🏎️ ",
122
134
  device: "💻 ",
123
135
  kernel: "🔧 ",
124
136
  shell: "🐚 ",
@@ -154,6 +166,7 @@ export const DEFAULT_SETTINGS = {
154
166
  cpu: "CPU",
155
167
  gpu: "GPU",
156
168
  bench: "Bench",
169
+ gpu_bench: "GPU Bench",
157
170
  device: "Device",
158
171
  kernel: "Kernel",
159
172
  shell: "Shell",
@@ -129,8 +129,8 @@ export interface SystemInfo {
129
129
  * Empty string if CPU not found or benchmark data unavailable
130
130
  *
131
131
  * @example
132
- * - "37.9k #1" (top performing CPU)
133
- * - "20.5k #68" (mid-range CPU)
132
+ * - "38k #1 top 1%" (top performing CPU)
133
+ * - "21k #68 top 7%" (mid-range CPU)
134
134
  * - "" (CPU not in benchmark database)
135
135
  */
136
136
  bench: string;
@@ -142,9 +142,9 @@ export interface SystemInfo {
142
142
  * Empty string if CPU not found or benchmark data unavailable
143
143
  *
144
144
  * @example
145
- * - "Geekbench 6: 37.9k (Rank #1) - ARM" (Apple M4 Ultra)
146
- * - "Geekbench 6: 20.5k (Rank #68) - Intel" (Intel Core i9)
147
- * - "Geekbench 6: 19.2k (Rank #91) - AMD" (AMD Ryzen 9 7950X)
145
+ * - "Geekbench 6: 38k (Rank #1, top 1%) - ARM" (Apple M4 Ultra)
146
+ * - "Geekbench 6: 21k (Rank #68, top 7%) - Intel" (Intel Core i9)
147
+ * - "Geekbench 6: 19k (Rank #91, top 10%) - AMD" (AMD Ryzen 9 7950X)
148
148
  * - "" (CPU not in benchmark database)
149
149
  */
150
150
  cpu_bench_info: string;
@@ -156,8 +156,8 @@ export interface SystemInfo {
156
156
  * Empty string if GPU not found or benchmark data unavailable
157
157
  *
158
158
  * @example
159
- * - "37.9k #1" (top performing GPU)
160
- * - "20.5k #68" (mid-range GPU)
159
+ * - "38k #1 top 1%" (top performing GPU)
160
+ * - "21k #68 top 7%" (mid-range GPU)
161
161
  * - "" (GPU not in benchmark database)
162
162
  */
163
163
  gpu_bench: string;
@@ -169,8 +169,8 @@ export interface SystemInfo {
169
169
  * Empty string if GPU not found or benchmark data unavailable
170
170
  *
171
171
  * @example
172
- * - "Geekbench 6: 37.9k (Rank #1) - NVIDIA" (NVIDIA GPU)
173
- * - "Geekbench 6: 20.5k (Rank #68) - AMD" (AMD GPU)
172
+ * - "Geekbench 6: 38k (Rank #1, top 1%) - NVIDIA" (NVIDIA GPU)
173
+ * - "Geekbench 6: 21k (Rank #68, top 7%) - AMD" (AMD GPU)
174
174
  * - "" (GPU not in benchmark database)
175
175
  */
176
176
  gpu_bench_info: string;