brianbellx commited on
Commit
460e6e1
·
verified ·
1 Parent(s): 419a527

Add Models leaderboard sub-switch with preview raw-output avg scores

Browse files
web/src/board.css CHANGED
@@ -81,6 +81,55 @@
81
  padding-top: 8px;
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  .board-list {
85
  margin: 0;
86
  padding: 0;
@@ -120,7 +169,8 @@
120
  font-variant-numeric: tabular-nums;
121
  }
122
 
123
- .board-repo {
 
124
  display: inline-flex;
125
  align-items: center;
126
  gap: 10px;
@@ -130,7 +180,8 @@
130
  font-weight: 500;
131
  }
132
 
133
- .board-repo .icon {
 
134
  flex: none;
135
  color: var(--ink-3);
136
  }
 
81
  padding-top: 8px;
82
  }
83
 
84
+ .board-bar {
85
+ display: flex;
86
+ flex-wrap: wrap;
87
+ align-items: center;
88
+ justify-content: space-between;
89
+ gap: 8px 16px;
90
+ margin-bottom: 12px;
91
+ }
92
+
93
+ .board-modes {
94
+ display: flex;
95
+ gap: 20px;
96
+ }
97
+
98
+ .board-mode {
99
+ height: 28px;
100
+ border-radius: var(--radius-sm);
101
+ color: var(--ink-3);
102
+ font-size: 14px;
103
+ transition: color var(--motion) var(--ease);
104
+ }
105
+
106
+ .board-mode:hover,
107
+ .board-mode[aria-pressed="true"] {
108
+ color: var(--ink);
109
+ }
110
+
111
+ .board-mode[aria-pressed="true"] {
112
+ font-weight: 500;
113
+ }
114
+
115
+ .board-note {
116
+ display: inline-flex;
117
+ align-items: center;
118
+ gap: 7px;
119
+ color: var(--ink-3);
120
+ font-size: 12.5px;
121
+ line-height: 18px;
122
+ }
123
+
124
+ .board-note.is-preview::before {
125
+ content: "";
126
+ flex: none;
127
+ width: 6px;
128
+ height: 6px;
129
+ border-radius: 50%;
130
+ background: var(--amber, #d99b26);
131
+ }
132
+
133
  .board-list {
134
  margin: 0;
135
  padding: 0;
 
169
  font-variant-numeric: tabular-nums;
170
  }
171
 
172
+ .board-repo,
173
+ .board-model {
174
  display: inline-flex;
175
  align-items: center;
176
  gap: 10px;
 
180
  font-weight: 500;
181
  }
182
 
183
+ .board-repo .icon,
184
+ .board-model .icon {
185
  flex: none;
186
  color: var(--ink-3);
187
  }
web/src/board.html CHANGED
@@ -1,66 +1,74 @@
1
- <!doctype html>
2
- <html lang="en" data-root="../">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <meta name="description" content="GitHub repos ranked by how readable their code is, plus live stats.">
7
- <title>Leaderboard · codehygiene</title>
8
- <link rel="stylesheet" href="../styles.css">
9
- <link rel="stylesheet" href="../board.css">
10
- <script type="module" src="../board.js"></script>
11
- </head>
12
- <body class="board-page">
13
- <svg class="sprite" aria-hidden="true">
14
- <symbol id="i-github" viewBox="0 0 16 16"><path fill="currentColor" stroke="none" d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"/></symbol>
15
- <symbol id="i-back" viewBox="0 0 24 24"><path d="M19 12H5"/><path d="m11 18-6-6 6-6"/></symbol>
16
- <symbol id="i-external" viewBox="5 5 14 14"><path d="M7 17 17 7"/><path d="M8 7h9v9"/></symbol>
17
- </svg>
18
-
19
- <div class="board">
20
- <header class="board-head">
21
- <a class="board-home" href="../" title="Back to CodeHygiene">
22
- <svg class="icon" aria-hidden="true"><use href="#i-back"/></svg>
23
- <span>CodeHygiene</span>
24
- </a>
25
- <nav class="board-tabs" aria-label="Views">
26
- <a class="board-tab" id="tab-board" href="#board">Leaderboard</a>
27
- <a class="board-tab" id="tab-stats" href="#stats">Stats</a>
28
- </nav>
29
- <p class="board-updated" id="board-updated"></p>
30
- </header>
31
-
32
- <main>
33
- <section class="board-view" id="view-board" aria-labelledby="tab-board">
34
- <ol class="board-list" id="board-list"></ol>
35
- <p class="board-empty" id="board-empty" hidden>No repos yet</p>
36
- </section>
37
-
38
- <section class="board-view" id="view-stats" aria-labelledby="tab-stats" hidden>
39
- <div class="tiles" id="tiles"></div>
40
- <div class="charts">
41
- <section class="panel">
42
- <h2 class="panel-title">Most flagged</h2>
43
- <p class="panel-note">Issues found by kind</p>
44
- <div class="bars" id="chart-kinds"></div>
45
- </section>
46
- <section class="panel">
47
- <h2 class="panel-title">Cleanest language</h2>
48
- <p class="panel-note">Average score, higher is better</p>
49
- <div class="bars" id="chart-languages"></div>
50
- </section>
51
- </div>
52
- <section class="panel reward" id="reward" hidden>
53
- <header class="reward-head">
54
- <h2 class="panel-title">As a reward</h2>
55
- <a class="reward-source" id="reward-source" target="_blank" rel="noopener">
56
- <span id="reward-version"></span>
57
- <svg class="icon" aria-hidden="true"><use href="#i-external"/></svg>
58
- </a>
59
- </header>
60
- <dl class="reward-facts" id="reward-facts"></dl>
61
- </section>
62
- </section>
63
- </main>
64
- </div>
65
- </body>
66
- </html>
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en" data-root="../">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="description" content="GitHub repos and coding models ranked by code readability, plus live stats.">
7
+ <title>Leaderboard · codehygiene</title>
8
+ <link rel="stylesheet" href="../styles.css">
9
+ <link rel="stylesheet" href="../board.css">
10
+ <script type="module" src="../board.js"></script>
11
+ </head>
12
+ <body class="board-page">
13
+ <svg class="sprite" aria-hidden="true">
14
+ <symbol id="i-github" viewBox="0 0 16 16"><path fill="currentColor" stroke="none" d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"/></symbol>
15
+ <symbol id="i-cpu" viewBox="0 0 24 24"><rect x="5" y="5" width="14" height="14" rx="2"/><rect x="9" y="9" width="6" height="6" rx="1"/><path d="M9 2v3"/><path d="M15 2v3"/><path d="M9 19v3"/><path d="M15 19v3"/><path d="M2 9h3"/><path d="M2 15h3"/><path d="M19 9h3"/><path d="M19 15h3"/></symbol>
16
+ <symbol id="i-back" viewBox="0 0 24 24"><path d="M19 12H5"/><path d="m11 18-6-6 6-6"/></symbol>
17
+ <symbol id="i-external" viewBox="5 5 14 14"><path d="M7 17 17 7"/><path d="M8 7h9v9"/></symbol>
18
+ </svg>
19
+
20
+ <div class="board">
21
+ <header class="board-head">
22
+ <a class="board-home" href="../" title="Back to CodeHygiene">
23
+ <svg class="icon" aria-hidden="true"><use href="#i-back"/></svg>
24
+ <span>CodeHygiene</span>
25
+ </a>
26
+ <nav class="board-tabs" aria-label="Views">
27
+ <a class="board-tab" id="tab-board" href="#board">Leaderboard</a>
28
+ <a class="board-tab" id="tab-stats" href="#stats">Stats</a>
29
+ </nav>
30
+ <p class="board-updated" id="board-updated"></p>
31
+ </header>
32
+
33
+ <main>
34
+ <section class="board-view" id="view-board" aria-labelledby="tab-board">
35
+ <div class="board-bar">
36
+ <div class="board-modes" role="group" aria-label="Leaderboard">
37
+ <button class="board-mode" type="button" data-kind="repos" aria-pressed="true">Repos</button>
38
+ <button class="board-mode" type="button" data-kind="models" aria-pressed="false">Models</button>
39
+ </div>
40
+ <p class="board-note" id="board-note" hidden></p>
41
+ </div>
42
+ <ol class="board-list" id="board-list"></ol>
43
+ <p class="board-empty" id="board-empty" hidden>No repos yet</p>
44
+ </section>
45
+
46
+ <section class="board-view" id="view-stats" aria-labelledby="tab-stats" hidden>
47
+ <div class="tiles" id="tiles"></div>
48
+ <div class="charts">
49
+ <section class="panel">
50
+ <h2 class="panel-title">Most flagged</h2>
51
+ <p class="panel-note">Issues found by kind</p>
52
+ <div class="bars" id="chart-kinds"></div>
53
+ </section>
54
+ <section class="panel">
55
+ <h2 class="panel-title">Cleanest language</h2>
56
+ <p class="panel-note">Average score, higher is better</p>
57
+ <div class="bars" id="chart-languages"></div>
58
+ </section>
59
+ </div>
60
+ <section class="panel reward" id="reward" hidden>
61
+ <header class="reward-head">
62
+ <h2 class="panel-title">As a reward</h2>
63
+ <a class="reward-source" id="reward-source" target="_blank" rel="noopener">
64
+ <span id="reward-version"></span>
65
+ <svg class="icon" aria-hidden="true"><use href="#i-external"/></svg>
66
+ </a>
67
+ </header>
68
+ <dl class="reward-facts" id="reward-facts"></dl>
69
+ </section>
70
+ </section>
71
+ </main>
72
+ </div>
73
+ </body>
74
+ </html>
web/src/board.js CHANGED
@@ -2,6 +2,7 @@
2
  import "./board.css";
3
  import { byId, el } from "./dom.js";
4
  import { LANGUAGES, NOTES, sentenceCase } from "./labels.js";
 
5
  import { fetchLeaderboard, fetchStats } from "./refiner.js";
6
  import REWARD_FACTS from "./reward-facts.json";
7
  import { formatCount, formatMs } from "./telemetry.js";
@@ -18,7 +19,11 @@ const DAY = 24 * HOUR;
18
  // benchmark table at each release. The strip stays hidden when the running scorer has no entry.
19
  const README_AT = "https://github.com/brianbell-x/codehygiene/blob";
20
 
21
- const state = { board: null, stats: null, yours: null };
 
 
 
 
22
 
23
  function icon(name) {
24
  const svg = document.createElementNS(SVG_NS, "svg");
@@ -69,7 +74,17 @@ function repoCell(repo) {
69
  ]);
70
  }
