Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
feat(web): rebuild the Overview page around sections instead of cards (#1114)
Raghav Chamadiya5463e64b89bc
diff --git a/packages/server/src/repowise/server/routers/overview.py b/packages/server/src/repowise/server/routers/overview.pyindex 10aede542..78c6624cd 100644--- a/packages/server/src/repowise/server/routers/overview.py+++ b/packages/server/src/repowise/server/routers/overview.py@@ -9,6 +9,7 @@ decisions slice, savings headline, and health KPIs.from __future__ import annotations+import configparserimport contextlibimport jsonimport sqlite3@@ -50,6 +51,68 @@ def _index_storage_bytes(repowise_dir: Path) -> int:return total+def _remote_url(stored_url: str | None, local_path: str | None) -> str | None:+ """Best-effort git remote for a repo.++ ``repositories.url`` is client-supplied and empty for most CLI-registered+ repos, so fall back to reading ``origin`` out of ``.git/config``. Parsed+ rather than shelled out to: this runs on a page load, and ``git remote+ get-url`` would cost a process spawn per request for a string sitting in a+ file we can read.++ Used only to resolve a repo avatar, so every failure path returns ``None``+ and the UI falls back to initials.+ """+ if stored_url:+ return stored_url+ if not local_path:+ return None++ git_path = Path(local_path) / ".git"+ # Worktrees and submodules use a `.git` FILE holding `gitdir: <path>`; the+ # config lives in the main checkout, so follow the pointer before reading.+ if git_path.is_file():+ try:+ pointer = git_path.read_text(encoding="utf-8").strip()+ except OSError:+ return None+ if not pointer.startswith("gitdir:"):+ return None+ resolved = Path(pointer.split(":", 1)[1].strip())+ if not resolved.is_absolute():+ resolved = (Path(local_path) / resolved).resolve()+ # A worktree's gitdir is `<main>/.git/worktrees/<name>`; config is two+ # levels up. Fall back to the pointed-at dir for the submodule case.+ git_path = resolved.parent.parent if resolved.parent.name == "worktrees" else resolved++ config_path = git_path / "config"+ if not config_path.is_file():+ return None++ # Both flags are load-bearing, not defensive boilerplate:+ #+ # strict=False — git tolerates duplicate keys and writes them routinely. A+ # remote with two `fetch` refspecs is normal, and VS Code writes+ # `vscode-merge-base` twice under a branch section. Strict parsing raises+ # DuplicateOptionError on both, which would mean this project's own+ # checkout never resolves a remote.+ #+ # interpolation=None — ConfigParser expands `%` at get() time, so a+ # perfectly valid remote like `https://user%[email protected]/...`+ # raises InterpolationSyntaxError. Left on, that exception escapes the+ # endpoint and turns the whole Overview into a 404 in order to render an+ # avatar.+ parser = configparser.ConfigParser(strict=False, interpolation=None)+ try:+ parser.read(config_path, encoding="utf-8")+ for section in ('remote "origin"', 'remote "upstream"'):+ if parser.has_option(section, "url"):+ return parser.get(section, "url").strip() or None+ except (OSError, configparser.Error):+ return None+ return None++def _decision_slim(d: Any) -> dict:return {"id": d.id,@@ -214,6 +277,30 @@ async def overview_summary(total_pages = (await session.scalar(select(func.count(Page.id)).where(Page.repository_id == repo_id)) or 0)+ # Pages a model actually wrote, as opposed to the ones assembled from the+ # index alone. The discriminator is the provider: "template" is the stub+ # writer, so anything else means a real generation call produced the prose.+ #+ # Deliberately NOT additionally scoped to MODEL_WRITTEN_PAGE_TYPES. That+ # narrower query looks more principled and is a lie in practice: file and+ # symbol pages do get generated with a real provider on some runs, so+ # scoping by type puts model-written pages in the "assembled from the index"+ # bucket. Asking the question the honest way — did a model write this page —+ # needs no page-type carve-out, and the answer stays true whatever the+ # generator does next.+ #+ # Note a stubbed page (a provider call that failed and fell back) counts as+ # not-prose, which is correct: it has no prose.+ prose_pages = (+ await session.scalar(+ select(func.count(Page.id)).where(+ Page.repository_id == repo_id,+ Page.provider_name.is_not(None),+ Page.provider_name != "template",+ )+ )+ or 0+ )fresh_pages = (await session.scalar(select(func.count(Page.id)).where(@@ -446,12 +533,14 @@ async def overview_summary("default_branch": repo.default_branch,"head_commit": indexed_commit,"updated_at": repo.updated_at.isoformat() if repo.updated_at else None,+ "remote_url": _remote_url(repo.url, repo.local_path),},"stats": {"file_count": file_count,"symbol_count": symbol_count,"entry_point_count": entry_point_count,"doc_page_count": total_pages,+ "doc_prose_page_count": prose_pages,"doc_coverage_pct": doc_coverage_pct,"freshness_score": freshness_score,"dead_export_count": dead_export_count,diff --git a/packages/types/src/overview.ts b/packages/types/src/overview.tsindex 9f32d8b6f..79ae0188a 100644--- a/packages/types/src/overview.ts+++ b/packages/types/src/overview.ts@@ -22,6 +22,10 @@ export interface OverviewRepoMeta {/** Whether the repo is publicly browsable. Hosted-only; drives the* public/private connect copy. Defaults to public when absent. */is_public?: boolean;+ /** Git remote, from the stored repo URL or `.git/config`'s origin. Used+ * only to resolve a repo avatar, so a null (no remote, or a host we do not+ * recognise) simply falls back to initials. */+ remote_url?: string | null;}export interface OverviewStatDeltas {@@ -40,6 +44,15 @@ export interface OverviewStats {* backend deploy — treat absent as unknown rather than rendering NaN.*/doc_page_count?: number;+ /**+ * Of `doc_page_count`, how many carry model-written prose rather than being+ * assembled deterministically from the index. The two are different products+ * — deterministic pages are free and always current, prose pages cost a model+ * call and can go stale — so the Overview reports them separately instead of+ * behind one total. Optional: a server predating the field omits it, and the+ * UI then shows the flat total rather than inventing a split.+ */+ doc_prose_page_count?: number;doc_coverage_pct: number;freshness_score: number;dead_export_count: number;diff --git a/packages/ui/__tests__/overview/repo-avatar.test.tsx b/packages/ui/__tests__/overview/repo-avatar.test.tsxnew file mode 100644index 000000000..5f32e550e--- /dev/null+++ b/packages/ui/__tests__/overview/repo-avatar.test.tsx@@ -0,0 +1,63 @@+import { render } from "@testing-library/react";+import { describe, expect, it } from "vitest";+import { RepoAvatar, githubOwnerFromRemote } from "../../src/overview/repo-avatar.js";++describe("githubOwnerFromRemote", () => {+ it("reads the owner out of every remote form git actually writes", () => {+ expect(githubOwnerFromRemote("https://github.com/repowise-dev/repowise.git")).toBe(+ "repowise-dev",+ );+ expect(githubOwnerFromRemote("https://github.com/repowise-dev/repowise")).toBe(+ "repowise-dev",+ );+ expect(githubOwnerFromRemote("[email protected]:repowise-dev/repowise.git")).toBe(+ "repowise-dev",+ );+ expect(githubOwnerFromRemote("ssh://[email protected]/repowise-dev/repowise.git")).toBe(+ "repowise-dev",+ );+ expect(githubOwnerFromRemote("https://[email protected]/repowise-dev/repowise")).toBe(+ "repowise-dev",+ );+ });++ it("returns null for hosts whose avatars we cannot resolve", () => {+ // Not a rejection of these hosts — just an honest "we have no image", which+ // is the signal to render initials rather than request a URL that 404s.+ expect(githubOwnerFromRemote("https://gitlab.com/group/project.git")).toBeNull();+ expect(githubOwnerFromRemote("[email protected]:team/repo.git")).toBeNull();+ expect(githubOwnerFromRemote("https://github.com/repowise-dev")).toBeNull();+ expect(githubOwnerFromRemote("")).toBeNull();+ expect(githubOwnerFromRemote(null)).toBeNull();+ expect(githubOwnerFromRemote(undefined)).toBeNull();+ });+});++describe("RepoAvatar", () => {+ it("makes no network request when the repo has no GitHub remote", () => {+ // The point of the guard: a local-first install should not call github.com+ // just because a page rendered.+ const { container } = render(<RepoAvatar name="my-repo" remoteUrl={null} />);++ expect(container.querySelector("img")).toBeNull();+ expect(container.textContent).toBe("MY");+ });++ it("layers the avatar over initials rather than swapping on error", () => {+ // The fallback must survive with JavaScript disabled, because this sits at+ // the top of a server-rendered page. Both layers are always in the markup.+ const { container } = render(+ <RepoAvatar name="repowise" remoteUrl="[email protected]:repowise-dev/repowise.git" />,+ );++ const img = container.querySelector("img");+ expect(img?.getAttribute("src")).toContain("avatars.githubusercontent.com/repowise-dev");+ expect(container.textContent).toBe("RE");+ });++ it("degrades to a placeholder for a name with no alphanumerics", () => {+ const { container } = render(<RepoAvatar name="---" />);++ expect(container.textContent).toBe("?");+ });+});diff --git a/packages/ui/package.json b/packages/ui/package.jsonindex 7c5826620..31eea2114 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -59,9 +59,12 @@"./chat": "./src/chat/index.ts","./chat/*": "./src/chat/*.tsx","./dashboard": "./src/dashboard/index.ts",+ "./dashboard/attention-href": "./src/dashboard/attention-href.ts","./dashboard/*": "./src/dashboard/*.tsx","./stats": "./src/stats/index.ts","./stats/*": "./src/stats/*.tsx",+ "./overview": "./src/overview/index.ts",+ "./overview/*": "./src/overview/*.tsx","./workspace": "./src/workspace/index.ts","./workspace/system-map": "./src/workspace/system-map/index.ts","./workspace/dsm": "./src/workspace/dsm/index.ts",diff --git a/packages/ui/src/dashboard/attention-href.ts b/packages/ui/src/dashboard/attention-href.tsnew file mode 100644index 000000000..6da4f7add--- /dev/null+++ b/packages/ui/src/dashboard/attention-href.ts@@ -0,0 +1,58 @@+import { fileEntityPath } from "../shared/entity/routes";++export type AttentionItemType =+ | "stale_decision"+ | "knowledge_silo"+ | "ungoverned_hotspot"+ | "dead_code"+ | "proposed_decision";++export interface AttentionItem {+ id: string;+ type: AttentionItemType;+ title: string;+ description: string;+ severity: "high" | "medium" | "low";+ /** What the item points at — a decision id, file path, owner, … Used to+ * deep-link straight to the offending entity. */+ target_id?: string;+ href?: string;+}++/**+ * Where an attention item points.+ *+ * Lives in a plain module rather than beside the panel that renders it,+ * because two surfaces need it and only one of them is a client component.+ * Importing it from `attention-panel` worked at compile time and failed at+ * runtime with "attempted to call getDefaultHref() from the server but+ * getDefaultHref is on the client" — a `"use client"` file exports components+ * to the server, not callable functions.+ *+ * Kept in one place because each branch is a per-type routing decision (a silo+ * wants the owners view filtered to its path, an ungoverned hotspot wants the+ * file page), so a second caller re-deriving them by hand gets most of them+ * wrong.+ */+export function getDefaultHref(item: AttentionItem, prefix: string): string {+ const target = item.target_id;+ switch (item.type) {+ case "stale_decision":+ case "proposed_decision":+ // Deep-link to the specific decision when we know which one.+ return target+ ? `${prefix}/decisions/${encodeURIComponent(target)}`+ : `${prefix}/decisions`;+ case "knowledge_silo":+ // The silo target is the owning module/path — surface it on the owners+ // view so the offending area is preselected.+ return target ? `${prefix}/owners?path=${encodeURIComponent(target)}` : `${prefix}/owners`;+ case "ungoverned_hotspot":+ // Target is the hotspot's file path → open its file entity page.+ return target ? fileEntityPath(prefix, target) : `${prefix}/code-health?tab=hotspots`;+ case "dead_code":+ return `${prefix}/code-health?tab=dead-code`;+ default:+ return prefix;+ }+}diff --git a/packages/ui/src/dashboard/attention-panel.tsx b/packages/ui/src/dashboard/attention-panel.tsxindex a36cd8515..4dabfa4ea 100644--- a/packages/ui/src/dashboard/attention-panel.tsx+++ b/packages/ui/src/dashboard/attention-panel.tsx@@ -18,24 +18,13 @@ import { AiPromptButton } from "../health/ai-prompt-button";import { AiPromptModal } from "../health/ai-prompt-modal";import { buildWorkQueueAiPrompt } from "../health/ai-prompt-builder";-export type AttentionItemType =- | "stale_decision"- | "knowledge_silo"- | "ungoverned_hotspot"- | "dead_code"- | "proposed_decision";--export interface AttentionItem {- id: string;- type: AttentionItemType;- title: string;- description: string;- severity: "high" | "medium" | "low";- /** What the item points at — a decision id, file path, owner, … Used to- * deep-link straight to the offending entity. */- target_id?: string;- href?: string;-}+// Re-exported so existing importers of this module keep working; the+// definitions live in a plain module because server components need them too+// and a `"use client"` file cannot hand a callable function to the server.+export { getDefaultHref } from "./attention-href";+export type { AttentionItem, AttentionItemType } from "./attention-href";+import { getDefaultHref } from "./attention-href";+import type { AttentionItem, AttentionItemType } from "./attention-href";const ICON_MAP = {stale_decision: AlertTriangle,@@ -109,31 +98,6 @@ function diversifyByType(items: AttentionItem[], count: number): AttentionItem[]return out;}-function getDefaultHref(item: AttentionItem, prefix: string): string {- const target = item.target_id;- switch (item.type) {- case "stale_decision":- case "proposed_decision":- // Deep-link to the specific decision when we know which one.- return target- ? `${prefix}/decisions/${encodeURIComponent(target)}`- : `${prefix}/decisions`;- case "knowledge_silo":- // The silo target is the owning module/path — surface it on the owners- // view so the offending area is preselected.- return target- ? `${prefix}/owners?path=${encodeURIComponent(target)}`- : `${prefix}/owners`;- case "ungoverned_hotspot":- // Target is the hotspot's file path → open its file entity page.- return target ? fileEntityPath(prefix, target) : `${prefix}/code-health?tab=hotspots`;- case "dead_code":- return `${prefix}/code-health?tab=dead-code`;- default:- return prefix;- }-}-export function AttentionPanel({items,repoId,diff --git a/packages/ui/src/dashboard/quick-actions.tsx b/packages/ui/src/dashboard/quick-actions.tsxindex bf320d92f..854320d67 100644--- a/packages/ui/src/dashboard/quick-actions.tsx+++ b/packages/ui/src/dashboard/quick-actions.tsx@@ -1,8 +1,9 @@-"use client";+"use client";import { useMemo, useState, type ReactNode, type ComponentType } from "react";-import { RefreshCw, Trash2, AlertTriangle, Zap } from "lucide-react";+import { RefreshCw, Trash2, AlertTriangle, Zap, MoreHorizontal } from "lucide-react";import { Button } from "../ui/button";+import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";import {Dialog,DialogContent,@@ -84,7 +85,7 @@ export const DEFAULT_QUICK_ACTIONS: QuickActionDef[] = [{key: "sync",label: "Sync",- description: "Update everything — only affected pages regenerated",+ description: "Update everything — only affected pages regenerated",icon: Zap,destructive: false,needsConfirm: true,@@ -120,7 +121,7 @@ export interface QuickActionsProps {actions?: QuickActionDef[];/** Bag of mutation callbacks; the shell calls the matching key. */onAction: (key: QuickActionKey) => Promise<void> | void;- /** Disabled / loading flag for a specific action. Optional — if omitted the+ /** Disabled / loading flag for a specific action. Optional — if omitted the* shell tracks its own optimistic loading state. */loadingKey?: QuickActionKey | null;/** ISO datetimes for the timestamp footer. */@@ -129,9 +130,19 @@ export interface QuickActionsProps {/** Inputs for the cost-estimate panel inside the confirm dialog. */pageCount?: number;modelName?: string;- /** When provided, replaces the buttons with the given node — typically a+ /** When provided, replaces the buttons with the given node — typically a* rendered job-progress widget. Wrapper decides what to pass. */activeJobSlot?: ReactNode;+ /**+ * `row` (default) renders every action as an equal outline button above a+ * timestamp footer. `header` renders the first action as the one primary+ * button and folds the rest into an overflow menu, dropping the footer.+ *+ * The distinction is editorial, not cosmetic: sync is an everyday action,+ * while full re-index and dead-code scan are maintenance. Giving all three+ * the same weight made the destructive one as easy to hit as the safe one.+ */+ variant?: "row" | "header";}export function QuickActions({@@ -143,9 +154,11 @@ export function QuickActions({pageCount = 0,modelName = "",activeJobSlot,+ variant = "row",}: QuickActionsProps) {const [internalLoading, setInternalLoading] = useState<QuickActionKey | null>(null);const [pendingAction, setPendingAction] = useState<QuickActionDef | null>(null);+ const [menuOpen, setMenuOpen] = useState(false);const loading = loadingKey !== undefined ? loadingKey : internalLoading;const estimate = useMemo(() => {@@ -177,6 +190,161 @@ export function QuickActions({return <div className="mb-2">{activeJobSlot}</div>;}+ // Shared by both variants: the confirm step (and its cost estimate) is the+ // safety rail, so it must not depend on which button shape triggered it.+ const confirmDialog = (+ <Dialog open={pendingAction !== null} onOpenChange={(open) => !open && setPendingAction(null)}>+ {pendingAction && (+ <DialogContent className="sm:max-w-sm">+ <DialogHeader>+ <DialogTitle className="flex items-center gap-2">+ {pendingAction.destructive && (+ <AlertTriangle className="h-4 w-4 text-[var(--color-warning)]" />+ )}+ {pendingAction.confirmTitle}+ </DialogTitle>+ <DialogDescription>{pendingAction.confirmDescription}</DialogDescription>+ </DialogHeader>++ {estimate && estimate.cost > 0 && (+ <div className="rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-inset)] p-3 space-y-2">+ <p className="text-xs font-medium text-[var(--color-text-secondary)] uppercase tracking-wider">+ Estimated Cost+ </p>+ <div className="grid grid-cols-3 gap-2 text-center">+ <div>+ <p className="text-sm font-semibold text-[var(--color-text-primary)] tabular-nums">+ {formatNumber(+ pendingAction.key === "sync"+ ? Math.max(1, Math.ceil(pageCount * 0.1))+ : pageCount,+ )}+ </p>+ <p className="text-[10px] text-[var(--color-text-tertiary)]">pages</p>+ </div>+ <div>+ <p className="text-sm font-semibold text-[var(--color-text-primary)] tabular-nums">+ {formatNumber(estimate.inputTokens + estimate.outputTokens)}+ </p>+ <p className="text-[10px] text-[var(--color-text-tertiary)]">tokens</p>+ </div>+ <div>+ <p className="text-sm font-semibold text-[var(--color-accent-primary)] tabular-nums">+ ~{formatCost(estimate.cost)}+ </p>+ <p className="text-[10px] text-[var(--color-text-tertiary)]">+ {modelName || "est."}+ </p>+ </div>+ </div>+ {estimate.cost < 0.01 && (+ <p className="text-[10px] text-[var(--color-text-tertiary)] text-center">+ Free or near-free with this model+ </p>+ )}+ </div>+ )}++ {estimate && estimate.cost === 0 && (+ <div className="rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-inset)] p-3">+ <p className="text-xs text-[var(--color-success)] text-center">+ No API cost — running locally via Ollama+ </p>+ </div>+ )}++ <DialogFooter>+ <Button variant="ghost" size="sm" onClick={() => setPendingAction(null)}>+ Cancel+ </Button>+ <Button+ variant={pendingAction.destructive ? "destructive" : "default"}+ size="sm"+ onClick={() => execute(pendingAction)}+ >+ {pendingAction.label}+ </Button>+ </DialogFooter>+ </DialogContent>+ )}+ </Dialog>+ );++ if (variant === "header") {+ const [primary, ...rest] = actions;+ if (!primary) return null;+ const PrimaryIcon = primary.icon;+ return (+ <>+ <div className="flex items-center gap-2">+ <Button+ size="sm"+ className="h-8 gap-1.5 text-xs"+ disabled={loading !== null}+ onClick={() => handleClick(primary)}+ >+ <PrimaryIcon+ className={`h-3.5 w-3.5 ${loading === primary.key ? "animate-spin" : ""}`}+ />+ {primary.label}+ </Button>+ {rest.length > 0 && (+ // Controlled rather than uncontrolled: picking an item opens the+ // confirm dialog, and an uncontrolled popover stays mounted behind+ // the modal and reappears when the dialog is dismissed.+ <Popover open={menuOpen} onOpenChange={setMenuOpen}>+ <PopoverTrigger asChild>+ <Button+ variant="outline"+ size="sm"+ className="h-8 w-8 p-0"+ disabled={loading !== null}+ aria-label="More actions"+ >+ <MoreHorizontal className="h-4 w-4" />+ </Button>+ </PopoverTrigger>+ <PopoverContent align="end" className="w-64 p-1">+ {rest.map((action) => {+ const Icon = action.icon;+ return (+ <button+ key={action.key}+ type="button"+ disabled={loading !== null}+ onClick={() => {+ setMenuOpen(false);+ handleClick(action);+ }}+ className="flex w-full items-start gap-2.5 rounded-md px-2.5 py-2 text-left transition-colors hover:bg-[var(--color-bg-elevated)] disabled:opacity-50"+ >+ <Icon+ className={`mt-0.5 h-3.5 w-3.5 shrink-0 ${+ action.destructive+ ? "text-[var(--color-warning)]"+ : "text-[var(--color-text-tertiary)]"+ } ${loading === action.key ? "animate-spin" : ""}`}+ />+ <span className="min-w-0">+ <span className="block text-xs font-medium text-[var(--color-text-primary)]">+ {action.label}+ </span>+ <span className="block text-[11px] leading-snug text-[var(--color-text-tertiary)]">+ {action.description}+ </span>+ </span>+ </button>+ );+ })}+ </PopoverContent>+ </Popover>+ )}+ </div>+ {confirmDialog}+ </>+ );+ }+return (<><div className="space-y-1.5">@@ -214,85 +382,7 @@ export function QuickActions({</span></div></div>-- <Dialog- open={pendingAction !== null}- onOpenChange={(open) => !open && setPendingAction(null)}- >- {pendingAction && (- <DialogContent className="sm:max-w-sm">- <DialogHeader>- <DialogTitle className="flex items-center gap-2">- {pendingAction.destructive && (- <AlertTriangle className="h-4 w-4 text-[var(--color-warning)]" />- )}- {pendingAction.confirmTitle}- </DialogTitle>- <DialogDescription>{pendingAction.confirmDescription}</DialogDescription>- </DialogHeader>-- {estimate && estimate.cost > 0 && (- <div className="rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-inset)] p-3 space-y-2">- <p className="text-xs font-medium text-[var(--color-text-secondary)] uppercase tracking-wider">- Estimated Cost- </p>- <div className="grid grid-cols-3 gap-2 text-center">- <div>- <p className="text-sm font-semibold text-[var(--color-text-primary)] tabular-nums">- {formatNumber(- pendingAction.key === "sync"- ? Math.max(1, Math.ceil(pageCount * 0.1))- : pageCount,- )}- </p>- <p className="text-[10px] text-[var(--color-text-tertiary)]">pages</p>- </div>- <div>- <p className="text-sm font-semibold text-[var(--color-text-primary)] tabular-nums">- {formatNumber(estimate.inputTokens + estimate.outputTokens)}- </p>- <p className="text-[10px] text-[var(--color-text-tertiary)]">tokens</p>- </div>- <div>- <p className="text-sm font-semibold text-[var(--color-accent-primary)] tabular-nums">- ~{formatCost(estimate.cost)}- </p>- <p className="text-[10px] text-[var(--color-text-tertiary)]">- {modelName || "est."}- </p>- </div>- </div>- {estimate.cost < 0.01 && (- <p className="text-[10px] text-[var(--color-text-tertiary)] text-center">- Free or near-free with this model- </p>- )}- </div>- )}-- {estimate && estimate.cost === 0 && (- <div className="rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-inset)] p-3">- <p className="text-xs text-[var(--color-success)] text-center">- No API cost — running locally via Ollama- </p>- </div>- )}-- <DialogFooter>- <Button variant="ghost" size="sm" onClick={() => setPendingAction(null)}>- Cancel- </Button>- <Button- variant={pendingAction.destructive ? "destructive" : "default"}- size="sm"- onClick={() => execute(pendingAction)}- >- {pendingAction.label}- </Button>- </DialogFooter>- </DialogContent>- )}- </Dialog>+ {confirmDialog}</>);}diff --git a/packages/ui/src/overview/activity-lists.tsx b/packages/ui/src/overview/activity-lists.tsxnew file mode 100644index 000000000..4f4afb8e6--- /dev/null+++ b/packages/ui/src/overview/activity-lists.tsx@@ -0,0 +1,123 @@+import * as React from "react";+import { formatRelativeTime, stripMarkdown } from "../lib/format";++export interface CommitRow {+ sha: string;+ short_sha: string;+ subject: string;+ author_name: string;+ committed_at: string | null;+}++export interface DecisionRow {+ id: string;+ title: string;+ status: string;+ created_at: string | null;+}++const STATUS_COLOR: Record<string, string> = {+ active: "var(--color-success)",+ proposed: "var(--color-info)",+ deprecated: "var(--color-error)",+ superseded: "var(--color-text-tertiary)",+};++/**+ * Recent commits as hairline rows rather than a card.+ *+ * Same content the card version showed; the difference is that it sits in the+ * page's own rhythm instead of introducing a box, and the subject line gets+ * the full column width so it stops truncating at a card's inner padding.+ */+export function CommitRows({+ commits,+ hrefFor,+ LinkComponent,+}: {+ commits: CommitRow[];+ hrefFor: (sha: string) => string;+ LinkComponent?: React.ElementType;+}) {+ const A = LinkComponent ?? "a";+ if (commits.length === 0) {+ return (+ <p className="text-xs text-[var(--color-text-tertiary)]">No commits indexed yet.</p>+ );+ }++ return (+ <ul className="m-0 list-none divide-y divide-[var(--color-border-default)] border-t border-[var(--color-border-default)] p-0">+ {commits.map((c) => (+ <li key={c.sha}>+ <A+ href={hrefFor(c.sha)}+ className="group flex items-baseline gap-2.5 py-2 text-xs no-underline"+ >+ <span className="shrink-0 font-mono text-[10px] text-[var(--color-accent-primary)]">+ {c.short_sha}+ </span>+ <span className="min-w-0 flex-1 truncate text-[var(--color-text-secondary)] group-hover:text-[var(--color-text-primary)]">+ {c.subject}+ </span>+ {c.committed_at && (+ <span+ className="shrink-0 font-mono text-[10px] text-[var(--color-text-tertiary)]"+ title={`${c.author_name} · ${new Date(c.committed_at).toLocaleString()}`}+ >+ {formatRelativeTime(c.committed_at)}+ </span>+ )}+ </A>+ </li>+ ))}+ </ul>+ );+}++/** Recent decisions as hairline rows, with the status carried by a dot and a+ * word rather than a badge — badges at this size are chrome, not signal. */+export function DecisionRows({+ decisions,+ hrefFor,+ LinkComponent,+}: {+ decisions: DecisionRow[];+ hrefFor: (id: string) => string;+ LinkComponent?: React.ElementType;+}) {+ const A = LinkComponent ?? "a";+ if (decisions.length === 0) {+ return (+ <p className="text-xs text-[var(--color-text-tertiary)]">+ No decisions extracted yet.+ </p>+ );+ }++ return (+ <ul className="m-0 list-none divide-y divide-[var(--color-border-default)] border-t border-[var(--color-border-default)] p-0">+ {decisions.map((d) => (+ <li key={d.id}>+ <A+ href={hrefFor(d.id)}+ className="group flex items-baseline gap-2.5 py-2 text-xs no-underline"+ >+ <span+ aria-hidden+ className="mt-1 h-1.5 w-1.5 shrink-0 rounded-full"+ style={{ background: STATUS_COLOR[d.status] ?? "var(--color-text-tertiary)" }}+ />+ <span className="min-w-0 flex-1 truncate text-[var(--color-text-secondary)] group-hover:text-[var(--color-text-primary)]">+ {stripMarkdown(d.title)}+ </span>+ <span className="shrink-0 font-mono text-[10px] text-[var(--color-text-tertiary)]">+ {d.status}+ {d.created_at ? ` · ${formatRelativeTime(d.created_at)}` : ""}+ </span>+ </A>+ </li>+ ))}+ </ul>+ );+}diff --git a/packages/ui/src/overview/attention-rows.tsx b/packages/ui/src/overview/attention-rows.tsxnew file mode 100644index 000000000..789d0eada--- /dev/null+++ b/packages/ui/src/overview/attention-rows.tsx@@ -0,0 +1,104 @@+import * as React from "react";+import type { AttentionItem } from "../dashboard/attention-href";++/** Same item the panel renders. Deliberately not a parallel local type: the+ * two surfaces must resolve identical targets, and a looser `type: string`+ * here would silently accept a value `getDefaultHref` cannot route. */+export type AttentionRowItem = AttentionItem;++const TYPE_LABEL: Record<string, string> = {+ stale_decision: "Stale decision",+ proposed_decision: "Proposed",+ ungoverned_hotspot: "Ungoverned",+ knowledge_silo: "Knowledge silo",+ dead_code: "Dead code",+};++const SEVERITY_COLOR: Record<string, string> = {+ high: "var(--color-error)",+ medium: "var(--color-warning)",+ low: "var(--color-text-tertiary)",+};++/**+ * Triage items as full-width rows.+ *+ * Replaces a 320px rail panel whose titles truncated mid-word — "Cap additional+ * same-family single-byte encodings after defin…" is a layout bug reported as+ * content. Given the whole column, the title fits and the item is readable+ * without a hover.+ *+ * Kept deliberately plain: what belongs in this list is a content question+ * (README.md and a marketplace manifest are not worth a person's attention),+ * and that is being worked separately. This component only fixes the shape.+ */+export function AttentionRows({+ items,+ hrefFor,+ LinkComponent,+}: {+ items: AttentionRowItem[];+ /** Resolves an item to its target page; null renders the row unlinked. */+ hrefFor: (item: AttentionRowItem) => string | null;+ LinkComponent?: React.ElementType;+}) {+ const A = LinkComponent ?? "a";+ if (items.length === 0) {+ return (+ <p className="text-xs text-[var(--color-success)]">+ Nothing needs attention right now.+ </p>+ );+ }++ return (+ <ul className="m-0 list-none divide-y divide-[var(--color-border-default)] border-t border-[var(--color-border-default)] p-0">+ {items.map((item) => {+ const href = hrefFor(item);+ const body = (+ <>+ <span className="flex shrink-0 items-center gap-1.5 sm:w-32">+ <span+ aria-hidden+ className="h-1.5 w-1.5 shrink-0 rounded-full"+ style={{ background: SEVERITY_COLOR[item.severity] ?? "var(--color-text-tertiary)" }}+ />+ {/* Severity is carried by the dot's colour, which is nothing at+ all to a screen reader (and to anyone who cannot separate the+ three hues). The text equivalent goes here rather than into a+ `title`, which assistive tech reads inconsistently. */}+ <span className="sr-only">{item.severity} severity. </span>+ <span className="font-mono text-[9.5px] uppercase tracking-[0.1em] text-[var(--color-text-tertiary)]">+ {TYPE_LABEL[item.type] ?? item.type}+ </span>+ </span>+ <span className="min-w-0 flex-1">+ <span className="block text-[var(--color-text-primary)] [text-wrap:pretty]">+ {item.title}+ </span>+ <span className="mt-0.5 block text-[11px] text-[var(--color-text-tertiary)] [text-wrap:pretty]">+ {item.description}+ </span>+ </span>+ </>+ );+ return (+ <li key={item.id}>+ {href ? (+ <A+ href={href}+ className="group flex flex-col gap-1 py-2.5 text-xs no-underline sm:flex-row sm:items-baseline sm:gap-3"+ >+ {body}+ </A>+ ) : (+ <div className="flex flex-col gap-1 py-2.5 text-xs sm:flex-row sm:items-baseline sm:gap-3">+ {body}+ </div>+ )}+ </li>+ );+ })}+ </ul>+ );+}diff --git a/packages/ui/src/overview/change-line.tsx b/packages/ui/src/overview/change-line.tsxnew file mode 100644index 000000000..12008e240--- /dev/null+++ b/packages/ui/src/overview/change-line.tsx@@ -0,0 +1,59 @@+import * as React from "react";+import { formatRelativeTime } from "../lib/format";++export interface ChangeStat {+ /** Pre-formatted figure, e.g. "8" or "10+". */+ value: string;+ /** Words after the figure, e.g. "commits". */+ label: string;+}++export interface ChangeLineProps {+ /**+ * ISO timestamp of the PREVIOUS index snapshot — the point the figures are+ * measured against, not the latest one.+ */+ since: string | null;+ stats: ChangeStat[];+}++/**+ * What moved between the last two indexes.+ *+ * This is the block the public repo landing page structurally cannot show:+ * that page serves a stranger arriving once, while this serves someone who was+ * here yesterday. Without it the local Overview is a slower copy of a page OSS+ * users cannot even reach.+ *+ * Measured against snapshots rather than against the last sync *timestamp*,+ * which is the version that does not work: a commit only appears in the index+ * once a sync has ingested it, and that same sync stamps `last_sync_at`, so+ * "commits newer than the last sync" is zero by construction. Decisions are+ * worse — they are created *by* the sync run. Snapshot deltas are the figures+ * that actually change.+ *+ * Renders nothing without two snapshots to compare, or when nothing moved: an+ * all-zeroes strip is noise pretending to be news.+ */+export function ChangeLine({ since, stats }: ChangeLineProps) {+ if (!since || stats.length === 0) return null;++ return (+ <div className="flex flex-wrap items-baseline gap-x-4 gap-y-1 border-y border-[var(--color-border-default)] py-2.5 text-xs text-[var(--color-text-secondary)]">+ <span+ className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]"+ title={new Date(since).toLocaleString()}+ >+ Since the previous index, {formatRelativeTime(since)}+ </span>+ {stats.map((s) => (+ <span key={s.label}>+ <span className="font-mono font-semibold tabular-nums text-[var(--color-text-primary)]">+ {s.value}+ </span>{" "}+ {s.label}+ </span>+ ))}+ </div>+ );+}diff --git a/packages/ui/src/overview/explore-list.tsx b/packages/ui/src/overview/explore-list.tsxnew file mode 100644index 000000000..f0e78e045--- /dev/null+++ b/packages/ui/src/overview/explore-list.tsx@@ -0,0 +1,72 @@+import * as React from "react";++export interface ExploreEntry {+ key: string;+ label: string;+ /** What is actually there, ideally with a live figure. "5,520 pages across+ * 115 modules" beats "Documentation for your code". */+ description: string;+ href: string;+ /** Small qualifier after the label, e.g. "Pro" or "beta". */+ tag?: string;+}++/**+ * Front doors to the pages that own each subject.+ *+ * Replaces four equal-sized cards that were four different species: a donut, a+ * marketing blurb with no data in it, a data list, and a text input. A link+ * list scans faster, survives any number of entries, and does not imply that a+ * blurb and a chart are the same kind of thing.+ *+ * Each row carries a real figure rather than a description of the feature,+ * which makes the list double as a second, quieter set of statistics.+ */+export function ExploreList({+ entries,+ LinkComponent,+}: {+ entries: ExploreEntry[];+ LinkComponent?: React.ElementType;+}) {+ const A = LinkComponent ?? "a";+ if (entries.length === 0) return null;++ return (+ <ul className="m-0 list-none divide-y divide-[var(--color-border-default)] border-y border-[var(--color-border-default)] p-0">+ {entries.map((e) => (+ <li key={e.key}>+ <A+ href={e.href}+ className="group flex flex-col gap-0.5 py-2.5 text-xs no-underline transition-colors hover:bg-[var(--color-bg-elevated)] sm:flex-row sm:items-baseline sm:gap-4"+ >+ <span className="flex shrink-0 items-center gap-2 sm:w-44">+ {/* The label carries the accent at rest, not only on hover. A row+ whose only affordance is a hover state reads as a table, and+ on touch there is no hover at all — the whole list would look+ like static data. Accent is this system's link colour, so this+ is the convention rather than an exception to it. */}+ <span className="font-medium text-[var(--color-accent-primary)] group-hover:underline">+ {e.label}+ </span>+ {e.tag && (+ <span className="rounded-full bg-[var(--color-bg-inset)] px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-wider text-[var(--color-text-tertiary)]">+ {e.tag}+ </span>+ )}+ </span>+ <span className="min-w-0 flex-1 text-[var(--color-text-secondary)] [text-wrap:pretty]">+ {e.description}+ </span>+ <span+ aria-hidden+ className="hidden shrink-0 self-center text-[var(--color-text-tertiary)] transition-transform group-hover:translate-x-0.5 group-hover:text-[var(--color-accent-primary)] sm:block"+ >+ →+ </span>+ </A>+ </li>+ ))}+ </ul>+ );+}diff --git a/packages/ui/src/overview/health-lede.tsx b/packages/ui/src/overview/health-lede.tsxnew file mode 100644index 000000000..d8de012ad--- /dev/null+++ b/packages/ui/src/overview/health-lede.tsx@@ -0,0 +1,144 @@+import * as React from "react";++export interface HealthLedeProps {+ /** Defect-risk headline, 1–10. Null until the first health run. */+ score: number | null;+ maintainability?: number | null;+ /** Static performance risk, 1–10. */+ performance?: number | null;+ /** Health of the highest-churn files. The interesting number, usually. */+ hotspotHealth?: number | null;+ hotspotCount?: number;+ fileCount?: number;+ /** "Full health report →" target. */+ href: string;+ LinkComponent?: React.ElementType;+}++/** 1–10 bands. Shared with HealthOverviewCard's thresholds on purpose: two+ * surfaces disagreeing about what "Good" means is worse than duplication. */+export function healthBand(v: number): { color: string; label: string } {+ if (v >= 8) return { color: "var(--color-success)", label: "Excellent" };+ if (v >= 6.5) return { color: "var(--color-success)", label: "Good" };+ if (v >= 5) return { color: "var(--color-caution)", label: "Fair" };+ if (v >= 3.5) return { color: "var(--color-warning)", label: "Needs work" };+ return { color: "var(--color-error)", label: "Critical" };+}++/**+ * Code health as a headline number and a plain sentence, not a card of tiles.+ *+ * The figure alone is not readable: "329 risks · 9.9/10" looks like a+ * contradiction until something says the score is a bounded summary of the+ * findings rather than a count of them. So the prose is load-bearing, not+ * decoration — it is the part that makes the number mean anything, and it is+ * why the public repo landing page reads calm while showing the same data.+ *+ * Health keeps the largest number on the page because it is the product's+ * moat. It does not get the whole top of the page: the column beside it+ * carries the other reasons people open Overview.+ */+export function HealthLede({+ score,+ maintainability,+ performance,+ hotspotHealth,+ hotspotCount = 0,+ fileCount = 0,+ href,+ LinkComponent,+}: HealthLedeProps) {+ const A = LinkComponent ?? "a";++ if (score == null) {+ return (+ <div className="flex flex-col gap-2">+ <p className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">+ Code health+ </p>+ <p className="max-w-[54ch] text-sm text-[var(--color-text-secondary)]">+ Health scores land with the first index: complexity, duplication, coverage,+ churn and ownership across every file.+ </p>+ </div>+ );+ }++ const band = healthBand(score);+ const hot = hotspotHealth != null ? healthBand(hotspotHealth) : null;++ // Assembled rather than interpolated inline: a repo can have measured one+ // pillar and not the other, and the naive version produced "Maintainability+ // scores 8.6. The three are scored separately" (there were two) or a sentence+ // starting lowercase when only performance was present.+ const pillars: string[] = [];+ if (maintainability != null) pillars.push(`maintainability ${maintainability.toFixed(1)}`);+ if (performance != null) pillars.push(`static performance risk ${performance.toFixed(1)}`);+ const pillarSentence =+ pillars.length === 0+ ? null+ : `It also scores ${pillars.join(" and ")} out of 10. ${+ pillars.length === 1+ ? "The two are scored separately and never blended into one number."+ : "The three are scored separately and never blended into one number."+ }`;++ return (+ <div className="flex flex-col">+ <p className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">+ Code health+ </p>++ <div className="mt-2.5 flex flex-wrap items-baseline gap-x-3 gap-y-1">+ <span+ className="text-[44px] font-semibold leading-none tracking-tight tabular-nums sm:text-5xl"+ style={{ color: band.color }}+ >+ {score.toFixed(1)}+ </span>+ <span className="text-xs text-[var(--color-text-tertiary)]">out of 10</span>+ <span+ className="rounded-full border px-2.5 py-0.5 text-[11px] font-medium"+ style={{+ color: band.color,+ borderColor: `color-mix(in srgb, ${band.color} 40%, transparent)`,+ background: `color-mix(in srgb, ${band.color} 9%, transparent)`,+ }}+ >+ {band.label}+ </span>+ </div>++ <p className="mt-3.5 max-w-[54ch] text-[13px] leading-relaxed text-[var(--color-text-secondary)] [text-wrap:pretty]">+ This codebase scores{" "}+ <strong className="font-semibold text-[var(--color-text-primary)]">+ {score.toFixed(1)} out of 10+ </strong>{" "}+ on defect risk, which we rate {band.label.toLowerCase()}.+ {pillarSentence && ` ${pillarSentence}`}+ {hotspotCount > 0 && hot && (+ <>+ {" "}+ The files you change most are the weak spot:{" "}+ <strong className="font-semibold text-[var(--color-text-primary)]">+ {hotspotCount.toLocaleString()}+ {fileCount > 0 ? ` of ${fileCount.toLocaleString()}` : ""} files+ </strong>{" "}+ are git hotspots, and they average{" "}+ <strong className="font-semibold" style={{ color: hot.color }}>+ {hotspotHealth!.toFixed(1)}+ </strong>+ .+ </>+ )}+ </p>++ <A+ href={href}+ className="mt-4 inline-flex w-fit items-center gap-1 text-sm font-medium text-[var(--color-accent-primary)] hover:underline"+ >+ Full health report <span aria-hidden>→</span>+ </A>+ </div>+ );+}diff --git a/packages/ui/src/overview/hotspot-table.tsx b/packages/ui/src/overview/hotspot-table.tsxnew file mode 100644index 000000000..802edf961--- /dev/null+++ b/packages/ui/src/overview/hotspot-table.tsx@@ -0,0 +1,114 @@+import * as React from "react";+import type { Hotspot } from "@repowise-dev/types/git";++function fileName(path: string): string {+ const i = path.lastIndexOf("/");+ return i === -1 ? path : path.slice(i + 1);+}++function fileDir(path: string): string {+ const i = path.lastIndexOf("/");+ return i === -1 ? "" : path.slice(0, i);+}++/**+ * Where the risk concentrates, as a table rather than a mini card.+ *+ * The card this replaces rendered a churn bar per file that read "100%" for+ * every row, which is no information at all. The columns here are the ones+ * that actually rank a file: prior fixes and change frequency mined from full+ * git history, plus how many people maintain it.+ *+ * Placed mid-page, not at the top. On the public landing page this table is+ * the proof that the product does something git-history-shaped, and a stranger+ * needs that proof up front. On your own repo it barely moves week to week, so+ * it is reference material — but it stays, because OSS users have no other+ * surface where this is ever shown.+ */+export function HotspotTable({+ hotspots,+ hrefFor,+ LinkComponent,+}: {+ hotspots: Hotspot[];+ /** Builds the per-file link. Callers differ on route shape, so it is a fn. */+ hrefFor: (path: string) => string;+ LinkComponent?: React.ElementType;+}) {+ const A = LinkComponent ?? "a";+ if (hotspots.length === 0) return null;++ return (+ // Horizontal scroll is scoped to the table so the page body never scrolls+ // sideways on a phone; the negative margin lets it bleed to the edge there.+ <div className="-mx-[var(--page-pad)] overflow-x-auto px-[var(--page-pad)] sm:mx-0 sm:px-0">+ <table className="w-full min-w-[560px] border-collapse text-xs">+ <thead>+ <tr className="border-b border-[var(--color-border-default)] text-left font-mono text-[9.5px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">+ <th scope="col" className="pb-2 pr-4 font-medium">File</th>+ <th scope="col" className="pb-2 pr-4 font-medium">Churn</th>+ <th scope="col" className="pb-2 pr-4 font-medium">Prior fixes</th>+ <th scope="col" className="pb-2 pr-4 font-medium">Maintainers</th>+ <th scope="col" className="pb-2 text-right font-medium">Commits 90d</th>+ </tr>+ </thead>+ <tbody>+ {hotspots.map((h) => {+ const dir = fileDir(h.file_path);+ return (+ <tr+ key={h.file_path}+ className="border-b border-[var(--color-border-default)] align-top last:border-b-0"+ >+ <td className="py-2.5 pr-4">+ <A+ href={hrefFor(h.file_path)}+ className="group block min-w-0 no-underline"+ >+ <span className="block font-medium text-[var(--color-text-primary)] group-hover:text-[var(--color-accent-primary)]">+ {fileName(h.file_path)}+ </span>+ {dir && (+ <span className="mt-0.5 block break-all font-mono text-[10px] text-[var(--color-text-tertiary)]">+ {dir}+ </span>+ )}+ </A>+ </td>+ <td className="py-2.5 pr-4 font-mono tabular-nums text-[var(--color-text-secondary)]">+ {h.churn_percentile != null ? (+ <>+ {h.churn_percentile.toFixed(1)}+ <span className="text-[var(--color-text-tertiary)]">th</span>+ </>+ ) : (+ <span className="text-[var(--color-text-tertiary)]">—</span>+ )}+ </td>+ <td className="py-2.5 pr-4 font-mono tabular-nums text-[var(--color-text-secondary)]">+ {h.prior_defect_count ?? 0}+ {h.bug_magnet && (+ <span className="ml-1.5 whitespace-nowrap rounded-full border border-[color-mix(in_srgb,var(--color-error)_35%,transparent)] bg-[color-mix(in_srgb,var(--color-error)_8%,transparent)] px-1.5 py-0.5 font-sans text-[9.5px] font-medium text-[var(--color-error)]">+ bug magnet+ </span>+ )}+ </td>+ <td className="py-2.5 pr-4 font-mono tabular-nums text-[var(--color-text-secondary)]">+ {h.contributor_count ?? 0}+ {h.bus_factor === 1 && (+ <span className="mt-0.5 block whitespace-nowrap font-sans text-[10px] text-[var(--color-warning)]">+ bus factor 1+ </span>+ )}+ </td>+ <td className="py-2.5 text-right font-mono tabular-nums text-[var(--color-text-secondary)]">+ {h.commit_count_90d ?? 0}+ </td>+ </tr>+ );+ })}+ </tbody>+ </table>+ </div>+ );+}diff --git a/packages/ui/src/overview/index.ts b/packages/ui/src/overview/index.tsnew file mode 100644index 000000000..36d5eb7ae--- /dev/null+++ b/packages/ui/src/overview/index.ts@@ -0,0 +1,40 @@+/**+ * Overview page vocabulary.+ *+ * A small set of section-shaped primitives, kept here rather than in the web+ * app so downstream consumers get them unchanged.+ *+ * The rules they encode: group with hairlines and vertical rhythm instead of+ * cards, spend colour on one accent plus the health bands and nothing else,+ * keep a wide type scale so hierarchy does not depend on borders, and put a+ * sentence next to every figure — a number with no frame is not information.+ */++export { OverviewSection, SectionLink } from "./section";+export type { OverviewSectionProps } from "./section";++export { RepoIdentityHeader } from "./repo-identity-header";+export type { RepoIdentityHeaderProps, RepoIdentityMeta } from "./repo-identity-header";++export { RepoAvatar, githubOwnerFromRemote } from "./repo-avatar";+export type { RepoAvatarProps } from "./repo-avatar";++export { HealthLede, healthBand } from "./health-lede";+export type { HealthLedeProps } from "./health-lede";++export { ReadsColumn } from "./reads-column";+export type { ReadItem, ReadBarSegment } from "./reads-column";++export { ChangeLine } from "./change-line";+export type { ChangeLineProps, ChangeStat } from "./change-line";++export { CommitRows, DecisionRows } from "./activity-lists";+export type { CommitRow, DecisionRow } from "./activity-lists";++export { AttentionRows } from "./attention-rows";+export type { AttentionRowItem } from "./attention-rows";++export { HotspotTable } from "./hotspot-table";+export { ExploreList } from "./explore-list";+export type { ExploreEntry } from "./explore-list";+export { LanguageBar } from "./language-bar";diff --git a/packages/ui/src/overview/language-bar.tsx b/packages/ui/src/overview/language-bar.tsxnew file mode 100644index 000000000..3cd3d0cb1--- /dev/null+++ b/packages/ui/src/overview/language-bar.tsx@@ -0,0 +1,74 @@+import * as React from "react";++/**+ * Language mix as a stacked bar plus a key.+ *+ * Replaces a donut that spent roughly 200px of height rendering four numbers+ * you can read faster as text, and did it in four unrelated hues that fought+ * every other colour on the page. The bar is one accent stepped down in+ * lightness, so proportion still reads at a glance without introducing a+ * second palette.+ */+export function LanguageBar({+ distribution,+ maxShown = 5,+}: {+ /** language → file count. */+ distribution: Record<string, number>;+ maxShown?: number;+}) {+ const entries = Object.entries(distribution)+ .filter(([, n]) => n > 0)+ .sort((a, b) => b[1] - a[1]);+ const total = entries.reduce((s, [, n]) => s + n, 0);+ if (total === 0) return null;++ const shown = entries.slice(0, maxShown);+ const restCount = entries.slice(maxShown).reduce((s, [, n]) => s + n, 0);+ const segments: { name: string; count: number; color: string }[] = shown.map(+ ([name, count], i) => ({+ name,+ count,+ // Step the accent down toward the inset surface rather than reaching for+ // new hues: proportion is the message, identity of each language is the+ // key's job.+ color:+ i === 0+ ? "var(--color-accent-fill)"+ : `color-mix(in srgb, var(--color-accent-fill) ${Math.max(12, 70 - i * 16)}%, var(--color-bg-inset))`,+ }),+ );+ if (restCount > 0) {+ segments.push({ name: "Other", count: restCount, color: "var(--color-bg-inset)" });+ }++ return (+ <div className="flex flex-col gap-2.5">+ <div className="flex h-1.5 w-full overflow-hidden rounded-full bg-[var(--color-bg-inset)]">+ {segments.map((s) => (+ <span+ key={s.name}+ title={`${s.name}: ${s.count.toLocaleString()} files`}+ className="h-full"+ style={{ width: `${(s.count / total) * 100}%`, background: s.color }}+ />+ ))}+ </div>+ <div className="flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px] text-[var(--color-text-tertiary)]">+ {segments.map((s) => (+ <span key={s.name} className="inline-flex items-center">+ <span+ aria-hidden+ className="mr-1.5 inline-block h-1.5 w-1.5 rounded-sm"+ style={{ background: s.color }}+ />+ {s.name}{" "}+ <span className="ml-1 tabular-nums text-[var(--color-text-secondary)]">+ {Math.round((s.count / total) * 100)}%+ </span>+ </span>+ ))}+ </div>+ </div>+ );+}diff --git a/packages/ui/src/overview/reads-column.tsx b/packages/ui/src/overview/reads-column.tsxnew file mode 100644index 000000000..d0c3924e0--- /dev/null+++ b/packages/ui/src/overview/reads-column.tsx@@ -0,0 +1,109 @@+import * as React from "react";++export interface ReadBarSegment {+ /** Share of the whole, 0–1. */+ fraction: number;+ /** CSS colour. Keep to accent tints so the bar stays inside the one-accent+ * rule; semantic red/amber/green belong to health, not to proportions. */+ color: string;+ /** Tooltip text for this segment. */+ title: string;+}++export interface ReadItem {+ key: string;+ label: string;+ value: string;+ /** Trailing unit or secondary figure, rendered small and quiet. */+ unit?: string;+ /** One line saying what the number means. Not optional in spirit: a figure+ * with no frame is the thing this whole redesign is fixing. */+ why: string;+ href: string;+ /** Optional proportion bar — use only when the number genuinely splits. */+ bar?: ReadBarSegment[];+}++/**+ * The other reasons people open Overview, beside the health hero.+ *+ * Code health is the product's moat and keeps the biggest number, but it+ * cannot be the only reason to visit: someone here for documentation+ * coverage, for what their agent has been costing, or for index freshness+ * should find their figure at the top of the page rather than three scrolls+ * down or buried in a footer. Same altitude, smaller type.+ *+ * Every row is a link, so this column doubles as navigation for the people who+ * did not come for health.+ *+ * Portability: the caller supplies the list. Hosted has no local `.repowise/`+ * directory and therefore no index-storage figure, so it composes the same+ * component with that row simply absent — no flag, no dead branch. Same for+ * agent savings, which come from a CLI-written sidecar.+ */+export function ReadsColumn({+ items,+ LinkComponent,+}: {+ items: ReadItem[];+ LinkComponent?: React.ElementType;+}) {+ const A = LinkComponent ?? "a";+ if (items.length === 0) return null;++ return (+ <div className="flex flex-col">+ {items.map((item, i) => (+ <A+ key={item.key}+ href={item.href}+ className={`group block border-[var(--color-border-default)] py-3.5 ${+ i === 0 ? "pt-0" : ""+ } ${i === items.length - 1 ? "pb-0" : "border-b"}`}+ >+ {/* Label above, figure below, both flush left — the same stacking as+ a StatRibbon cell. The earlier version put the label left and the+ value right on one baseline, which looks tidy in a mockup and is+ ragged with real data: a trailing unit shifts every number to a+ different x, so four figures in a column line up on nothing. */}+ <span className="block font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">+ {item.label}+ </span>+ <span className="mt-1 flex items-baseline gap-1.5">+ {/* A step below the scale ribbon's figures, deliberately. These are+ secondary reads in a narrow column, and at the ribbon's size+ they out-shouted both it and the health prose beside them. */}+ <span className="text-lg font-semibold leading-none tracking-tight tabular-nums text-[var(--color-text-primary)] transition-colors group-hover:text-[var(--color-accent-primary)]">+ {item.value}+ </span>+ {item.unit && (+ <span className="text-[11px] font-medium text-[var(--color-text-tertiary)]">+ {item.unit}+ </span>+ )}+ </span>++ {item.bar && item.bar.length > 0 && (+ <span className="mt-2 flex h-1 w-full overflow-hidden rounded-full bg-[var(--color-bg-inset)]">+ {item.bar.map((seg, si) => (+ <span+ key={si}+ title={seg.title}+ className="h-full"+ style={{+ width: `${Math.max(0, Math.min(1, seg.fraction)) * 100}%`,+ background: seg.color,+ }}+ />+ ))}+ </span>+ )}++ <span className="mt-1.5 block text-[11px] leading-relaxed text-[var(--color-text-tertiary)] [text-wrap:pretty]">+ {item.why}+ </span>+ </A>+ ))}+ </div>+ );+}diff --git a/packages/ui/src/overview/repo-avatar.tsx b/packages/ui/src/overview/repo-avatar.tsxnew file mode 100644index 000000000..9c061e189--- /dev/null+++ b/packages/ui/src/overview/repo-avatar.tsx@@ -0,0 +1,80 @@+import * as React from "react";++/**+ * Parses the owner (GitHub user or org) out of a git remote URL.+ *+ * Handles the three forms a remote actually takes: HTTPS, SSH scp-style, and+ * `ssh://`. Returns null for anything that is not GitHub, which is the signal+ * to render initials instead of reaching for an avatar that does not exist.+ */+export function githubOwnerFromRemote(remote: string | null | undefined): string | null {+ if (!remote) return null;+ const trimmed = remote.trim().replace(/\.git$/, "");+ const patterns = [+ /^https?:\/\/(?:[^@]+@)?github\.com\/([^/]+)\/[^/]+$/i,+ /^git@github\.com:([^/]+)\/[^/]+$/i,+ /^ssh:\/\/git@github\.com\/([^/]+)\/[^/]+$/i,+ ];+ for (const re of patterns) {+ const m = trimmed.match(re);+ if (m?.[1]) return m[1];+ }+ return null;+}++export interface RepoAvatarProps {+ /** Repo name, for the initials fallback. */+ name: string;+ /** Git remote, if the repo has one. Only GitHub remotes resolve to a real+ * avatar; everything else renders initials and touches no network. */+ remoteUrl?: string | null | undefined;+ size?: number;+ className?: string;+}++/**+ * Repo mark for the identity header.+ *+ * A server component on purpose. The obvious implementation swaps in a+ * fallback from an `onError` handler, but that needs `useState` and therefore+ * a client boundary at the very top of the page — the one place where a+ * hydration boundary costs the most, on a page that must stream fast and be+ * indexable. So the initials sit *underneath* the image instead: if the avatar+ * 404s, an `alt=""` image paints nothing and the layer beneath shows through.+ * No JavaScript, no boundary, same outcome.+ *+ * Also conservative about the network: a local install should not call+ * github.com just because a page rendered. The request only happens when the+ * repo actually has a GitHub remote recorded.+ */+export function RepoAvatar({ name, remoteUrl, size = 40, className }: RepoAvatarProps) {+ const owner = githubOwnerFromRemote(remoteUrl);+ const initials = name.replace(/[^a-zA-Z0-9]/g, "").slice(0, 2).toUpperCase() || "?";++ return (+ <span+ aria-hidden+ className={`relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-xl border border-[var(--color-border-default)] bg-[var(--color-accent-muted)] ${className ?? ""}`}+ style={{ width: size, height: size }}+ >+ <span+ className="font-semibold leading-none text-[var(--color-accent-primary)]"+ style={{ fontSize: Math.max(11, Math.floor(size / 2.8)) }}+ >+ {initials}+ </span>+ {owner && (+ <img+ src={`https://avatars.githubusercontent.com/${encodeURIComponent(owner)}?size=${size * 2}`}+ alt=""+ width={size}+ height={size}+ loading="lazy"+ decoding="async"+ referrerPolicy="no-referrer"+ className="absolute inset-0 h-full w-full object-cover"+ />+ )}+ </span>+ );+}diff --git a/packages/ui/src/overview/repo-identity-header.tsx b/packages/ui/src/overview/repo-identity-header.tsxnew file mode 100644index 000000000..d2eb97fd1--- /dev/null+++ b/packages/ui/src/overview/repo-identity-header.tsx@@ -0,0 +1,92 @@+import * as React from "react";+import { RepoAvatar } from "./repo-avatar";++export interface RepoIdentityMeta {+ /** Short label, e.g. "main", "ab13c4e", "419.6K lines". */+ label: string;+ /** Renders an accent dot before the label — used for the primary language. */+ dot?: boolean;+ /** Native tooltip, e.g. the absolute timestamp behind "synced 1 day ago". */+ title?: string;+ /** Renders monospaced. Use for machine-produced values: SHAs, counts, paths. */+ mono?: boolean;+}++export interface RepoIdentityHeaderProps {+ name: string;+ /** Owner segment, rendered in front of the name in a quieter weight.+ * Hosted has one; the OSS CLI usually does not, so it is optional. */+ owner?: string | null;+ /** One or two sentences about the repo. This is the whole orientation job+ * for a first-time visitor, which matters because OSS users never see the+ * public repo landing page — this page is the only description they get. */+ description?: string | null;+ /** Git remote, used only to resolve a GitHub avatar. */+ remoteUrl?: string | null;+ meta?: RepoIdentityMeta[];+ /** Primary action plus an overflow trigger. One everyday action, not three+ * equal buttons: sync is navigation, re-index is maintenance. */+ actions?: React.ReactNode;+}++/**+ * Repo identity band at the top of the Overview.+ *+ * Replaces PageShell's generic title/description header on this page only,+ * because Overview's header carries real content (mark, owner, description,+ * language, freshness) rather than a label. It still renders exactly one `h1`,+ * so the page keeps a single subject.+ */+export function RepoIdentityHeader({+ name,+ owner,+ description,+ remoteUrl,+ meta = [],+ actions,+}: RepoIdentityHeaderProps) {+ return (+ <header className="flex flex-col gap-4 sm:flex-row sm:items-start sm:gap-4">+ <RepoAvatar name={name} remoteUrl={remoteUrl} size={40} className="hidden sm:inline-flex" />+ <div className="min-w-0 flex-1">+ <div className="flex items-center gap-3">+ <RepoAvatar name={name} remoteUrl={remoteUrl} size={32} className="sm:hidden" />+ <h1 className="min-w-0 text-xl font-semibold tracking-tight text-[var(--color-text-primary)] sm:text-2xl">+ {owner && (+ <span className="font-normal text-[var(--color-text-tertiary)]">{owner} / </span>+ )}+ <span className="[overflow-wrap:anywhere]">{name}</span>+ </h1>+ </div>+ {description && (+ // `overflow-wrap:anywhere` because callers pass a filesystem path+ // here, and a path is one unbreakable token: without it a long+ // absolute path overflows on a phone and takes the page body with it.+ <p className="mt-1.5 max-w-[64ch] text-sm text-[var(--color-text-secondary)] [overflow-wrap:anywhere] [text-wrap:pretty]">+ {description}+ </p>+ )}+ {meta.length > 0 && (+ <div className="mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[11px] text-[var(--color-text-tertiary)]">+ {meta.map((m) => (+ <span+ key={m.label}+ title={m.title}+ className={`inline-flex items-center ${m.mono ? "font-mono tabular-nums" : ""}`}+ >+ {m.dot && (+ <span+ aria-hidden+ className="mr-1.5 inline-block h-1.5 w-1.5 rounded-full bg-[var(--color-accent-fill)]"+ />+ )}+ {m.label}+ </span>+ ))}+ </div>+ )}+ </div>+ {actions && <div className="flex shrink-0 items-center gap-2">{actions}</div>}+ </header>+ );+}diff --git a/packages/ui/src/overview/section.tsx b/packages/ui/src/overview/section.tsxnew file mode 100644index 000000000..1d75c2d99--- /dev/null+++ b/packages/ui/src/overview/section.tsx@@ -0,0 +1,82 @@+import * as React from "react";+import { cn } from "../lib/cn";++export interface OverviewSectionProps {+ title: string;+ /** One line under the title. Use it to say what the numbers mean, not what+ * the section is called again. */+ description?: string;+ /** Right-aligned jump into the page that owns this subject. */+ action?: React.ReactNode;+ /** Drop the top hairline — for the first section under a header that already+ * closes with one. */+ flush?: boolean;+ className?: string;+ children: React.ReactNode;+}++/**+ * The page's only grouping device.+ *+ * The Overview used to be ~13 bordered cards at near-identical weight, which+ * reads as box soup: every block claims the same importance, so none of them+ * lands. A card should mean "discrete object you can act on"; a statistic is+ * not that. Here a hairline plus vertical rhythm carries the grouping at a+ * fraction of the ink, which is what the public repo landing page does and why+ * that page reads calm at higher density than this one.+ *+ * Deliberately not a `<Card>` wrapper with the border switched off: the whole+ * point is that there is no box to configure.+ */+export function OverviewSection({+ title,+ description,+ action,+ flush = false,+ className,+ children,+}: OverviewSectionProps) {+ return (+ <section+ className={cn(+ "flex flex-col gap-3",+ !flush && "border-t border-[var(--color-border-default)] pt-6 sm:pt-8",+ className,+ )}+ >+ <div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1">+ <h2 className="text-base font-semibold tracking-tight text-[var(--color-text-primary)]">+ {title}+ </h2>+ {action}+ </div>+ {description && (+ <p className="max-w-[62ch] text-xs leading-relaxed text-[var(--color-text-tertiary)] [text-wrap:pretty]">+ {description}+ </p>+ )}+ {children}+ </section>+ );+}++/** The standard "go to the page that owns this" link. */+export function SectionLink({+ href,+ children,+ LinkComponent,+}: {+ href: string;+ children: React.ReactNode;+ LinkComponent?: React.ElementType;+}) {+ const A = LinkComponent ?? "a";+ return (+ <A+ href={href}+ className="whitespace-nowrap text-xs font-medium text-[var(--color-accent-primary)] hover:underline"+ >+ {children} <span aria-hidden>→</span>+ </A>+ );+}diff --git a/packages/ui/src/stats/stat-ribbon.tsx b/packages/ui/src/stats/stat-ribbon.tsxindex 0ca6b37a9..ee8c93e0e 100644--- a/packages/ui/src/stats/stat-ribbon.tsx+++ b/packages/ui/src/stats/stat-ribbon.tsx@@ -4,6 +4,10 @@ export interface RibbonStat {label: string;value: string;hint?: string;+ /** Optional jump to the page that owns this figure. Added because the+ * Overview replaced a strip of *linked* KPI tiles with this component, and+ * without it Files and Symbols lost their only entry point from that page. */+ href?: string;}/**@@ -17,9 +21,17 @@ export interface RibbonStat {* Rendered as a `<dl>` because that is what it is — labelled values, not a* layout grid.*/-export function StatRibbon({ stats }: { stats: RibbonStat[] }) {+export function StatRibbon({+ stats,+ LinkComponent,+}: {+ stats: RibbonStat[];+ /** Router link for `href` entries; defaults to a plain anchor. */+ LinkComponent?: React.ElementType;+}) {const shown = stats.filter((s) => s.value);if (shown.length === 0) return null;+ const A = LinkComponent ?? "a";return (<dl className="grid grid-cols-2 border-y border-[var(--color-border-default)] sm:grid-cols-3 lg:grid-cols-5">@@ -28,7 +40,7 @@ export function StatRibbon({ stats }: { stats: RibbonStat[] }) {key={s.label}title={s.hint}className={[- "px-4 py-3.5",+ s.href ? "" : "px-4 py-3.5",s.hint ? "cursor-help" : "",// Hairlines between cells only — the outer edges come from the// wrapper's border-y, so cells never double up on the boundary.@@ -44,12 +56,31 @@ export function StatRibbon({ stats }: { stats: RibbonStat[] }) {.filter(Boolean).join(" ")}>- <dt className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">- {s.label}- </dt>- <dd className="mt-1 text-xl font-semibold tabular-nums text-[var(--color-text-primary)]">- {s.value}- </dd>+ {s.href ? (+ // The link wraps the whole cell rather than the value, so the+ // padding is part of the hit target instead of a dead margin+ // around it.+ <A+ href={s.href}+ className="group block px-4 py-3.5 no-underline transition-colors hover:bg-[var(--color-bg-elevated)]"+ >+ <dt className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">+ {s.label}+ </dt>+ <dd className="mt-1 text-xl font-semibold tabular-nums text-[var(--color-text-primary)] group-hover:text-[var(--color-accent-primary)]">+ {s.value}+ </dd>+ </A>+ ) : (+ <>+ <dt className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">+ {s.label}+ </dt>+ <dd className="mt-1 text-xl font-semibold tabular-nums text-[var(--color-text-primary)]">+ {s.value}+ </dd>+ </>+ )}</div>))}</dl>diff --git a/packages/web/src/app/repos/[id]/overview/loading.tsx b/packages/web/src/app/repos/[id]/overview/loading.tsxindex b20b5f4db..c84f3eb8b 100644--- a/packages/web/src/app/repos/[id]/overview/loading.tsx+++ b/packages/web/src/app/repos/[id]/overview/loading.tsx@@ -1,32 +1,52 @@import { Skeleton } from "@repowise-dev/ui/ui/skeleton";-/** Progressive skeleton mirroring the Overview layout — header, attention- * strip, stat strip, tab area. (The owl stays reserved for brand moments.) */+/**+ * Skeleton mirroring the Overview layout — identity header, change line,+ * health lede beside its reads column, scale ribbon, then sections.+ *+ * Shapes and widths track the real page deliberately: a skeleton that does not+ * match causes a visible reflow the moment content lands, which reads as+ * slower than showing nothing. (The owl stays reserved for brand moments.)+ */export default function OverviewLoading() {return (- <div className="p-4 sm:p-6 space-y-6 max-w-[1600px]">- <div className="space-y-3">- <div className="flex items-center gap-3">- <Skeleton className="h-7 w-48" />- <Skeleton className="h-5 w-16" />- <Skeleton className="h-7 w-40 rounded-full" />+ <div className="mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-[var(--page-pad)] sm:gap-8">+ {/* Identity header: mark, title, description, meta row */}+ <div className="flex gap-4">+ <Skeleton className="h-10 w-10 rounded-xl" />+ <div className="flex-1 space-y-2">+ <Skeleton className="h-7 w-56" />+ <Skeleton className="h-4 w-96 max-w-full" />+ <Skeleton className="h-3 w-72 max-w-full" /></div>- <Skeleton className="h-4 w-72" />- <Skeleton className="h-9 w-80" />+ <Skeleton className="h-8 w-24" /></div>- <div className="grid grid-cols-1 gap-4 lg:grid-cols-3">- <Skeleton className="h-56 lg:col-span-2" />++ <Skeleton className="h-10 w-full" />++ {/* Health lede beside the reads column */}+ <div className="grid grid-cols-1 items-start gap-8 lg:grid-cols-[minmax(0,1fr)_300px] lg:gap-12">+ <div className="space-y-3">+ <Skeleton className="h-3 w-24" />+ <Skeleton className="h-12 w-40" />+ <Skeleton className="h-16 w-full max-w-[54ch]" />+ <Skeleton className="h-4 w-36" />+ </div><div className="space-y-4">- <Skeleton className="h-32" />- <Skeleton className="h-32" />+ {Array.from({ length: 4 }).map((_, i) => (+ <Skeleton key={i} className="h-12" />+ ))}</div></div>- <div className="grid grid-cols-2 gap-2 sm:grid-cols-5">++ <div className="grid grid-cols-2 gap-px sm:grid-cols-3 lg:grid-cols-5">{Array.from({ length: 5 }).map((_, i) => (- <Skeleton key={i} className="h-16" />+ <Skeleton key={i} className="h-14" />))}</div>- <Skeleton className="h-72" />++ <Skeleton className="h-48" />+ <Skeleton className="h-40" /></div>);}diff --git a/packages/web/src/app/repos/[id]/overview/page.tsx b/packages/web/src/app/repos/[id]/overview/page.tsxindex 298905799..de2f07914 100644--- a/packages/web/src/app/repos/[id]/overview/page.tsx+++ b/packages/web/src/app/repos/[id]/overview/page.tsx@@ -1,29 +1,45 @@import type { Metadata } from "next";import { notFound } from "next/navigation";-import { Hash } from "lucide-react";import Link from "next/link";import { getOverviewSummary } from "@/lib/api/overview";import { getProviders } from "@/lib/api/providers";import { getStatsHighlights } from "@/lib/api/stats";-import { getCoupling } from "@/lib/api/coupling";-import { StatsTeaserCard } from "@/components/overview/stats-teaser-card";-import { Badge } from "@repowise-dev/ui/ui/badge";-import { PageShell } from "@repowise-dev/ui/shared";+import { getCommitsPage } from "@/lib/api/git";import { FirstIndexExperience } from "@/components/repos/first-index-experience";-import { HealthOverviewCard } from "@repowise-dev/ui/dashboard/health-overview-card";-import { AttentionPanel } from "@repowise-dev/ui/dashboard/attention-panel";-import { KpiStrip, kpiDelta, type KpiItem } from "@repowise-dev/ui/dashboard/kpi-strip";-import { OverviewGrid, OverviewPanelPair } from "@repowise-dev/ui/dashboard/overview-grid";-import { SavingsMini } from "@repowise-dev/ui/dashboard/savings-mini";-import { IndexStorageMini } from "@repowise-dev/ui/dashboard/index-storage-mini";-import { LanguageDonut } from "@repowise-dev/ui/dashboard/language-donut";-import { KnowledgeGraphCard } from "@repowise-dev/ui/dashboard/explore-cards";-import { CouplingMiniCard } from "@repowise-dev/ui/dashboard/coupling-mini-card";-import { AskAnythingCardWrapper } from "@/components/overview/ask-anything-card-wrapper";-import { QuickActionsWrapper as QuickActions } from "@/components/dashboard/quick-actions-wrapper";-import { OverviewTabs } from "@/components/overview/overview-tabs";-import { ContributorsStripCard } from "@/components/overview/contributors-strip-card";-import { formatNumber, formatRelativeTime } from "@repowise-dev/ui/lib/format";+import { QuickActionsWrapper } from "@/components/dashboard/quick-actions-wrapper";+import { AskAnythingRow } from "@/components/overview/ask-anything-row";+import {+ AttentionRows,+ ChangeLine,+ CommitRows,+ DecisionRows,+ ExploreList,+ HealthLede,+ HotspotTable,+ LanguageBar,+ OverviewSection,+ ReadsColumn,+ RepoIdentityHeader,+ SectionLink,+ type ChangeStat,+ type ExploreEntry,+ type ReadItem,+ type RepoIdentityMeta,+} from "@repowise-dev/ui/overview";+import { getDefaultHref } from "@repowise-dev/ui/dashboard/attention-href";+// Direct path, not the `ui/stats` barrel: that barrel re-exports two+// "use client" modules, which would ship them to the browser for a page that+// renders entirely on the server.+import { StatRibbon, type RibbonStat } from "@repowise-dev/ui/stats/stat-ribbon";+import { fileEntityPath } from "@repowise-dev/ui/shared/entity";+import {+ formatBytes,+ formatCost,+ formatLOC,+ formatNumber,+ formatRelativeTime,+ formatTokens,+} from "@repowise-dev/ui/lib/format";export const metadata: Metadata = { title: "Overview" };@@ -39,175 +55,409 @@ async function safeFetch<T>(fn: () => Promise<T>): Promise<T | null> {}}+/** Rows shown in the activity section. Fetched server-side so the list is in+ * the initial HTML instead of waterfalling in after paint. */+const COMMIT_LIMIT = 6;+export default async function OverviewPage({ params }: Props) {const { id } = await params;- const [summary, providers, statsHighlights, coupling] = await Promise.all([+ // Every fetch the page needs, in one wave, on the server. Nothing below+ // renders client-side: this is a static read, so a hydration boundary would+ // only buy a slower first paint and worse indexability. The commits call+ // replaces a client-side SWR fetch that used to waterfall in after paint.+ const [summary, providers, statsHighlights, commitsPage] = await Promise.all([safeFetch(() => getOverviewSummary(id)),safeFetch(() => getProviders()),safeFetch(() => getStatsHighlights(id)),- safeFetch(() => getCoupling(id, { limit: 3 })),+ safeFetch(() => getCommitsPage(id, { sort: "date", limit: COMMIT_LIMIT })),]);if (!summary) notFound();const { repo, stats, health, sync } = summary;const isFresh = stats.file_count === 0;- // Fall back to the sync page count so the tile still reads on a server that- // predates the doc page count.+ const base = `/repos/${id}`;+ const lastActivityAt = sync.last_sync_at ?? sync.last_resync_at ?? health.last_indexed_at;++ // ── Identity ───────────────────────────────────────────────────────────+ const meta: RepoIdentityMeta[] = [];+ const primaryLanguage = summary.languages[0]?.language;+ if (primaryLanguage) meta.push({ label: primaryLanguage, dot: true });+ meta.push({ label: repo.default_branch, mono: true });+ if (repo.head_commit) meta.push({ label: repo.head_commit.slice(0, 7), mono: true });+ if (statsHighlights) {+ meta.push({ label: `${formatLOC(statsHighlights.scale.total_nloc)} lines`, mono: true });+ }+ if (lastActivityAt) {+ meta.push({+ label: `synced ${formatRelativeTime(lastActivityAt)}`,+ title: new Date(lastActivityAt).toLocaleString(),+ });+ }++ const header = (+ <RepoIdentityHeader+ name={repo.name}+ owner={repo.owner}+ description={repo.local_path}+ remoteUrl={repo.remote_url}+ meta={isFresh ? [] : meta}+ actions={+ isFresh ? null : (+ <QuickActionsWrapper+ variant="header"+ repoId={id}+ repoName={repo.name}+ pageCount={sync.page_count || stats.file_count}+ modelName={providers?.active.model ?? sync.last_sync_model ?? ""}+ lastSyncAt={sync.last_sync_at}+ lastResyncAt={sync.last_resync_at}+ />+ )+ }+ />+ );++ if (isFresh) {+ return (+ <div className="mx-auto flex w-full max-w-[1280px] flex-col gap-8 p-[var(--page-pad)]">+ {header}+ <FirstIndexExperience repoId={id} repoName={repo.name} />+ </div>+ );+ }++ // ── What moved between the last two indexes ────────────────────────────+ // Deltas, not "things newer than the last sync". A commit only lands in the+ // index once a sync ingests it, and that same sync stamps `last_sync_at`, so+ // counting commits after that timestamp returns zero on a healthy repo.+ // Decisions are worse: the sync run creates them. The snapshot deltas the+ // server already computes are the figures that genuinely move.+ const commits = commitsPage?.items ?? [];+ const history = health.history;+ const previousSnapshotAt =+ history.length >= 2 ? (history[history.length - 2]?.taken_at ?? null) : null;++ const changeStats: ChangeStat[] = [];+ if (stats.deltas.file_count) {+ const d = stats.deltas.file_count;+ changeStats.push({+ value: `${d > 0 ? "+" : ""}${formatNumber(d)}`,+ label: Math.abs(d) === 1 ? "file" : "files",+ });+ }+ if (stats.deltas.average_health != null && Math.abs(stats.deltas.average_health) >= 0.05) {+ const d = stats.deltas.average_health;+ changeStats.push({+ value: `${d > 0 ? "+" : ""}${d.toFixed(1)}`,+ label: "defect risk",+ });+ }+ if (stats.deltas.hotspot_health != null && Math.abs(stats.deltas.hotspot_health) >= 0.05) {+ const d = stats.deltas.hotspot_health;+ changeStats.push({+ value: `${d > 0 ? "+" : ""}${d.toFixed(1)}`,+ label: "hotspot health",+ });+ }++ // ── The reads beside health ────────────────────────────────────────────+ // Health is the hero and keeps the biggest number, but it cannot be the only+ // reason to open this page. Each row headlines a subject someone might have+ // come for, at the same altitude as the health score and one click from the+ // page that owns it.const docPages = stats.doc_page_count ?? sync.page_count ?? 0;+ const prosePages = stats.doc_prose_page_count;+ const reads: ReadItem[] = [];- const kpis: KpiItem[] = [- {- label: "Files",- value: formatNumber(stats.file_count),- href: `/repos/${id}/files`,- // File-count growth is neutral, not "good" — render the delta uncolored.- delta: kpiDelta(stats.deltas.file_count, true),- },+ if (docPages > 0) {+ // Pages a model wrote and pages built from the index alone are different+ // things — one costs a generation call and can go stale, the other is free+ // and rebuilt every sync — and a single total hides which you have.+ //+ // The copy says exactly what the query measured ("with model-written+ // prose" / "without") rather than the tempting shorthand "deterministic".+ // A page can lack prose because its provider call failed, and calling that+ // deterministic would report an outage as a design choice.+ const hasSplit = prosePages != null;+ const withoutProse = hasSplit ? Math.max(0, docPages - prosePages) : 0;+ reads.push({+ key: "docs",+ label: "Documentation",+ value: formatNumber(docPages),+ unit: "pages",+ href: `${base}/docs`,+ why: hasSplit+ ? `${formatNumber(prosePages)} with model-written prose, ${formatNumber(withoutProse)} built from the index`+ : `Across ${formatNumber(stats.module_count)} modules`,+ ...(hasSplit+ ? {+ bar: [+ {+ fraction: prosePages / docPages,+ color: "var(--color-accent-fill)",+ title: `${formatNumber(prosePages)} pages with model-written prose`,+ },+ {+ fraction: withoutProse / docPages,+ color: "color-mix(in srgb, var(--color-accent-fill) 30%, var(--color-bg-inset))",+ title: `${formatNumber(withoutProse)} pages built from the index alone`,+ },+ ],+ }+ : {}),+ });+ }++ // Savings come from a CLI-written `.repowise/omissions` sidecar, so this row+ // is simply absent wherever that sidecar cannot exist. Hosted composes the+ // same component without it — no flag, no empty state pitching a CLI the+ // viewer is not running.+ const savings = summary.savings;+ const savedTokens = (savings.saved_tokens ?? 0) + (savings.mcp_tokens ?? 0);+ if (savings.available && savedTokens > 0) {+ reads.push({+ key: "savings",+ label: "Agent savings",+ value: formatTokens(savedTokens),+ ...(savings.estimated_usd_saved+ ? { unit: formatCost(savings.estimated_usd_saved) }+ : {}),+ href: `${base}/costs`,+ why: `Tokens your agent did not spend${savings.pricing_model ? `, priced at ${savings.pricing_model}` : ""}`,+ });+ }++ if (stats.dead_export_count > 0) {+ reads.push({+ key: "dead-code",+ label: "Dead code",+ value: formatNumber(stats.dead_export_count),+ unit: "exports",+ href: `${base}/code-health?tab=dead-code`,+ why: "Unused exports that nothing in the graph reaches",+ });+ }++ // Index storage is a local-disk figure. Hosted stores indexes elsewhere and+ // simply never adds this row.+ if (sync.index_storage_bytes) {+ reads.push({+ key: "index",+ label: "Index",+ value: formatBytes(sync.index_storage_bytes),+ href: `${base}/settings`,+ why: `Wiki, symbols and vectors on disk · ${Math.round(stats.doc_coverage_pct)}% average doc confidence`,+ });+ }++ // ── Scale ribbon: the whole first-visit orientation job, in one row ─────+ const ribbon: RibbonStat[] = [];+ if (statsHighlights) {+ ribbon.push({ label: "Lines of code", value: formatLOC(statsHighlights.scale.total_nloc) });+ }+ // Linked, because the KPI strip this replaces was five links: without hrefs+ // here, Files and Symbols lose their only entry point from this page.+ ribbon.push(+ { label: "Files", value: formatNumber(stats.file_count), href: `${base}/files` },{label: "Symbols",value: formatNumber(stats.symbol_count),- href: `/repos/${id}/architecture?view=symbols`,+ href: `${base}/architecture?view=symbols`,+ },+ { label: "Modules", value: formatNumber(stats.module_count), href: `${base}/architecture` },+ {+ label: "Languages",+ value: formatNumber(summary.languages.length),+ href: `${base}/architecture?view=graph&colorMode=language`,},+ );++ // ── Explore ────────────────────────────────────────────────────────────+ // Replaces four equal-sized cards that were four different species. Every+ // row carries a live figure rather than a description of the feature, which+ // makes the list double as a second, quieter set of statistics.+ const explore: ExploreEntry[] = [{+ key: "docs",label: "Docs",- value: formatNumber(docPages),- href: `/repos/${id}/docs`,+ href: `${base}/docs`,+ description: `${formatNumber(docPages)} pages across ${formatNumber(stats.module_count)} modules`,},{- label: "Dead Exports",- value: formatNumber(stats.dead_export_count),- href: `/repos/${id}/code-health?tab=dead-code`,+ key: "files",+ label: "Files",+ href: `${base}/files`,+ description: `${formatNumber(stats.file_count)} files with per-file docs, health and history`,+ },+ {+ key: "architecture",+ label: "Architecture",+ href: `${base}/architecture`,+ description: `Dependency graph, layers, and ${formatNumber(stats.entry_point_count)} entry points`,},{- label: "Entry Points",- value: formatNumber(stats.entry_point_count),- href: `/repos/${id}/architecture?view=graph&viewMode=architecture`,+ key: "code-health",+ label: "Code health",+ href: `${base}/code-health`,+ description: `Per-file scores, ${formatNumber(health.open_findings)} open findings, coverage and refactoring targets`,+ },+ {+ key: "knowledge-graph",+ label: "Knowledge graph",+ href: `${base}/knowledge-graph`,+ description: "Entities, communities, and the paths between them",+ },+ {+ key: "coupling",+ label: "Change coupling",+ href: `${base}/architecture?view=coupling`,+ description: "Files that keep changing together, mined from commit history",+ },+ {+ key: "commits",+ label: "Commits",+ href: `${base}/commits`,+ description: "Change-risk ranked history with agent provenance",+ },+ {+ key: "contributors",+ label: "Contributors",+ href: `${base}/owners`,+ description: "Bus factor, per-file maintainers, and the human/agent split",+ },+ {+ key: "stats",+ label: "Stats",+ href: `${base}/stats`,+ description: "Size class, origin, lifetime churn, rhythm and records",},];const langDistribution: Record<string, number> = {};for (const l of summary.languages) langDistribution[l.language] = l.file_count;- const attentionItems = summary.attention.map((a) => ({- id: a.id,- type: a.type,- title: a.title,- description: a.description,- severity: a.severity,- target_id: a.target_id,- }));-- const lastActivityAt = sync.last_sync_at ?? sync.last_resync_at ?? health.last_indexed_at;+ return (+ <div className="mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-[var(--page-pad)] sm:gap-8">+ {header}- const headerMeta = (- <div className="flex flex-wrap items-center gap-2">- {repo.head_commit && (- <Badge variant="outline" className="text-[10px] h-5 shrink-0">- <Hash className="h-2.5 w-2.5" />- {repo.head_commit.slice(0, 7)}- </Badge>- )}- <Badge variant="outline" className="text-[10px] h-5 shrink-0">- {repo.default_branch}- </Badge>- {lastActivityAt && (- <span- className="text-xs text-[var(--color-text-tertiary)]"- title={new Date(lastActivityAt).toLocaleString()}- >- synced {formatRelativeTime(lastActivityAt)}- </span>- )}- </div>- );+ <ChangeLine since={previousSnapshotAt} stats={changeStats} />- return (- <PageShell title={repo.name} description={repo.local_path} actions={headerMeta} maxWidth="wide">- {/* Fresh repos get one prominent index action instead of the sync- toolbar; everything else appears once the first index lands. */}- {!isFresh && (- <QuickActions- repoId={id}- repoName={repo.name}- pageCount={sync.page_count || stats.file_count}- modelName={providers?.active.model ?? sync.last_sync_model ?? ""}- lastSyncAt={sync.last_sync_at}- lastResyncAt={sync.last_resync_at}+ {/* Health keeps the largest number and the leftmost position. The column+ beside it carries the other reasons someone opens this page, so a+ visitor who came for docs or costs finds their figure at the same+ altitude rather than three scrolls down. */}+ <div className="grid grid-cols-1 items-start gap-8 lg:grid-cols-[minmax(0,1fr)_300px] lg:gap-12">+ <HealthLede+ score={health.average_health}+ maintainability={health.maintainability_average}+ performance={health.performance_average}+ hotspotHealth={health.hotspot_health}+ hotspotCount={stats.hotspot_count}+ fileCount={stats.file_count}+ href={`${base}/code-health`}+ LinkComponent={Link}/>- )}+ <ReadsColumn items={reads} LinkComponent={Link} />+ </div>- {isFresh ? (- <FirstIndexExperience repoId={id} repoName={repo.name} />- ) : (- <>- {/* ── KPI bar leads ── */}- <KpiStrip items={kpis} LinkComponent={Link} />-- {/* ── Code Health (our moat) leads, with triage + savings rail ── */}- <OverviewGrid- main={- <>- <HealthOverviewCard- data={health}- repoId={id}- averageDelta={stats.deltas.average_health}- hotspotDelta={stats.deltas.hotspot_health}- defectAccuracy={health.defect_accuracy ?? null}- />- <ContributorsStripCard repoId={id} />- {/* The two short tiles sit two-up here rather than stacked in- the rail: it keeps the main column from bottoming out well- above the taller Attention panel beside it. */}- <OverviewPanelPair>- <SavingsMini data={summary.savings} repoId={id} />- <IndexStorageMini- data={{- index_storage_bytes: sync.index_storage_bytes ?? 0,- page_count: sync.page_count,- doc_coverage_pct: stats.doc_coverage_pct,- }}- />- </OverviewPanelPair>- </>- }- rail={- <>- {statsHighlights && <StatsTeaserCard repoId={id} data={statsHighlights} />}- <AttentionPanel items={attentionItems} repoId={id} previewCount={5} repoName={repo.name} />- </>- }+ <StatRibbon stats={ribbon} LinkComponent={Link} />++ <OverviewSection+ title="Recent activity"+ action={+ <SectionLink href={`${base}/commits`} LinkComponent={Link}>+ All commits+ </SectionLink>+ }+ >+ <div className="grid grid-cols-1 gap-6 md:grid-cols-2 md:gap-10">+ <div className="flex min-w-0 flex-col gap-2">+ <h3 className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">+ Commits+ </h3>+ <CommitRows+ commits={commits}+ hrefFor={(sha) => `${base}/commits?commit=${sha}`}+ LinkComponent={Link}+ />+ </div>+ <div className="flex min-w-0 flex-col gap-2">+ <h3 className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">+ Decisions+ </h3>+ <DecisionRows+ decisions={summary.recent_decisions.slice(0, 6)}+ hrefFor={(decisionId) => `${base}/decisions/${encodeURIComponent(decisionId)}`}+ LinkComponent={Link}+ />+ </div>+ </div>+ </OverviewSection>++ {summary.attention.length > 0 && (+ <OverviewSection+ title="Needs attention"+ // No section link: these items span decisions, dead code, hotspots+ // and ownership, so there is no single page that holds "all of+ // them". A count that linked to just one of those would be a lie+ // about where the rest live.+ action={+ <span className="font-mono text-[11px] tabular-nums text-[var(--color-text-tertiary)]">+ {formatNumber(summary.attention.length)} open+ </span>+ }+ >+ <AttentionRows+ items={summary.attention.slice(0, 5)}+ hrefFor={(item) => getDefaultHref(item, base)}+ LinkComponent={Link}/>+ </OverviewSection>+ )}- {/* ── Pulse / Structure ── */}- <OverviewTabs- repoId={id}- hotspots={summary.top_hotspots}- hotspotTotal={stats.hotspot_count}- decisions={summary.recent_decisions}+ {summary.top_hotspots.length > 0 && (+ <OverviewSection+ title="Where the risk concentrates"+ description="Ranked by prior bug fixes and change frequency, mined from full git history rather than from the code alone."+ action={+ <SectionLink href={`${base}/code-health?tab=hotspots`} LinkComponent={Link}>+ {`All ${formatNumber(stats.hotspot_count)} hotspots`}+ </SectionLink>+ }+ >+ <HotspotTable+ hotspots={summary.top_hotspots.slice(0, 5)}+ hrefFor={(path) => fileEntityPath(base, path)}+ LinkComponent={Link}/>+ </OverviewSection>+ )}- {/* ── Languages + explore: donut alongside the graph, coupling, and- chat front-doors. Coupling has no sidebar entry, so this card is- its discoverable landing-page door. ── */}- <div className="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4">- {summary.languages.length > 0 && (- <LanguageDonut- distribution={langDistribution}- viewAllHref={`/repos/${id}/architecture?view=graph&colorMode=language`}- />- )}- <KnowledgeGraphCard href={`/repos/${id}/knowledge-graph`} />- <CouplingMiniCard- edges={coupling?.edges ?? []}- href={`/repos/${id}/architecture?view=coupling`}+ {summary.languages.length > 0 && (+ <OverviewSection+ title="Composition"+ action={+ <SectionLink+ href={`${base}/architecture?view=graph&colorMode=language`}LinkComponent={Link}- />- <AskAnythingCardWrapper repoId={id} />- </div>- </>+ >+ Open the graph+ </SectionLink>+ }+ >+ <LanguageBar distribution={langDistribution} />+ </OverviewSection>)}- </PageShell>++ <OverviewSection title="Ask this codebase">+ <AskAnythingRow repoId={id} />+ </OverviewSection>++ <OverviewSection title="Explore this codebase">+ <ExploreList entries={explore} LinkComponent={Link} />+ </OverviewSection>+ </div>);}diff --git a/packages/web/src/components/dashboard/quick-actions-wrapper.tsx b/packages/web/src/components/dashboard/quick-actions-wrapper.tsxindex 91905d384..e5ef7e45c 100644--- a/packages/web/src/components/dashboard/quick-actions-wrapper.tsx+++ b/packages/web/src/components/dashboard/quick-actions-wrapper.tsx@@ -21,6 +21,9 @@ interface Props {modelName?: string;lastSyncAt?: string | null;lastResyncAt?: string | null;+ /** Button arrangement — see `QuickActionsProps.variant`. Overview passes+ * `header` so sync is the one primary action. */+ variant?: "row" | "header";}/** Human label for an action key, for toast copy. */@@ -35,6 +38,7 @@ export function QuickActionsWrapper({modelName = "",lastSyncAt,lastResyncAt,+ variant,}: Props) {const router = useRouter();const [activeJobId, setActiveJobId] = useState<string | null>(null);@@ -143,6 +147,7 @@ export function QuickActionsWrapper({pageCount={pageCount}modelName={modelName}activeJobSlot={activeSlot}+ variant={variant}/>);}diff --git a/packages/web/src/components/overview/ask-anything-card-wrapper.tsx b/packages/web/src/components/overview/ask-anything-card-wrapper.tsxdeleted file mode 100644index 8b503a9c9..000000000--- a/packages/web/src/components/overview/ask-anything-card-wrapper.tsx+++ /dev/null@@ -1,16 +0,0 @@-"use client";--import { useRouter } from "next/navigation";-import { AskAnythingCard } from "@repowise-dev/ui/dashboard/explore-cards";--/** Routes the overview "ask" input into the chat page's `?q=` deep link. */-export function AskAnythingCardWrapper({ repoId }: { repoId: string }) {- const router = useRouter();- return (- <AskAnythingCard- onAsk={(question) =>- router.push(`/repos/${repoId}/chat?q=${encodeURIComponent(question)}`)- }- />- );-}diff --git a/packages/web/src/components/overview/ask-anything-row.tsx b/packages/web/src/components/overview/ask-anything-row.tsxnew file mode 100644index 000000000..d2d445cae--- /dev/null+++ b/packages/web/src/components/overview/ask-anything-row.tsx@@ -0,0 +1,95 @@+"use client";++import { useState } from "react";+import { useRouter } from "next/navigation";+import { ArrowRight, Sparkles } from "lucide-react";++const PLACEHOLDER = "How does the incremental pipeline decide what to re-index?";++/** Openers that show what this is good at: tracing behaviour, locating a+ * concern, and asking for rationale. Concrete beats "Ask me anything" — most+ * people stall at a blank box because they cannot tell what it can answer. */+const SUGGESTIONS = [+ "How does authentication work?",+ "Where is the retry logic?",+ "Why is this module structured this way?",+];++/**+ * One input row that deep-links into chat.+ *+ * The card this replaces was one of four equal tiles at the bottom of the+ * page, which put a text input beside a chart and a blurb as though they were+ * the same kind of object. Asking a question is an action, so it gets a+ * control, not a card.+ *+ * The ember rail and the sparkle are the page's only ornament, spent here on+ * purpose: this is the one row that does something rather than reporting+ * something, and it needs to look different enough to be found.+ */+export function AskAnythingRow({ repoId }: { repoId: string }) {+ const router = useRouter();+ const [question, setQuestion] = useState("");++ function ask(q: string) {+ const trimmed = q.trim();+ if (!trimmed) return;+ router.push(`/repos/${repoId}/chat?q=${encodeURIComponent(trimmed)}`);+ }++ return (+ <div className="flex flex-col gap-2.5">+ <form+ onSubmit={(e) => {+ e.preventDefault();+ ask(question);+ }}+ className="group relative flex items-center gap-2.5 overflow-hidden rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] py-2 pl-3.5 pr-2 transition-colors focus-within:border-[var(--color-border-hover)]"+ >+ {/* Ember rail on the leading edge — the same accent the Code Health+ hero uses, at a quarter the width, so the two read as related+ without competing. */}+ <span+ aria-hidden+ className="absolute inset-y-0 left-0 w-[3px]"+ style={{ background: "var(--gradient-ember)" }}+ />+ <Sparkles+ aria-hidden+ className="h-3.5 w-3.5 shrink-0 text-[var(--color-accent-primary)] transition-transform group-focus-within:scale-110"+ />+ <label htmlFor="overview-ask" className="sr-only">+ Ask a question about this codebase+ </label>+ <input+ id="overview-ask"+ value={question}+ onChange={(e) => setQuestion(e.target.value)}+ placeholder={PLACEHOLDER}+ className="min-w-0 flex-1 bg-transparent text-xs text-[var(--color-text-primary)] placeholder:text-[var(--color-text-tertiary)] focus:outline-none"+ />+ <button+ type="submit"+ disabled={!question.trim()}+ className="inline-flex shrink-0 items-center gap-1 rounded-md bg-[var(--color-accent-fill)] px-2.5 py-1 text-xs font-medium text-[var(--color-text-on-accent)] transition hover:bg-[var(--color-accent-fill-hover)] disabled:opacity-40"+ >+ Ask+ <ArrowRight className="h-3 w-3" />+ </button>+ </form>++ <div className="flex flex-wrap gap-1.5">+ {SUGGESTIONS.map((s) => (+ <button+ key={s}+ type="button"+ onClick={() => ask(s)}+ className="rounded-full border border-[var(--color-border-default)] px-2.5 py-1 text-[11px] text-[var(--color-text-tertiary)] transition-colors hover:border-[var(--color-accent-primary)] hover:text-[var(--color-accent-primary)]"+ >+ {s}+ </button>+ ))}+ </div>+ </div>+ );+}diff --git a/packages/web/src/components/overview/contributors-strip-card.tsx b/packages/web/src/components/overview/contributors-strip-card.tsxdeleted file mode 100644index 65445b3e4..000000000--- a/packages/web/src/components/overview/contributors-strip-card.tsx+++ /dev/null@@ -1,70 +0,0 @@-"use client";--import useSWR from "swr";-import { ContributorsStrip, type StripProvenance } from "@repowise-dev/ui/git/contributors-strip";-import { Card, CardContent, CardHeader } from "@repowise-dev/ui/ui/card";-import { Skeleton } from "@repowise-dev/ui/ui/skeleton";-import { getAgentTrend, getGitSummary } from "@/lib/api/git";--const SWR_OPTS = { revalidateOnFocus: false, revalidateOnReconnect: false };--/**- * Overview contributors strip — who owns the code, plus agent-vs-human- * authorship when provenance is indexed. Ownership comes from the git- * summary; provenance is best-effort (older indexes / repos with no agent- * commits simply omit that row).- */-export function ContributorsStripCard({ repoId }: { repoId: string }) {- const { data: summary, isLoading } = useSWR(- `overview-git-summary:${repoId}`,- () => getGitSummary(repoId, 50),- SWR_OPTS,- );- // Provenance is optional: swallow errors so the strip still renders owners.- const { data: trend } = useSWR(- `overview-agent-trend:${repoId}`,- () => getAgentTrend(repoId).catch(() => null),- SWR_OPTS,- );-- if (isLoading) {- return (- <Card className="shadow-sm">- <CardHeader className="pb-2">- <Skeleton className="h-4 w-32" />- </CardHeader>- <CardContent className="pt-0 space-y-2.5">- <Skeleton className="h-2 w-full rounded-full" />- <Skeleton className="h-4 w-3/4" />- </CardContent>- </Card>- );- }-- // git-summary returns pct as a 0–1 fraction; the strip works in 0–100.- const owners = (summary?.top_owners ?? []).map((o) => ({- ...o,- pct: (o.pct ?? 0) * 100,- }));- if (owners.length === 0) return null;-- const provenance: StripProvenance | null =- trend && trend.agent_commits > 0- ? {- agentPct: trend.agent_pct,- agentCommits: trend.agent_commits,- totalCommits: trend.total_commits,- agentNames: trend.agent_names ?? [],- }- : null;-- return (- <ContributorsStrip- owners={owners}- contributorCount={owners.length}- provenance={provenance}- ownersHref={`/repos/${repoId}/owners`}- commitsHref={`/repos/${repoId}/commits?authorship=agent`}- />- );-}diff --git a/packages/web/src/components/overview/overview-tabs.tsx b/packages/web/src/components/overview/overview-tabs.tsxdeleted file mode 100644index dc70981e9..000000000--- a/packages/web/src/components/overview/overview-tabs.tsx+++ /dev/null@@ -1,52 +0,0 @@-"use client";--import { parseAsStringLiteral, useQueryState } from "nuqs";-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@repowise-dev/ui/ui/tabs";-import { ErrorBoundary } from "@repowise-dev/ui/shared";-import { PulseTab } from "./pulse-tab";-import { StructureTab } from "./structure-tab";-import type { Hotspot } from "@repowise-dev/types/git";-import type { OverviewDecisionSlim } from "@repowise-dev/types/overview";--const TAB_VALUES = ["pulse", "structure"] as const;--interface OverviewTabsProps {- repoId: string;- hotspots: Hotspot[];- hotspotTotal: number;- decisions: OverviewDecisionSlim[];-}--/** Two purposeful, URL-synced tabs: Pulse (activity) and Structure (how- * it's built). Tab content fetches its own data and streams in behind- * skeletons; the summary slices arrive as props from the server payload. */-export function OverviewTabs({ repoId, hotspots, hotspotTotal, decisions }: OverviewTabsProps) {- const [tab, setTab] = useQueryState(- "tab",- parseAsStringLiteral(TAB_VALUES).withDefault("pulse"),- );-- return (- <Tabs value={tab} onValueChange={(v) => setTab(v as (typeof TAB_VALUES)[number])}>- <TabsList>- <TabsTrigger value="pulse">Pulse</TabsTrigger>- <TabsTrigger value="structure">Structure</TabsTrigger>- </TabsList>- <TabsContent value="pulse" className="mt-4">- <ErrorBoundary title="Couldn't load activity">- <PulseTab- repoId={repoId}- hotspots={hotspots}- hotspotTotal={hotspotTotal}- decisions={decisions}- />- </ErrorBoundary>- </TabsContent>- <TabsContent value="structure" className="mt-4">- <ErrorBoundary title="Couldn't load structure">- <StructureTab repoId={repoId} />- </ErrorBoundary>- </TabsContent>- </Tabs>- );-}diff --git a/packages/web/src/components/overview/pulse-tab.tsx b/packages/web/src/components/overview/pulse-tab.tsxdeleted file mode 100644index cf5b7518d..000000000--- a/packages/web/src/components/overview/pulse-tab.tsx+++ /dev/null@@ -1,69 +0,0 @@-"use client";--import useSWR from "swr";-import { CommitsMini } from "@repowise-dev/ui/dashboard/commits-mini";-import { DecisionsTimeline } from "@repowise-dev/ui/dashboard/decisions-timeline";-import { HotspotsMini } from "@repowise-dev/ui/dashboard/hotspots-mini";-import {- CommitActivityCard,- OverviewPanelPair,-} from "@repowise-dev/ui/dashboard/overview-grid";-import { CommitCategorySparkline } from "@repowise-dev/ui/git/commit-category-sparkline";-import { Card, CardContent } from "@repowise-dev/ui/ui/card";-import { Skeleton } from "@repowise-dev/ui/ui/skeleton";-import { getCommitsPage } from "@/lib/api/git";-import type { Hotspot } from "@repowise-dev/types/git";-import type { OverviewDecisionSlim } from "@repowise-dev/types/overview";--interface PulseTabProps {- repoId: string;- hotspots: Hotspot[];- hotspotTotal: number;- decisions: OverviewDecisionSlim[];-}--/** Default Overview tab: real activity — recent commits, change pressure,- * and the decisions timeline. Commits stream in client-side; the hotspot- * and decision slices arrive with the summary payload. */-export function PulseTab({ repoId, hotspots, hotspotTotal, decisions }: PulseTabProps) {- const { data: commitsPage, isLoading } = useSWR(- `overview-commits:${repoId}`,- () => getCommitsPage(repoId, { sort: "date", limit: 10 }),- { revalidateOnFocus: false, revalidateOnReconnect: false },- );-- const aggregatedCategories: Record<string, number> = {};- for (const h of hotspots) {- for (const [cat, count] of Object.entries(h.commit_categories ?? {})) {- aggregatedCategories[cat] = (aggregatedCategories[cat] || 0) + count;- }- }- const hasCategories = Object.values(aggregatedCategories).some((v) => v > 0);-- return (- <div className="space-y-4">- <OverviewPanelPair>- {isLoading ? (- <Card>- <CardContent className="space-y-2 pt-4">- {Array.from({ length: 6 }).map((_, i) => (- <Skeleton key={i} className="h-5 w-full" />- ))}- </CardContent>- </Card>- ) : (- <CommitsMini commits={commitsPage?.items ?? []} repoId={repoId} />- )}- <DecisionsTimeline decisions={decisions} repoId={repoId} />- </OverviewPanelPair>- <OverviewPanelPair>- <HotspotsMini hotspots={hotspots} repoId={repoId} total={hotspotTotal} />- {hasCategories && (- <CommitActivityCard- sparkline={<CommitCategorySparkline categories={aggregatedCategories} />}- />- )}- </OverviewPanelPair>- </div>- );-}diff --git a/packages/web/src/components/overview/stats-teaser-card.tsx b/packages/web/src/components/overview/stats-teaser-card.tsxdeleted file mode 100644index e858f9216..000000000--- a/packages/web/src/components/overview/stats-teaser-card.tsx+++ /dev/null@@ -1,72 +0,0 @@-import Link from "next/link";-import { BarChart3, ArrowRight, Clock } from "lucide-react";-import type { StatsHighlights } from "@repowise-dev/types/stats";-import { Card } from "@repowise-dev/ui/ui/card";-import { formatLOC, formatNumber, formatAgeDays } from "@repowise-dev/ui/lib/format";-import { NLOC_HINT } from "@repowise-dev/ui/stats";--interface StatsTeaserCardProps {- repoId: string;- data: StatsHighlights;-}--/** Compact overview teaser that headlines the "size class" + a couple of- * marquee figures and links into the full Stats page. */-export function StatsTeaserCard({ repoId, data }: StatsTeaserCardProps) {- const { scale, origin, rhythm } = data;-- const figures: { label: string; value: string; hint?: string }[] = [- { label: "Lines of code", value: formatLOC(scale.total_nloc), hint: NLOC_HINT },- { label: "Commits", value: formatNumber(origin.total_commits) },- {- label: "Age",- value: origin.age_days != null ? formatAgeDays(origin.age_days) : "—",- },- ];-- return (- <Card className="overflow-hidden">- <Link- href={`/repos/${repoId}/stats`}- className="group block p-4 transition-colors hover:bg-[var(--color-bg-elevated)]"- >- <div className="flex items-center justify-between">- <span className="flex items-center gap-2 text-sm font-semibold text-[var(--color-text-primary)]">- <BarChart3 className="h-4 w-4 text-[var(--color-accent-primary)]" />- By the Numbers- </span>- <ArrowRight className="h-4 w-4 text-[var(--color-text-tertiary)] transition-transform group-hover:translate-x-0.5" />- </div>-- <div className="mt-3 flex items-baseline gap-2">- <span className="text-2xl font-bold text-[var(--color-text-primary)]">- {scale.size_class.name}- </span>- <span className="text-xs text-[var(--color-text-tertiary)]">- {formatNumber(scale.file_count)} files- </span>- </div>-- <div className="mt-3 grid grid-cols-3 gap-2">- {figures.map((f) => (- <div key={f.label} title={f.hint} className={f.hint ? "cursor-help" : undefined}>- <p className="text-base font-semibold tabular-nums text-[var(--color-text-primary)]">- {f.value}- </p>- <p className="text-[10px] uppercase tracking-wider text-[var(--color-text-tertiary)]">- {f.label}- </p>- </div>- ))}- </div>-- {rhythm.longest_streak && (- <p className="mt-3 flex items-center gap-1.5 text-xs text-[var(--color-text-secondary)]">- <Clock className="h-3.5 w-3.5 text-[var(--color-accent-primary)]" />- Longest streak: {formatNumber(rhythm.longest_streak.days)} consecutive days- </p>- )}- </Link>- </Card>- );-}diff --git a/packages/web/src/components/overview/structure-tab.tsx b/packages/web/src/components/overview/structure-tab.tsxdeleted file mode 100644index 1fd2989e8..000000000--- a/packages/web/src/components/overview/structure-tab.tsx+++ /dev/null@@ -1,103 +0,0 @@-"use client";--import useSWR from "swr";-import { ModuleOverviewGrid } from "@repowise-dev/ui/dashboard/module-overview-grid";-import { OwnershipTreemap } from "@repowise-dev/ui/dashboard/ownership-treemap";-import { ExecutionFlowsPanel } from "@repowise-dev/ui/dashboard/execution-flows-panel";-import {- OverviewPanelPair,- TitledPanel,-} from "@repowise-dev/ui/dashboard/overview-grid";-import { BusFactorPanel } from "@repowise-dev/ui/git/bus-factor-panel";-import { EmptyState } from "@repowise-dev/ui/shared";-import { Card, CardContent } from "@repowise-dev/ui/ui/card";-import { Skeleton } from "@repowise-dev/ui/ui/skeleton";-import { CommunitySummaryGridWrapper } from "@/components/dashboard/community-summary-grid-wrapper";-import { useCommunities, useExecutionFlows, useModuleGraph } from "@/lib/hooks/use-graph";-import { getHotspotsPage, getOwnership } from "@/lib/api/git";--const SWR_OPTS = { revalidateOnFocus: false, revalidateOnReconnect: false };--function PanelSkeleton({ rows = 6 }: { rows?: number }) {- return (- <Card>- <CardContent className="space-y-2 pt-4">- {Array.from({ length: rows }).map((_, i) => (- <Skeleton key={i} className="h-5 w-full" />- ))}- </CardContent>- </Card>- );-}--interface StructureTabProps {- repoId: string;-}--/** "How is this built" — module map, dependency heatmap, communities,- * execution flows, plus ownership treemap and bus factor fed by the full- * ownership/hotspot datasets (not the summary slice). */-export function StructureTab({ repoId }: StructureTabProps) {- const { graph: moduleGraph, isLoading: modulesLoading } = useModuleGraph(repoId);- const { communities, isLoading: communitiesLoading } = useCommunities(repoId);- const { flows, isLoading: flowsLoading } = useExecutionFlows(repoId, {- top_n: 5,- max_depth: 5,- });- const { data: ownership, isLoading: ownershipLoading } = useSWR(- `overview-ownership:${repoId}`,- () => getOwnership(repoId, "module"),- SWR_OPTS,- );- const { data: hotspotsPage, isLoading: hotspotsLoading } = useSWR(- `overview-hotspots:${repoId}`,- () => getHotspotsPage(repoId, { limit: 50 }),- SWR_OPTS,- );-- const hasModules = !!moduleGraph && moduleGraph.nodes.length > 0;-- return (- <div className="space-y-4">- {modulesLoading ? (- <PanelSkeleton rows={4} />- ) : hasModules ? (- <ModuleOverviewGrid nodes={moduleGraph.nodes} edges={moduleGraph.edges} repoId={repoId} />- ) : (- <EmptyState- title="No module graph yet"- description="Module structure appears once indexing completes. Sync the repo to refresh."- />- )}-- {communitiesLoading ? (- <PanelSkeleton />- ) : communities && communities.length > 0 ? (- <CommunitySummaryGridWrapper communities={communities} repoId={repoId} />- ) : null}-- <OverviewPanelPair>- {flowsLoading ? (- <PanelSkeleton />- ) : flows && flows.flows.length > 0 ? (- <ExecutionFlowsPanel flows={flows.flows} repoId={repoId} />- ) : null}- {hotspotsLoading ? (- <PanelSkeleton />- ) : hotspotsPage && hotspotsPage.items.length > 0 ? (- <TitledPanel title="Bus Factor">- <BusFactorPanel hotspots={hotspotsPage.items} />- </TitledPanel>- ) : null}- </OverviewPanelPair>-- {ownershipLoading ? (- <PanelSkeleton rows={8} />- ) : ownership && ownership.length > 0 ? (- <TitledPanel title="Ownership Map">- <OwnershipTreemap entries={ownership} />- </TitledPanel>- ) : null}- </div>- );-}diff --git a/tests/unit/server/test_overview_docs_split.py b/tests/unit/server/test_overview_docs_split.pyindex 9ef54d8de..23132cec7 100644--- a/tests/unit/server/test_overview_docs_split.py+++ b/tests/unit/server/test_overview_docs_split.py@@ -1,9 +1,17 @@-"""Tests for the docs count in /api/repos/{id}/overview-summary.+"""Tests for the docs counts in /api/repos/{id}/overview-summary.-The Overview's Docs tile reports the total generated page count. The-template-vs-AI split it used to carry was retired with the provenance axis: the-file layer is structural for every repo, so a per-page "who wrote this" count-said nothing.+Two counts: every generated page, and the subset carrying model-written prose.++The old `doc_auto_page_count` split was retired with the provenance axis+(#1037) and is not coming back. Its problem was the denominator: it labelled+every `provider_name == "template"` page "auto", which swept in the whole file+layer — pages no model was ever going to write — so the split really said+"file pages vs everything else" while claiming to say "who wrote this".++`doc_prose_page_count` asks a narrower and answerable question — did a model+write this page — using the provider alone, with no page-type carve-out. That+keeps the label honest whatever the generator does next, and total minus prose+is exactly "pages built from the index"."""from __future__ import annotations@@ -20,11 +28,11 @@ from tests.unit.server.conftest import create_test_repo_NOW = datetime(2026, 1, 1, tzinfo=UTC)-def _page(repo_id: str, path: str, provider: str) -> Page:+def _page(repo_id: str, path: str, provider: str, page_type: str = "file_page") -> Page:return Page(- id=f"file_page:{path}",+ id=f"{page_type}:{path}",repository_id=repo_id,- page_type="file_page",+ page_type=page_type,title=path,content=f"# {path}",summary="",@@ -69,3 +77,51 @@ async def test_docs_count_is_zero_without_pages(client: AsyncClient) -> None:stats = resp.json()["stats"]assert stats["doc_page_count"] == 0+ assert stats["doc_prose_page_count"] == 0+++async def test_prose_count_follows_the_provider_not_the_page_type(+ client: AsyncClient, app+) -> None:+ """A model-written page counts as prose whatever type it is.++ Scoping the count to "page types a model usually writes" looks more+ principled and is wrong in practice: file and symbol pages *do* get+ generated with a real provider on some runs, and excluding them would file+ model-written pages under "built from the index" — the exact mislabel this+ count exists to avoid.+ """+ repo = await create_test_repo(client)++ async with get_session(app.state.session_factory) as session:+ session.add(_page(repo["id"], "a.py", "openai"))+ session.add(_page(repo["id"], "b.py", "template"))+ session.add(_page(repo["id"], "core", "anthropic", page_type="module_page"))++ resp = await client.get(f"/api/repos/{repo['id']}/overview-summary")+ stats = resp.json()["stats"]++ assert stats["doc_page_count"] == 3+ assert stats["doc_prose_page_count"] == 2+++async def test_stubbed_pages_are_not_prose(client: AsyncClient, app) -> None:+ """A page the template stub produced carries no prose.++ Covers the fallback case too: when a provider call fails the page keeps+ `provider_name = "template"`, and counting it as prose would report a+ generation outage as documentation the repo does not have.+ """+ repo = await create_test_repo(client)++ async with get_session(app.state.session_factory) as session:+ session.add(_page(repo["id"], "core", "template", page_type="module_page"))+ session.add(_page(repo["id"], "api", "anthropic", page_type="module_page"))++ resp = await client.get(f"/api/repos/{repo['id']}/overview-summary")+ stats = resp.json()["stats"]++ assert stats["doc_page_count"] == 2+ assert stats["doc_prose_page_count"] == 1diff --git a/tests/unit/server/test_overview_remote_url.py b/tests/unit/server/test_overview_remote_url.pynew file mode 100644index 000000000..d59c319de--- /dev/null+++ b/tests/unit/server/test_overview_remote_url.py@@ -0,0 +1,81 @@+"""Tests for the git remote the Overview header resolves its avatar from.++`repositories.url` is client-supplied and empty for most CLI-registered repos,+so the header would show initials for nearly every local repo if the stored+value were the only source. `_remote_url` falls back to reading `origin` out of+`.git/config`, which is where the answer actually lives.++Every failure path must return None rather than raise: this runs on a page+load, and a malformed git config is not a reason to fail the Overview.+"""++from __future__ import annotations++from pathlib import Path++from repowise.server.routers.overview import _remote_url++_ORIGIN = "https://github.com/repowise-dev/repowise.git"+++def _write_config(git_dir: Path, body: str) -> None:+ git_dir.mkdir(parents=True, exist_ok=True)+ (git_dir / "config").write_text(body, encoding="utf-8")+++def test_stored_url_wins_without_touching_disk(tmp_path: Path) -> None:+ """An explicitly registered URL is authoritative; no file read happens."""+ assert _remote_url("https://example.com/x/y", str(tmp_path)) == "https://example.com/x/y"+++def test_reads_origin_from_git_config(tmp_path: Path) -> None:+ _write_config(tmp_path / ".git", f'[remote "origin"]\n\turl = {_ORIGIN}\n')++ assert _remote_url("", str(tmp_path)) == _ORIGIN+++def test_falls_back_to_upstream_when_origin_is_absent(tmp_path: Path) -> None:+ """A fork checkout can carry only `upstream`; that still names the repo."""+ _write_config(tmp_path / ".git", f'[remote "upstream"]\n\turl = {_ORIGIN}\n')++ assert _remote_url(None, str(tmp_path)) == _ORIGIN+++def test_follows_a_worktree_gitdir_pointer(tmp_path: Path) -> None:+ """Worktrees keep a `.git` FILE; the config lives in the main checkout.++ Without following the pointer, every worktree — which is how a lot of this+ project's own development happens — would fall back to initials.+ """+ main = tmp_path / "main"+ _write_config(main / ".git", f'[remote "origin"]\n\turl = {_ORIGIN}\n')+ worktree_gitdir = main / ".git" / "worktrees" / "feature"+ worktree_gitdir.mkdir(parents=True)++ linked = tmp_path / "linked"+ linked.mkdir()+ (linked / ".git").write_text(f"gitdir: {worktree_gitdir}\n", encoding="utf-8")++ assert _remote_url("", str(linked)) == _ORIGIN+++def test_returns_none_without_a_git_dir(tmp_path: Path) -> None:+ assert _remote_url("", str(tmp_path)) is None+++def test_returns_none_for_a_malformed_config(tmp_path: Path) -> None:+ """A config we cannot parse degrades to initials, not to a 500."""+ _write_config(tmp_path / ".git", "this is not ini\n=== nope ===\n")++ assert _remote_url("", str(tmp_path)) is None+++def test_returns_none_when_no_remote_is_configured(tmp_path: Path) -> None:+ """A repo with local branches and no remote is a normal repo, not an error."""+ _write_config(tmp_path / ".git", '[core]\n\tbare = false\n[branch "main"]\n')++ assert _remote_url("", str(tmp_path)) is None+++def test_returns_none_without_a_local_path() -> None:+ assert _remote_url("", None) is None