From 86dfa336b30ab911f80da82ffa6ffe77e4106b62 Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Sun, 8 Nov 2026 22:06:22 +0800 Subject: [PATCH] fix: link every repo in verdict preview Source column The Source column printed repo names as plain text, and a row with an empty url rendered its name as a dead link. Co-Authored-By: Claude --- .claude/skills/preview-verdicts/SKILL.md | 2 +- .claude/skills/preview-verdicts/template.html | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.claude/skills/preview-verdicts/SKILL.md b/.claude/skills/preview-verdicts/SKILL.md index fbae4003..9df54fe9 100644 --- a/.claude/skills/preview-verdicts/SKILL.md +++ b/.claude/skills/preview-verdicts/SKILL.md @@ -10,7 +10,7 @@ Maintainer review happens through an interactive HTML page: one row per entry wi ## Generate the preview 1. Build the `DATA` array. A group is `[section, subcategory, rows]`; a row is `[entry, url, downloads, kind, verdict, reason]`, plus an optional seventh `source` field. - - `source` says where a row came from when that is not obvious, such as the starred repo behind a scan candidate or an incumbent pulled in during the audit. The page shows a Source column only when a row has one. + - `source` says where a row came from when that is not obvious, such as the starred repo behind a scan candidate or an incumbent pulled in during the audit. Name each repo as `owner/repo` (`starred: piskvorky/smart_open`), which the page turns into a GitHub link. The page shows a Source column only when a row has one. - `subcategory` may carry a note after ` — ` (rendered muted): use it for proposed splits, re-homes, or anything the maintainer should weigh for the whole group. - `downloads` is PyPI last-month as a comma-formatted string; use `—` when no signal exists (e.g. agent skill packs), `stdlib` for standard-library modules, `fetch failed` when the lookup failed. State the fetch date in the sub-header. - `kind` sets the buttons independently of the seeded `verdict`: diff --git a/.claude/skills/preview-verdicts/template.html b/.claude/skills/preview-verdicts/template.html index d71b01f7..5c3900f0 100644 --- a/.claude/skills/preview-verdicts/template.html +++ b/.claude/skills/preview-verdicts/template.html @@ -25,8 +25,8 @@ td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; } tr.changed td { background: var(--changed); border-bottom-color: var(--changed-line); } td.name { white-space: nowrap; font-weight: 600; } - td.name a { color: var(--ink); text-decoration: none; border-bottom: 1px solid #c8c4c0; } - td.name a:hover { border-bottom-color: var(--ink); } + td.name a, td.source a { color: var(--ink); text-decoration: none; border-bottom: 1px solid #c8c4c0; } + td.name a:hover, td.source a:hover { border-bottom-color: var(--ink); } td.source { font-size: .95rem; color: var(--muted); max-width: 14rem; } td.dl { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; } td.mine { white-space: nowrap; } @@ -78,6 +78,11 @@ const CHOICES = { listed: ["keep", "remove", "park"], candidate: ["add", "reject const cap = v => v[0].toUpperCase() + v.slice(1); function rowId(section, name) { return section + "::" + name; } +// Each owner/repo in a Source cell links to its GitHub repo. +function linkRepos(text) { + return (text || "").replace(/(^|[\s(,;])([A-Za-z0-9][\w.-]*\/[\w.-]*[\w])(?=$|[\s),;])/g, + (_, pre, repo) => `${pre}${repo}`); +} function render() { const app = document.getElementById("app"); @@ -94,8 +99,8 @@ function render() { const yours = s.verdict || mine; const changed = yours !== mine || (s.feedback || "").trim() !== ""; html += ` - ${name} - ${hasSource ? `${source || ""}` : ""} + ${url ? `${name}` : name} + ${hasSource ? `${linkRepos(source)}` : ""} ${dl} ${mine.toUpperCase()} ${reason}