impact-analysis 2.0.3 → 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/dist/cli.js +24 -0
- package/dist/core/analyzer.js +1 -3
- package/package.json +1 -1
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';
|