This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run dev # Start dev server (tsx server/index.ts) — Express + Vite on port 3000
npm run build # Production build: Vite build + esbuild bundle server
npm run start # Run production server from dist/
npm run lint # TypeScript type check onlyOpenWiki analyzes GitHub repositories with AI, generating architecture diagrams (Mermaid), learning roadmaps, and business analysis. The frontend is React 19 + Tailwind CSS 4. The backend is Express serving a Vite SPA in development.
- React Router v7 with routes:
/(Home),/workspace/:id(Layout with nested routes: Overview, Architecture, Learn, Business, Report) - Zustand store (
workspaceStore.ts) — single source of truth for all analysis data (project, summary, fileTree, modules, lessons, architecture, business) - Architecture.tsx — diagram rendering with Mermaid.js, pan/zoom canvas (mouse drag + scroll),
diagramReadystate gates rendering. Canvas starts empty; center "RENDER ARCHITECTURE" button shows existing store data; toolbar "REGENERATE" re-fetches from/api/analyze
- server/index.ts — Express + Vite middleware; mounts all routes
- routes/analyze.ts —
GET /api/analyze— SSE stream; callsrunAnalysis() - routes/project.ts —
GET /api/project/:id,GET /api/project/:id/status,POST /api/project/:id/business,POST /api/tutor - services/analyzer.ts —
runAnalysis()fetches GitHub (metadata, README, package.json, file tree) then calls AI - services/ai.ts —
generateWithRetry()wraps OpenAI SDK with exponential backoff. UsesOPENAI_API_KEY+OPENAI_BASE_URLenv vars. DeepSeek model:deepseek-v4-flash. JSON mode viaresponse_format: { type: 'json_object' } - services/github.ts —
fetchGithub()injectsGITHUB_TOKENinto all requests (prevents rate limit). Token-less: 60 req/hr; with token: 5000 req/hr
- AI generates full JSON (summary, fileTree, modules, lessons, architecture, business) in one call
architecturefield is raw Mermaid syntax. DeepSeek may produce invalid syntax (underscore IDs, unquoted pipes).sanitizeMermaid()in Architecture.tsx handles:flowchart_TD_→flowchart TD\n, bracket labels with pipes/quotes- The
ANALYSIS_SCHEMAinserver/services/ai.tsis passed to the AI asresponse_schemafor structured output
OPENAI_API_KEY=sk-... # DeepSeek API key
OPENAI_BASE_URL=https://api.deepseek.com
GITHUB_TOKEN=github_pat_... # Optional but strongly recommended; anonymous GitHub API = 60 req/hr limit