This document tracks the current implementation progress against the proposal in Codebase Intelligence Graph — Initial POC Proposal.md, listing completed features, upcoming versions, and current tasks.
The foundational pipeline (Repository
- Scanner & AST Engine (
server/analyzer.ts):- Auto-discovery of
.tsand.tsxsource files usingfast-glob, ignoringnode_modulesand build directories. - AST parsing via
ts-morph. tsconfig.jsondetection to respect compiler options and path aliases (@/*).- Import (
ImportDeclaration) and Re-export (ExportDeclaration) resolution to internal source files. - Filtering external packages and standard libraries to focus purely on internal codebase structure.
- In-memory graph model generation with portable, relative-path node IDs.
- Calculation of fan-in (incoming callers) and fan-out (outgoing imports) metrics.
- Auto-discovery of
- Backend API (
server/index.ts):- Express server on port
3001withPOST /api/analyzeandGET /api/graph?path=.... - Codebase presets endpoint
GET /api/presets. - Resilient fallback mock dataset (
server/mockData.ts).
- Express server on port
- Dagre Layout Engine (
src/utils/layout.ts):- Automated hierarchical arrangement with toggleable Top-to-Bottom (
TB) and Left-to-Right (LR) directions. - Dynamic edge generation with animated flowing arrows and bezier curves.
- Automated hierarchical arrangement with toggleable Top-to-Bottom (
- Interactive UI (
src/components/):- React Flow (
@xyflow/react) canvas with minimap, zoom/fit controls, and background grid. - Custom file nodes with category badges (Component, Hook, Service, Util, Type).
- Neighborhood focus: active node glows indigo, incoming callers in cyan, outgoing dependencies in purple with animated dashes, unrelated files dimmed to 15%.
- Inspector sidebar showing relative path, callers, and dependencies with clickable jump-to-node links.
- Search bar with autocomplete and preset switcher.
- React Flow (
- Test Repository (
example-repo/):- 10 interdependent React + TypeScript files covering components, hooks, services, utils, types, and barrel re-exports.
Objective: Extract what functions, components, hooks, and types exist inside each file and surface them in the application inspector.
- AST Symbol Extractor (
server/analyzer.ts):- Parses
FunctionDeclaration,VariableDeclaration(arrow functions/components),InterfaceDeclaration,TypeAliasDeclaration, andClassDeclaration. - Discovers 7 symbol kinds (
component,hook,function,interface,type,class,variable). - Detects export visibility (
isExported: true/false).
- Parses
- Interactive Inspector UI (
src/components/Sidebar.tsx):- Displays "Symbols & Declarations (N)" section with colored badges for each symbol type (sky for components, amber for hooks, indigo for functions, fuchsia for types).
- Shows export status badges (
exportin emerald vsinternalin slate).
- File Node Badges (
src/components/FileNode.tsx):- Shows live symbol count pill (e.g.
2 syms,3 syms) in each file node header on the canvas.
- Shows live symbol count pill (e.g.
- Unit Testing & Browser Verification:
- Validated with
npm run test:analyzer(10 files, 15 symbols extracted). - Verified in interactive browser session (e.g. inspecting
Chat.tsx,types/chat.ts,services/api.ts).
- Validated with
- Visual Folder Browser & Native OS Dialog (
src/components/FolderBrowserModal.tsx&server/index.ts):- In-app visual directory navigator with breadcrumb navigation and shortcuts (
Desktop,Home,ProjectX,example-repo). - Automatic
Codebasebadge detection for folders containingpackage.jsonortsconfig.json. - Native Windows Explorer Folder Dialog integration via
/api/browse-folder. - 0 file uploads required: passes directory path directly to the AST engine.
- In-app visual directory navigator with breadcrumb navigation and shortcuts (
- Topological Sort Engine & Developer Onboarding Guide (
src/utils/topoSort.ts&src/components/TopoOrderDrawer.tsx):- Kahn's algorithm computing linear order across both Execution Flow (Entrypoint
$\rightarrow$ Leaves, default) and Build Order (Leaves$\rightarrow$ Entrypoint). - Interactive direction toggle with contextual developer tips explaining runtime boot sequence vs compilation prerequisites.
- Automatic Architectural Layering (Entrypoints
$\rightarrow$ Containers$\rightarrow$ Layouts$\rightarrow$ Hooks$\rightarrow$ APIs$\rightarrow$ Utilities$\rightarrow$ Types). - Slide-out "Topological Flow Order" drawer with step-by-step reading guide and jump-to-node links.
- Kahn's algorithm computing linear order across both Execution Flow (Entrypoint
- Interactive Canvas Stepper / Flow Player (
src/components/CanvasFlowPlayer.tsx):- Bottom docked player with Play, Pause, Next, Prev, First, Last, and speed toggles (0.5x, 1.0x, 2.0x).
- Real-time visual synchronization on React Flow: lights up current step node with glowing amber ring, dims unreached modules, and animates progress bar.
- Instant Circular Dependency Cycle Detection & Fault-Tolerant Sort (
src/utils/topoSort.ts&src/components/CycleAlertModal.tsx):-
Cycle-Breaking Heuristic: When circular dependencies (
$A \rightarrow B \rightarrow C \rightarrow A$ ) exist, the engine identifies the loop, bypasses the deadlock, and completes topological sort for 100% of the codebase. - Diagnostic Highlighting: Flags cyclic nodes in crimson red with clear warnings in the drawer, stepper, and canvas, while ensuring the healthy 95% of the repository's flow is never hidden.
- Flashing header alert pill and one-click canvas cycle isolation with glowing crimson red nodes and animated edges.
-
Cycle-Breaking Heuristic: When circular dependencies (
Objective: Move beyond direct 1-hop dependencies to compute full architectural propagation:
- Implement BFS graph traversal from any selected node across upstream dependents.
- Calculate direct impact (Level 1) vs indirect impact (Level 2+).
- Display total "Blast Radius" counter badge in the Inspector Sidebar.
- Visual multi-tiered highlighting on the canvas (e.g. level 1 callers in cyan, level 2+ in deep blue).
- File-to-Symbol containment edges: Representing
FILE ──CONTAINS──▶ SYMBOLin the graph model. - Expandable Node Clusters: Ability to expand a file node on the canvas to see internal function pills inside the node box.
- Cross-file call graphs:
Component ──RENDERS──▶ Component(e.g.ChatrendersMessageList).Function/Hook ──CALLS──▶ Function(e.g.MessagecallsformatTimestamp).Component ──USES──▶ Hook(e.g.ChatusesuseChat).
- Semantic AST resolution tracing identifiers back to import declarations.
-
BFS Traversal Engine:
- Level 1: Direct dependents.
- Level 2: Indirect dependents.
- Level
$N$ : Deep architectural ripple effects.
-
Impact Counter: "Changing
formatDate.tsdirectly impacts 1 file and indirectly affects 4 files (Total reachable blast radius: 5 files)." - Color-coded depth tiers on the canvas during inspection.
- Circular Dependency Detection: Automated cycle detection algorithm (Tarjan's or Johnson's algorithm) highlighting illegal dependency loops in red.
- Hotspot & Coupling Metrics:
- Identifying God-objects / architectural bottlenecks (files with excessive fan-in).
- High instability / volatile files (excessive fan-out).
- Architecture Clustering: Grouping nodes into logical modules or layers (Presentation, Domain, Infrastructure).
- CLI Export: Run
npx codebase-graph export --path ./src --output graph.jsonin CI/CD. - Markdown Architecture Report Generator: Automatic architectural health report.
- VS Code Extension: View the dependency neighborhood directly inside the editor sidebar.