# kanoel7/codelens architecture

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

- Interactive diagram: https://gitdiagram.com/kanoel7/codelens
- Repository: https://github.com/kanoel7/codelens

## Overview

Code Lens turns an agent’s reading of a project’s Git changes into an interactive, locally saved code-map board. The principal workflow runs from the user’s request, through the Code Lens skill and MCP server, to board validation and display in the host panel. The board UI supports Before/After comparison, editing and navigation; saved boards can be reopened, and an offline viewer is available. Extended boards add class context and notes. Source excerpts do not show every server operation, so only documented or directly evidenced relationships are connected.

Main entry points: [`apps/web/src/CodeMap.tsx`](https://github.com/kanoel7/codelens/blob/main/apps/web/src/CodeMap.tsx) (Interactive code map), [`apps/mcp/src/index.ts`](https://github.com/kanoel7/codelens/blob/main/apps/mcp/src/index.ts) (MCP server), [`packages/report-schema/src/index.ts`](https://github.com/kanoel7/codelens/blob/main/packages/report-schema/src/index.ts) (Board schema), [`apps/mcp/src/saved.ts`](https://github.com/kanoel7/codelens/blob/main/apps/mcp/src/saved.ts) (Saved board access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Analysis workflow"]
  node_skill["Code Lens skill<br/>[SKILL.md]"]
  node_analysis["Board analysis<br/>[index.ts]"]
  node_schema["Board schema<br/>[index.ts]"]
end

subgraph group_protocol["MCP and storage"]
  node_mcp["MCP server<br/>[index.ts]"]
  node_saved["Saved board access<br/>[saved.ts]"]
  node_localboards[("Local boards")]
end

subgraph group_board["Board interface"]
  node_map["Interactive code map<br/>[CodeMap.tsx]"]
  node_card["Method cards<br/>[CardView.tsx]"]
  node_boardparts["Frames and controls<br/>[boardParts.tsx]"]
  node_model["Board model<br/>[codeMapModel.ts]"]
  node_diff["Diff formatting<br/>[diff.ts]"]
  node_geometry["Canvas geometry<br/>[geometry.ts]"]
  node_history["Canvas history"]
  node_paste["Pasted code<br/>[pastedCode.ts]"]
  node_references["Code references<br/>[references.ts]"]
  node_settings["Board settings<br/>[settings.ts]"]
  node_ids["Board identifiers<br/>[ids.ts]"]
end

subgraph group_presentation["Display and helpers"]
  node_app["Board app<br/>[mcpApp.tsx]"]
  node_highlight["Syntax highlighting<br/>[highlight.ts]"]
  node_i18n["Interface strings<br/>[i18n.ts]"]
  node_images["Image assets<br/>[imageAssets.ts]"]
end

node_user(("User"))
node_agent(("AI agent"))
node_host["MCP host panel"]

node_user -->|"requests board"| node_agent
node_agent -->|"follows workflow"| node_skill
node_skill -->|"guides analysis"| node_agent
node_agent -.->|"prepares board data"| node_analysis
node_analysis -->|"validates board"| node_schema
node_mcp -->|"imports analysis"| node_analysis
node_mcp -->|"uses board schema"| node_schema
node_mcp -->|"opens saved boards"| node_saved
node_saved -->|"reads boards"| node_localboards
node_saved -->|"validates loaded boards"| node_schema
node_mcp -->|"serves board panel"| node_host
node_host -->|"hosts app"| node_app
node_app -->|"loads and validates board"| node_schema
node_app -->|"renders board"| node_map
node_map -->|"uses board model"| node_model
node_map -->|"renders cards"| node_card
node_map -->|"renders controls"| node_boardparts
node_map -->|"uses geometry"| node_geometry
node_map -->|"tracks edits"| node_history
node_map -->|"parses pasted code"| node_paste
node_map -->|"uses references"| node_references
node_map -->|"uses settings"| node_settings
node_map -->|"uses image assets"| node_images
node_model -->|"builds diffs"| node_diff
node_model -->|"creates identifiers"| node_ids
node_card -->|"highlights code"| node_highlight
node_card -->|"uses interface strings"| node_i18n
node_boardparts -->|"uses interface strings"| node_i18n
node_boardparts -->|"uses dismissal helper"| node_settings

click node_skill "https://github.com/kanoel7/codelens/blob/main/skill/code-lens/SKILL.md"
click node_analysis "https://github.com/kanoel7/codelens/blob/main/packages/analysis/src/index.ts"
click node_schema "https://github.com/kanoel7/codelens/blob/main/packages/report-schema/src/index.ts"
click node_mcp "https://github.com/kanoel7/codelens/blob/main/apps/mcp/src/index.ts"
click node_saved "https://github.com/kanoel7/codelens/blob/main/apps/mcp/src/saved.ts"
click node_app "https://github.com/kanoel7/codelens/blob/main/apps/web/src/mcpApp.tsx"
click node_map "https://github.com/kanoel7/codelens/blob/main/apps/web/src/CodeMap.tsx"
click node_card "https://github.com/kanoel7/codelens/blob/main/apps/web/src/CardView.tsx"
click node_boardparts "https://github.com/kanoel7/codelens/blob/main/apps/web/src/boardParts.tsx"
click node_model "https://github.com/kanoel7/codelens/blob/main/apps/web/src/codeMapModel.ts"
click node_diff "https://github.com/kanoel7/codelens/blob/main/apps/web/src/diff.ts"
click node_geometry "https://github.com/kanoel7/codelens/blob/main/apps/web/src/geometry.ts"
click node_history "https://github.com/kanoel7/codelens/blob/main/apps/web/src/useCanvasHistory.ts"
click node_paste "https://github.com/kanoel7/codelens/blob/main/apps/web/src/pastedCode.ts"
click node_references "https://github.com/kanoel7/codelens/blob/main/apps/web/src/references.ts"
click node_settings "https://github.com/kanoel7/codelens/blob/main/apps/web/src/settings.ts"
click node_ids "https://github.com/kanoel7/codelens/blob/main/apps/web/src/ids.ts"
click node_highlight "https://github.com/kanoel7/codelens/blob/main/apps/web/src/highlight.ts"
click node_i18n "https://github.com/kanoel7/codelens/blob/main/apps/web/src/i18n.ts"
click node_images "https://github.com/kanoel7/codelens/blob/main/apps/web/src/imageAssets.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_skill,node_analysis,node_schema,node_user toneBlue
class node_mcp,node_saved,node_localboards toneAmber
class node_map,node_card,node_boardparts,node_model,node_diff,node_geometry,node_history,node_paste,node_references,node_settings,node_ids toneMint
class node_app,node_highlight,node_i18n,node_images toneRose
class node_agent,node_host toneIndigo
```

## Components

### Analysis workflow

- [Code Lens skill](https://github.com/kanoel7/codelens/blob/main/skill/code-lens/SKILL.md): `skill/code-lens/SKILL.md`
- [Board analysis](https://github.com/kanoel7/codelens/blob/main/packages/analysis/src/index.ts): `packages/analysis/src/index.ts`
- [Board schema](https://github.com/kanoel7/codelens/blob/main/packages/report-schema/src/index.ts): `packages/report-schema/src/index.ts`

### MCP and storage

- [MCP server](https://github.com/kanoel7/codelens/blob/main/apps/mcp/src/index.ts): `apps/mcp/src/index.ts`
- [Saved board access](https://github.com/kanoel7/codelens/blob/main/apps/mcp/src/saved.ts): `apps/mcp/src/saved.ts`
- **Local boards**

### Board interface

- [Interactive code map](https://github.com/kanoel7/codelens/blob/main/apps/web/src/CodeMap.tsx): `apps/web/src/CodeMap.tsx`
- [Method cards](https://github.com/kanoel7/codelens/blob/main/apps/web/src/CardView.tsx): `apps/web/src/CardView.tsx`
- [Frames and controls](https://github.com/kanoel7/codelens/blob/main/apps/web/src/boardParts.tsx): `apps/web/src/boardParts.tsx`
- [Board model](https://github.com/kanoel7/codelens/blob/main/apps/web/src/codeMapModel.ts): `apps/web/src/codeMapModel.ts`
- [Diff formatting](https://github.com/kanoel7/codelens/blob/main/apps/web/src/diff.ts): `apps/web/src/diff.ts`
- [Canvas geometry](https://github.com/kanoel7/codelens/blob/main/apps/web/src/geometry.ts): `apps/web/src/geometry.ts`
- [Canvas history](https://github.com/kanoel7/codelens/blob/main/apps/web/src/useCanvasHistory.ts): `apps/web/src/useCanvasHistory.ts`
- [Pasted code](https://github.com/kanoel7/codelens/blob/main/apps/web/src/pastedCode.ts): `apps/web/src/pastedCode.ts`
- [Code references](https://github.com/kanoel7/codelens/blob/main/apps/web/src/references.ts): `apps/web/src/references.ts`
- [Board settings](https://github.com/kanoel7/codelens/blob/main/apps/web/src/settings.ts): `apps/web/src/settings.ts`
- [Board identifiers](https://github.com/kanoel7/codelens/blob/main/apps/web/src/ids.ts): `apps/web/src/ids.ts`

### Display and helpers

- [Board app](https://github.com/kanoel7/codelens/blob/main/apps/web/src/mcpApp.tsx): `apps/web/src/mcpApp.tsx`
- [Syntax highlighting](https://github.com/kanoel7/codelens/blob/main/apps/web/src/highlight.ts): `apps/web/src/highlight.ts`
- [Interface strings](https://github.com/kanoel7/codelens/blob/main/apps/web/src/i18n.ts): `apps/web/src/i18n.ts`
- [Image assets](https://github.com/kanoel7/codelens/blob/main/apps/web/src/imageAssets.ts): `apps/web/src/imageAssets.ts`

### Other components

- **User**
- **AI agent**
- **MCP host panel**

## Connections

- User → AI agent: requests board (evidence: `README.md`)
- AI agent → Code Lens skill: follows workflow (evidence: `README.md`)
- Code Lens skill → AI agent: guides analysis (evidence: `README.md`)
- AI agent → Board analysis: prepares board data
- Board analysis → Board schema: validates board (evidence: `packages/analysis/src/index.ts`)
- MCP server → Board analysis: imports analysis (evidence: `apps/mcp/src/index.ts`)
- MCP server → Board schema: uses board schema (evidence: `apps/mcp/src/index.ts`)
- MCP server → Saved board access: opens saved boards (evidence: `apps/mcp/src/index.ts`)
- Saved board access → Local boards: reads boards (evidence: `apps/mcp/src/saved.ts`)
- Saved board access → Board schema: validates loaded boards (evidence: `apps/mcp/src/saved.ts`)
- MCP server → MCP host panel: serves board panel (evidence: `README.md`)
- MCP host panel → Board app: hosts app (evidence: `README.md`)
- Board app → Board schema: loads and validates board (evidence: `apps/web/src/mcpApp.tsx`)
- Board app → Interactive code map: renders board (evidence: `apps/web/src/mcpApp.tsx`)
- Interactive code map → Board model: uses board model (evidence: `apps/web/src/CodeMap.tsx`)
- Interactive code map → Method cards: renders cards (evidence: `apps/web/src/CodeMap.tsx`)
- Interactive code map → Frames and controls: renders controls (evidence: `apps/web/src/CodeMap.tsx`)
- Interactive code map → Canvas geometry: uses geometry (evidence: `apps/web/src/CodeMap.tsx`)
- Interactive code map → Canvas history: tracks edits (evidence: `apps/web/src/CodeMap.tsx`)
- Interactive code map → Pasted code: parses pasted code (evidence: `apps/web/src/CodeMap.tsx`)
- Interactive code map → Code references: uses references (evidence: `apps/web/src/CodeMap.tsx`)
- Interactive code map → Board settings: uses settings (evidence: `apps/web/src/CodeMap.tsx`)
- Interactive code map → Image assets: uses image assets (evidence: `apps/web/src/CodeMap.tsx`)
- Board model → Diff formatting: builds diffs (evidence: `apps/web/src/codeMapModel.ts`)
- Board model → Board identifiers: creates identifiers (evidence: `apps/web/src/codeMapModel.ts`)
- Method cards → Syntax highlighting: highlights code (evidence: `apps/web/src/CardView.tsx`)
- Method cards → Interface strings: uses interface strings (evidence: `apps/web/src/CardView.tsx`)
- Frames and controls → Interface strings: uses interface strings (evidence: `apps/web/src/boardParts.tsx`)
- Frames and controls → Board settings: uses dismissal helper (evidence: `apps/web/src/boardParts.tsx`)
