impact-analysis 2.0.3 → 2.0.5

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
@@ -32,6 +32,11 @@ Or use locally in a project:
32
32
  npm install --save-dev impact-analysis
33
33
  ```
34
34
 
35
+ For pnpm:
36
+ ```bash
37
+ pnpm add -D impact-analysis
38
+ ```
39
+
35
40
  ## Usage
36
41
 
37
42
  ### Basic Analysis
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 {
@@ -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 = Object.entries(dependencyMap)
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impact-analysis",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Analyze real impact of code changes using dependency graphs",
5
5
  "bin": {
6
6
  "impact-analysis": "dist/cli.js"