refactor: format markdown files using prettier, fix spelling concerns, reduce Taskfile bloat

This commit is contained in:
sam committed 2026-09-25 01:10:28 +10:00
1 parent 2051ca94d2
commit 2e00777f07
608 files changed
+63317 -10219

No files matched your search

+11 -3
View File
@@ -40,10 +40,18 @@ const when = computed(() => (props.event.at ? ago(props.event.at) : "\u2014"));
@keydown.enter.prevent="open"
@keydown.space.prevent="open"
>
<TableCell class="font-medium">{{ props.event.kind || props.event.type || "event" }}</TableCell>
<TableCell class="font-mono">{{ taskID > 0 ? `#${taskID}` : "—" }}</TableCell>
<TableCell class="font-medium">{{
props.event.kind || props.event.type || "event"
}}</TableCell>
<TableCell class="font-mono">{{
taskID > 0 ? `#${taskID}` : "—"
}}</TableCell>
<TableCell class="w-[55%] max-w-0">
<span class="block truncate" :title="detail.truncated ? detail.full : undefined">{{ detail.text }}</span>
<span
class="block truncate"
:title="detail.truncated ? detail.full : undefined"
>{{ detail.text }}</span
>
</TableCell>
<TableCell>{{ when }}</TableCell>
</TableRow>
+4 -1
View File
@@ -20,7 +20,10 @@ const targets = computed(() => dashboardTaskTargets(tasks.value ?? []));
<Button v-if="targets.attention.count > 0" variant="attention" as-child>
<RouterLink :to="targets.attention.href">
<ListChecks data-icon="inline-start" />
{{ targets.attention.count }} need{{ targets.attention.count === 1 ? "s" : "" }} you
{{ targets.attention.count }} need{{
targets.attention.count === 1 ? "s" : ""
}}
you
</RouterLink>
</Button>
<Button v-if="targets.running.count > 0" variant="outline" as-child>
+6 -2
View File
@@ -12,12 +12,16 @@ function greeting(): string {
return "Good evening";
}
const currentGreeting = computed(() => (setup.value?.operator ? `${greeting()}, ${setup.value.operator}` : greeting()));
const currentGreeting = computed(() =>
setup.value?.operator ? `${greeting()}, ${setup.value.operator}` : greeting(),
);
</script>
<template>
<div class="mb-5 flex flex-wrap items-start justify-between gap-5">
<h1 class="text-3xl font-semibold tracking-[-0.03em]">{{ currentGreeting }}</h1>
<h1 class="text-3xl font-semibold tracking-[-0.03em]">
{{ currentGreeting }}
</h1>
<div class="flex flex-wrap items-center gap-2">
<DashboardActions />
</div>
+16 -4
View File
@@ -17,7 +17,9 @@ import TokenOutlookCard from "./TokenOutlookCard.vue";
*/
useDashboard();
const setupIncomplete = computed(() => setupPanelState(setup.value).kind === "incomplete");
const setupIncomplete = computed(
() => setupPanelState(setup.value).kind === "incomplete",
);
</script>
<template>
@@ -31,19 +33,29 @@ const setupIncomplete = computed(() => setupPanelState(setup.value).kind === "in
<DashboardSection title="Health">
<div
class="grid items-start gap-4"
:class="setupIncomplete ? 'grid-cols-1 min-[1080px]:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)]' : 'grid-cols-1'"
:class="
setupIncomplete
? 'grid-cols-1 min-[1080px]:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)]'
: 'grid-cols-1'
"
>
<SetupPanel />
<GatePulseCard />
</div>
</DashboardSection>
<DashboardSection v-if="summary" title="Throughput" note="Across all repositories">
<DashboardSection
v-if="summary"
title="Throughput"
note="Across all repositories"
>
<ThroughputTiles />
</DashboardSection>
<DashboardSection v-if="summary" title="Right now">
<div class="grid grid-cols-1 gap-4 min-[1080px]:grid-cols-[minmax(0,1fr)_minmax(0,1.5fr)]">
<div
class="grid grid-cols-1 gap-4 min-[1080px]:grid-cols-[minmax(0,1fr)_minmax(0,1.5fr)]"
>
<TokenOutlookCard />
<LiveActivityCard />
</div>
+5 -1
View File
@@ -11,7 +11,11 @@ defineProps<{ title: string; note?: string }>();
<template>
<section class="mb-5">
<div class="mb-3 flex items-baseline gap-3 pl-1">
<h2 class="text-xs font-semibold tracking-[0.08em] text-fg-subtle uppercase">{{ title }}</h2>
<h2
class="text-xs font-semibold tracking-[0.08em] text-fg-subtle uppercase"
>
{{ title }}
</h2>
<span v-if="note" class="text-xs text-fg-subtle">{{ note }}</span>
</div>
<slot />
+23 -6
View File
@@ -11,7 +11,10 @@ const stats = computed(() => workflows.value?.workflows ?? []);
const totals = computed(() => ({
runs: stats.value.reduce((a, w) => a + (w.runs || 0), 0),
merged: stats.value.reduce((a, w) => a + (w.merged || 0) + (w.pr_open || 0), 0),
merged: stats.value.reduce(
(a, w) => a + (w.merged || 0) + (w.pr_open || 0),
0,
),
}));
const pct = computed(() => {
@@ -38,10 +41,14 @@ const pct = computed(() => {
here -- Throughput's Needs-you tile already speaks for them, from
the statuses themselves.
-->
<div class="grid grid-cols-1 gap-6 min-[720px]:grid-cols-[auto_minmax(0,1fr)]">
<div
class="grid grid-cols-1 gap-6 min-[720px]:grid-cols-[auto_minmax(0,1fr)]"
>
<div class="flex flex-col justify-center">
<span class="text-3xl font-semibold">{{ pct }}%</span>
<span class="text-xs text-fg-muted">pass rate · {{ totals.runs }} runs</span>
<span class="text-xs text-fg-muted"
>pass rate · {{ totals.runs }} runs</span
>
</div>
<ul class="flex flex-col">
<li
@@ -49,8 +56,18 @@ const pct = computed(() => {
:key="i"
class="flex items-center justify-between gap-3 border-b border-hairline py-1.5 text-sm last:border-b-0"
>
<span class="truncate text-fg-muted">{{ w.workflow || "workflow" }}</span>
<Badge :variant="(w.merged || 0) === (w.runs || 0) ? 'ok' : (w.parked || 0) > 0 ? 'warn' : 'info'">
<span class="truncate text-fg-muted">{{
w.workflow || "workflow"
}}</span>
<Badge
:variant="
(w.merged || 0) === (w.runs || 0)
? 'ok'
: (w.parked || 0) > 0
? 'warn'
: 'info'
"
>
{{ w.merged || 0 }}/{{ w.runs || 0 }}
</Badge>
</li>
@@ -59,4 +76,4 @@ const pct = computed(() => {
</template>
</CardContent>
</Card>
</template>
</template>
+99 -53
View File
@@ -5,9 +5,22 @@ import { useRouter } from "vue-router";
import { ChevronDown, ChevronRight } from "@lucide/vue";
import { Badge } from "@/components/ui/badge";
import { Card, CardAction, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import {
Card,
CardAction,
CardContent,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { ago } from "@/lib/format";
import { useLiveUpdatesStore } from "@/stores/live-updates";
import ActivityRow from "./ActivityRow.vue";
@@ -23,7 +36,9 @@ import { groupActivity, type ActivityGroup } from "./activity-group";
*/
const router = useRouter();
const { activity, streamKind, streamState } = storeToRefs(useLiveUpdatesStore());
const { activity, streamKind, streamState } = storeToRefs(
useLiveUpdatesStore(),
);
// Expansion is keyed on label:taskID, so a live run stays open as its events
// arrive, and a collapsed group re-collapses only when the run breaks.
@@ -89,67 +104,98 @@ function openTask(taskID: number) {
<TableHead>When</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow v-if="!activity.length">
<TableCell colspan="4">
<Empty>
<EmptyHeader>
<EmptyTitle>Waiting for activity</EmptyTitle>
</EmptyHeader>
</Empty>
</TableCell>
</TableRow>
<template v-if="activity.length">
<template v-for="group in groups" :key="group.key">
<!-- A singleton is exactly the row the raw feed would show. -->
<ActivityRow v-if="group.count === 1" :event="group.representative" @open="openTask" />
<template v-else>
<!--
<TableBody>
<TableRow v-if="!activity.length">
<TableCell colspan="4">
<Empty>
<EmptyHeader>
<EmptyTitle>Waiting for activity</EmptyTitle>
</EmptyHeader>
</Empty>
</TableCell>
</TableRow>
<template v-if="activity.length">
<template v-for="group in groups" :key="group.key">
<!-- A singleton is exactly the row the raw feed would show. -->
<ActivityRow
v-if="group.count === 1"
:event="group.representative"
@open="openTask"
/>
<template v-else>
<!--
The group row keeps ActivityRow's link contract: when its
events resolve to a task, the row itself opens the task,
with the same focusable role="link" behaviour. The
disclosure button is a stop-propagated control inside the
first cell, so it never fights the row-level link.
-->
<TableRow
:class="group.taskID > 0 ? 'cursor-pointer' : ''"
:role="group.taskID > 0 ? 'link' : undefined"
:tabindex="group.taskID > 0 ? 0 : undefined"
:title="group.taskID > 0 ? 'Open task details' : undefined"
@click="group.taskID > 0 && openTask(group.taskID)"
@keydown.enter.prevent="group.taskID > 0 && openTask(group.taskID)"
@keydown.space.prevent="group.taskID > 0 && openTask(group.taskID)"
>
<TableCell class="font-medium">
<button
type="button"
class="inline-flex items-center gap-1 rounded hover:opacity-80"
:aria-expanded="isOpen(group)"
:aria-label="`${isOpen(group) ? 'Hide' : 'Show'} ${group.count} ${group.label} events`"
@click.stop="toggle(group.key)"
>
<ChevronDown v-if="isOpen(group)" class="size-3.5 shrink-0 text-fg-subtle" />
<ChevronRight v-else class="size-3.5 shrink-0 text-fg-subtle" />
{{ group.label }}
<Badge variant="idle">×{{ group.count }}</Badge>
</button>
</TableCell>
<TableCell class="font-mono">{{ group.taskID > 0 ? `#${group.taskID}` : "—" }}</TableCell>
<TableCell class="w-[55%] max-w-0">
<span class="block truncate" :title="groupDetail(group).truncated ? groupDetail(group).full : undefined">{{ groupDetail(group).text }}</span>
</TableCell>
<TableCell>{{ groupWhen(group) }}</TableCell>
</TableRow>
<template v-if="isOpen(group)">
<ActivityRow v-for="(event, i) in group.events" :key="`${group.key}:${i}`" :event="event" @open="openTask" />
<TableRow
:class="group.taskID > 0 ? 'cursor-pointer' : ''"
:role="group.taskID > 0 ? 'link' : undefined"
:tabindex="group.taskID > 0 ? 0 : undefined"
:title="
group.taskID > 0 ? 'Open task details' : undefined
"
@click="group.taskID > 0 && openTask(group.taskID)"
@keydown.enter.prevent="
group.taskID > 0 && openTask(group.taskID)
"
@keydown.space.prevent="
group.taskID > 0 && openTask(group.taskID)
"
>
<TableCell class="font-medium">
<button
type="button"
class="inline-flex items-center gap-1 rounded hover:opacity-80"
:aria-expanded="isOpen(group)"
:aria-label="`${isOpen(group) ? 'Hide' : 'Show'} ${group.count} ${group.label} events`"
@click.stop="toggle(group.key)"
>
<ChevronDown
v-if="isOpen(group)"
class="size-3.5 shrink-0 text-fg-subtle"
/>
<ChevronRight
v-else
class="size-3.5 shrink-0 text-fg-subtle"
/>
{{ group.label }}
<Badge variant="idle">×{{ group.count }}</Badge>
</button>
</TableCell>
<TableCell class="font-mono">{{
group.taskID > 0 ? `#${group.taskID}` : "—"
}}</TableCell>
<TableCell class="w-[55%] max-w-0">
<span
class="block truncate"
:title="
groupDetail(group).truncated
? groupDetail(group).full
: undefined
"
>{{ groupDetail(group).text }}</span
>
</TableCell>
<TableCell>{{ groupWhen(group) }}</TableCell>
</TableRow>
<template v-if="isOpen(group)">
<ActivityRow
v-for="(event, i) in group.events"
:key="`${group.key}:${i}`"
:event="event"
@open="openTask"
/>
</template>
</template>
</template>
</template>
</template>
</TableBody>
</TableBody>
</Table>
</div>
</div>
</CardContent>
</Card>
</template>
</template>
+10 -3
View File
@@ -48,11 +48,18 @@ const pct = computed(() => {
<Check v-if="step.done" class="size-3" />
</span>
<div>
<div class="text-sm" :class="step.done ? 'text-fg-muted line-through' : ''">{{ step.title }}</div>
<div v-if="step.detail" class="mt-0.5 text-xs text-fg-subtle">{{ step.detail }}</div>
<div
class="text-sm"
:class="step.done ? 'text-fg-muted line-through' : ''"
>
{{ step.title }}
</div>
<div v-if="step.detail" class="mt-0.5 text-xs text-fg-subtle">
{{ step.detail }}
</div>
</div>
</li>
</ul>
</CardContent>
</Card>
</template>
</template>
+13 -4
View File
@@ -12,7 +12,9 @@ const counts = computed(() => summary.value?.statuses ?? {});
const tokensByDay = computed(() => summary.value?.tokens_by_day ?? []);
const series = computed(() => tokensByDay.value.map((d) => d.tokens || 0));
const done = computed(() => (counts.value.merged || 0) + (counts.value.pr_open || 0));
const done = computed(
() => (counts.value.merged || 0) + (counts.value.pr_open || 0),
);
// "Needs you" is the server's grouping, not a local pair of ids: it is the
// same attentionStatusIds() source TasksSummary and the needs_you filter read,
// so a status that joins the grouping on the backend is counted here without
@@ -20,11 +22,14 @@ const done = computed(() => (counts.value.merged || 0) + (counts.value.pr_open |
const attention = computed(() => {
const attentionStatuses = attentionStatusIds();
return Object.entries(counts.value).reduce(
(sum, [status, n]) => (attentionStatuses.has(status) ? sum + (n || 0) : sum),
(sum, [status, n]) =>
attentionStatuses.has(status) ? sum + (n || 0) : sum,
0,
);
});
const total = computed(() => Object.values(counts.value).reduce((a, b) => a + b, 0));
const total = computed(() =>
Object.values(counts.value).reduce((a, b) => a + b, 0),
);
const used = computed(() => series.value.reduce((a, b) => a + b, 0));
/**
@@ -59,7 +64,11 @@ function trendPct(values: number[]): number | null {
<StatTile
label="Delivered"
:value="done"
:compare="total ? `${Math.round((done / total) * 100)}% of all tasks` : 'No tasks yet'"
:compare="
total
? `${Math.round((done / total) * 100)}% of all tasks`
: 'No tasks yet'
"
/>
<StatTile
label="Tokens used"
+24 -7
View File
@@ -10,9 +10,15 @@ import { summary } from "./state";
/** What the current rate projects to over the next 30 days. */
const days = computed(() => summary.value?.tokens_by_day ?? []);
const used = computed(() => days.value.reduce((a, d) => a + (d.tokens || 0), 0));
const recent = computed(() => days.value.slice(-7).reduce((a, d) => a + (d.tokens || 0), 0));
const perDay = computed(() => (days.value.length ? used.value / days.value.length : 0));
const used = computed(() =>
days.value.reduce((a, d) => a + (d.tokens || 0), 0),
);
const recent = computed(() =>
days.value.slice(-7).reduce((a, d) => a + (d.tokens || 0), 0),
);
const perDay = computed(() =>
days.value.length ? used.value / days.value.length : 0,
);
const projected = computed(() => Math.round(perDay.value * 30));
</script>
@@ -28,14 +34,25 @@ const projected = computed(() => Math.round(perDay.value * 30));
</EmptyHeader>
</Empty>
<template v-else>
<div class="mb-1 text-3xl font-semibold tracking-[-0.03em]">{{ compact(projected) }}</div>
<div class="mb-1 text-3xl font-semibold tracking-[-0.03em]">
{{ compact(projected) }}
</div>
<div class="mb-4 text-xs text-fg-subtle">
Based on {{ compact(Math.round(perDay)) }} per day over {{ days.length }} days
Based on {{ compact(Math.round(perDay)) }} per day over
{{ days.length }} days
</div>
<SegmentBar
:segments="[
{ label: `Last 7 days (${compact(recent)})`, value: recent, kind: 'info' },
{ label: `Earlier (${compact(used - recent)})`, value: Math.max(used - recent, 0), kind: 'idle' },
{
label: `Last 7 days (${compact(recent)})`,
value: recent,
kind: 'info',
},
{
label: `Earlier (${compact(used - recent)})`,
value: Math.max(used - recent, 0),
kind: 'idle',
},
]"
/>
</template>
+12 -3
View File
@@ -33,13 +33,22 @@ export interface ActivityDetail {
* `text` is the single line the cell renders, `full` the untouched payload,
* and `truncated` whether the two differ.
*/
export function activityDetail(event: ActivityDetailInput | undefined): ActivityDetail {
export function activityDetail(
event: ActivityDetailInput | undefined,
): ActivityDetail {
const full = String(event?.detail || event?.message || "");
if (!full) return { text: "", full: "", truncated: false };
// The first line that says something: agent output often opens with blanks.
const firstLine = full.split("\n").map((line) => line.trim()).find(Boolean) || "";
const clipped = firstLine.length > CELL_LIMIT ? `${firstLine.slice(0, CELL_LIMIT).trimEnd()}…` : firstLine;
const firstLine =
full
.split("\n")
.map((line) => line.trim())
.find(Boolean) || "";
const clipped =
firstLine.length > CELL_LIMIT
? `${firstLine.slice(0, CELL_LIMIT).trimEnd()}…`
: firstLine;
return { text: clipped, full, truncated: clipped !== full };
}
+9 -3
View File
@@ -22,7 +22,6 @@ import { activityDetail } from "./activity-detail.ts";
* every event, and this module decides only how the feed presents them.
*/
/** One displayed row: either a single event (count 1) or a collapsed run. */
export interface ActivityGroup {
/** Stable identity of the run: the grouping key of its first event. */
@@ -55,7 +54,14 @@ export function groupActivity(events: ActivityEvent[]): ActivityGroup[] {
last.events.push(event);
continue;
}
groups.push({ key, label, taskID, count: 1, representative: event, events: [event] });
groups.push({
key,
label,
taskID,
count: 1,
representative: event,
events: [event],
});
}
return groups;
}
}
+4 -2
View File
@@ -19,10 +19,12 @@ export interface SetupPanelState {
// setupPanelState distinguishes the only two states worth rendering: there is
// setup work left (the checklist), or there is not (nothing — a configured
// daemon is the absence of a problem, not a card announcing it).
export function setupPanelState(setup: Setup | null | undefined): SetupPanelState {
export function setupPanelState(
setup: Setup | null | undefined,
): SetupPanelState {
const remaining = (setup?.steps ?? []).filter((step) => !step.done);
if (!setup?.steps?.length || !remaining.length) {
return { kind: "omit", remaining: [] };
}
return { kind: "incomplete", remaining };
}
}
+15 -8
View File
@@ -58,16 +58,20 @@ export const taskIDsBySource = ref(new Map<string, number>());
export async function loadDashboard(): Promise<void> {
error.value = null;
try {
const [nextSummary, nextSetup, nextWorkflows, nextTasks] = await Promise.all([
api.summary<Summary>(),
api.setup<Setup>().catch(() => null),
api.workflows<{ workflows?: WorkflowStat[] }>().catch(() => null),
api.tasks<DashboardTask[]>().catch(() => []),
]);
const [nextSummary, nextSetup, nextWorkflows, nextTasks] =
await Promise.all([
api.summary<Summary>(),
api.setup<Setup>().catch(() => null),
api.workflows<{ workflows?: WorkflowStat[] }>().catch(() => null),
api.tasks<DashboardTask[]>().catch(() => []),
]);
const map = new Map<string, number>();
for (const task of nextTasks) {
if (task.owner && task.repo && task.issue_number) {
map.set(`${task.owner}/${task.repo}#${task.issue_number}`, Number(task.id));
map.set(
`${task.owner}/${task.repo}#${task.issue_number}`,
Number(task.id),
);
}
}
taskIDsBySource.value = map;
@@ -80,7 +84,10 @@ export async function loadDashboard(): Promise<void> {
}
}
export function taskIDForEvent(event: ActivityEvent, bySource: Map<string, number>): number {
export function taskIDForEvent(
event: ActivityEvent,
bySource: Map<string, number>,
): number {
if (Number(event.task_id) > 0) return Number(event.task_id);
if (!event.repo || !event.issue) return 0;
return Number(bySource.get(`${event.repo}#${event.issue}`)) || 0;
+3 -1
View File
@@ -19,7 +19,9 @@ export interface TaskTargets {
// History routing means a hash is not a route any more, so one that survived
// here would navigate nowhere.
export function dashboardTaskTargets(tasks: TaskTarget[] = []): TaskTargets {
const attention = tasks.filter((task) => ATTENTION_STATUSES.has(task.status ?? ""));
const attention = tasks.filter((task) =>
ATTENTION_STATUSES.has(task.status ?? ""),
);
const running = tasks.filter((task) => task.status === "running");
return {
attention: {