# magic5644/graph-it-live architecture

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

- Interactive diagram: https://gitdiagram.com/magic5644/graph-it-live
- Repository: https://github.com/magic5644/graph-it-live

## Overview

Graph-It-Live is a local codebase-analysis product exposed through VS Code, a CLI, and MCP tools. The main workflow is to index a workspace, analyze file and symbol relationships, then explore or query the resulting graph and receive navigable or agent-ready output. The graph preserves the documented review, dead-code, call-graph, codemap, wiki, and bounded-context capabilities. Several subsystem links rely on README descriptions or SOURCE INDEX references; unsampled implementations are represented at their existing directory paths.

Main entry points: [`src/cli/commands`](https://github.com/magic5644/graph-it-live/tree/main/src/cli/commands) (CLI commands), [`src/cli/runtime.ts`](https://github.com/magic5644/graph-it-live/blob/main/src/cli/runtime.ts) (CLI runtime), [`src/mcp/McpWorker.ts`](https://github.com/magic5644/graph-it-live/blob/main/src/mcp/McpWorker.ts) (MCP worker), [`src/extension/extension.ts`](https://github.com/magic5644/graph-it-live/blob/main/src/extension/extension.ts) (VS Code extension)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["User surfaces"]
  node_cli["CLI commands"]
  node_extension["VS Code extension<br/>[extension.ts]"]
  node_mcp["MCP server<br/>[mcpServer.ts]"]
  node_runtime["CLI runtime<br/>[runtime.ts]"]
  node_worker["MCP worker<br/>[McpWorker.ts]"]
  node_mcp_state["MCP worker state<br/>[state.ts]"]
end

subgraph group_indexing["Workspace indexing"]
  node_spider["Workspace graph index<br/>[Spider.ts]"]
  node_parser["File and language parsing<br/>[Parser.ts]"]
  node_ast_worker["AST worker host<br/>[AstWorkerHost.ts]"]
  node_path_resolver["Path resolution<br/>[PathResolver.ts]"]
  node_workspace_boundary["Workspace boundaries"]
  node_cache[("Shared index cache<br/>[IndexCache.ts]")]
end

subgraph group_analysis["Graph analysis"]
  node_callgraph["Cross-file call graph<br/>[CallGraphQuery.ts]"]
  node_symbol_analysis["Symbol analysis<br/>[SymbolAnalyzer.ts]"]
  node_deadcode["Dead-code and impact review"]
end

subgraph group_context["Context and review"]
  node_context_retriever["Bounded graph context"]
  node_query_engine["Natural-language query<br/>[QueryEngine.ts]"]
  node_llm_factory["LLM provider selection"]
  node_llm_client["LLM client interface<br/>[LlmClient.ts]"]
  node_mcp_query["MCP query tool<br/>[query.ts]"]
end

subgraph group_results["Views and output"]
  node_webview["Graph exploration UI<br/>[App.tsx]"]
  node_callgraph_view["Live call graph view"]
  node_wiki["Navigable code wiki<br/>[WikiGenerator.ts]"]
  node_html_export["HTML graph export<br/>[HtmlExporter.ts]"]
  node_formatter["CLI output formatting<br/>[formatter.ts]"]
  node_shared_types["Graph and query types<br/>[query-types.ts]"]
end

node_developer(("Developer"))
node_vscode(("VS Code user"))
node_ai_client(("MCP client"))

node_developer -->|"runs commands"| node_cli
node_vscode -->|"explores workspace"| node_extension
node_ai_client -->|"invokes tools"| node_mcp
node_cli -->|"uses runtime"| node_runtime
node_runtime -->|"configures analysis"| node_parser
node_runtime -->|"builds workspace graph"| node_spider
node_runtime -->|"starts worker"| node_ast_worker
node_runtime -->|"resolves paths"| node_path_resolver
node_runtime -->|"checks workspace"| node_workspace_boundary
node_runtime -->|"uses shared cache"| node_cache
node_extension -->|"indexes workspace"| node_cache
node_extension -->|"refreshes graph"| node_spider
node_mcp -->|"starts worker"| node_worker
node_worker -->|"uses shared state"| node_mcp_state
node_worker -->|"configures analysis"| node_parser
node_worker -->|"builds workspace graph"| node_spider
node_worker -->|"uses shared cache"| node_cache
node_spider -.->|"parses files"| node_parser
node_cli -->|"runs natural query"| node_mcp_query
node_mcp_query -->|"delegates query"| node_query_engine
node_mcp_query -->|"initializes index"| node_callgraph
node_query_engine -->|"uses client interface"| node_llm_client
node_llm_factory -->|"returns provider client"| node_llm_client
node_llm_factory -.->|"supports query workflow"| node_context_retriever
node_query_engine -->|"queries call index"| node_callgraph
node_context_retriever -->|"uses graph queries"| node_query_engine
node_webview -.->|"receives graph updates"| node_extension
node_extension -.->|"provides call graph"| node_callgraph_view
node_cli -->|"runs review checks"| node_deadcode
node_cli -->|"generates wiki"| node_wiki
node_cli -->|"exports graph"| node_html_export
node_cli -->|"formats results"| node_formatter
node_query_engine -->|"returns query results"| node_shared_types
node_mcp_query -->|"encodes TOON"| node_formatter

click node_cli "https://github.com/magic5644/graph-it-live/tree/main/src/cli/commands"
click node_extension "https://github.com/magic5644/graph-it-live/blob/main/src/extension/extension.ts"
click node_mcp "https://github.com/magic5644/graph-it-live/blob/main/src/mcp/mcpServer.ts"
click node_runtime "https://github.com/magic5644/graph-it-live/blob/main/src/cli/runtime.ts"
click node_worker "https://github.com/magic5644/graph-it-live/blob/main/src/mcp/McpWorker.ts"
click node_spider "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/Spider.ts"
click node_parser "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/Parser.ts"
click node_ast_worker "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/ast/AstWorkerHost.ts"
click node_path_resolver "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/utils/PathResolver.ts"
click node_workspace_boundary "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/utils/workspaceBoundary.ts"
click node_cache "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/cache/IndexCache.ts"
click node_callgraph "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/callgraph/CallGraphQuery.ts"
click node_symbol_analysis "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/SymbolAnalyzer.ts"
click node_deadcode "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/ReviewGateAnalyzer.ts"
click node_context_retriever "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/graph-context/GraphContextRetriever.ts"
click node_query_engine "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/QueryEngine.ts"
click node_llm_factory "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/llm/LlmClientFactory.ts"
click node_llm_client "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/llm/LlmClient.ts"
click node_mcp_query "https://github.com/magic5644/graph-it-live/blob/main/src/mcp/tools/query.ts"
click node_mcp_state "https://github.com/magic5644/graph-it-live/blob/main/src/mcp/shared/state.ts"
click node_webview "https://github.com/magic5644/graph-it-live/blob/main/src/webview/App.tsx"
click node_callgraph_view "https://github.com/magic5644/graph-it-live/blob/main/src/extension/services/CallGraphViewService.ts"
click node_wiki "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/wiki/WikiGenerator.ts"
click node_html_export "https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/export/HtmlExporter.ts"
click node_formatter "https://github.com/magic5644/graph-it-live/blob/main/src/cli/formatter.ts"
click node_shared_types "https://github.com/magic5644/graph-it-live/blob/main/src/shared/query-types.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_cli,node_extension,node_mcp,node_runtime,node_worker,node_mcp_state,node_vscode,node_ai_client toneBlue
class node_spider,node_parser,node_ast_worker,node_path_resolver,node_workspace_boundary,node_cache toneAmber
class node_callgraph,node_symbol_analysis,node_deadcode toneMint
class node_context_retriever,node_query_engine,node_llm_factory,node_llm_client,node_mcp_query toneRose
class node_webview,node_callgraph_view,node_wiki,node_html_export,node_formatter,node_shared_types,node_developer toneIndigo
```

## Components

### User surfaces

- [CLI commands](https://github.com/magic5644/graph-it-live/tree/main/src/cli/commands): `src/cli/commands`
- [VS Code extension](https://github.com/magic5644/graph-it-live/blob/main/src/extension/extension.ts): `src/extension/extension.ts`
- [MCP server](https://github.com/magic5644/graph-it-live/blob/main/src/mcp/mcpServer.ts): `src/mcp/mcpServer.ts`
- [CLI runtime](https://github.com/magic5644/graph-it-live/blob/main/src/cli/runtime.ts): `src/cli/runtime.ts`
- [MCP worker](https://github.com/magic5644/graph-it-live/blob/main/src/mcp/McpWorker.ts): `src/mcp/McpWorker.ts`
- [MCP worker state](https://github.com/magic5644/graph-it-live/blob/main/src/mcp/shared/state.ts): `src/mcp/shared/state.ts`

### Workspace indexing

- [Workspace graph index](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/Spider.ts): `src/analyzer/Spider.ts`
- [File and language parsing](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/Parser.ts): `src/analyzer/Parser.ts`
- [AST worker host](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/ast/AstWorkerHost.ts): `src/analyzer/ast/AstWorkerHost.ts`
- [Path resolution](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/utils/PathResolver.ts): `src/analyzer/utils/PathResolver.ts`
- [Workspace boundaries](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/utils/workspaceBoundary.ts): `src/analyzer/utils/workspaceBoundary.ts`
- [Shared index cache](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/cache/IndexCache.ts): `src/analyzer/cache/IndexCache.ts`

### Graph analysis

- [Cross-file call graph](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/callgraph/CallGraphQuery.ts): `src/analyzer/callgraph/CallGraphQuery.ts`
- [Symbol analysis](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/SymbolAnalyzer.ts): `src/analyzer/SymbolAnalyzer.ts`
- [Dead-code and impact review](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/ReviewGateAnalyzer.ts): `src/analyzer/ReviewGateAnalyzer.ts`

### Context and review

- [Bounded graph context](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/graph-context/GraphContextRetriever.ts): `src/analyzer/graph-context/GraphContextRetriever.ts`
- [Natural-language query](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/QueryEngine.ts): `src/analyzer/QueryEngine.ts`
- [LLM provider selection](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/llm/LlmClientFactory.ts): `src/analyzer/llm/LlmClientFactory.ts`
- [LLM client interface](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/llm/LlmClient.ts): `src/analyzer/llm/LlmClient.ts`
- [MCP query tool](https://github.com/magic5644/graph-it-live/blob/main/src/mcp/tools/query.ts): `src/mcp/tools/query.ts`

### Views and output

- [Graph exploration UI](https://github.com/magic5644/graph-it-live/blob/main/src/webview/App.tsx): `src/webview/App.tsx`
- [Live call graph view](https://github.com/magic5644/graph-it-live/blob/main/src/extension/services/CallGraphViewService.ts): `src/extension/services/CallGraphViewService.ts`
- [Navigable code wiki](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/wiki/WikiGenerator.ts): `src/analyzer/wiki/WikiGenerator.ts`
- [HTML graph export](https://github.com/magic5644/graph-it-live/blob/main/src/analyzer/export/HtmlExporter.ts): `src/analyzer/export/HtmlExporter.ts`
- [CLI output formatting](https://github.com/magic5644/graph-it-live/blob/main/src/cli/formatter.ts): `src/cli/formatter.ts`
- [Graph and query types](https://github.com/magic5644/graph-it-live/blob/main/src/shared/query-types.ts): `src/shared/query-types.ts`

### Other components

- **Developer**
- **VS Code user**
- **MCP client**

## Connections

- Developer → CLI commands: runs commands (evidence: `README.md`)
- VS Code user → VS Code extension: explores workspace (evidence: `README.md`)
- MCP client → MCP server: invokes tools (evidence: `README.md`)
- CLI commands → CLI runtime: uses runtime (evidence: `src/cli/index.ts`)
- CLI runtime → File and language parsing: configures analysis (evidence: `src/cli/runtime.ts`)
- CLI runtime → Workspace graph index: builds workspace graph (evidence: `src/cli/runtime.ts`)
- CLI runtime → AST worker host: starts worker (evidence: `src/cli/runtime.ts`)
- CLI runtime → Path resolution: resolves paths (evidence: `src/cli/runtime.ts`)
- CLI runtime → Workspace boundaries: checks workspace (evidence: `src/cli/runtime.ts`)
- CLI runtime → Shared index cache: uses shared cache (evidence: `src/cli/runtime.ts`)
- VS Code extension → Shared index cache: indexes workspace
- VS Code extension → Workspace graph index: refreshes graph
- MCP server → MCP worker: starts worker (evidence: `src/mcp/McpWorker.ts`)
- MCP worker → MCP worker state: uses shared state (evidence: `src/mcp/McpWorker.ts`)
- MCP worker → File and language parsing: configures analysis (evidence: `src/mcp/McpWorker.ts`)
- MCP worker → Workspace graph index: builds workspace graph (evidence: `src/mcp/McpWorker.ts`)
- MCP worker → Shared index cache: uses shared cache (evidence: `src/mcp/McpWorker.ts`)
- Workspace graph index → File and language parsing: parses files
- CLI commands → MCP query tool: runs natural query (evidence: `src/cli/commands/query.ts`)
- MCP query tool → Natural-language query: delegates query (evidence: `src/mcp/tools/query.ts`)
- MCP query tool → Cross-file call graph: initializes index (evidence: `src/mcp/tools/query.ts`)
- Natural-language query → LLM client interface: uses client interface (evidence: `src/analyzer/QueryEngine.ts`)
- LLM provider selection → LLM client interface: returns provider client (evidence: `src/analyzer/llm/LlmClientFactory.ts`)
- LLM provider selection → Bounded graph context: supports query workflow
- Natural-language query → Cross-file call graph: queries call index (evidence: `src/analyzer/QueryEngine.ts`)
- Bounded graph context → Natural-language query: uses graph queries (evidence: `src/analyzer/graph-context/GraphContextRetriever.ts`)
- Graph exploration UI → VS Code extension: receives graph updates
- VS Code extension → Live call graph view: provides call graph
- CLI commands → Dead-code and impact review: runs review checks (evidence: `src/cli/commands/reviewPr.ts`)
- CLI commands → Navigable code wiki: generates wiki (evidence: `README.md`)
- CLI commands → HTML graph export: exports graph (evidence: `README.md`)
- CLI commands → CLI output formatting: formats results (evidence: `src/cli/index.ts`)
- Natural-language query → Graph and query types: returns query results (evidence: `src/analyzer/QueryEngine.ts`)
- MCP query tool → CLI output formatting: encodes TOON (evidence: `src/mcp/tools/query.ts`)
