Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat(web): first-run polish: app icon, add-repo flow, explore cards, collapsible workspace nav (#685)

Raghav Chamadiyae0cbe2ded36c
diff --git a/packages/ui/src/dashboard/explore-cards.tsx b/packages/ui/src/dashboard/explore-cards.tsx
new file mode 100644
index 000000000..4cd4d2ec9
--- /dev/null
+++ b/packages/ui/src/dashboard/explore-cards.tsx
@@ -0,0 +1,96 @@
+"use client";
+
+import * as React from "react";
+import { ArrowRight, MessageCircleQuestion, Waypoints } from "lucide-react";
+import { Card } from "../ui/card";
+
+interface KnowledgeGraphCardProps {
+ /** Link to the repo's knowledge-graph page. */
+ href: string;
+}
+
+/**
+ * Overview tile that routes into the curated knowledge-graph view. The graph
+ * is the richest surface in the product but lives only in the sidebar nav;
+ * this card gives it a front-door on the landing page.
+ */
+export function KnowledgeGraphCard({ href }: KnowledgeGraphCardProps) {
+ return (
+ <Card className="overflow-hidden">
+ <a
+ href={href}
+ className="group block h-full 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)]">
+ <Waypoints className="h-4 w-4 text-[var(--color-accent-primary)]" />
+ Knowledge Graph
+ </span>
+ <ArrowRight className="h-4 w-4 text-[var(--color-text-tertiary)] transition-transform group-hover:translate-x-0.5" />
+ </div>
+ <p className="mt-3 text-sm text-[var(--color-text-secondary)]">
+ A living map of this codebase: layers, communities, entry points, and
+ the paths between them, rebuilt on every index.
+ </p>
+ <p className="mt-3 text-xs font-medium text-[var(--color-accent-primary)]">
+ Explore the map
+ </p>
+ </a>
+ </Card>
+ );
+}
+
+interface AskAnythingCardProps {
+ /** Called with the typed question; the host app routes it to chat. */
+ onAsk: (question: string) => void;
+ /** Example placeholder question. */
+ placeholder?: string;
+}
+
+/**
+ * Overview tile with a single input that drops the user straight into chat
+ * with their question pre-asked. Chat accepts a `?q=` deep link; the host
+ * wires `onAsk` to that navigation.
+ */
+export function AskAnythingCard({
+ onAsk,
+ placeholder = "How does authentication work?",
+}: AskAnythingCardProps) {
+ const [question, setQuestion] = React.useState("");
+
+ function handleSubmit(e: React.FormEvent) {
+ e.preventDefault();
+ const q = question.trim();
+ if (q) onAsk(q);
+ }
+
+ return (
+ <Card className="flex h-full flex-col p-4">
+ <span className="flex items-center gap-2 text-sm font-semibold text-[var(--color-text-primary)]">
+ <MessageCircleQuestion className="h-4 w-4 text-[var(--color-accent-primary)]" />
+ Ask this codebase
+ </span>
+ <p className="mt-3 text-sm text-[var(--color-text-secondary)]">
+ Plain-language answers with citations, grounded in the index.
+ </p>
+ <form onSubmit={handleSubmit} className="mt-auto flex items-center gap-2 pt-3">
+ <input
+ type="text"
+ value={question}
+ onChange={(e) => setQuestion(e.target.value)}
+ placeholder={placeholder}
+ aria-label="Ask a question about this codebase"
+ className="h-9 w-full min-w-0 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] px-3 text-sm text-[var(--color-text-primary)] placeholder:text-[var(--color-text-tertiary)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-accent-primary)]"
+ />
+ <button
+ type="submit"
+ disabled={!question.trim()}
+ aria-label="Ask"
+ className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-[var(--color-accent-fill)] text-[var(--color-text-on-accent)] transition-opacity hover:opacity-90 disabled:opacity-40"
+ >
+ <ArrowRight className="h-4 w-4" />
+ </button>
+ </form>
+ </Card>
+ );
+}
diff --git a/packages/ui/src/dashboard/index.ts b/packages/ui/src/dashboard/index.ts
index e57c5a960..3eff543b9 100644
--- a/packages/ui/src/dashboard/index.ts
+++ b/packages/ui/src/dashboard/index.ts
@@ -16,3 +16,4 @@ export * from "./ownership-treemap";
export * from "./active-job-banner";
export * from "./quick-actions";
export * from "./community-summary-grid";
+export * from "./explore-cards";
diff --git a/packages/web/src/app/icon.png b/packages/web/src/app/icon.png
new file mode 100644
index 000000000..268fd0a4f
Binary files /dev/null and b/packages/web/src/app/icon.png differ
diff --git a/packages/web/src/app/not-found.tsx b/packages/web/src/app/not-found.tsx
new file mode 100644
index 000000000..f0dd0dcd8
--- /dev/null
+++ b/packages/web/src/app/not-found.tsx
@@ -0,0 +1,28 @@
+import Link from "next/link";
+import { Compass, ChevronLeft } from "lucide-react";
+
+export default function NotFound() {
+ return (
+ <div className="flex min-h-[60vh] flex-col items-center justify-center gap-4 px-6 text-center">
+ <div className="rounded-full bg-[var(--color-bg-elevated)] border border-[var(--color-border-default)] p-4">
+ <Compass className="h-8 w-8 text-[var(--color-text-tertiary)]" />
+ </div>
+ <div className="space-y-1">
+ <h1 className="text-lg font-semibold text-[var(--color-text-primary)]">
+ Page not found
+ </h1>
+ <p className="max-w-md text-sm text-[var(--color-text-secondary)]">
+ The page you requested doesn&apos;t exist. It may have been moved or
+ never existed.
+ </p>
+ </div>
+ <Link
+ href="/"
+ className="inline-flex items-center gap-1 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] px-3 py-1.5 text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] transition-colors"
+ >
+ <ChevronLeft className="h-4 w-4" />
+ Back to dashboard
+ </Link>
+ </div>
+ );
+}
diff --git a/packages/web/src/app/page.tsx b/packages/web/src/app/page.tsx
index 6fc63893e..bdadf1740 100644
--- a/packages/web/src/app/page.tsx
+++ b/packages/web/src/app/page.tsx
@@ -21,6 +21,7 @@ import { Badge } from "@repowise-dev/ui/ui/badge";
import { EmptyState } from "@repowise-dev/ui/shared/empty-state";
import { formatRelativeTime, formatNumber } from "@repowise-dev/ui/lib/format";
import { DeleteRepoButton } from "@/components/repos/delete-repo-button";
+import { EmptyReposState } from "@/components/repos/empty-repos-state";
import { LiveJobProgress } from "@/components/jobs/live-job-progress";
export const metadata: Metadata = { title: "Dashboard" };
@@ -122,24 +123,8 @@ export default async function DashboardPage() {
</CardHeader>
<CardContent className="p-0">
{repoList.length === 0 ? (
- <div className="px-6 pb-6 space-y-2">
- <EmptyState
- title="No repositories yet"
- description="Run repowise init on a repository to get started."
- icon={<FileText className="h-8 w-8" />}
- />
- <p className="text-center text-xs text-[var(--color-text-tertiary)]">
- New here? See the{" "}
- <a
- href="https://github.com/repowise-dev/repowise#quick-start"
- target="_blank"
- rel="noreferrer"
- className="text-[var(--color-accent-primary)] hover:underline"
- >
- setup guide
- </a>
- .
- </p>
+ <div className="px-6 pb-6">
+ <EmptyReposState />
</div>
) : (
<ul className="divide-y divide-[var(--color-border-default)]">
@@ -217,7 +202,7 @@ export default async function DashboardPage() {
<div className="px-6 pb-6">
<EmptyState
title="No jobs yet"
- description="Jobs appear after running repowise init or sync."
+ description="Indexing and sync runs show up here, with live progress."
icon={<Activity className="h-8 w-8" />}
/>
</div>
diff --git a/packages/web/src/app/repos/[id]/overview/page.tsx b/packages/web/src/app/repos/[id]/overview/page.tsx
index 347b89c23..edb7a7510 100644
--- a/packages/web/src/app/repos/[id]/overview/page.tsx
+++ b/packages/web/src/app/repos/[id]/overview/page.tsx
@@ -14,6 +14,8 @@ import { KpiStrip, kpiDelta, type KpiItem } from "@repowise-dev/ui/dashboard/kpi
import { OverviewGrid } from "@repowise-dev/ui/dashboard/overview-grid";
import { SavingsMini } from "@repowise-dev/ui/dashboard/savings-mini";
import { LanguageDonut } from "@repowise-dev/ui/dashboard/language-donut";
+import { KnowledgeGraphCard } from "@repowise-dev/ui/dashboard/explore-cards";
+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";
@@ -131,7 +133,7 @@ export default async function OverviewPage({ params }: Props) {
? `Indexed ${formatRelativeTime(lastActivityAt)} — nothing to show yet`
: "This repo hasn't been indexed yet"
}
- description="Run a sync (above) or `repowise init` in the repo to populate the overview. Stats, attention items, and activity appear as soon as the first index lands."
+ description="Start a sync above to build the index. Stats, attention items, and activity appear as soon as the first index lands."
/>
) : (
<>
@@ -168,15 +170,17 @@ export default async function OverviewPage({ params }: Props) {
decisions={summary.recent_decisions}
/>
- {/* ── Languages (single canonical donut) ── */}
- {summary.languages.length > 0 && (
- <div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
+ {/* ── Languages + explore: donut alongside the graph and chat front-doors ── */}
+ <div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
+ {summary.languages.length > 0 && (
<LanguageDonut
distribution={langDistribution}
viewAllHref={`/repos/${id}/architecture?view=graph&colorMode=language`}
/>
- </div>
- )}
+ )}
+ <KnowledgeGraphCard href={`/repos/${id}/knowledge-graph`} />
+ <AskAnythingCardWrapper repoId={id} />
+ </div>
</>
)}
</PageShell>
diff --git a/packages/web/src/app/workspace/page.tsx b/packages/web/src/app/workspace/page.tsx
index 3b6a8c949..1def4b37d 100644
--- a/packages/web/src/app/workspace/page.tsx
+++ b/packages/web/src/app/workspace/page.tsx
@@ -12,6 +12,7 @@ import {
} from "lucide-react";
import { getWorkspace, getWorkspaceCoChanges } from "@/lib/api/workspace";
import { StatCard } from "@repowise-dev/ui/shared/stat-card";
+import { EmptyState } from "@repowise-dev/ui/shared/empty-state";
import { Card, CardContent, CardHeader, CardTitle } from "@repowise-dev/ui/ui/card";
import { RepoCard } from "@repowise-dev/ui/workspace/repo-card";
import { CrossRepoSummary } from "@repowise-dev/ui/workspace/cross-repo-summary";
@@ -159,6 +160,13 @@ export default async function WorkspaceDashboardPage() {
<h2 className="text-sm font-medium text-[var(--color-text-primary)] mb-3">
Repositories
</h2>
+ {wsRepos.length === 0 && (
+ <EmptyState
+ title="No repositories discovered yet"
+ description="Run `repowise init .` in the workspace root to scan for git repositories and index them. They show up here as soon as the scan lands."
+ icon={<Layers className="h-8 w-8" />}
+ />
+ )}
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
{wsRepos.map((wsRepo) => {
const status = wsRepo.status ?? (wsRepo.repo_id ? "indexed" : "needs_index");
diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsx
index 589a1d167..2241481c9 100644
--- a/packages/web/src/components/layout/sidebar.tsx
+++ b/packages/web/src/components/layout/sidebar.tsx
@@ -74,6 +74,18 @@ export function Sidebar({ repos = [], activeRepoId, workspace }: SidebarProps) {
}
}, [isDocsRoute]);
+ // Workspace group: collapsed unless the user is on a workspace route, so
+ // the (more used) per-repo navigation leads. Tracks route changes in both
+ // directions; manual toggles win while the route type is unchanged.
+ const isWorkspaceRoute = pathname?.startsWith("/workspace") ?? false;
+ const [workspaceNavOpen, setWorkspaceNavOpen] = React.useState(isWorkspaceRoute);
+ const wasWorkspaceRoute = React.useRef(isWorkspaceRoute);
+ React.useEffect(() => {
+ if (isWorkspaceRoute === wasWorkspaceRoute.current) return;
+ wasWorkspaceRoute.current = isWorkspaceRoute;
+ setWorkspaceNavOpen(isWorkspaceRoute);
+ }, [isWorkspaceRoute]);
+
const toggleRepo = (id: string) => {
setExpandedRepos((prev) => {
const next = new Set(prev);
@@ -135,28 +147,42 @@ export function Sidebar({ repos = [], activeRepoId, workspace }: SidebarProps) {
<SidebarSearchButton iconOnly={isIconOnly} />
</nav>
- {/* Workspace nav — only shown in workspace mode */}
+ {/* Workspace nav — only shown in workspace mode. Collapsed by
+ default: per-repo navigation is the primary surface, so the
+ cross-repo views tuck behind a toggle unless one is active. */}
{isWorkspace && (
<>
+ <Separator className="my-4" />
{!isIconOnly && (
- <>
- <Separator className="my-4" />
- <p className="mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">
- Workspace
- </p>
- </>
+ <button
+ onClick={() => setWorkspaceNavOpen((v) => !v)}
+ aria-expanded={workspaceNavOpen}
+ aria-controls="sidebar-workspace-nav"
+ className="mb-1 flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-secondary)]"
+ >
+ <span className="flex-1 truncate text-left">Workspace</span>
+ {workspaceNavOpen ? (
+ <ChevronDown className="h-3.5 w-3.5 shrink-0 opacity-60" />
+ ) : (
+ <ChevronRight className="h-3.5 w-3.5 shrink-0 opacity-60" />
+ )}
+ </button>
+ )}
+ {(isIconOnly || workspaceNavOpen) && (
+ <nav className="space-y-1" id="sidebar-workspace-nav">
+ {(isIconOnly && !isWorkspaceRoute
+ ? WORKSPACE_NAV.slice(0, 1)
+ : WORKSPACE_NAV
+ ).map((item) => (
+ <SidebarNavItem
+ key={item.href}
+ item={item}
+ isActive={item.exact ? pathname === item.href : pathname.startsWith(`${item.href}`)}
+ iconOnly={isIconOnly}
+ />
+ ))}
+ </nav>
)}
- {isIconOnly && <Separator className="my-4" />}
- <nav className="space-y-1">
- {WORKSPACE_NAV.map((item) => (
- <SidebarNavItem
- key={item.href}
- item={item}
- isActive={item.exact ? pathname === item.href : pathname.startsWith(`${item.href}`)}
- iconOnly={isIconOnly}
- />
- ))}
- </nav>
</>
)}
@@ -342,8 +368,9 @@ export function Sidebar({ repos = [], activeRepoId, workspace }: SidebarProps) {
{repos.length === 0 && !isIconOnly && (
<>
<Separator className="my-4" />
+ {/* First run: no repos to list, so the add action carries the sidebar. */}
<div className="px-0.5">
- <AddRepoDialog variant="sidebar" />
+ <AddRepoDialog />
</div>
</>
)}
diff --git a/packages/web/src/components/overview/ask-anything-card-wrapper.tsx b/packages/web/src/components/overview/ask-anything-card-wrapper.tsx
new file mode 100644
index 000000000..8b503a9c9
--- /dev/null
+++ b/packages/web/src/components/overview/ask-anything-card-wrapper.tsx
@@ -0,0 +1,16 @@
+"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/repos/add-repo-dialog.tsx b/packages/web/src/components/repos/add-repo-dialog.tsx
index c17f62435..4e2bb9a2e 100644
--- a/packages/web/src/components/repos/add-repo-dialog.tsx
+++ b/packages/web/src/components/repos/add-repo-dialog.tsx
@@ -1,7 +1,9 @@
"use client";
import { useState } from "react";
+import { useRouter } from "next/navigation";
import { Plus } from "lucide-react";
+import { toast } from "sonner";
import { useSWRConfig } from "swr";
import { createRepo } from "@/lib/api/repos";
import { Button } from "@repowise-dev/ui/ui/button";
@@ -18,11 +20,24 @@ import { Input } from "@repowise-dev/ui/ui/input";
interface Props {
/** Render as a sidebar button (icon + label) vs standalone button */
variant?: "sidebar" | "default";
+ /** Controlled open state — pass both to drive the dialog from an external trigger. */
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
+ /** Hide the built-in trigger button (for externally-triggered use). */
+ showTrigger?: boolean;
}
-export function AddRepoDialog({ variant = "default" }: Props) {
+export function AddRepoDialog({
+ variant = "default",
+ open: controlledOpen,
+ onOpenChange,
+ showTrigger = true,
+}: Props) {
const { mutate } = useSWRConfig();
- const [open, setOpen] = useState(false);
+ const router = useRouter();
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
+ const open = controlledOpen ?? uncontrolledOpen;
+ const setOpen = onOpenChange ?? setUncontrolledOpen;
const [name, setName] = useState("");
const [localPath, setLocalPath] = useState("");
const [url, setUrl] = useState("");
@@ -44,7 +59,7 @@ export function AddRepoDialog({ variant = "default" }: Props) {
setSubmitting(true);
setError(null);
try {
- await createRepo({
+ const repo = await createRepo({
name: name.trim(),
local_path: localPath.trim(),
url: url.trim() || undefined,
@@ -54,6 +69,10 @@ export function AddRepoDialog({ variant = "default" }: Props) {
await mutate("/api/repos");
setOpen(false);
reset();
+ toast.success(`Added ${repo.name}`);
+ // Land on the new repo's overview, where the sync actions live.
+ router.push(`/repos/${repo.id}/overview`);
+ router.refresh();
} catch (e) {
setError(e instanceof Error ? e.message : "Failed to add repository");
} finally {
@@ -63,7 +82,7 @@ export function AddRepoDialog({ variant = "default" }: Props) {
return (
<>
- {variant === "sidebar" ? (
+ {!showTrigger ? null : variant === "sidebar" ? (
<button
type="button"
onClick={() => setOpen(true)}
diff --git a/packages/web/src/components/repos/delete-repo-button.tsx b/packages/web/src/components/repos/delete-repo-button.tsx
index 59b687c35..3e672035b 100644
--- a/packages/web/src/components/repos/delete-repo-button.tsx
+++ b/packages/web/src/components/repos/delete-repo-button.tsx
@@ -67,8 +67,9 @@ export function DeleteRepoButton({
e.stopPropagation();
setOpen(true);
}}
- className="opacity-0 group-hover:opacity-100 p-1 text-[var(--color-text-tertiary)] hover:text-[var(--color-error)] transition-all"
+ className="p-1 text-[var(--color-text-tertiary)] hover:text-[var(--color-error)] transition-all md:opacity-0 md:group-hover:opacity-100 md:focus-visible:opacity-100"
title="Delete repository"
+ aria-label={`Delete ${repoName}`}
>
<Trash2 className="h-3.5 w-3.5" />
</button>
diff --git a/packages/web/src/components/repos/empty-repos-state.tsx b/packages/web/src/components/repos/empty-repos-state.tsx
new file mode 100644
index 000000000..d6887e152
--- /dev/null
+++ b/packages/web/src/components/repos/empty-repos-state.tsx
@@ -0,0 +1,38 @@
+"use client";
+
+import { useState } from "react";
+import { FolderGit2 } from "lucide-react";
+import { EmptyState } from "@repowise-dev/ui/shared/empty-state";
+import { AddRepoDialog } from "@/components/repos/add-repo-dialog";
+
+/**
+ * First-run state for the dashboard's repository list: a one-click path into
+ * the add-repository dialog, with the CLI and docs as secondary routes.
+ */
+export function EmptyReposState() {
+ const [open, setOpen] = useState(false);
+
+ return (
+ <div className="space-y-2">
+ <EmptyState
+ title="No repositories yet"
+ description="Point repowise at a local git repository to build its index, docs, and health signals."
+ icon={<FolderGit2 className="h-8 w-8" />}
+ action={{ label: "Add repository", onClick: () => setOpen(true) }}
+ />
+ <p className="text-center text-xs text-[var(--color-text-tertiary)]">
+ Prefer the terminal? Run <code className="font-mono">repowise init</code> in a repo, or see the{" "}
+ <a
+ href="https://github.com/repowise-dev/repowise#quick-start"
+ target="_blank"
+ rel="noreferrer"
+ className="text-[var(--color-accent-primary)] hover:underline"
+ >
+ setup guide
+ </a>
+ .
+ </p>
+ <AddRepoDialog showTrigger={false} open={open} onOpenChange={setOpen} />
+ </div>
+ );
+}