depgraph-core 1.5.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  [![npm version](https://img.shields.io/npm/v/depgraph-core.svg)](https://www.npmjs.com/package/depgraph-core)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- **DepGraph Core** is a powerful static analysis CLI that maps code dependencies and simulates the ripple-effect impact of changes across multi-language codebases — supporting JavaScript, TypeScript, Python, Go, C#, Java, Kotlin, PHP, Ruby, and Swift. By parsing imports, exports, functions, classes, interfaces, and methods, DepGraph constructs a comprehensive dependency graph, computes centrality metrics, and generates impact simulations — helping you prevent regression bugs in large systems.
6
+ **DepGraph Core** is a powerful static analysis CLI that maps code dependencies and simulates the ripple-effect impact of changes across multi-language codebases — supporting JavaScript, TypeScript, Python, Go, C#, Java, Kotlin, PHP, Ruby, Swift, and Rust. By parsing imports, exports, functions, classes, interfaces, and methods, DepGraph constructs a comprehensive dependency graph, computes centrality metrics, and generates impact simulations — helping you prevent regression bugs in large systems.
7
7
 
8
8
  ---
9
9
 
10
10
  ## Key Features
11
11
 
12
- - **Multi-Language AST & Regex Code Parsing**: Comprehensive native extractors for **10 languages**:
12
+ - **Multi-Language AST & Regex Code Parsing**: Comprehensive native extractors for **11 languages**:
13
13
  - **JavaScript / TypeScript / React** (`.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs`)
14
14
  - **Python** (`.py`)
15
15
  - **Go** (`.go`)
@@ -19,6 +19,7 @@
19
19
  - **PHP** (`.php`)
20
20
  - **Ruby** (`.rb`)
21
21
  - **Swift** (`.swift`)
22
+ - **Rust** (`.rs`)
22
23
  - **Dependency Graph Reconstruction**: Resolves local imports, aliases, namespace packages, and cross-file relationships to build a full topology map of your codebase.
23
24
  - **Metrics & Centrality Analysis**: Calculates in-degree, out-degree, and centrality scores for every entity to automatically identify **Critical Nodes**.
24
25
  - **Impact Simulation Engine**: Runs a reverse BFS to model the cascading impact of changing a specific function or class. Generates a risk score, lists affected nodes, and provides an actionable testing plan.
@@ -30,7 +31,7 @@
30
31
 
31
32
  ## Supported Languages
32
33
 
33
- DepGraph Core provides native parsing and symbol extraction across 10 major programming languages:
34
+ DepGraph Core provides native parsing and symbol extraction across 11 major programming languages:
34
35
 
35
36
  | Language | Extensions | Extracted Entities | Import & Resolution Features |
36
37
  | :--- | :--- | :--- | :--- |
@@ -43,6 +44,7 @@ DepGraph Core provides native parsing and symbol extraction across 10 major prog
43
44
  | **PHP** | `.php` | Classes (abstract, final), Interfaces, Traits, Enums, Functions, Methods | Namespaces, single & grouped `use` statements, `use ... as` aliases, `require`/`include` file paths |
44
45
  | **Ruby** | `.rb` | Classes, Modules, Instance methods, Class methods (`def self.`), `attr_accessor`/`reader`/`writer` | `require`, `require_relative`, `load`, `include`, `extend`, `prepend` |
45
46
  | **Swift** | `.swift` | Classes, Structs, Enums, Protocols, Actors, Extensions (including `where` constraints), Functions, Initializers | Module imports, sub-module imports, kind-specifier imports (`import class/func/...`) |
47
+ | **Rust** | `.rs` | Functions, Structs (named & tuple fields), Enums (tuple & struct variants), Traits, Impl blocks, Methods | Single & grouped `use` statements, `crate::`/`super::`/`self::` modules, aliases (`as`) |
46
48
 
47
49
  ---
48
50
 
@@ -222,7 +224,7 @@ Recommendations
222
224
  Output written to ./depgraph-output.json
223
225
  ```
224
226
 
225
- **Supported languages for diff parsing:** All 10 languages (JavaScript/TypeScript, Python, Go, C#, Java, Kotlin, PHP, Ruby, and Swift) are fully supported via shared entity pattern registries and fallbacks.
227
+ **Supported languages for diff parsing:** All 11 languages (JavaScript/TypeScript, Python, Go, C#, Java, Kotlin, PHP, Ruby, Swift, and Rust) are fully supported via shared entity pattern registries and fallbacks.
226
228
 
227
229
  ---
228
230
 
@@ -303,6 +305,45 @@ When running `--impact` or `--git-impact`, the tool performs:
303
305
 
304
306
  ---
305
307
 
308
+ ## Claude Code Integration (MCP)
309
+
310
+ DepGraph ships an **MCP server** (`depgraph-mcp`) that lets Claude analyze your codebase and simulate impact directly inside a conversation — no copy-pasting output required.
311
+
312
+ ### Quick setup
313
+
314
+ **1. Build the MCP server**
315
+ ```bash
316
+ npm install
317
+ npm run release:all # compiles + bundles both CLI and MCP server
318
+ ```
319
+
320
+ **2. Register with Claude Code** (run once)
321
+ ```bash
322
+ claude mcp add depgraph -- node /absolute/path/to/depgraph/depgraph-mcp.js
323
+ ```
324
+
325
+ **3. Use it** — open Claude Code in any project and ask naturally:
326
+ ```
327
+ Summarize the dependency graph of /Users/me/my-app
328
+ What is the risk of changing getUserById in /Users/me/my-app?
329
+ Show the impact of the last commit in /Users/me/my-app
330
+ ```
331
+
332
+ ### Available MCP tools
333
+
334
+ | Tool | What it does |
335
+ | :--- | :--- |
336
+ | `get_graph_summary` | Quick overview — counts, critical nodes, entry/leaf points |
337
+ | `analyze_project` | Full dependency graph — all nodes, edges, and file metadata |
338
+ | `simulate_impact` | Risk score + affected nodes for a named function or class |
339
+ | `git_impact` | Detect git-changed entities and simulate their downstream impact |
340
+
341
+ For the full reference (parameters, examples, removal) see [docs/claude-code-integration.md](docs/claude-code-integration.md).
342
+
343
+ > **Backward compatible** — the existing `depgraph` CLI is untouched. All current scripts and CI pipelines continue to work without changes.
344
+
345
+ ---
346
+
306
347
  ## Development & Contribution
307
348
 
308
349
  ### Setup
@@ -317,8 +358,11 @@ npm install
317
358
  | Command | Description |
318
359
  | :--- | :--- |
319
360
  | `npm run build` | Compile TypeScript → `dist/` |
320
- | `npm run bundle` | Bundle `dist/main.js` → `depgraph.js` via esbuild |
321
- | `npm run release` | Build + bundle in one step |
361
+ | `npm run bundle` | Bundle CLI → `depgraph.js` via esbuild |
362
+ | `npm run bundle:mcp` | Bundle MCP server `depgraph-mcp.js` via esbuild |
363
+ | `npm run release` | Build + bundle CLI |
364
+ | `npm run release:mcp` | Build + bundle MCP server |
365
+ | `npm run release:all` | Build + bundle both CLI and MCP server |
322
366
  | `npm run test` | Run tests in watch mode (vitest) |
323
367
  | `npm run test:run` | Run tests once (for CI) |
324
368