depgraph-core 1.5.0 β 1.5.1
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 +36 -36
- package/depgraph.js +1 -1
- package/docs/stage-impact.md +4 -4
- package/docs/stage-output.md +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DepGraph Core
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/depgraph-core)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Key Features
|
|
11
11
|
|
|
12
|
-
-
|
|
12
|
+
- **Multi-Language AST & Regex Code Parsing**: Comprehensive native extractors for **10 languages**:
|
|
13
13
|
- **JavaScript / TypeScript / React** (`.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs`)
|
|
14
14
|
- **Python** (`.py`)
|
|
15
15
|
- **Go** (`.go`)
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
- **PHP** (`.php`)
|
|
20
20
|
- **Ruby** (`.rb`)
|
|
21
21
|
- **Swift** (`.swift`)
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
22
|
+
- **Dependency Graph Reconstruction**: Resolves local imports, aliases, namespace packages, and cross-file relationships to build a full topology map of your codebase.
|
|
23
|
+
- **Metrics & Centrality Analysis**: Calculates in-degree, out-degree, and centrality scores for every entity to automatically identify **Critical Nodes**.
|
|
24
|
+
- **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.
|
|
25
|
+
- **Git Diff Integration**: Automatically detects changed entities from your git history (uncommitted changes, a specific commit, or a branch comparison) across all supported languages and runs impact simulation on every changed symbol.
|
|
26
|
+
- **Rich CLI Interface**: Colorized, human-readable output with a `--no-color` flag for CI/CD pipelines.
|
|
27
|
+
- **Detailed JSON Output**: Exports a comprehensive report containing graph structure, metrics, and simulation results.
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Supported Languages
|
|
32
32
|
|
|
33
33
|
DepGraph Core provides native parsing and symbol extraction across 10 major programming languages:
|
|
34
34
|
|
|
@@ -46,7 +46,7 @@ DepGraph Core provides native parsing and symbol extraction across 10 major prog
|
|
|
46
46
|
|
|
47
47
|
---
|
|
48
48
|
|
|
49
|
-
##
|
|
49
|
+
## Installation
|
|
50
50
|
|
|
51
51
|
### Global (recommended)
|
|
52
52
|
```bash
|
|
@@ -60,7 +60,7 @@ npx depgraph-core <projectDir> [options]
|
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## CLI Usage
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
66
|
depgraph <projectDir> [options]
|
|
@@ -87,7 +87,7 @@ depgraph <projectDir> [options]
|
|
|
87
87
|
|
|
88
88
|
---
|
|
89
89
|
|
|
90
|
-
##
|
|
90
|
+
## Examples
|
|
91
91
|
|
|
92
92
|
### Standard Usage
|
|
93
93
|
|
|
@@ -113,11 +113,11 @@ depgraph ./src --no-color --output ./ci/depgraph.json
|
|
|
113
113
|
|
|
114
114
|
---
|
|
115
115
|
|
|
116
|
-
###
|
|
116
|
+
### Git Diff Integration
|
|
117
117
|
|
|
118
118
|
`--git-impact` automatically reads your git diff, detects every function or class that changed, and runs an impact simulation for each one β no need to manually select a target entity.
|
|
119
119
|
|
|
120
|
-
####
|
|
120
|
+
#### How It Works under the Hood
|
|
121
121
|
|
|
122
122
|
1. **Git Diff Execution**: Runs the appropriate git command depending on the mode:
|
|
123
123
|
- **Uncommitted Changes**: `git diff HEAD` (detects staged & unstaged changes).
|
|
@@ -128,7 +128,7 @@ depgraph ./src --no-color --output ./ci/depgraph.json
|
|
|
128
128
|
4. **Fallback Parsers**: Contains built-in fallback parser logic for popular OOP languages like Java (`.java`) and C# (`.cs`) to extract method signatures.
|
|
129
129
|
5. **Change Description Generation**: Automatically analyzes added/removed lines in the change hunk to build descriptive labels (e.g. `getUserById: 3 line(s) changed to 2 new line(s)`).
|
|
130
130
|
|
|
131
|
-
####
|
|
131
|
+
#### Git Commands Reference
|
|
132
132
|
|
|
133
133
|
| Mode | CLI Command | Under-the-hood Command | Description |
|
|
134
134
|
| :--- | :--- | :--- | :--- |
|
|
@@ -137,7 +137,7 @@ depgraph ./src --no-color --output ./ci/depgraph.json
|
|
|
137
137
|
| **Specific Commit** | `depgraph ./src --git-impact --commit <sha>` | `git diff <sha>~1 <sha>` | Analyze any commit by its SHA |
|
|
138
138
|
| **Branch Comparison** | `depgraph ./src --git-impact --from main --to feature/auth` | `git diff main...feature/auth` | Compare two branches |
|
|
139
139
|
|
|
140
|
-
####
|
|
140
|
+
#### CLI Output Example
|
|
141
141
|
|
|
142
142
|
Running `--git-impact` displays a colorized report of detected entities and runs an impact simulation for each one:
|
|
143
143
|
|
|
@@ -146,14 +146,14 @@ Running `--git-impact` displays a colorized report of detected entities and runs
|
|
|
146
146
|
DepGraph v1.0.0
|
|
147
147
|
βββββββββββββββββββββββββββββββββββββββββ
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
Scanning .
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
Graph Summary
|
|
152
152
|
Files : 27
|
|
153
153
|
Nodes : 76
|
|
154
154
|
Edges : 252
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
Reading git diff...
|
|
157
157
|
|
|
158
158
|
Found 2 changed entity(s):
|
|
159
159
|
β slugify (src/languages/javascript.ts)
|
|
@@ -163,7 +163,7 @@ Running impact simulation...
|
|
|
163
163
|
|
|
164
164
|
ββββββββββββββββββββββββββββββββββββββββββ
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
Impact Simulation
|
|
167
167
|
Target : slugify__javascript
|
|
168
168
|
Change : slugify: 16 line(s) added
|
|
169
169
|
Risk Score : 0
|
|
@@ -171,22 +171,22 @@ Running impact simulation...
|
|
|
171
171
|
|
|
172
172
|
β No affected nodes found
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
Testing Plan
|
|
175
175
|
β Test slugify directly after making changes
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
Recommendations
|
|
178
178
|
β Standard PR process is sufficient
|
|
179
179
|
β Unit tests for the changed node are enough
|
|
180
180
|
|
|
181
181
|
ββββββββββββββββββββββββββββββββββββββββββ
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
Impact Simulation
|
|
184
184
|
Target : LanguageParser__registry
|
|
185
185
|
Change : LanguageParser: 6 line(s) added
|
|
186
186
|
Risk Score : 100
|
|
187
187
|
Risk Level : CRITICAL
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
Affected Nodes (3)
|
|
190
190
|
|
|
191
191
|
[CRITICAL] extractEntities
|
|
192
192
|
file : src/languages/go.ts
|
|
@@ -206,27 +206,27 @@ Running impact simulation...
|
|
|
206
206
|
action : Update extractExports to handle the new interface of LanguageParser
|
|
207
207
|
breaking: YES
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
Testing Plan
|
|
210
210
|
β Test LanguageParser directly after making changes
|
|
211
211
|
β Regression test extractEntities β direct dependent
|
|
212
212
|
β Regression test extractImports β direct dependent
|
|
213
213
|
β Regression test extractExports β direct dependent
|
|
214
214
|
β Run full test suite β 3 nodes affected
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
Recommendations
|
|
217
217
|
β Full team review required before merging
|
|
218
218
|
β Consider a phased rollout
|
|
219
219
|
β Run full regression test suite
|
|
220
220
|
β 3 breaking change(s) must be updated before deploying
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
Output written to ./depgraph-output.json
|
|
223
223
|
```
|
|
224
224
|
|
|
225
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.
|
|
226
226
|
|
|
227
227
|
---
|
|
228
228
|
|
|
229
|
-
##
|
|
229
|
+
## Impact Simulation Mechanics
|
|
230
230
|
|
|
231
231
|
When running `--impact` or `--git-impact`, the tool performs:
|
|
232
232
|
|
|
@@ -238,14 +238,14 @@ When running `--impact` or `--git-impact`, the tool performs:
|
|
|
238
238
|
- Number of medium/low-impact nodes
|
|
239
239
|
- The target node's in-degree
|
|
240
240
|
4. **Risk Level Mapping**:
|
|
241
|
-
-
|
|
242
|
-
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
241
|
+
- **CRITICAL** (β₯ 75): Comprehensive review, phased rollout, full regression testing.
|
|
242
|
+
- **HIGH** (50β74): Tech lead review, feature flag recommended.
|
|
243
|
+
- **MEDIUM** (25β49): Standard peer review, targeted module testing.
|
|
244
|
+
- **LOW** (< 25): Standard PR process is sufficient.
|
|
245
245
|
|
|
246
246
|
---
|
|
247
247
|
|
|
248
|
-
##
|
|
248
|
+
## Output JSON Schema
|
|
249
249
|
|
|
250
250
|
```json
|
|
251
251
|
{
|
|
@@ -303,7 +303,7 @@ When running `--impact` or `--git-impact`, the tool performs:
|
|
|
303
303
|
|
|
304
304
|
---
|
|
305
305
|
|
|
306
|
-
##
|
|
306
|
+
## Development & Contribution
|
|
307
307
|
|
|
308
308
|
### Setup
|
|
309
309
|
```bash
|
|
@@ -324,6 +324,6 @@ npm install
|
|
|
324
324
|
|
|
325
325
|
---
|
|
326
326
|
|
|
327
|
-
##
|
|
327
|
+
## License
|
|
328
328
|
|
|
329
329
|
This project is licensed under the MIT License β see the [LICENSE](LICENSE) file for details.
|
package/depgraph.js
CHANGED
|
@@ -2298,7 +2298,7 @@ function getFlag(flag) {
|
|
|
2298
2298
|
}
|
|
2299
2299
|
function printHelp() {
|
|
2300
2300
|
console.log(`
|
|
2301
|
-
${bold("DepGraph")} ${dim("v1.5.
|
|
2301
|
+
${bold("DepGraph")} ${dim("v1.5.1")}
|
|
2302
2302
|
${dim("Dependency mapping \xB7 Impact simulation \xB7 Developer intelligence")}
|
|
2303
2303
|
|
|
2304
2304
|
${bold("USAGE")}
|
package/docs/stage-impact.md
CHANGED
|
@@ -58,10 +58,10 @@ Impact level is determined by **BFS depth**:
|
|
|
58
58
|
|
|
59
59
|
| Depth | Impact Level | Breaking Change? |
|
|
60
60
|
|---|---|---|
|
|
61
|
-
| 1 | `critical` |
|
|
62
|
-
| 2 | `high` |
|
|
63
|
-
| 3β4 | `medium` |
|
|
64
|
-
| 5β10 | `low` |
|
|
61
|
+
| 1 | `critical` | Yes |
|
|
62
|
+
| 2 | `high` | Yes |
|
|
63
|
+
| 3β4 | `medium` | No |
|
|
64
|
+
| 5β10 | `low` | No |
|
|
65
65
|
|
|
66
66
|
Nodes at depth β€ 2 are flagged as `breakingChange: true` because they directly consume the target's interface.
|
|
67
67
|
|
package/docs/stage-output.md
CHANGED
|
@@ -72,7 +72,7 @@ if (!fs.existsSync(dir)) {
|
|
|
72
72
|
After a successful write, a summary is printed to stdout:
|
|
73
73
|
|
|
74
74
|
```
|
|
75
|
-
|
|
75
|
+
Output written to ./depgraph-output.json
|
|
76
76
|
12 files
|
|
77
77
|
87 nodes
|
|
78
78
|
143 edges
|
|
@@ -82,7 +82,7 @@ After a successful write, a summary is printed to stdout:
|
|
|
82
82
|
If an impact report was included:
|
|
83
83
|
|
|
84
84
|
```
|
|
85
|
-
|
|
85
|
+
Impact Report included
|
|
86
86
|
Target : getUserById__userService
|
|
87
87
|
Risk Level : HIGH
|
|
88
88
|
Risk Score : 62
|