impact-analysis
v2.0.8
Published
Analyze real impact of code changes using dependency graphs
Maintainers
Readme
Impact Analysis
Analyze the real impact of code changes in JavaScript, TypeScript, React, Vue, and Angular projects.
Keywords: impact-analysis · dependency-graph · code-analysis · static-analysis · react · vue · angular · typescript · ast · ast-parser · code-impact · dependency-tracker · git-diff · change-analysis
Features
- Smart Dependency Analysis
- Visual Reports - Beautiful HTML reports with interactive dependency graphs
- Fast with Caching - Caches dependency graphs for quick re-analysis
- AI Explanations - Get AI-powered insights using Google Gemini
- React Support - Full support for .js, .jsx, .ts, .tsx files
- Angular Support - Supports TypeScript components
- Vue Support - Full support for Vue SFCs including
- Risk Scoring - Automatic LOW/MEDIUM/HIGH risk classification
Installation
npm install -g impact-analysisOr use locally in a project:
npm install --save-dev impact-analysisFor pnpm:
pnpm add -D impact-analysisUsage
Basic Analysis
# Analyze changes compared to main branch
impact-analysis
# Compare against a different branch
impact-analysis develop
# Open HTML report in browser
impact-analysis --html
# Clear cache and rebuild dependency graph
impact-analysis --clear-cacheAI Explanations (If you really want to get an AI powered analysis)
To enable AI-powered impact explanations:
- Get a free API key from Google AI Studio
- Create a
.envfile in your project root:GEMINI_API_KEY=your-api-key-here - Run with
--aiflag:impact-analysis --ai
Note: AI features are completely optional. The tool works perfectly without an API key.
How It Works
- Scans your repository for all files
- Builds a dependency graph using AST parsing
- Detects changed files using Git diff
- Analyzes which files import the changed files
- Generates an HTML report with interactive visualization
Supported Import Formats
- ES6 imports:
import x from './module' - Dynamic imports:
import('./module') - CommonJS:
require('./module') - Export from:
export { x } from './module' - Export all:
export * from './module' - Path aliases:
@/,~/,#, tsconfig paths
Path Alias Support
The tool automatically resolves:
@/components/Header→components/Header~/utils/helper→utils/helper#components/Footer→components/Footer- Custom tsconfig paths
Output
Console Output
Scanning repository...
Building dependency graph from 850 files...
Dependency graph built: 543 files with dependencies
Getting changed files against main...
Found 2 changed files. Analyzing impact...
--- Impact Analysis Results ---
1. Dashboard.vue
Risk: HIGH
Impacted files: 12
- Header.vue
- Layout.vue
- NavBar.vue
... and 9 more
Generating HTML report...
Report saved: impact-analysis.htmlHTML Report
Interactive visualization with:
- Graph View: Visual dependency network
- Table View: Detailed file-by-file breakdown
- Clickable nodes and expandable lists
Requirements
- Node.js 18+
- Git (for change detection)
- A Git repository
License
MITbash npm install -g impact-analysis