71
 
72
- function boardRow(row, index) {
 
 
 
 
 
 
 
 
 
 
73
  const yours = state.yours && row.repo.toLowerCase() === state.yours;
74
  return el("li", { class: yours ? "board-row is-yours" : "board-row" }, [
75
  el("span", { class: "board-rank", text: String(index + 1) }),
@@ -79,12 +94,38 @@ function boardRow(row, index) {
79
  ]);
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  function renderBoard() {
83
- const rows = state.board?.cleanest ?? [];
84
- byId("board-list").replaceChildren(...rows.map(boardRow));
 
 
85
  byId("board-list").hidden = rows.length === 0;
86
- byId("board-empty").hidden = rows.length > 0 || !state.board;
87
- byId("board-list").querySelector(".is-yours")?.scrollIntoView({ block: "center" });
 
 
 
 
 
 
 
88
  }
89
 
90
  function tile(label, value, note) {
@@ -196,6 +237,9 @@ function updatedText() {
196
  if (currentView() === "stats") {
197
  return "Live";
198
  }
 
 
 
199
  const updated = state.board?.updated_at;
200
  return updated ? since(updated) : "";
201
  }
@@ -204,12 +248,22 @@ function renderUpdated() {
204
  byId("board-updated").textContent = updatedText();
205
  }
206
 
 
 
 
 
 
 
 
 
207
  function showView() {
 
208
  const view = currentView();
209
  byId("view-board").hidden = view !== "board";
210
  byId("view-stats").hidden = view !== "stats";
211
  byId("tab-board").setAttribute("aria-current", view === "board" ? "page" : "false");
212
  byId("tab-stats").setAttribute("aria-current", view === "stats" ? "page" : "false");
 
213
  renderUpdated();
214
  }
215
 
@@ -220,7 +274,19 @@ function readYours() {
220
 
221
  function boot() {
222
  state.yours = readYours();
223
- window.addEventListener("hashchange", showView);
 
 
 
 
 
 
 
 
 
 
 
 
224
  showView();
225
  fetchLeaderboard().then((board) => {
226
  state.board = board;
 
2
  import "./board.css";
3
  import { byId, el } from "./dom.js";
4
  import { LANGUAGES, NOTES, sentenceCase } from "./labels.js";
5
+ import MODEL_SCORES from "./model-scores.json";
6
  import { fetchLeaderboard, fetchStats } from "./refiner.js";
7
  import REWARD_FACTS from "./reward-facts.json";
8
  import { formatCount, formatMs } from "./telemetry.js";
 
19
  // benchmark table at each release. The strip stays hidden when the running scorer has no entry.
20
  const README_AT = "https://github.com/brianbell-x/codehygiene/blob";
21
 
22
+ const SORTED_MODELS = [...MODEL_SCORES.models].sort(
23
+ (left, right) => right.score - left.score || left.name.localeCompare(right.name),
24
+ );
25
+
26
+ const state = { kind: "repos", board: null, stats: null, yours: null };
27
 
28
  function icon(name) {
29
  const svg = document.createElementNS(SVG_NS, "svg");
 
74
  ]);
75
  }
76
 
77
+ function modelCell(row) {
78
+ return el("span", { class: "board-model", title: row.id }, [
79
+ icon("i-cpu"),
80
+ el("span", { class: "board-repo-name" }, [
81
+ el("span", { class: "board-owner", text: `${row.provider} / ` }),
82
+ el("span", { text: row.name }),
83
+ ]),
84
+ ]);
85
+ }
86
+
87
+ function repoRow(row, index) {
88
  const yours = state.yours && row.repo.toLowerCase() === state.yours;
89
  return el("li", { class: yours ? "board-row is-yours" : "board-row" }, [
90
  el("span", { class: "board-rank", text: String(index + 1) }),
 
94
  ]);
95
  }
96
 
97
+ function modelRow(row, index) {
98
+ return el("li", { class: "board-row" }, [
99
+ el("span", { class: "board-rank", text: String(index + 1) }),
100
+ modelCell(row),
101
+ track(row.score),
102
+ el("span", { class: "board-score", text: points(row.score) }),
103
+ ]);
104
+ }
105
+
106
+ function renderNote() {
107
+ const note = byId("board-note");
108
+ const showModels = state.kind === "models" && Boolean(MODEL_SCORES.note);
109
+ note.hidden = !showModels;
110
+ note.textContent = showModels ? MODEL_SCORES.note : "";
111
+ note.classList.toggle("is-preview", showModels && Boolean(MODEL_SCORES.preview));
112
+ }
113
+
114
  function renderBoard() {
115
+ const isModels = state.kind === "models";
116
+ const rows = isModels ? SORTED_MODELS : (state.board?.cleanest ?? []);
117
+ const rowView = isModels ? modelRow : repoRow;
118
+ byId("board-list").replaceChildren(...rows.map(rowView));
119
  byId("board-list").hidden = rows.length === 0;
120
+ byId("board-empty").hidden = rows.length > 0 || (!isModels && !state.board);
121
+ for (const button of document.querySelectorAll(".board-mode")) {
122
+ button.setAttribute("aria-pressed", String(button.dataset.kind === state.kind));
123
+ }
124
+ byId("tab-board").setAttribute("href", isModels ? "#models" : "#board");
125
+ renderNote();
126
+ if (!isModels) {
127
+ byId("board-list").querySelector(".is-yours")?.scrollIntoView({ block: "center" });
128
+ }
129
  }
130
 
131
  function tile(label, value, note) {
 
237
  if (currentView() === "stats") {
238
  return "Live";
239
  }
240
+ if (state.kind === "models") {
241
+ return MODEL_SCORES.preview ? "Preview" : "Avg score";
242
+ }
243
  const updated = state.board?.updated_at;
244
  return updated ? since(updated) : "";
245
  }
 
248
  byId("board-updated").textContent = updatedText();
249
  }
250
 
251
+ function syncFromHash() {
252
+ if (window.location.hash === "#models") {
253
+ state.kind = "models";
254
+ } else if (window.location.hash === "#board" || window.location.hash.startsWith("#repo=")) {
255
+ state.kind = "repos";
256
+ }
257
+ }
258
+
259
  function showView() {
260
+ syncFromHash();
261
  const view = currentView();
262
  byId("view-board").hidden = view !== "board";
263
  byId("view-stats").hidden = view !== "stats";
264
  byId("tab-board").setAttribute("aria-current", view === "board" ? "page" : "false");
265
  byId("tab-stats").setAttribute("aria-current", view === "stats" ? "page" : "false");
266
+ renderBoard();
267
  renderUpdated();
268
  }
269
 
 
274
 
275
  function boot() {
276
  state.yours = readYours();
277
+ for (const button of document.querySelectorAll(".board-mode")) {
278
+ button.addEventListener("click", () => {
279
+ state.kind = button.dataset.kind;
280
+ const hash = state.kind === "models" ? "#models" : "#board";
281
+ window.history.replaceState(null, "", hash);
282
+ renderBoard();
283
+ renderUpdated();
284
+ });
285
+ }
286
+ window.addEventListener("hashchange", () => {
287
+ state.yours = readYours() ?? state.yours;
288
+ showView();
289
+ });
290
  showView();
291
  fetchLeaderboard().then((board) => {
292
  state.board = board;
web/src/model-scores.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "preview": true,
3
+ "note": "Preview — raw-output benchmark in progress",
4
+ "models": [
5
+ { "provider": "Anthropic", "name": "Claude Fable 5.2", "id": "anthropic/claude-fable-5.2", "score": 84 },
6
+ { "provider": "OpenAI", "name": "GPT-6.2 Astra", "id": "openai/gpt-6.2-astra", "score": 82 },
7
+ { "provider": "Anthropic", "name": "Claude Opus 5.5", "id": "anthropic/claude-opus-5.5", "score": 81 },
8
+ { "provider": "Google", "name": "Gemini 4 Hydrogen", "id": "google/gemini-4-hydrogen", "score": 79 },
9
+ { "provider": "Anthropic", "name": "Claude Sonnet 5.5", "id": "anthropic/claude-sonnet-5.5", "score": 78 },
10
+ { "provider": "OpenAI", "name": "GPT-6.2 Sol", "id": "openai/gpt-6.2-sol", "score": 76 },
11
+ { "provider": "Qwen", "name": "Qwen4 Max", "id": "qwen/qwen4-max", "score": 75 },
12
+ { "provider": "Google", "name": "Gemini 4 Carbon", "id": "google/gemini-4-carbon", "score": 74 },
13
+ { "provider": "DeepSeek", "name": "DeepSeek V4 Pro", "id": "deepseek/deepseek-v4-pro-0813", "score": 72 },
14
+ { "provider": "Z.ai", "name": "GLM 5.3 Prime", "id": "z-ai/glm-5.3-prime", "score": 70 },
15
+ { "provider": "MoonshotAI", "name": "Kimi K3.1 Pro", "id": "moonshotai/kimi-k3.1-pro", "score": 69 },
16
+ { "provider": "xAI", "name": "Grok 4.7", "id": "x-ai/grok-4.7", "score": 67 },
17
+ { "provider": "Mistral", "name": "Mistral Large 4", "id": "mistralai/mistral-large-4-0", "score": 65 },
18
+ { "provider": "DeepSeek", "name": "DeepSeek V4.1 Flash", "id": "deepseek/deepseek-v4.1-flash-1017", "score": 64 },
19
+ { "provider": "Anthropic", "name": "Claude Haiku 5.5", "id": "anthropic/claude-haiku-5.5", "score": 62 }
20
+ ]
21
+ }