# mk668a/llm-codemap architecture

> Architecture diagram of the GitHub repository mk668a/llm-codemap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mk668a/llm-codemap
- Repository: https://github.com/mk668a/llm-codemap

## Overview

LLM Code Map is a VS Code extension that turns a TypeScript/JavaScript workspace—or an LLM-supplied graph—into an interactive dependency map. Users refresh the sidebar to scan and visualize a workspace, or an AI agent invokes the Language Model Tool with graph data or discovery hints. The runtime separates source parsing, graph construction/filtering, and graph presentation. The README documents symbol-level relationships, focused analysis, D3 rendering, and symbol navigation; sampled excerpts do not establish the implementation details of every webview interaction.

Main entry points: [`src/analyzer/TypeScriptAnalyzer.ts`](https://github.com/mk668a/llm-codemap/blob/main/src/analyzer/TypeScriptAnalyzer.ts) (TS Analyzer), [`src/extension.ts`](https://github.com/mk668a/llm-codemap/blob/main/src/extension.ts) (Extension Activation), [`src/tools/codemapTool.ts`](https://github.com/mk668a/llm-codemap/blob/main/src/tools/codemapTool.ts) (Codemap Tool), [`src/visualizer/CodemapViewProvider.ts`](https://github.com/mk668a/llm-codemap/blob/main/src/visualizer/CodemapViewProvider.ts) (Sidebar Provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Extension Runtime"]
  node_extension["Extension Activation<br/>[extension.ts]"]
  node_logger["Output Logger<br/>[logger.ts]"]
end

subgraph group_analysis["Code Analysis"]
  node_analyzer["TS Analyzer"]
  node_fileutils["File Utilities<br/>[fileUtils.ts]"]
  node_pathutils["Path Utilities<br/>[pathUtils.ts]"]
  node_extractor["Graph Extractor"]
  node_graphtypes["Graph Types<br/>[types.ts]"]
end

subgraph group_tool["Agent Tool"]
  node_tool["Codemap Tool<br/>[codemapTool.ts]"]
  node_tooltypes["Tool Parameters<br/>[types.ts]"]
end

subgraph group_view["Graph View"]
  node_provider["Sidebar Provider"]
  node_transformer["D3 Transformer"]
  node_webview["Interactive D3 Graph"]
end

node_user(("VS Code User"))
node_agent(("AI Agent"))
node_workspace["Code Workspace"]

node_user -->|"refresh command"| node_extension
node_agent -->|"invoke analysis"| node_tool
node_extension -->|"analyze workspace"| node_analyzer
node_extension -->|"build graph"| node_extractor
node_extension -->|"update graph"| node_provider
node_tool -->|"analyze workspace"| node_analyzer
node_tool -->|"extract or create graph"| node_extractor
node_tool -->|"update graph"| node_provider
node_analyzer -->|"scan source files"| node_workspace
node_analyzer -->|"find and read"| node_fileutils
node_analyzer -->|"normalize paths"| node_pathutils
node_extractor -->|"resolve source files"| node_analyzer
node_provider -->|"transform graph data"| node_transformer
node_provider -->|"render graph"| node_webview
node_user -->|"inspect graph"| node_webview
node_extension -->|"log runtime"| node_logger
node_tool -->|"log analysis"| node_logger
node_provider -->|"log rendering"| node_logger

click node_extension "https://github.com/mk668a/llm-codemap/blob/main/src/extension.ts"
click node_analyzer "https://github.com/mk668a/llm-codemap/blob/main/src/analyzer/TypeScriptAnalyzer.ts"
click node_fileutils "https://github.com/mk668a/llm-codemap/blob/main/src/utils/fileUtils.ts"
click node_pathutils "https://github.com/mk668a/llm-codemap/blob/main/src/utils/pathUtils.ts"
click node_extractor "https://github.com/mk668a/llm-codemap/blob/main/src/analyzer/DependencyExtractor.ts"
click node_graphtypes "https://github.com/mk668a/llm-codemap/blob/main/src/analyzer/types.ts"
click node_tool "https://github.com/mk668a/llm-codemap/blob/main/src/tools/codemapTool.ts"
click node_tooltypes "https://github.com/mk668a/llm-codemap/blob/main/src/tools/types.ts"
click node_provider "https://github.com/mk668a/llm-codemap/blob/main/src/visualizer/CodemapViewProvider.ts"
click node_transformer "https://github.com/mk668a/llm-codemap/blob/main/src/visualizer/graphDataTransformer.ts"
click node_webview "https://github.com/mk668a/llm-codemap/blob/main/src/visualizer/CodemapViewProvider.ts"
click node_logger "https://github.com/mk668a/llm-codemap/blob/main/src/utils/logger.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_extension,node_logger,node_user toneBlue
class node_analyzer,node_fileutils,node_pathutils,node_extractor,node_graphtypes toneAmber
class node_tool,node_tooltypes toneMint
class node_provider,node_transformer,node_webview toneRose
class node_agent,node_workspace toneIndigo
```

## Components

### Extension Runtime

- [Extension Activation](https://github.com/mk668a/llm-codemap/blob/main/src/extension.ts): `src/extension.ts`
- [Output Logger](https://github.com/mk668a/llm-codemap/blob/main/src/utils/logger.ts): `src/utils/logger.ts`

### Code Analysis

- [TS Analyzer](https://github.com/mk668a/llm-codemap/blob/main/src/analyzer/TypeScriptAnalyzer.ts): `src/analyzer/TypeScriptAnalyzer.ts`
- [File Utilities](https://github.com/mk668a/llm-codemap/blob/main/src/utils/fileUtils.ts): `src/utils/fileUtils.ts`
- [Path Utilities](https://github.com/mk668a/llm-codemap/blob/main/src/utils/pathUtils.ts): `src/utils/pathUtils.ts`
- [Graph Extractor](https://github.com/mk668a/llm-codemap/blob/main/src/analyzer/DependencyExtractor.ts): `src/analyzer/DependencyExtractor.ts`
- [Graph Types](https://github.com/mk668a/llm-codemap/blob/main/src/analyzer/types.ts): `src/analyzer/types.ts`

### Agent Tool

- [Codemap Tool](https://github.com/mk668a/llm-codemap/blob/main/src/tools/codemapTool.ts): `src/tools/codemapTool.ts`
- [Tool Parameters](https://github.com/mk668a/llm-codemap/blob/main/src/tools/types.ts): `src/tools/types.ts`

### Graph View

- [Sidebar Provider](https://github.com/mk668a/llm-codemap/blob/main/src/visualizer/CodemapViewProvider.ts): `src/visualizer/CodemapViewProvider.ts`
- [D3 Transformer](https://github.com/mk668a/llm-codemap/blob/main/src/visualizer/graphDataTransformer.ts): `src/visualizer/graphDataTransformer.ts`
- [Interactive D3 Graph](https://github.com/mk668a/llm-codemap/blob/main/src/visualizer/CodemapViewProvider.ts): `src/visualizer/CodemapViewProvider.ts`

### Other components

- **VS Code User**
- **AI Agent**
- **Code Workspace**

## Connections

- VS Code User → Extension Activation: refresh command
- AI Agent → Codemap Tool: invoke analysis
- Extension Activation → TS Analyzer: analyze workspace
- Extension Activation → Graph Extractor: build graph
- Extension Activation → Sidebar Provider: update graph
- Codemap Tool → TS Analyzer: analyze workspace
- Codemap Tool → Graph Extractor: extract or create graph
- Codemap Tool → Sidebar Provider: update graph
- TS Analyzer → Code Workspace: scan source files
- TS Analyzer → File Utilities: find and read
- TS Analyzer → Path Utilities: normalize paths
- Graph Extractor → TS Analyzer: resolve source files
- Sidebar Provider → D3 Transformer: transform graph data
- Sidebar Provider → Interactive D3 Graph: render graph
- VS Code User → Interactive D3 Graph: inspect graph
- Extension Activation → Output Logger: log runtime
- Codemap Tool → Output Logger: log analysis
- Sidebar Provider → Output Logger: log rendering
