AI triage › Overview: labels on open issues as one table, a group per category with its coverage and backfill, every bar out of all open issues, a category filter and label search; bars are drawn in SVG since the CSP blocked their inline widths (Overview, Custom labels, Re-run)

This commit is contained in:
juansebsol committed 2026-10-28 11:04:41 -07:00
1 parent 43e8b22d89
commit 736d4f55f4
8 files changed
+238 -80

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ and filed by a GitHub App. Reporters never need a GitHub account.
- **Repo status (optional):** every repository at a glance, like a team status board: open PRs and issues and the oldest open PR, the last commit, issue and PR, what happened in a window you pick (10 minutes to a week, since the last build, or all time: commits, PRs opened and merged, issues, people), and each latest build with its unreleased commits and downloads. Sort by any column; a totals row sums them up. Fix first ranks the open issues across the repositories by what they say (crash, hang, data loss beats "doesn't work"), who filed them, how many people pile on and how fresh they are, with the reasons beside each score. Most reported ranks the issues by how many Discord tickets are about them (a duplicate counts for its original; ones Claude suggested and nobody has reviewed yet are shown as waiting for review), over the last 7, 30 or 90 days or all time, with the tickets one click away, and says when an issue closed as fixed keeps being reported. Pull requests lists the open ones (the ones fixing the most reported issues first, with how many Discord tickets are about them), the merged ones waiting for a release, and the ones merged in the last 90 days; Fix first and Most reported show when someone's working on an issue or it's already fixed. Read in the background every 5 to 60 minutes with GitHub's GraphQL API, which has its own budget, so filing isn't affected. Off until you turn it on; you pick the repositories (your apps' ones to start with).
- **Analytics (optional):** downloads recorded every 30 minutes from when you turn it on (GitHub only keeps running totals), per app, platform, processor, format and version, from 30 minutes to 12 months at a time (today in 30-minute steps by default; steps of 30m, 1h, 3h, 6h, 12h or a day), in your own time zone, or All: lifetime totals (GitHub's own download and star counts) with the same breakdowns. The main chart switches between downloads and stars: stars gained over time (the change in GitHub's star count, read every 30 minutes with the downloads from when you turn it on; a star taken back counts -1) and each app's star total. Next to them: tickets, issues opened and closed, pull requests merged and stars over the same time, each compared with the period before, and release health: Discord tickets while each release was the latest, per 1,000 of its downloads. Every chart has a table view.
- **AI triage (optional):** Claude flags priority, duplicates, regressions, spam and more, and sorts tickets into your own custom labels. Each action can be off, a suggestion, or automatic above a confidence threshold, with separate settings for issues opened directly on GitHub.
- AI triage › Overview: every label on your open issues at a glance (priority, triage's own labels, each custom label category with how many still have none of its labels, and your team's other labels), each linked to its issues on GitHub, next to what triage did over 7 days to all time: tickets and issues read per day, labels added, duplicates found, details asked for, what it closed, applied and still suggested by action, the priority it gave and how sure it was, what it skipped, what it cost, by app.
- AI triage › Overview: every label on your open issues in one table, grouped by category and searchable (priority, triage's own labels, each custom label category with how many still have none of its labels and a backfill for them, and your team's other labels), each bar out of all open issues and linked to its issues on GitHub, next to what triage did over 7 days to all time: tickets and issues read per day, labels added, duplicates found, details asked for, what it closed, applied and still suggested by action, the priority it gave and how sure it was, what it skipped, what it cost, by app.
- AI triage › Custom labels: your own labels in categories (Kind: bug, parity, plugins, backlog; Topic; Platform…), each with a sentence on when to use it. Claude picks from each category for every ticket and never invents a label. Each label shows how many open issues have it.
- AI triage › Review lists everything with suggestions waiting, from Discord tickets and GitHub issues. Every ticket shows its triage state (To review, Partly applied, Applied…), and suggestions say exactly what applying them does.
- Apply or dismiss in bulk, e.g. all duplicates at 80%+ confidence.
+84 -34
View File
@@ -465,6 +465,12 @@ input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-a
.dot.c4 { background: var(--dot-4); } .dot.c5 { background: var(--dot-5); } .dot.c6 { background: var(--dot-6); } .dot.c7 { background: var(--dot-7); }
.dot.r0 { background: var(--role-0); } .dot.r1 { background: var(--role-1); } .dot.r2 { background: var(--role-2); }
.dot.r3 { background: var(--role-3); } .dot.r4 { background: var(--role-4); } .dot.r5 { background: var(--role-5); }
/* Bars drawn by meter() in ui.ts, in SVG since the CSP blocks inline widths. */
.meter { display: block; overflow: hidden; border-radius: var(--r-full); }
.meter-track { fill: var(--surface-2); }
.meter-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.mh-bg.warn { fill: var(--warn-soft); } .mh-fg.warn { fill: var(--warn); }
.mh-bg.muted { fill: var(--surface-3); } .mh-fg.muted { fill: var(--faint); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); font: 600 11px/18px var(--font); text-align: center; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--muted); flex: none; }
@@ -2062,8 +2068,9 @@ details[open] > summary .cl-chev { transform: rotate(90deg); }
.cl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cl-modes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cl-cov { display: flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; }
.cl-cover-bar { flex: 0 0 90px; height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.cl-cover-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ok); }
.cl-cover-bar { flex: 0 0 90px; display: block; }
.cl-cover-bar .meter-track { fill: var(--surface-3); }
.cl-cover-fill { fill: var(--ok); }
.cl-open .c, details[open] > summary .cl-open .o { display: none; }
details[open] > summary .cl-open .c { display: inline; }
.cl-body { border-top: 1px solid var(--border); }
@@ -2128,13 +2135,14 @@ details[open] > summary .cl-open .c { display: inline; }
.bf-totals-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.bf-totals-h h3 { margin: 0; font-size: 14px; }
.bf-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.bf-key.sure, .bf-bar .sure { background: var(--ok); }
.bf-key.unsure, .bf-bar .unsure { background: var(--warn-border); }
.bf-key.sure { background: var(--ok); }
.bf-key.unsure { background: var(--warn-border); }
.bf-bar .sure { fill: var(--ok); }
.bf-bar .unsure { fill: var(--warn-border); }
.bf-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bf-bars li { display: grid; grid-template-columns: minmax(150px, 0.28fr) minmax(0, 1fr) 11em; gap: 12px; align-items: center; }
.bf-bar-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bf-bar { display: flex; height: 10px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.bf-bar i { display: block; height: 100%; }
.bf-bar { display: block; min-width: 0; }
.bf-bar-n { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
th.bf-ticket { width: 34%; }
th.bf-had { width: 16%; }
@@ -2151,50 +2159,92 @@ th.bf-had { width: 16%; }
.ov-kpi:hover { border-color: var(--border-hover); text-decoration: none; }
.ov-ch-a { margin-left: auto; }
.ov-labels .an-ch { align-items: center; }
.ov-prio { padding: 6px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.ov-prio-h, .ov-sec-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ov-prio-h h3, .ov-sec-h h3 { margin: 0; font-size: 13px; font-weight: 600; }
.ov-sec-h .btn { margin-left: auto; }
.ov-stack { display: flex; height: 14px; gap: 2px; border-radius: var(--r-full); overflow: hidden; background: var(--surface-2); }
.ov-stack > * { display: block; min-width: 3px; transition: opacity var(--t-fast); }
.ov-stack > a:hover { opacity: 0.8; }
.p-crit { background: var(--danger); } .p-high { background: var(--viz-2); } .p-med { background: var(--viz-1); } .p-low { background: var(--faint); } .p-none { background: var(--surface-3); }
.ov-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12px; }
.ov-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ov-legend i { width: 10px; height: 10px; border-radius: 2px; }
.ov-legend a { color: var(--text); font-family: var(--mono); }
.ov-legend b { font-variant-numeric: tabular-nums; }
.ov-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px 28px; }
.ov-sec { min-width: 0; }
.p-crit { background: var(--danger); } .p-high { background: var(--viz-2); } .p-med { background: var(--viz-1); } .p-low { background: var(--faint); }
.ov-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ov-bar { display: grid; grid-template-columns: minmax(118px, 0.48fr) minmax(40px, 1fr) 6.5em; gap: 10px; align-items: center; padding: 4px 6px; margin: 0 -6px; border-radius: var(--r-xs); color: var(--text); text-decoration: none; }
a.ov-bar:hover { background: var(--surface-2); text-decoration: none; }
.ov-bar-l { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; overflow: hidden; }
.ov-bar-l .tag { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ov-bars.wide .ov-bar { grid-template-columns: minmax(118px, 0.48fr) minmax(40px, 1fr) 10.5em; }
.ov-bar-t { display: flex; height: 8px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.ov-bar-t i { display: block; height: 100%; background: var(--viz-1); border-radius: var(--r-full); }
.ov-bars.two .ov-bar-t i { border-radius: 0; }
.ov-bar-t i.a { background: var(--viz-1); }
.ov-bar-t i.s { background: var(--viz-4); }
.ov-bar-t i.none { background: var(--warn); }
.ov-bar-t i.conf { background: var(--viz-3); }
.ov-bar-t i.skip { background: var(--faint); }
.ov-bar-t i.p-crit { background: var(--danger); } .ov-bar-t i.p-high { background: var(--viz-2); } .ov-bar-t i.p-med { background: var(--viz-1); } .ov-bar-t i.p-low { background: var(--faint); }
.ov-bar-t { display: block; min-width: 0; }
.ov-bar-t .v1, .ov-bar-t .a, .ov-bar-t .p-med { fill: var(--viz-1); }
.ov-bar-t .s { fill: var(--viz-4); }
.ov-bar-t .conf { fill: var(--viz-3); }
.ov-bar-t .skip, .ov-bar-t .p-low { fill: var(--faint); }
.ov-bar-t .p-crit { fill: var(--danger); } .ov-bar-t .p-high { fill: var(--viz-2); }
.ov-bar-n { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-bar-n .muted { font-size: 11px; }
.ov-bar-x { font-size: 11px; color: var(--muted); }
.ov-none-l { font-size: 12px; color: var(--warn-text); font-weight: 500; }
.ov-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ov-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.ov-key.a { background: var(--viz-1); } .ov-key.s { background: var(--viz-4); }
.ov-sub { margin: 16px 0 8px; font-size: 13px; font-weight: 600; }
.ov-none { margin: 0; }
.ov-grid { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.ov-empty-cat .empty { padding: 16px 8px; }
.ov-grid { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
/* Labels on open issues: one table, a group per category, every bar out of all open issues. */
.lt-tools { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.lt-tools .search { margin-left: auto; }
.lt-table { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 4px; }
.lt-head, .lt-row { display: grid; grid-template-columns: minmax(0, 18rem) 6.5rem minmax(0, 1fr) 2.75rem; align-items: center; }
.lt-head { height: 34px; font-size: 12px; font-weight: 500; color: var(--muted); }
.lt-head > span:first-child { padding-left: 16px; }
.lt-n { text-align: right; padding-right: 16px; font-variant-numeric: tabular-nums; }
.lt-bar { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 16px; }
.lt-track, .lt-scale { position: relative; flex: 1; min-width: 0; }
.lt-track { padding: 6px 0; background: linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 25% 100% repeat-x; }
.lt-track .meter-track { fill: var(--surface-3); }
.lt-pct { flex: none; width: 3em; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lt-scale { height: 16px; font-variant-numeric: tabular-nums; }
.lt-scale i { position: absolute; top: 0; font-style: normal; line-height: 16px; transform: translateX(-50%); }
.lt-scale i:first-child { left: 0; transform: none; }
.lt-scale .t25 { left: 25%; } .lt-scale .t50 { left: 50%; } .lt-scale .t75 { left: 75%; }
.lt-scale .t100 { right: 0; transform: none; }
.lt-head .lt-pct { font-size: inherit; color: inherit; }
.lt-group { border-top: 1px solid var(--border); }
.lt-gh { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; min-height: 46px; padding: 6px 16px 6px 12px; background: var(--surface-2); }
.lt-gh::-webkit-details-marker { display: none; }
.lt-chev { display: inline-flex; color: var(--muted); transition: transform var(--t-fast); }
.lt-group[open] > .lt-gh .lt-chev { transform: rotate(90deg); }
.lt-gh:hover .lt-chev { color: var(--text); }
.lt-gname { font-size: 13px; font-weight: 600; }
.lt-kind { font-size: 12px; color: var(--muted); }
.lt-cov { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.lt-cov b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.lt-cov.low b { color: var(--warn-text); }
.lt-cov-bar { display: block; width: 96px; }
.lt-cov-bar .meter-track { fill: var(--surface-3); }
.lt-cov-fill, .lt-fill { fill: var(--accent); }
.lt-sum { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.lt-sum b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.lt-group[open] .lt-sum { display: none; }
.lt-act { margin-left: auto; }
.lt-rows { list-style: none; margin: 0; padding: 0; }
.lt-rows > li { border-top: 1px solid var(--border); }
.lt-row { min-height: 36px; color: var(--text); text-decoration: none; }
.lt-row:hover { background: var(--surface-2); text-decoration: none; }
.lt-row.zero { opacity: 0.55; }
.lt-l { display: flex; min-width: 0; padding-left: 40px; }
.lt-l .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.lt-row .lt-n { font-size: 13px; font-weight: 600; }
.lt-nolabel { font-size: 13px; font-weight: 500; color: var(--muted); }
.lt-nolabel.warn { color: var(--warn-text); }
.lt-go { justify-self: center; display: inline-flex; color: var(--faint); }
.lt-row:hover .lt-go { color: var(--text); }
.lt-nil { margin: 0; padding: 12px 16px 12px 40px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); }
.lt-nomatch { padding-left: 16px; }
.lt-empty { border-top: 1px solid var(--border); }
.lt-empty .empty { padding: 16px 8px; }
@media (max-width: 720px) {
.ov-cols { grid-template-columns: minmax(0, 1fr); }
.ov-ch-a { margin-left: 0; }
.lt-tools .search { margin-left: 0; width: 100%; }
.lt-head { display: none; }
.lt-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; padding: 8px 0; }
.lt-l { padding-left: 16px; }
.lt-row .lt-bar { grid-column: 1 / -1; padding-left: 16px; }
.lt-go { display: none; }
.lt-cov { margin-left: 0; }
.lt-act { margin-left: 0; }
}
/* Re-run: what a run will cost, by Start; and on a running one, what it cost so far. */
+47
View File
@@ -426,6 +426,53 @@
if (clear) clear.addEventListener('click', function (e) { e.preventDefault(); input.value = ''; run(); input.focus(); });
run();
});
// AI triage › Overview: the labels table shows one category, or the labels a search finds. The
// groups that show open; clearing it puts each group back as it was.
$$('[data-lt]').forEach(function (table) {
var tools = $('[data-lt-tools]', table);
var find = $('[data-lt-find]', table);
var nothing = $('[data-lt-none]', table);
var groups = $$('[data-lt-group]', table);
var buttons = $$('[data-lt-show]', table);
if (!tools || !find) return;
tools.hidden = false;
var show = 'all';
var saved = null;
function run() {
var q = find.value.trim().toLowerCase();
var filtered = Boolean(q) || show !== 'all';
if (filtered && !saved) saved = groups.map(function (g) { return g.open; });
var any = false;
groups.forEach(function (g) {
var hits = 0;
$$('.lt-rows > li', g).forEach(function (li) {
var name = li.getAttribute('data-lt-name');
var hit = !q || (name !== null && name.indexOf(q) !== -1);
li.hidden = !hit;
if (hit) hits++;
});
var on = (show === 'all' || g.getAttribute('data-lt-group') === show) && (!q || hits > 0);
g.hidden = !on;
if (on) any = true;
if (on && filtered) g.open = true;
});
if (!filtered && saved) {
groups.forEach(function (g, i) { g.open = saved[i]; });
saved = null;
}
$$('[data-lt-extra]', table).forEach(function (el) { el.hidden = filtered; });
if (nothing) nothing.hidden = any;
}
buttons.forEach(function (b) {
b.addEventListener('click', function () {
show = b.getAttribute('data-lt-show');
buttons.forEach(function (x) { x.setAttribute('aria-pressed', x === b ? 'true' : 'false'); });
run();
});
});
find.addEventListener('input', run);
});
$$('[data-toggle-filters]').forEach(function (b) {
b.addEventListener('click', function () {
var target = document.getElementById(b.getAttribute('data-toggle-filters'));
+2 -2
View File
@@ -31,7 +31,7 @@ import {
} from '../../triage/settings.js';
import { setFlash } from '../session.js';
import type { Web, WorkspaceRequestContext } from '../server.js';
import { csrfField, empty, icon, iconBtn, labelTag, linkBtn, menu, notice, pageHeader, pill, postBtn, segRadios, selectWrap, submitBtn, timeAgo, type Tone } from '../ui.js';
import { csrfField, empty, icon, iconBtn, labelTag, linkBtn, menu, meter, notice, pageHeader, pill, postBtn, segRadios, selectWrap, submitBtn, timeAgo, type Tone } from '../ui.js';
import { openLabels, openMissing } from '../../triage/label-stats.js';
import { textField } from './panel.js';
import { areaHref, canOpen, knowledgeHref, pageLink, toolHeader, toolHref } from './tool.js';
@@ -146,7 +146,7 @@ export function registerTriageConfigRoutes(app: FastifyInstance, web: Web): void
</span>
<span class="cl-side">
<span class="cl-modes">${pill(`Discord: ${MODE_NAMES[g.mode]}`, MODE_TONE[g.mode])}${pill(`GitHub: ${MODE_NAMES[ghMode]}`, MODE_TONE[ghMode])}</span>
${open.open ? html`<span class="cl-cov" title="${`${n(open.open - none)} of ${n(open.open)} open issues have a ${g.name} label`}"><span class="cl-cover-bar" aria-hidden="true"><i style="width:${String(done)}%"></i></span><span><b>${String(done)}%</b> labelled${none ? html`<span class="muted"> · ${n(none)} have none</span>` : ''}</span></span>` : ''}
${open.open ? html`<span class="cl-cov" title="${`${n(open.open - none)} of ${n(open.open)} open issues have a ${g.name} label`}"><span class="cl-cover-bar">${meter([{ pct: done, cls: 'cl-cover-fill' }])}</span><span><b>${String(done)}%</b> labelled${none ? html`<span class="muted"> · ${n(none)} have none</span>` : ''}</span></span>` : ''}
<span class="btn sm cl-open" aria-hidden="true"><span class="o">${edit ? 'Edit' : 'Details'}</span><span class="c">Close</span></span>
</span>
</summary>
+73 -39
View File
@@ -12,9 +12,9 @@ import { listApps } from '../../domain/store.js';
import { html, raw, type SafeHtml } from '../../lib/html.js';
import { openLabels, openMissing, type OpenLabels } from '../../triage/label-stats.js';
import { triageOverview, type TriageOverview } from '../../triage/overview.js';
import { FLAGS, getTriageSettings, groupKind, PRIORITIES, tokenCost, type LabelGroup, type TriageConfig } from '../../triage/settings.js';
import { FLAGS, getTriageSettings, groupKind, PRIORITIES, tokenCost, type TriageConfig } from '../../triage/settings.js';
import type { Web, WorkspaceRequestContext } from '../server.js';
import { empty, labelTag, linkBtn, notice, segLinks, selectWrap } from '../ui.js';
import { empty, icon, labelTag, linkBtn, meter, meterDefs, notice, plural, segLinks, selectWrap } from '../ui.js';
import { compact, delta, type Better } from './analytics.js';
import { areaHref, canOpen, toolHeader } from './tool.js';
import { FLAG_COPY } from './triage.js';
@@ -47,7 +47,7 @@ function bars(items: Bar[], o: { of: number; empty: string; max?: number }): Saf
const most = Math.max(1, ...shown.map((b) => b.n));
return html`<ul class="ov-bars${shown.some((b) => b.note) ? ' wide' : ''}">${shown.map((b) => {
const inner = html`<span class="ov-bar-l">${b.label}</span>
<span class="ov-bar-t" aria-hidden="true"><i class="${b.tone ?? ''}" style="width:${String(Math.max(b.n ? 1.5 : 0, (b.n / most) * 100))}%"></i></span>
<span class="ov-bar-t">${meter([{ pct: b.n ? Math.max(1.5, (b.n / most) * 100) : 0, cls: b.tone ?? 'v1' }], { h: 8 })}</span>
<span class="ov-bar-n"><b>${n(b.n)}</b><span class="muted">${pct(b.n, o.of)}</span>${b.note ? html`<span class="ov-bar-x">${b.note}</span>` : ''}</span>`;
return html`<li>${b.href ? html`<a class="ov-bar" href="${b.href}" target="_blank" rel="noopener noreferrer" title="See them on GitHub">${inner}</a>` : html`<div class="ov-bar">${inner}</div>`}</li>`;
})}</ul>`;
@@ -165,51 +165,85 @@ export function registerTriageOverviewRoutes(app: FastifyInstance, web: Web): vo
</div>`;
}
/**
* Every label on the open issues as one table, a group per category (priority, each custom
* category, triage's own, the rest), each bar out of all open issues. app.js adds the category
* filter and the label search.
*/
function labelsCard(ctx: WorkspaceRequestContext, c: TriageConfig, l: OpenLabels, missing: Map<string, number>, o: { search: (terms: string) => string; runs: string | null; app: string | null }): SafeHtml {
const has = (name: string) => l.byLabel.get(name.toLowerCase()) ?? 0;
const gh = (name: string) => o.search(`label:"${name}"`);
const prio = PRIORITIES.map((p) => ({ p, name: c.priority.labels[p], n: has(c.priority.labels[p]) }));
const without = (names: string[]) => o.search(names.map((x) => `-label:"${x}"`).join(' '));
const prio = PRIORITIES.map((p) => ({ name: c.priority.labels[p], n: has(c.priority.labels[p]) }));
const prioritized = prio.reduce((t, x) => t + x.n, 0);
const noPriority = Math.max(0, l.open - prioritized);
const flagLabels = [...new Map(FLAGS.filter((f) => c[f].label.trim()).map((f) => [c[f].label.toLowerCase(), { name: c[f].label, title: FLAG_COPY[f].title }])).values()];
const known = new Set([...prio.map((x) => x.name.toLowerCase()), ...flagLabels.map((x) => x.name.toLowerCase()), ...c.labelGroups.flatMap((g) => g.options.map((x) => x.label.toLowerCase()))]);
const flagLabels = [...new Map(FLAGS.filter((f) => c[f].label.trim()).map((f) => [c[f].label.toLowerCase(), c[f].label])).values()];
const known = new Set([...prio.map((x) => x.name.toLowerCase()), ...flagLabels.map((x) => x.toLowerCase()), ...c.labelGroups.flatMap((g) => g.options.map((x) => x.label.toLowerCase()))]);
const others = [...l.byLabel].filter(([k]) => !known.has(k)).sort((a, b) => b[1] - a[1]).map(([k, v]) => ({ name: l.names.get(k) ?? k, n: v }));
const backfill = (g: LabelGroup) => (o.runs ? `${o.runs}?what=labels&group=${encodeURIComponent(g.id)}` : null);
const category = (g: LabelGroup) => {
const none = missing.get(g.id) ?? 0;
const link = backfill(g);
return html`<section class="ov-sec" aria-labelledby="ov-g-${g.id}">
<div class="ov-sec-h"><h3 id="ov-g-${g.id}">${g.name}</h3><span class="xs muted">custom labels</span>${link && none ? linkBtn(link, `Backfill ${n(none)}`, { size: 'sm', variant: 'ghost', icon: 'history', title: `Add ${g.name} labels to the open tickets and issues that have none` }) : ''}</div>
${bars([
...g.options.map((x) => ({ label: labelTag(x.label), n: has(x.label), href: gh(x.label) })).sort((a, b) => b.n - a.n),
{ label: html`<span class="ov-none-l">None yet</span>`, n: none, href: o.search(g.options.map((x) => `-label:"${x.label}"`).join(' ')), tone: 'none' },
], { of: l.open, empty: 'No labels in this category.' })}
</section>`;
const byCount = (a: { n: number }, b: { n: number }) => b.n - a.n;
interface Row { name: string; n: number; href: string; none?: 'warn' | 'muted' }
interface Group { key: string; name: string; short?: string; kind: string; open: boolean; rows: Row[]; empty: string; cover?: { labelled: number; word: string; hatch: 'warn' | 'muted' }; backfill?: { href: string; none: number; name: string } | null }
const groups: Group[] = [
{
key: 'priority', name: 'Priority', kind: 'set by triage', open: true, empty: '',
cover: { labelled: prioritized, word: 'have one', hatch: 'muted' },
rows: [...prio.map((x) => ({ ...x, href: gh(x.name) })), { name: 'No priority', n: Math.max(0, l.open - prioritized), href: without(prio.map((x) => x.name)), none: 'muted' }],
},
...c.labelGroups.map((g): Group => {
const none = missing.get(g.id) ?? 0;
const runs = o.runs ? `${o.runs}?what=labels&group=${encodeURIComponent(g.id)}` : null;
return {
key: `g-${g.id}`, name: g.name, kind: 'custom labels', open: true, empty: 'No labels in this category.',
cover: { labelled: Math.max(0, l.open - none), word: 'labelled', hatch: 'warn' },
backfill: runs && none ? { href: runs, none, name: g.name } : null,
rows: [...g.options.map((x) => ({ name: x.label, n: has(x.label), href: gh(x.label) })).sort(byCount), { name: 'None yet', n: none, href: without(g.options.map((x) => x.label)), none: 'warn' }],
};
}),
{ key: 'triage', name: 'From triage', kind: 'its own labels', open: false, empty: 'Triage adds no labels of its own.', rows: flagLabels.map((x) => ({ name: x, n: has(x), href: gh(x) })).sort(byCount) },
{ key: 'other', name: 'Your other labels', short: 'Other', kind: 'added by people or ticket types', open: false, empty: 'None.', rows: others.slice(0, 50).map((x) => ({ ...x, href: gh(x.name) })) },
];
const share = (x: number) => (x ? Math.max(0.6, (x / l.open) * 100) : 0);
const row = (r: Row) => html`<li ${r.none ? '' : html`data-lt-name="${r.name.toLowerCase()}"`}>
<a class="lt-row${r.n ? '' : ' zero'}" href="${r.href}" target="_blank" rel="noopener noreferrer" aria-label="${`${r.name}: ${n(r.n)} open issues, ${pct(r.n, l.open)}. See them on GitHub`}">
<span class="lt-l">${r.none ? html`<span class="lt-nolabel ${r.none}">${r.name}</span>` : labelTag(r.name)}</span>
<span class="lt-n">${n(r.n)}</span>
<span class="lt-bar"><span class="lt-track">${meter([r.none ? { pct: share(r.n), hatch: r.none } : { pct: share(r.n), cls: 'lt-fill' }])}</span><span class="lt-pct">${pct(r.n, l.open)}</span></span>
<span class="lt-go">${icon('arrow-up-right', 14)}</span>
</a>
</li>`;
const group = (g: Group) => {
const labels = g.rows.filter((r) => !r.none);
const top = [...labels].sort(byCount).slice(0, 3);
const cover = g.cover;
const done = cover && l.open ? (cover.labelled / l.open) * 100 : 0;
return html`<details class="lt-group" data-lt-group="${g.key}" ${g.open ? raw('open') : ''}>
<summary class="lt-gh">
<span class="lt-chev" aria-hidden="true">${icon('chevron-right', 14)}</span>
<span class="lt-gname">${g.name}</span>
<span class="lt-kind">${g.kind}</span>
${cover ? html`<span class="lt-cov${done < 50 ? ' low' : ''}" title="${`${n(cover.labelled)} of ${n(l.open)} open issues`}"><span class="lt-cov-bar">${meter([{ pct: done, cls: 'lt-cov-fill' }, { pct: 100 - done, hatch: cover.hatch }])}</span><b>${pct(cover.labelled, l.open)}</b> ${cover.word}</span>` : ''}
${labels.length ? html`<span class="lt-sum">${plural(labels.length, 'label')}${top.map((t) => html` · ${t.name} <b>${n(t.n)}</b>`)}${labels.length > 3 ? ` · +${String(labels.length - 3)} more` : ''}</span>` : ''}
${g.backfill ? html`<span class="lt-act">${linkBtn(g.backfill.href, `Backfill ${n(g.backfill.none)}`, { size: 'sm', variant: 'secondary', icon: 'history', title: `Add ${g.backfill.name} labels to the open tickets and issues that have none` })}</span>` : ''}
</summary>
${g.rows.length ? html`<ul class="lt-rows">${g.rows.map(row)}</ul>` : html`<p class="lt-nil">${g.empty}</p>`}
</details>`;
};
const noCustom = c.labelGroups.length ? '' : html`<div class="lt-empty" data-lt-extra>${empty('tags', 'No custom labels yet', html`Sort every ticket into your own labels, such as bug, parity or plugins.`, canOpen(ctx.membership, 'triage.labels') ? linkBtn(areaHref(ctx, 'triage.labels'), 'Add custom labels', { size: 'sm', trail: 'arrow-right' }) : null)}</div>`;
return html`<section class="card an-card ov-labels" aria-labelledby="ov-labels-h">
<div class="an-ch"><h2 id="ov-labels-h">Labels on open issues</h2><span class="small muted">${n(l.open)} open issues · as on GitHub now · click a label to see its issues</span>
${canOpen(ctx.membership, 'triage.labels') ? html`<span class="ov-ch-a">${linkBtn(areaHref(ctx, 'triage.labels'), 'Custom labels', { size: 'sm', variant: 'ghost', trail: 'arrow-right' })}</span>` : ''}</div>
${l.open ? html`
<div class="ov-prio">
<div class="ov-prio-h"><h3>Priority</h3><span class="xs muted">${pct(prioritized, l.open)} of open issues have one</span></div>
<div class="ov-stack" role="img" aria-label="${prio.map((x) => `${x.name}: ${x.n}`).join(', ')}, no priority: ${String(noPriority)}">
${prio.map((x) => (x.n ? html`<a class="${PRIORITY_TONE[x.p]}" href="${gh(x.name)}" target="_blank" rel="noopener noreferrer" style="flex-grow:${String(x.n)}" title="${x.name}: ${n(x.n)}"></a>` : ''))}
${noPriority ? html`<span class="p-none" style="flex-grow:${String(noPriority)}" title="No priority: ${n(noPriority)}"></span>` : ''}
${l.open ? html`<div class="lt" data-lt>${meterDefs()}
<div class="lt-tools" data-lt-tools hidden>
<div class="seg" role="group" aria-label="Show">${[{ key: 'all', label: 'All' }, ...groups.map((g) => ({ key: g.key, label: g.short ?? g.name }))].map((s) => html`<button type="button" class="seg-item" data-lt-show="${s.key}" aria-pressed="${s.key === 'all' ? 'true' : 'false'}">${s.label}</button>`)}</div>
<span class="search sm">${icon('search', 14)}<input type="search" placeholder="Find a label" aria-label="Find a label" data-lt-find></span>
</div>
<div class="lt-table">
<div class="lt-head" aria-hidden="true"><span>Label</span><span class="lt-n">Open issues</span><span class="lt-bar"><span class="lt-scale"><i>0</i><i class="t25">25%</i><i class="t50">50%</i><i class="t75">75%</i><i class="t100">100%</i></span><span class="lt-pct">Share</span></span><span></span></div>
${groups[0] ? group(groups[0]) : ''}${noCustom}${groups.slice(1).map(group)}
<p class="lt-nil lt-nomatch" data-lt-none hidden>No label matches.</p>
</div>
<ul class="ov-legend">${prio.map((x) => html`<li><i class="${PRIORITY_TONE[x.p]}"></i><a href="${gh(x.name)}" target="_blank" rel="noopener noreferrer">${x.name}</a><b>${n(x.n)}</b><span class="muted">${pct(x.n, l.open)}</span></li>`)}
<li><i class="p-none"></i><span>No priority</span><b>${n(noPriority)}</b><span class="muted">${pct(noPriority, l.open)}</span></li></ul>
</div>
<div class="ov-cols">
<section class="ov-sec" aria-labelledby="ov-tri-h">
<div class="ov-sec-h"><h3 id="ov-tri-h">From triage</h3><span class="xs muted">its own labels</span></div>
${bars(flagLabels.map((x) => ({ label: html`<span title="${x.title}">${labelTag(x.name)}</span>`, n: has(x.name), href: gh(x.name) })).sort((a, b) => b.n - a.n), { of: l.open, empty: 'Triage adds no labels of its own.' })}
</section>
${c.labelGroups.map(category)}
${c.labelGroups.length ? '' : html`<section class="ov-sec ov-empty-cat">${empty('tags', 'No custom labels yet', html`Sort every ticket into your own labels, such as bug, parity or plugins.`, canOpen(ctx.membership, 'triage.labels') ? linkBtn(areaHref(ctx, 'triage.labels'), 'Add custom labels', { size: 'sm', trail: 'arrow-right' }) : null)}</section>`}
<section class="ov-sec" aria-labelledby="ov-oth-h">
<div class="ov-sec-h"><h3 id="ov-oth-h">Your other labels</h3><span class="xs muted">added by people or ticket types</span></div>
${bars(others.map((x) => ({ label: labelTag(x.name), n: x.n, href: gh(x.name) })), { of: l.open, empty: 'None.', max: 15 })}
</section>
</div>` : html`<p class="small muted ov-none">No open issues${o.app ? ' in this app’s repository' : ''}, or the issue sync hasn’t run yet.</p>`}
</section>`;
}
@@ -222,7 +256,7 @@ export function registerTriageOverviewRoutes(app: FastifyInstance, web: Web): vo
${rows.length
? html`<ul class="ov-bars two">${rows.map((a) => html`<li><div class="ov-bar">
<span class="ov-bar-l">${actionTitle(c, a.kind, a.category)}</span>
<span class="ov-bar-t" aria-hidden="true"><i class="a" style="width:${String((a.applied / most) * 100)}%"></i><i class="s" style="width:${String((a.suggested / most) * 100)}%"></i></span>
<span class="ov-bar-t">${meter([{ pct: (a.applied / most) * 100, cls: 'a' }, { pct: (a.suggested / most) * 100, cls: 's' }], { h: 8 })}</span>
<span class="ov-bar-n"><b>${n(a.applied)}</b>${a.suggested ? html`<span class="muted">+${n(a.suggested)}</span>` : ''}</span>
</div></li>`)}</ul>`
: html`<p class="small muted ov-none">Nothing in this period.</p>`}
+2 -1
View File
@@ -53,6 +53,7 @@ import {
labelTag,
linkBtn,
menu,
meter,
notice,
pageHeader,
pill,
@@ -675,7 +676,7 @@ export function registerTriageRunRoutes(app: FastifyInstance, web: Web): void {
${totals.length
? html`<ul class="bf-bars">${totals.map((t) => html`<li>
<span class="bf-bar-l">${labelTag(t.label)}<span class="xs muted">${t.category}</span></span>
<span class="bf-bar" aria-hidden="true"><i class="sure" style="width:${String((t.sure / most) * 100)}%"></i><i class="unsure" style="width:${String((t.unsure / most) * 100)}%"></i></span>
<span class="bf-bar">${meter([{ pct: (t.sure / most) * 100, cls: 'sure' }, { pct: (t.unsure / most) * 100, cls: 'unsure' }], { h: 10 })}</span>
<span class="bf-bar-n"><b>${n(t.sure)}</b>${t.unsure ? html` <span class="muted">+${n(t.unsure)}</span>` : ''}${t.added ? html` <span class="ok-text" title="Added on GitHub">· ${n(t.added)} added</span>` : ''}</span>
</li>`)}</ul>`
: html`<p class="small muted">${counts.pending ? 'Labels show up here as Claude reads each ticket.' : 'Claude found no labels to add.'}</p>`}
+23
View File
@@ -254,6 +254,29 @@ export function labelTag(name: string): SafeHtml {
return html`<span class="tag label"><span class="dot c${String(c)}"></span>${name}</span>`;
}
/**
* A bar in parts, each a share (0–100) of its length, coloured by its class in app.css. Drawn in SVG:
* the CSP blocks inline widths. A `hatch` part is striped instead, with `meterDefs()` once on the page.
*/
export function meter(parts: { pct: number; cls?: string; hatch?: 'warn' | 'muted' }[], o: { h?: number; title?: string } = {}): SafeHtml {
const h = o.h ?? 6;
const round = parts.length === 1 ? raw(` rx="${String(h / 2)}"`) : '';
let x = 0;
const rects = parts.map((p) => {
const at = x;
const w = Math.max(0, Math.min(100 - at, p.pct));
x += w;
return w ? html`<rect x="${at.toFixed(2)}%" width="${w.toFixed(2)}%" height="${String(h)}"${p.cls ? html` class="${p.cls}"` : ''}${p.hatch ? raw(` fill="url(#mh-${p.hatch})"`) : ''}${round}></rect>` : '';
});
return html`<svg class="meter" width="100%" height="${String(h)}" ${o.title ? html`role="img" aria-label="${o.title}"` : raw('aria-hidden="true"')} focusable="false"><rect class="meter-track" width="100%" height="${String(h)}"></rect>${rects}</svg>`;
}
/** The stripes of `hatch` meter parts. */
export function meterDefs(): SafeHtml {
const stripes = (id: string) => `<pattern id="mh-${id}" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect class="mh-bg ${id}" width="6" height="6"></rect><rect class="mh-fg ${id}" width="2" height="6"></rect></pattern>`;
return raw(`<svg class="meter-defs" width="0" height="0" aria-hidden="true" focusable="false"><defs>${stripes('warn')}${stripes('muted')}</defs></svg>`);
}
/** A Discord role chip; `index` picks a stable color from the role palette. */
export function roleTag(name: string, index: number): SafeHtml {
return html`<span class="tag role"><span class="dot r${String(index % 6)}"></span>@${name}</span>`;
+6 -3
View File
@@ -239,9 +239,12 @@ describe('AI triage › Overview', () => {
expect(res.body).toContain('Labels on open issues');
expect(res.body).toContain('3 open issues');
// Priority, the custom categories with what still has none, and a backfill for them.
expect(res.body).toMatch(/medium<\/a><b>3<\/b>/);
expect(res.body).toContain('<h3 id="ov-g-kind1">Kind</h3>');
expect(res.body).toContain('None yet');
expect(res.body).toMatch(/medium: 3 open issues, 100%/);
expect(res.body).toContain('data-lt-group="g-kind1" open');
expect(res.body).toContain('<span class="lt-gname">Kind</span>');
expect(res.body).toContain('<span class="lt-nolabel warn">None yet</span>');
// Bars are SVG: the CSP blocks inline styles, which drew them empty.
expect(res.body).not.toContain('style="');
expect(res.body).toContain('/triage/runs?what=labels&amp;group=kind1');
expect(res.body).toContain(encodeURIComponent('label:"parity"'));
expect(res.body).toContain('What triage did');