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
finalizing UI
swati51060b34d051e2e
diff --git a/.claude/settings.local.json b/.claude/settings.local.jsonindex fa47bb98e..5f7b7fcea 100644--- a/.claude/settings.local.json+++ b/.claude/settings.local.json@@ -164,7 +164,30 @@"Bash(pip show:*)","Read(//Users/swati.ahuja/**)","Bash(head -20 grep -rn \"wiki.db\\\\|db_path\\\\|database_url\\\\|engine\\\\|DB_URL\" /Users/swati.ahuja/Desktop/wise/repowise/packages/server/src/repowise/server/)",- "Bash(find /Users/swati.ahuja/Desktop/wise/repowise/venv/lib -path *repowise_core* -o -path *repowise/core*)"+ "Bash(find /Users/swati.ahuja/Desktop/wise/repowise/venv/lib -path *repowise_core* -o -path *repowise/core*)",+ "Bash(git rm:*)",+ "Bash(find /Users/swati.ahuja/Desktop/wise/repowise -name *.db -o -name .repowise -type d)",+ "Bash(find /Users/swati.ahuja/Desktop/wise/repowise/packages/web -name tailwind.config.* -o -name globals.css -o -name theme* -o -name *variables.css)",+ "Bash(find /Users/swati.ahuja/Desktop/wise/repowise/packages/web/src -name *.tsx -o -name *.ts)",+ "Bash(find /Users/swati.ahuja/Desktop/wise/repowise/packages/web -name repowise* -o -name logo*)",+ "Bash(mkdir -p /Users/swati.ahuja/Desktop/wise/repowise/packages/web/public)",+ "Bash(cp \"/Users/swati.ahuja/Desktop/wise/repowise/packages/web/src/repowise-logo .png\" /Users/swati.ahuja/Desktop/wise/repowise/packages/web/public/repowise-logo.png)",+ "Bash(npx next:*)",+ "Bash(grep -r 'GET /api/repos' /Users/swati.ahuja/Desktop/wise/repowise/packages/web/src --include=*.ts --include=*.tsx)",+ "Bash(grep -r \"useSWR\\\\|useQuery\\\\|setInterval\\\\|useEffect\" /Users/swati.ahuja/Desktop/wise/repowise/packages/web/src --include=*.ts --include=*.tsx -l)",+ "Bash(grep -r /api/repos/ /Users/swati.ahuja/Desktop/wise/repowise/packages/web/src --include=*.ts --include=*.tsx)",+ "Bash(grep -E \"\\\\.\\(ts|tsx\\)$\")",+ "Bash(grep -r \"localStorage\\\\|useContext\\\\|Context\" /Users/swati.ahuja/Desktop/wise/repowise/packages/web/src/lib --include=*.ts --include=*.tsx -l)",+ "Bash(wc -l /Users/swati.ahuja/Desktop/wise/repowise/repowise-hosted-frontend/src/components/landing/*.tsx)",+ "Bash(grep:*)",+ "Bash(find /Users/swati.ahuja/Desktop/wise/repowise/packages/web -name \"swr\\\\|next.config\\\\|package.json\")",+ "Bash(find /Users/swati.ahuja/Desktop/wise/repowise/packages/web/src/lib/api -type f -name *.ts)",+ "Bash(wc:*)",+ "Bash(find packages/web/src/components/graph packages/web/src/components/docs packages/web/src/components/wiki packages/web/src/components/git packages/web/src/components/dead-code packages/web/src/components/decisions packages/web/src/components/coverage packages/web/src/components/symbols packages/web/src/components/jobs -name *.tsx -o -name *.ts)",+ "Bash(find packages/web/src/lib -name *.ts -o -name *.tsx)",+ "Bash(npx tsc:*)",+ "Bash(kill %1)",+ "Bash(lsof -ti:3002)"]},"enableAllProjectMcpServers": true,diff --git a/packages/cli/src/repowise/cli/__init__.py b/packages/cli/src/repowise/cli/__init__.pyindex 2b7fcf18c..3002cc42d 100644--- a/packages/cli/src/repowise/cli/__init__.py+++ b/packages/cli/src/repowise/cli/__init__.py@@ -6,4 +6,4 @@ git signals, dead code detection, architectural decisions, andAI-generated documentation."""-__version__ = "0.1.24"+__version__ = "0.1.25"diff --git a/packages/web/src/repowise-logo .png b/packages/web/public/repowise-logo.pngsimilarity index 100%rename from packages/web/src/repowise-logo .pngrename to packages/web/public/repowise-logo.pngdiff --git a/packages/web/src/app/page.tsx b/packages/web/src/app/page.tsxindex f9a9a09c6..bebe9b5e7 100644--- a/packages/web/src/app/page.tsx+++ b/packages/web/src/app/page.tsx@@ -70,11 +70,11 @@ export default async function DashboardPage() {const stalePages = totalPages - freshPages;return (- <div className="p-4 sm:p-6 space-y-6 max-w-[1200px]">+ <div className="p-5 sm:p-8 space-y-8 max-w-[1200px]">{/* Header */}<div>- <h1 className="text-xl font-semibold text-[var(--color-text-primary)]">Dashboard</h1>- <p className="text-sm text-[var(--color-text-secondary)] mt-0.5">+ <h1 className="text-2xl font-semibold text-[var(--color-text-primary)]">Dashboard</h1>+ <p className="text-sm text-[var(--color-text-secondary)] mt-1">{repoList.length} {repoList.length === 1 ? "repository" : "repositories"} registered</p></div>diff --git a/packages/web/src/components/chat/chat-interface.tsx b/packages/web/src/components/chat/chat-interface.tsxindex c29d0ac11..f06c6f437 100644--- a/packages/web/src/components/chat/chat-interface.tsx+++ b/packages/web/src/components/chat/chat-interface.tsx@@ -1,6 +1,7 @@"use client";import { useRef, useEffect, useState, useCallback } from "react";+import Image from "next/image";import { Send, StopCircle, PanelRight, MessageSquare } from "lucide-react";import { Button } from "@/components/ui/button";import { ScrollArea } from "@/components/ui/scroll-area";@@ -101,7 +102,7 @@ export function ChatInterface({ repoId, repoName }: ChatInterfaceProps) {<div className="flex h-full flex-col min-h-0">{/* Header bar (when active conversation) */}{!isEmpty && (- <div className="flex items-center justify-between px-4 py-2 border-b border-[var(--color-border-default)] shrink-0 bg-[var(--color-bg-surface)]/95 backdrop-blur-sm">+ <div className="flex items-center justify-between px-4 py-2.5 border-b border-[var(--color-border-default)] shrink-0 bg-[var(--color-bg-surface)]/95 backdrop-blur-sm"><div className="flex items-center gap-2"><ConversationHistoryrepoId={repoId}@@ -115,10 +116,10 @@ export function ChatInterface({ repoId, repoName }: ChatInterfaceProps) {<Buttonvariant="ghost"size="sm"- className="h-7 text-xs gap-1"+ className="h-8 text-xs gap-1.5"onClick={() => setArtifactPanelOpen(true)}>- <PanelRight className="h-3.5 w-3.5" />+ <PanelRight className="h-4 w-4" />{totalArtifactCount}</Button>)}@@ -130,28 +131,32 @@ export function ChatInterface({ repoId, repoName }: ChatInterfaceProps) {{/* Message list or empty state */}<div className="flex-1 min-h-0 relative">{isEmpty ? (- <div className="flex flex-col items-center justify-center h-full gap-8 px-4">- <div className="text-center space-y-2">- <div className="flex items-center justify-center mb-4">- <div className="rounded-full bg-[var(--color-bg-elevated)] border border-[var(--color-border-default)] p-3">- <MessageSquare className="h-6 w-6 text-[var(--color-accent-primary)]" />- </div>+ <div className="flex flex-col items-center justify-center h-full gap-10 px-4">+ <div className="text-center space-y-3">+ <div className="flex items-center justify-center mb-6">+ <Image+ src="/repowise-logo.png"+ alt="repowise"+ width={48}+ height={48}+ className="drop-shadow-[0_0_12px_rgba(245,149,32,0.35)]"+ /></div>- <h2 className="text-lg font-semibold text-[var(--color-text-primary)]">+ <h2 className="text-xl font-semibold text-[var(--color-text-primary)]">Ask anything about {repoName ?? "this codebase"}</h2>- <p className="text-sm text-[var(--color-text-secondary)] max-w-md">+ <p className="text-sm text-[var(--color-text-secondary)] max-w-md leading-relaxed">Explore architecture, assess risk, search code, tracedependencies, and understand decisions.</p></div>{/* Suggestion chips */}- <div className="grid grid-cols-1 sm:grid-cols-2 gap-2 max-w-lg w-full">+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-2.5 max-w-xl w-full">{DEFAULT_SUGGESTIONS.map((s) => (<buttonkey={s}- className="text-left text-xs text-[var(--color-text-secondary)] rounded-lg border border-[var(--color-border-default)] px-3 py-2.5 hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] hover:border-[var(--color-border-hover)] transition-colors"+ className="text-left text-sm text-[var(--color-text-secondary)] rounded-xl border border-[var(--color-border-default)] px-4 py-3 hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] hover:border-[var(--color-border-hover)] transition-colors"onClick={() => handleSuggestion(s)}>{s}@@ -160,7 +165,7 @@ export function ChatInterface({ repoId, repoName }: ChatInterfaceProps) {</div>{/* Model selector for empty state */}- <div className="flex items-center gap-2">+ <div className="flex items-center gap-3"><span className="text-xs text-[var(--color-text-tertiary)]">Using:</span>@@ -175,7 +180,7 @@ export function ChatInterface({ repoId, repoName }: ChatInterfaceProps) {</div>) : (<ScrollArea className="h-full">- <div className="px-4 py-4 space-y-4 max-w-3xl mx-auto">+ <div className="px-4 py-6 space-y-5 max-w-3xl mx-auto">{messages.map((m) => (<ChatMessagekey={m.id}@@ -185,7 +190,7 @@ export function ChatInterface({ repoId, repoName }: ChatInterfaceProps) {/>))}{error && (- <div className="rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400">+ <div className="rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2.5 text-sm text-red-400">{error}</div>)}@@ -198,14 +203,14 @@ export function ChatInterface({ repoId, repoName }: ChatInterfaceProps) {{/* Input area */}<divclassName={cn(- "shrink-0 px-4 py-3",+ "shrink-0 px-4 py-4",!isEmpty && "border-t border-[var(--color-border-default)]",)}><div className="max-w-3xl mx-auto"><divclassName={cn(- "flex items-end gap-2 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] px-3 py-2",+ "flex items-end gap-2 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] px-4 py-3",isEmpty && "shadow-lg shadow-black/20",)}>@@ -226,19 +231,19 @@ export function ChatInterface({ repoId, repoName }: ChatInterfaceProps) {/><Buttonsize="icon"- className="h-7 w-7 shrink-0"+ className="h-8 w-8 shrink-0 rounded-xl"onClick={isStreaming ? reset : handleSubmit}disabled={!input.trim() && !isStreaming}>{isStreaming ? (- <StopCircle className="h-3.5 w-3.5" />+ <StopCircle className="h-4 w-4" />) : (- <Send className="h-3.5 w-3.5" />+ <Send className="h-4 w-4" />)}</Button></div>{isEmpty && (- <p className="text-center text-[10px] text-[var(--color-text-tertiary)] mt-2">+ <p className="text-center text-[11px] text-[var(--color-text-tertiary)] mt-2.5">Shift+Enter for newline · Enter to send</p>)}diff --git a/packages/web/src/components/chat/chat-message.tsx b/packages/web/src/components/chat/chat-message.tsxindex 63c89648f..40454ff78 100644--- a/packages/web/src/components/chat/chat-message.tsx+++ b/packages/web/src/components/chat/chat-message.tsx@@ -1,6 +1,7 @@"use client";-import { Bot, User } from "lucide-react";+import Image from "next/image";+import { User } from "lucide-react";import { cn } from "@/lib/utils/cn";import { ToolCallBlock } from "./tool-call-block";import { ChatMarkdown } from "./chat-markdown";@@ -17,20 +18,26 @@ export function ChatMessage({ message, repoId, onViewArtifact }: ChatMessagePropconst isUser = message.role === "user";return (- <div className={cn("flex gap-3", isUser && "flex-row-reverse")}>+ <div className={cn("flex gap-3.5", isUser && "flex-row-reverse")}>{/* Avatar */}<divclassName={cn(- "flex h-7 w-7 shrink-0 items-center justify-center rounded-full mt-0.5",+ "flex shrink-0 items-center justify-center rounded-full mt-0.5",isUser- ? "bg-[var(--color-accent-primary)]"- : "bg-[var(--color-bg-elevated)] border border-[var(--color-border-default)]",+ ? "h-8 w-8 bg-[var(--color-accent-primary)]"+ : "h-8 w-8 bg-[var(--color-bg-elevated)] border border-[var(--color-border-default)]",)}>{isUser ? (- <User className="h-3.5 w-3.5 text-white" />+ <User className="h-4 w-4 text-white" />) : (- <Bot className="h-3.5 w-3.5 text-[var(--color-text-tertiary)]" />+ <Image+ src="/repowise-logo.png"+ alt="repowise"+ width={22}+ height={22}+ className="drop-shadow-[0_0_4px_rgba(245,149,32,0.25)]"+ />)}</div>@@ -43,14 +50,14 @@ export function ChatMessage({ message, repoId, onViewArtifact }: ChatMessageProp>{/* User message */}{isUser && (- <div className="rounded-2xl rounded-tr-sm bg-[var(--color-accent-primary)] px-3.5 py-2 text-sm text-white max-w-[85%]">+ <div className="rounded-2xl rounded-tr-sm bg-[var(--color-accent-primary)] px-4 py-2.5 text-sm text-white max-w-[85%]">{message.text}</div>)}{/* Assistant message */}{!isUser && (- <div className="max-w-full space-y-1">+ <div className="max-w-full space-y-1.5">{/* Tool calls */}{message.toolCalls.length > 0 && (<div className="space-y-1">diff --git a/packages/web/src/components/layout/mobile-nav.tsx b/packages/web/src/components/layout/mobile-nav.tsxindex faee7aab7..a60a0fbdb 100644--- a/packages/web/src/components/layout/mobile-nav.tsx+++ b/packages/web/src/components/layout/mobile-nav.tsx@@ -3,6 +3,7 @@import * as React from "react";import Link from "next/link";import { usePathname } from "next/navigation";+import Image from "next/image";import {Menu,BookOpen,@@ -71,38 +72,45 @@ export function MobileNav({ repos = [] }: MobileNavProps) {}, [pathname]);return (- <div className="flex md:hidden h-12 items-center gap-3 px-4 border-b border-[var(--color-border-default)] bg-[var(--color-bg-surface)] shrink-0">+ <div className="flex md:hidden h-14 items-center gap-3 px-4 border-b border-[var(--color-border-default)] bg-[var(--color-bg-surface)] shrink-0"><Buttonvariant="ghost"size="icon"onClick={() => setOpen(true)}aria-label="Open navigation menu"- className="h-8 w-8"+ className="h-9 w-9"><Menu className="h-5 w-5" /></Button>- {/* Current page breadcrumb */}- <div className="flex items-center gap-1.5 min-w-0">- <div className="flex h-5 w-5 items-center justify-center rounded bg-[var(--color-accent-primary)] shrink-0">- <BookOpen className="h-3 w-3 text-[var(--color-text-inverse)]" />- </div>- <span className="text-sm font-semibold text-[var(--color-text-primary)] tracking-tight truncate">+ <div className="flex items-center gap-2 min-w-0">+ <Image+ src="/repowise-logo.png"+ alt="repowise"+ width={24}+ height={24}+ className="shrink-0 drop-shadow-[0_0_8px_rgba(245,149,32,0.3)]"+ />+ <span className="text-base font-semibold text-[var(--color-text-primary)] tracking-tight truncate">repowise</span></div><Sheet open={open} onOpenChange={setOpen}><SheetContent side="left" className="p-0">- <SheetHeader className="border-b border-[var(--color-border-default)] h-12 flex-row items-center gap-2.5 py-0">- <div className="flex h-6 w-6 items-center justify-center rounded bg-[var(--color-accent-primary)] shrink-0">- <BookOpen className="h-3.5 w-3.5 text-[var(--color-text-inverse)]" />- </div>- <SheetTitle>repowise</SheetTitle>+ <SheetHeader className="border-b border-[var(--color-border-default)] h-14 flex-row items-center gap-3 py-0 px-4">+ <Image+ src="/repowise-logo.png"+ alt="repowise"+ width={28}+ height={28}+ className="shrink-0 drop-shadow-[0_0_8px_rgba(245,149,32,0.3)]"+ />+ <SheetTitle className="text-base">repowise</SheetTitle></SheetHeader><ScrollArea className="flex-1">- <div className="p-2">- <nav className="space-y-0.5">+ <div className="px-3 py-3">+ <nav className="space-y-1">{GLOBAL_NAV.map((item) => {const Icon = item.icon;const isActive = pathname === item.href;@@ -111,13 +119,13 @@ export function MobileNav({ repos = [] }: MobileNavProps) {key={item.href}href={item.href}className={cn(- "flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors",+ "flex items-center gap-2.5 rounded-lg px-2 py-2 text-sm transition-colors",isActive? "bg-[var(--color-accent-muted)] text-[var(--color-accent-primary)]": "text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)]",)}>- <Icon className="h-4 w-4 shrink-0" />+ <Icon className="h-[18px] w-[18px] shrink-0" />{item.label}</Link>);@@ -126,8 +134,8 @@ export function MobileNav({ repos = [] }: MobileNavProps) {{repos.length > 0 && (<>- <Separator className="my-3" />- <p className="mb-1.5 px-2 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">+ <Separator className="my-4" />+ <p className="mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">Repositories</p><div className="space-y-0.5">@@ -138,20 +146,20 @@ export function MobileNav({ repos = [] }: MobileNavProps) {<div key={repo.id}><buttononClick={() => toggleRepo(repo.id)}- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-[var(--color-bg-elevated)] text-[var(--color-text-secondary)]"+ className="flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-sm transition-colors hover:bg-[var(--color-bg-elevated)] text-[var(--color-text-secondary)]"><Circle className="h-2 w-2 shrink-0 fill-[var(--color-text-tertiary)] text-[var(--color-text-tertiary)]" /><span className="flex-1 truncate text-left font-medium">{repo.name}</span>{isExpanded ? (- <ChevronDown className="h-3.5 w-3.5 shrink-0 opacity-50" />+ <ChevronDown className="h-4 w-4 shrink-0 opacity-40" />) : (- <ChevronRight className="h-3.5 w-3.5 shrink-0 opacity-50" />+ <ChevronRight className="h-4 w-4 shrink-0 opacity-40" />)}</button>{isExpanded && (- <div className="ml-3 mt-0.5 space-y-0.5 border-l border-[var(--color-border-default)] pl-3">+ <div className="ml-3.5 mt-0.5 space-y-0.5 border-l border-[var(--color-border-default)] pl-3">{navItems.map((item) => {const Icon = item.icon;const isActive =@@ -162,13 +170,13 @@ export function MobileNav({ repos = [] }: MobileNavProps) {key={item.href}href={item.href}className={cn(- "flex items-center gap-2 rounded-md px-2 py-1 text-xs transition-colors",+ "flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-[13px] transition-colors",isActive? "bg-[var(--color-accent-muted)] text-[var(--color-accent-primary)]": "text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)]",)}>- <Icon className="h-3.5 w-3.5 shrink-0" />+ <Icon className="h-4 w-4 shrink-0" />{item.label}</Link>);@@ -179,7 +187,7 @@ export function MobileNav({ repos = [] }: MobileNavProps) {);})}</div>- <div className="mt-1 px-0.5">+ <div className="mt-2 px-0.5"><AddRepoDialog variant="sidebar" /></div></>@@ -187,7 +195,7 @@ export function MobileNav({ repos = [] }: MobileNavProps) {{repos.length === 0 && (<>- <Separator className="my-3" />+ <Separator className="my-4" /><div className="px-0.5"><AddRepoDialog variant="sidebar" /></div>@@ -196,8 +204,8 @@ export function MobileNav({ repos = [] }: MobileNavProps) {</div></ScrollArea>- <div className="border-t border-[var(--color-border-default)] p-3">- <p className="text-xs text-[var(--color-text-tertiary)] text-center">repowise v0.1.0</p>+ <div className="border-t border-[var(--color-border-default)] px-4 py-3">+ <p className="text-xs text-[var(--color-text-tertiary)]">repowise v0.1.0</p></div></SheetContent></Sheet>diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsxindex c9460f637..d42c391f0 100644--- a/packages/web/src/components/layout/sidebar.tsx+++ b/packages/web/src/components/layout/sidebar.tsx@@ -3,6 +3,7 @@import * as React from "react";import Link from "next/link";import { usePathname } from "next/navigation";+import Image from "next/image";import {LayoutDashboard,BookOpen,@@ -39,6 +40,7 @@ const GLOBAL_NAV: NavItem[] = [{ label: "Settings", href: "/settings", icon: Settings },];+function repoNavItems(repoId: string): NavItem[] {return [{ label: "Chat", href: `/repos/${repoId}`, icon: MessageSquare },@@ -65,7 +67,6 @@ export function Sidebar({ repos = [], activeRepoId }: SidebarProps) {const [expandedRepos, setExpandedRepos] = React.useState<Set<string>>(activeRepoId ? new Set([activeRepoId]) : new Set(),);- // On lg screens, start expanded if a repo is activeconst [collapsed, setCollapsed] = React.useState(false);const toggleRepo = (id: string) => {@@ -83,32 +84,36 @@ export function Sidebar({ repos = [], activeRepoId }: SidebarProps) {<asideclassName={cn("hidden md:flex h-full flex-col border-r border-[var(--color-border-default)] bg-[var(--color-bg-surface)] transition-all duration-200 shrink-0",- isIconOnly ? "w-[52px]" : "w-[260px]",+ isIconOnly ? "w-[56px]" : "w-[260px]",)}>{/* Logo */}- <div className="flex h-12 items-center gap-2.5 px-3 border-b border-[var(--color-border-default)]">- <div className="flex h-6 w-6 items-center justify-center rounded bg-[var(--color-accent-primary)] shrink-0">- <BookOpen className="h-3.5 w-3.5 text-[var(--color-text-inverse)]" />- </div>+ <div className="flex h-14 items-center gap-3 px-4">+ <Image+ src="/repowise-logo.png"+ alt="repowise"+ width={28}+ height={28}+ className="shrink-0 drop-shadow-[0_0_8px_rgba(245,149,32,0.3)]"+ />{!isIconOnly && (- <span className="text-sm font-semibold text-[var(--color-text-primary)] tracking-tight flex-1 truncate">+ <span className="text-base font-semibold text-[var(--color-text-primary)] tracking-tight flex-1 truncate">repowise</span>)}<buttononClick={() => setCollapsed((c) => !c)}- className="ml-auto shrink-0 rounded p-1 text-[var(--color-text-tertiary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-secondary)] transition-colors"+ className="ml-auto shrink-0 rounded-md p-1.5 text-[var(--color-text-tertiary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-secondary)] transition-colors"aria-label={isIconOnly ? "Expand sidebar" : "Collapse sidebar"}>- <PanelLeft className={cn("h-3.5 w-3.5 transition-transform", isIconOnly && "rotate-180")} />+ <PanelLeft className={cn("h-4 w-4 transition-transform", isIconOnly && "rotate-180")} /></button></div><ScrollArea className="flex-1">- <div className={cn("p-2", isIconOnly && "px-1.5")}>+ <div className={cn("px-3 py-2", isIconOnly && "px-2")}>{/* Global nav */}- <nav className="space-y-0.5">+ <nav className="space-y-1">{GLOBAL_NAV.map((item) => (<SidebarNavItemkey={item.href}@@ -117,19 +122,20 @@ export function Sidebar({ repos = [], activeRepoId }: SidebarProps) {iconOnly={isIconOnly}/>))}+</nav>{repos.length > 0 && (<>{!isIconOnly && (<>- <Separator className="my-3" />- <p className="mb-1.5 px-2 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">+ <Separator className="my-4" />+ <p className="mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">Repositories</p></>)}- {isIconOnly && <Separator className="my-3" />}+ {isIconOnly && <Separator className="my-4" />}<div className="space-y-0.5">{repos.map((repo) => {const isExpanded = expandedRepos.has(repo.id);@@ -161,7 +167,7 @@ export function Sidebar({ repos = [], activeRepoId }: SidebarProps) {<buttononClick={() => toggleRepo(repo.id)}className={cn(- "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-[var(--color-bg-elevated)]",+ "flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-sm transition-colors hover:bg-[var(--color-bg-elevated)]",isActive? "text-[var(--color-text-primary)]": "text-[var(--color-text-secondary)]",@@ -174,13 +180,13 @@ export function Sidebar({ repos = [], activeRepoId }: SidebarProps) {{repo.name}</span>{isExpanded ? (- <ChevronDown className="h-3.5 w-3.5 shrink-0 opacity-50" />+ <ChevronDown className="h-4 w-4 shrink-0 opacity-40" />) : (- <ChevronRight className="h-3.5 w-3.5 shrink-0 opacity-50" />+ <ChevronRight className="h-4 w-4 shrink-0 opacity-40" />)}</button>{isExpanded && (- <div className="ml-3 mt-0.5 space-y-0.5 border-l border-[var(--color-border-default)] pl-3">+ <div className="ml-3.5 mt-0.5 space-y-0.5 border-l border-[var(--color-border-default)] pl-3">{navItems.map((item) => (<SidebarNavItemkey={item.href}@@ -198,7 +204,7 @@ export function Sidebar({ repos = [], activeRepoId }: SidebarProps) {</div>{!isIconOnly && (- <div className="mt-1 px-0.5">+ <div className="mt-2 px-0.5"><AddRepoDialog variant="sidebar" /></div>)}@@ -207,7 +213,7 @@ export function Sidebar({ repos = [], activeRepoId }: SidebarProps) {{repos.length === 0 && !isIconOnly && (<>- <Separator className="my-3" />+ <Separator className="my-4" /><div className="px-0.5"><AddRepoDialog variant="sidebar" /></div>@@ -218,8 +224,8 @@ export function Sidebar({ repos = [], activeRepoId }: SidebarProps) {{/* Footer */}{!isIconOnly && (- <div className="border-t border-[var(--color-border-default)] p-3">- <p className="text-xs text-[var(--color-text-tertiary)] text-center">+ <div className="border-t border-[var(--color-border-default)] px-4 py-3">+ <p className="text-xs text-[var(--color-text-tertiary)]">repowise v0.1.0</p></div>@@ -249,13 +255,13 @@ function SidebarNavItem({href={item.href}aria-label={item.label}className={cn(- "flex items-center justify-center rounded-md p-2 transition-colors",+ "flex items-center justify-center rounded-lg p-2.5 transition-colors",isActive? "bg-[var(--color-accent-muted)] text-[var(--color-accent-primary)]": "text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)]",)}>- <Icon className="h-4 w-4 shrink-0" />+ <Icon className="h-4.5 w-4.5 shrink-0" /></Link></TooltipTrigger><TooltipContent side="right">{item.label}</TooltipContent>@@ -267,15 +273,16 @@ function SidebarNavItem({<Linkhref={item.href}className={cn(- "flex items-center gap-2 rounded-md px-2 transition-colors",- size === "sm" ? "py-1 text-xs" : "py-1.5 text-sm",+ "flex items-center gap-2.5 rounded-lg px-2 transition-colors",+ size === "sm" ? "py-1.5 text-[13px]" : "py-2 text-sm",isActive? "bg-[var(--color-accent-muted)] text-[var(--color-accent-primary)]": "text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)]",)}>- <Icon className={cn("shrink-0", size === "sm" ? "h-3.5 w-3.5" : "h-4 w-4")} />+ <Icon className={cn("shrink-0", size === "sm" ? "h-4 w-4" : "h-[18px] w-[18px]")} /><span className="truncate">{item.label}</span></Link>);}+diff --git a/packages/web/src/lib/hooks/use-repo.ts b/packages/web/src/lib/hooks/use-repo.tsindex e7f6e36f0..71c2b9def 100644--- a/packages/web/src/lib/hooks/use-repo.ts+++ b/packages/web/src/lib/hooks/use-repo.ts@@ -2,13 +2,30 @@import useSWR from "swr";import { listRepos, getRepo } from "@/lib/api/repos";+import { ApiClientError } from "@/lib/api/client";import type { RepoResponse } from "@/lib/api/types";+/** Stop retrying when the resource simply doesn't exist. */+function skipRetryOn404(+ err: unknown,+ _key: string,+ _config: unknown,+ revalidate: (opts: { retryCount: number }) => void,+ { retryCount }: { retryCount: number },+) {+ if (err instanceof ApiClientError && err.status === 404) return;+ if (retryCount >= 3) return;+ setTimeout(+ () => revalidate({ retryCount: retryCount + 1 }),+ 5_000 * Math.min(2 ** retryCount, 8),+ );+}+export function useRepos() {const { data, error, isLoading, mutate } = useSWR<RepoResponse[]>("repos",() => listRepos(),- { refreshInterval: 30_000 },+ { refreshInterval: 30_000, onErrorRetry: skipRetryOn404 },);return { repos: data ?? [], error, isLoading, mutate };}@@ -17,7 +34,7 @@ export function useRepo(repoId: string | null) {const { data, error, isLoading, mutate } = useSWR<RepoResponse>(repoId ? `repo:${repoId}` : null,() => getRepo(repoId!),- { refreshInterval: 30_000 },+ { refreshInterval: 30_000, onErrorRetry: skipRetryOn404 },);return { repo: data, error, isLoading, mutate };}diff --git a/packages/web/src/repowise-logo.png b/packages/web/src/repowise-logo.pngnew file mode 100644index 000000000..d7f40440eBinary files /dev/null and b/packages/web/src/repowise-logo.png differdiff --git a/packages/web/src/styles/globals.css b/packages/web/src/styles/globals.cssindex 54a1bca15..ef4974072 100644--- a/packages/web/src/styles/globals.css+++ b/packages/web/src/styles/globals.css@@ -11,33 +11,33 @@/* ------------------------------------------------------------------ *//* Core Surfaces *//* ------------------------------------------------------------------ */- --color-bg-root: #0a0a0a;- --color-bg-surface: #111111;- --color-bg-elevated: #171717;- --color-bg-overlay: #1a1a1a;- --color-bg-inset: #080808;+ --color-bg-root: #0d0d0d;+ --color-bg-surface: #141414;+ --color-bg-elevated: #1c1c1c;+ --color-bg-overlay: #202020;+ --color-bg-inset: #0a0a0a;/* ------------------------------------------------------------------ *//* Borders *//* ------------------------------------------------------------------ */- --color-border-default: rgba(255, 255, 255, 0.08);- --color-border-hover: rgba(255, 255, 255, 0.15);- --color-border-active: rgba(255, 255, 255, 0.25);+ --color-border-default: rgba(255, 255, 255, 0.06);+ --color-border-hover: rgba(255, 255, 255, 0.12);+ --color-border-active: rgba(255, 255, 255, 0.20);/* ------------------------------------------------------------------ *//* Text *//* ------------------------------------------------------------------ */- --color-text-primary: #f0f0f0;- --color-text-secondary: #a0a0a0;- --color-text-tertiary: #666666;- --color-text-inverse: #0a0a0a;+ --color-text-primary: #ececec;+ --color-text-secondary: #999999;+ --color-text-tertiary: #5c5c5c;+ --color-text-inverse: #0d0d0d;/* ------------------------------------------------------------------ */- /* Accent — repowise Blue */+ /* Accent — repowise Orange *//* ------------------------------------------------------------------ */- --color-accent-primary: #5b9cf6;- --color-accent-hover: #7bb3f7;- --color-accent-muted: rgba(91, 156, 246, 0.15);+ --color-accent-primary: #f59520;+ --color-accent-hover: #f7a94d;+ --color-accent-muted: rgba(245, 149, 32, 0.15);/* ------------------------------------------------------------------ *//* Confidence System */@@ -52,7 +52,7 @@--color-success: #22c55e;--color-warning: #eab308;--color-error: #ef4444;- --color-info: #5b9cf6;+ --color-info: #f59520;/* ------------------------------------------------------------------ *//* Graph — React Flow */@@ -79,7 +79,7 @@/* ------------------------------------------------------------------ *//* Edge Colors (graph edges) *//* ------------------------------------------------------------------ */- --color-edge-imports: #5b9cf6;+ --color-edge-imports: #f59520;--color-edge-calls: #22c55e;--color-edge-inherits: #a855f7;--color-edge-implements: #ec4899;@@ -91,13 +91,13 @@--font-sans: "Geist", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;--font-mono: "Geist Mono", "JetBrains Mono", "Fira Code", monospace;- --text-xs: 0.75rem;- --text-sm: 0.8125rem;- --text-base: 0.875rem;- --text-lg: 1rem;- --text-xl: 1.25rem;- --text-2xl: 1.5rem;- --text-3xl: 2rem;+ --text-xs: 0.8125rem;+ --text-sm: 0.875rem;+ --text-base: 0.9375rem;+ --text-lg: 1.0625rem;+ --text-xl: 1.375rem;+ --text-2xl: 1.75rem;+ --text-3xl: 2.25rem;--leading-tight: 1.3;--leading-normal: 1.5;@@ -120,10 +120,10 @@/* ------------------------------------------------------------------ *//* Radii *//* ------------------------------------------------------------------ */- --radius-sm: 4px;- --radius-md: 6px;- --radius-lg: 8px;- --radius-xl: 12px;+ --radius-sm: 6px;+ --radius-md: 8px;+ --radius-lg: 10px;+ --radius-xl: 14px;/* ------------------------------------------------------------------ *//* Z-Index Scale */@@ -290,7 +290,7 @@ body {--xy-controls-button-border-color: var(--color-border-default);--xy-controls-button-color: var(--color-text-secondary);--xy-controls-button-color-hover: var(--color-text-primary);- --xy-edge-stroke: rgba(91, 156, 246, 0.3);+ --xy-edge-stroke: rgba(245, 149, 32, 0.3);--xy-edge-stroke-selected: var(--color-accent-graph);--xy-node-border-radius: var(--radius-lg);}diff --git a/pyproject.toml b/pyproject.tomlindex b23c55d61..8c7daee78 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"[project]name = "repowise"-version = "0.1.24"+version = "0.1.25"description = "Codebase intelligence for developers and AI — generates and maintains a structured wiki for any codebase"readme = "README.md"requires-python = ">=3.11"diff --git a/scripts/extract-demo-data.py b/scripts/extract-demo-data.pynew file mode 100644index 000000000..ab24f0f07--- /dev/null+++ b/scripts/extract-demo-data.py@@ -0,0 +1,457 @@+#!/usr/bin/env python3+"""Extract data from fastapi/.repowise/wiki.db into static JSON files for the hosted frontend demo."""++import json+import os+import sqlite3+from collections import defaultdict+from pathlib import Path++DB_PATH = Path(__file__).parent.parent / "fastapi" / ".repowise" / "wiki.db"+OUT_DIR = Path(__file__).parent.parent / "repowise-hosted-frontend" / "public" / "data" / "fastapi"+REPO_ID = "4912f43143cb4cb881ee805268de797c"+++def write_json(filename: str, data):+ path = OUT_DIR / filename+ with open(path, "w") as f:+ json.dump(data, f, separators=(",", ":"), default=str)+ size_kb = path.stat().st_size / 1024+ print(f" {filename}: {size_kb:.1f} KB")+++def extract_repo(cur):+ row = cur.execute(+ "SELECT id, name, url, local_path, default_branch, head_commit, settings_json, created_at, updated_at FROM repositories WHERE id = ?",+ (REPO_ID,),+ ).fetchone()+ if not row:+ raise RuntimeError(f"Repo {REPO_ID} not found")+ repo = {+ "id": row[0],+ "name": row[1] or "fastapi",+ "url": row[2] or "https://github.com/tiangolo/fastapi",+ "local_path": row[3],+ "default_branch": row[4],+ "head_commit": row[5],+ "settings": json.loads(row[6]) if row[6] else {},+ "created_at": row[7],+ "updated_at": row[8],+ }+ write_json("repo.json", repo)+ return repo+++def extract_stats(cur):+ file_count = cur.execute(+ "SELECT COUNT(*) FROM graph_nodes WHERE repository_id = ? AND node_type = 'file'", (REPO_ID,)+ ).fetchone()[0]+ symbol_count = cur.execute(+ "SELECT COUNT(*) FROM wiki_symbols WHERE repository_id = ?", (REPO_ID,)+ ).fetchone()[0]+ entry_point_count = cur.execute(+ "SELECT COUNT(*) FROM graph_nodes WHERE repository_id = ? AND is_entry_point = 1", (REPO_ID,)+ ).fetchone()[0]++ total_pages = cur.execute(+ "SELECT COUNT(*) FROM wiki_pages WHERE repository_id = ?", (REPO_ID,)+ ).fetchone()[0]+ fresh_pages = cur.execute(+ "SELECT COUNT(*) FROM wiki_pages WHERE repository_id = ? AND freshness_status = 'fresh'", (REPO_ID,)+ ).fetchone()[0]+ doc_coverage = round((fresh_pages / total_pages * 100) if total_pages else 0, 1)+ freshness_score = round(+ cur.execute(+ "SELECT AVG(confidence) FROM wiki_pages WHERE repository_id = ?", (REPO_ID,)+ ).fetchone()[0]+ or 0,+ 2,+ )+ dead_export_count = cur.execute(+ "SELECT COUNT(*) FROM dead_code_findings WHERE repository_id = ? AND kind = 'unused_export'", (REPO_ID,)+ ).fetchone()[0]++ stats = {+ "file_count": file_count,+ "symbol_count": symbol_count,+ "entry_point_count": entry_point_count,+ "doc_coverage_pct": doc_coverage,+ "freshness_score": freshness_score,+ "dead_export_count": dead_export_count,+ }+ write_json("stats.json", stats)+++def extract_pages(cur):+ rows = cur.execute(+ """SELECT id, repository_id, page_type, title, content, target_path, source_hash,+ model_name, provider_name, input_tokens, output_tokens, cached_tokens,+ generation_level, version, confidence, freshness_status, metadata_json,+ created_at, updated_at+ FROM wiki_pages WHERE repository_id = ?+ ORDER BY target_path""",+ (REPO_ID,),+ ).fetchall()++ pages_index = []+ pages_content = []+ for r in rows:+ meta = json.loads(r[16]) if r[16] else {}+ page = {+ "id": r[0],+ "repository_id": r[1],+ "page_type": r[2],+ "title": r[3],+ "content": r[4],+ "target_path": r[5],+ "source_hash": r[6],+ "model_name": r[7],+ "provider_name": r[8],+ "input_tokens": r[9],+ "output_tokens": r[10],+ "cached_tokens": r[11],+ "generation_level": r[12],+ "version": r[13],+ "confidence": r[14],+ "freshness_status": r[15],+ "metadata": meta,+ "created_at": r[17],+ "updated_at": r[18],+ }+ pages_content.append(page)+ # Index entry: same but without content+ idx = {k: v for k, v in page.items() if k != "content"}+ pages_index.append(idx)++ write_json("pages-index.json", pages_index)+ write_json("pages-content.json", pages_content)+ print(f" -> {len(pages_content)} pages extracted")+++def extract_graph(cur):+ # Get set of documented paths+ doc_paths = set()+ for (tp,) in cur.execute(+ "SELECT target_path FROM wiki_pages WHERE repository_id = ?", (REPO_ID,)+ ):+ doc_paths.add(tp)++ nodes = []+ for r in cur.execute(+ """SELECT node_id, node_type, language, symbol_count, pagerank, betweenness,+ community_id, is_test, is_entry_point+ FROM graph_nodes WHERE repository_id = ?""",+ (REPO_ID,),+ ):+ nodes.append({+ "node_id": r[0],+ "node_type": r[1],+ "language": r[2],+ "symbol_count": r[3],+ "pagerank": round(r[4], 6),+ "betweenness": round(r[5], 6),+ "community_id": r[6],+ "is_test": bool(r[7]),+ "is_entry_point": bool(r[8]),+ "has_doc": r[0] in doc_paths,+ })++ links = []+ for r in cur.execute(+ """SELECT source_node_id, target_node_id, imported_names_json+ FROM graph_edges WHERE repository_id = ?""",+ (REPO_ID,),+ ):+ names = json.loads(r[2]) if r[2] else []+ links.append({+ "source": r[0],+ "target": r[1],+ "imported_names": names,+ })++ graph = {"nodes": nodes, "links": links}+ write_json("graph.json", graph)+ print(f" -> {len(nodes)} nodes, {len(links)} edges")+++def extract_symbols(cur):+ rows = cur.execute(+ """SELECT id, repository_id, file_path, symbol_id, name, qualified_name, kind,+ signature, start_line, end_line, docstring, visibility, is_async,+ complexity_estimate, language, parent_name+ FROM wiki_symbols WHERE repository_id = ?+ ORDER BY file_path, start_line""",+ (REPO_ID,),+ ).fetchall()++ symbols = []+ for r in rows:+ symbols.append({+ "id": r[0],+ "repository_id": r[1],+ "file_path": r[2],+ "symbol_id": r[3],+ "name": r[4],+ "qualified_name": r[5],+ "kind": r[6],+ "signature": r[7],+ "start_line": r[8],+ "end_line": r[9],+ "docstring": r[10],+ "visibility": r[11],+ "is_async": bool(r[12]),+ "complexity_estimate": r[13],+ "language": r[14],+ "parent_name": r[15],+ })++ write_json("symbols.json", symbols)+ print(f" -> {len(symbols)} symbols")+++def extract_hotspots(cur):+ rows = cur.execute(+ """SELECT file_path, commit_count_90d, commit_count_30d, churn_percentile,+ primary_owner_name, is_hotspot, is_stable, bus_factor, contributor_count,+ lines_added_90d, lines_deleted_90d, avg_commit_size, commit_categories_json+ FROM git_metadata WHERE repository_id = ?+ ORDER BY churn_percentile DESC+ LIMIT 100""",+ (REPO_ID,),+ ).fetchall()++ hotspots = []+ for r in rows:+ cats = json.loads(r[12]) if r[12] else {}+ hotspots.append({+ "file_path": r[0],+ "commit_count_90d": r[1],+ "commit_count_30d": r[2],+ "churn_percentile": round(r[3], 4),+ "primary_owner": r[4],+ "is_hotspot": bool(r[5]),+ "is_stable": bool(r[6]),+ "bus_factor": r[7],+ "contributor_count": r[8],+ "lines_added_90d": r[9],+ "lines_deleted_90d": r[10],+ "avg_commit_size": round(r[11], 1),+ "commit_categories": cats,+ })++ write_json("hotspots.json", hotspots)+ print(f" -> {len(hotspots)} hotspots")+++def extract_git_summary(cur):+ total_files = cur.execute(+ "SELECT COUNT(*) FROM git_metadata WHERE repository_id = ?", (REPO_ID,)+ ).fetchone()[0]+ hotspot_count = cur.execute(+ "SELECT COUNT(*) FROM git_metadata WHERE repository_id = ? AND is_hotspot = 1", (REPO_ID,)+ ).fetchone()[0]+ stable_count = cur.execute(+ "SELECT COUNT(*) FROM git_metadata WHERE repository_id = ? AND is_stable = 1", (REPO_ID,)+ ).fetchone()[0]+ avg_churn = cur.execute(+ "SELECT AVG(churn_percentile) FROM git_metadata WHERE repository_id = ?", (REPO_ID,)+ ).fetchone()[0] or 0++ # Top owners+ owner_counts = defaultdict(int)+ for (owner,) in cur.execute(+ "SELECT primary_owner_name FROM git_metadata WHERE repository_id = ? AND primary_owner_name IS NOT NULL",+ (REPO_ID,),+ ):+ owner_counts[owner] += 1++ top_owners = sorted(owner_counts.items(), key=lambda x: x[1], reverse=True)[:10]+ top_owners_list = [+ {"name": name, "file_count": count, "pct": round(count / total_files * 100, 1)}+ for name, count in top_owners+ ]++ summary = {+ "total_files": total_files,+ "hotspot_count": hotspot_count,+ "stable_count": stable_count,+ "average_churn_percentile": round(avg_churn, 2),+ "top_owners": top_owners_list,+ }+ write_json("git-summary.json", summary)+++def extract_ownership(cur):+ # Module-level ownership: group by top-level directory+ rows = cur.execute(+ """SELECT file_path, primary_owner_name, primary_owner_commit_pct, bus_factor+ FROM git_metadata WHERE repository_id = ?""",+ (REPO_ID,),+ ).fetchall()++ module_map = defaultdict(lambda: {"files": [], "owners": defaultdict(int)})+ file_ownership = []++ for fp, owner, pct, bf in rows:+ parts = fp.split("/")+ module = parts[0] if len(parts) > 1 else "."++ module_map[module]["files"].append(fp)+ if owner:+ module_map[module]["owners"][owner] += 1++ file_ownership.append({+ "module_path": fp,+ "primary_owner": owner,+ "owner_pct": round(pct, 1) if pct else None,+ "file_count": 1,+ "is_silo": bf <= 1 if bf else False,+ })++ module_ownership = []+ for mod, data in sorted(module_map.items()):+ file_count = len(data["files"])+ owners = data["owners"]+ if owners:+ top_owner = max(owners, key=owners.get)+ top_pct = round(owners[top_owner] / file_count * 100, 1)+ else:+ top_owner = None+ top_pct = None+ is_silo = len(owners) <= 1+ module_ownership.append({+ "module_path": mod,+ "primary_owner": top_owner,+ "owner_pct": top_pct,+ "file_count": file_count,+ "is_silo": is_silo,+ })++ write_json("ownership-module.json", module_ownership)+ write_json("ownership-file.json", file_ownership)+ print(f" -> {len(module_ownership)} modules, {len(file_ownership)} files")+++def extract_dead_code(cur):+ rows = cur.execute(+ """SELECT id, kind, file_path, symbol_name, symbol_kind, confidence, reason,+ lines, safe_to_delete, primary_owner, status, note+ FROM dead_code_findings WHERE repository_id = ?+ ORDER BY confidence DESC""",+ (REPO_ID,),+ ).fetchall()++ findings = []+ by_kind = defaultdict(int)+ conf_summary = {"high": 0, "medium": 0, "low": 0}+ deletable_lines = 0+ total_lines = 0++ for r in rows:+ conf = r[5]+ finding = {+ "id": r[0],+ "kind": r[1],+ "file_path": r[2],+ "symbol_name": r[3],+ "symbol_kind": r[4],+ "confidence": round(conf, 2),+ "reason": r[6],+ "lines": r[7],+ "safe_to_delete": bool(r[8]),+ "primary_owner": r[9],+ "status": r[10],+ "note": r[11],+ }+ findings.append(finding)+ by_kind[r[1]] += 1+ total_lines += r[7]+ if bool(r[8]):+ deletable_lines += r[7]+ if conf >= 0.8:+ conf_summary["high"] += 1+ elif conf >= 0.5:+ conf_summary["medium"] += 1+ else:+ conf_summary["low"] += 1++ write_json("dead-code.json", findings)+ write_json("dead-code-summary.json", {+ "total_findings": len(findings),+ "confidence_summary": conf_summary,+ "deletable_lines": deletable_lines,+ "total_lines": total_lines,+ "by_kind": dict(by_kind),+ })+ print(f" -> {len(findings)} findings")+++def extract_decisions(cur):+ rows = cur.execute(+ """SELECT id, repository_id, title, status, context, decision, rationale,+ alternatives_json, consequences_json, affected_files_json,+ affected_modules_json, tags_json, evidence_commits_json, source,+ evidence_file, evidence_line, confidence, staleness_score,+ superseded_by, last_code_change, created_at, updated_at+ FROM decision_records WHERE repository_id = ?+ ORDER BY confidence DESC""",+ (REPO_ID,),+ ).fetchall()++ decisions = []+ for r in rows:+ decisions.append({+ "id": r[0],+ "repository_id": r[1],+ "title": r[2],+ "status": r[3],+ "context": r[4],+ "decision": r[5],+ "rationale": r[6],+ "alternatives": json.loads(r[7]) if r[7] else [],+ "consequences": json.loads(r[8]) if r[8] else [],+ "affected_files": json.loads(r[9]) if r[9] else [],+ "affected_modules": json.loads(r[10]) if r[10] else [],+ "tags": json.loads(r[11]) if r[11] else [],+ "evidence_commits": json.loads(r[12]) if r[12] else [],+ "source": r[13],+ "evidence_file": r[14],+ "evidence_line": r[15],+ "confidence": round(r[16], 2),+ "staleness_score": round(r[17], 2),+ "superseded_by": r[18],+ "last_code_change": r[19],+ "created_at": r[20],+ "updated_at": r[21],+ })++ write_json("decisions.json", decisions)+ print(f" -> {len(decisions)} decisions")+++def main():+ print(f"Reading: {DB_PATH}")+ print(f"Output: {OUT_DIR}")+ OUT_DIR.mkdir(parents=True, exist_ok=True)++ conn = sqlite3.connect(str(DB_PATH))+ cur = conn.cursor()++ print("\nExtracting...")+ extract_repo(cur)+ extract_stats(cur)+ extract_pages(cur)+ extract_graph(cur)+ extract_symbols(cur)+ extract_hotspots(cur)+ extract_git_summary(cur)+ extract_ownership(cur)+ extract_dead_code(cur)+ extract_decisions(cur)++ conn.close()+ print("\nDone!")+++if __name__ == "__main__":+ main()