impact-analysis 2.0.2 → 2.0.4
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 +3 -3
- package/dist/cli.js +24 -0
- package/dist/core/analyzer.js +1 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
- **Smart Dependency Analysis**
|
|
16
16
|
- **Visual Reports** - Beautiful HTML reports with interactive dependency graphs
|
|
17
17
|
- **Fast with Caching** - Caches dependency graphs for quick re-analysis
|
|
18
|
-
- **AI Explanations**
|
|
18
|
+
- **AI Explanations** - Get AI-powered insights using Google Gemini
|
|
19
19
|
- **React Support** - Full support for .js, .jsx, .ts, .tsx files
|
|
20
20
|
- **Angular Support** - Supports TypeScript components
|
|
21
|
-
- **Vue Support** - Full support for Vue SFCs including
|
|
21
|
+
- **Vue Support** - Full support for Vue SFCs including
|
|
22
22
|
- **Risk Scoring** - Automatic LOW/MEDIUM/HIGH risk classification
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
@@ -68,7 +68,7 @@ Note: AI features are completely optional. The tool works perfectly without an A
|
|
|
68
68
|
|
|
69
69
|
## How It Works
|
|
70
70
|
|
|
71
|
-
1. **Scans** your repository for all
|
|
71
|
+
1. **Scans** your repository for all files
|
|
72
72
|
2. **Builds** a dependency graph using AST parsing
|
|
73
73
|
3. **Detects** changed files using Git diff
|
|
74
74
|
4. **Analyzes** which files import the changed files
|
package/dist/cli.js
CHANGED
|
@@ -77,6 +77,30 @@ async function main() {
|
|
|
77
77
|
graph.importedBy.forEach((importers, file) => {
|
|
78
78
|
dependencyMap[file] = Array.from(importers);
|
|
79
79
|
});
|
|
80
|
+
changedFiles.forEach(changed => {
|
|
81
|
+
const changedBasename = path_1.default.basename(changed);
|
|
82
|
+
console.log(`\nChanged file: ${changedBasename}`);
|
|
83
|
+
console.log(`Full path: ${changed}`);
|
|
84
|
+
// Check if this file exists in the dependency map
|
|
85
|
+
if (dependencyMap[changed]) {
|
|
86
|
+
console.log(`Files that import ${changedBasename}:`, dependencyMap[changed].map(f => path_1.default.basename(f)));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
console.log(`Not found in dependency map as an imported file`);
|
|
90
|
+
const matchingKeys = Object.keys(dependencyMap).filter(key => key.toLowerCase().includes(changedBasename.toLowerCase()));
|
|
91
|
+
if (matchingKeys.length > 0) {
|
|
92
|
+
console.log(`Similar paths found in dependency map:`);
|
|
93
|
+
matchingKeys.forEach(key => {
|
|
94
|
+
console.log(` - ${key}`);
|
|
95
|
+
console.log(` Imported by:`, dependencyMap[key].map(f => path_1.default.basename(f)));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const imports = graph.imports.get(changed);
|
|
100
|
+
if (imports) {
|
|
101
|
+
console.log(`Files imported by ${changedBasename}:`, Array.from(imports).map(f => path_1.default.basename(f)));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
80
104
|
const results = (0, analyzer_1.analyzeImpact)(changedFiles, dependencyMap);
|
|
81
105
|
if (useAI) {
|
|
82
106
|
try {
|
package/dist/core/analyzer.js
CHANGED
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.analyzeImpact = analyzeImpact;
|
|
4
4
|
function analyzeImpact(changedFiles, dependencyMap) {
|
|
5
5
|
return changedFiles.map(changed => {
|
|
6
|
-
const impacted =
|
|
7
|
-
.filter(([, deps]) => deps.includes(changed))
|
|
8
|
-
.map(([file]) => file);
|
|
6
|
+
const impacted = dependencyMap[changed] || [];
|
|
9
7
|
let risk = 'LOW';
|
|
10
8
|
if (impacted.length > 5)
|
|
11
9
|
risk = 'HIGH';
|