dependency-therapist
v0.3.0
Published
π₯ AI-powered dependency health diagnostics for Node.js projects
Maintainers
Readme
π₯ Dependency Therapist
Is your project healthy?
Dependency Therapist is an AI-powered analysis tool that diagnoses the health of Node.js project dependencies and visualizes technical debt.
Using a medical diagnosis metaphor, it makes dependency health status easy to understand and visualize.
β¨ Features
- π― Overall Health Score: Evaluate project dependencies with a 0-100 score
- π Symptom Detection: Automatically detect problematic packages (7 types)
- π Prescriptions: Suggest specific improvement strategies
- π Detailed Analysis: Individual evaluation of freshness, security, complexity, maintainability, and performance
- π Security Scanning: npm audit integration for vulnerability detection
- π Terminal Charts: Interactive ASCII charts and gauges
- π HTML Reports: Beautiful, responsive HTML report generation
- π§ Auto-Fix: Automatic dependency healing with backup
- π i18n Support: English and Japanese language support
- π CI/CD Ready: Threshold checking and JSON output
π¦ Installation
npm install -g dependency-therapistOr run directly with npx:
npx dependency-therapist diagnoseπ Usage
Basic Diagnosis
dependency-therapist diagnoseOptions
# Diagnose a specific project
dependency-therapist diagnose --path /path/to/project
# Show simple summary only
dependency-therapist diagnose --simple
# Output in JSON format
dependency-therapist diagnose --json
# Generate HTML report
dependency-therapist diagnose --html report.html
# Show interactive terminal charts
dependency-therapist diagnose --charts
# Use Japanese language
dependency-therapist diagnose --lang ja
# Use English language
dependency-therapist diagnose --lang enLanguage Support
The CLI supports English and Japanese. Language is detected automatically from your system locale (LANG environment variable), or you can specify it explicitly:
# Japanese output
dependency-therapist diagnose -l ja
# English output
dependency-therapist heal --lang en --dry-runAuto-Fix (Heal Command)
# Auto-fix dependencies
dependency-therapist heal
# Preview fixes without applying
dependency-therapist heal --dry-run
# Force fixes including breaking changes
dependency-therapist heal --force
# Skip confirmation prompt
dependency-therapist heal --yesCI/CD Integration
# GitHub Actions example
- name: Dependency Health Check
run: |
npx dependency-therapist diagnose --simpleExits with code 1 if score is below 60.
π Sample Output
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Project Health Diagnosis Report β
β β
β Overall Health Score: 72/100 π‘ Needs Attention β
β β
β π Detailed Scores: β
β ββ Freshness: 45/100 π΄ ββββββββββββββββββββ β
β ββ Security: 88/100 π’ ββββββββββββββββββββ β
β ββ Complexity: 62/100 π‘ ββββββββββββββββββββ β
β ββ Maintainability: 71/100 π‘ ββββββββββββββββββββ β
β ββ Performance: 80/100 π’ ββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Summary:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total Dependencies: 45
Outdated Packages: 12
Deprecated Packages: 2
Average Age: 8 months
Detected Symptoms: 3
π₯ Detected Symptoms:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β οΈ Severity: HIGH
Symptom: "Update Delay Syndrome"
Description: 12 packages are outdated (including 3 major updates)
Prescription:
1. Check with npm outdated
2. Implement gradual updates
3. Review CHANGELOG for breaking changesπ― Scoring Criteria
Overall Score
- π’ 80-100: Healthy - Good condition
- π‘ 60-79: Needs Attention - Room for improvement
- π΄ 0-59: Unhealthy - Urgent action required
Score Categories
- Freshness: Evaluates package recency
- Security: Deprecated packages and security risks
- Complexity: Number and complexity of dependencies
- Maintainability: Ease of maintenance
- Performance: Impact on build and runtime
π Detected Symptoms
| Symptom | Description | |---------|-------------| | Security Vulnerability Infection | npm audit vulnerabilities detected | | Clone Infection | Duplicate packages with multiple versions | | Zombie Package Infection | Deprecated or not updated for 2+ years | | Update Delay Syndrome | Large number of outdated packages | | Dependency Obesity | Too many dependencies (100+) | | Version Conflict Syndrome | Different versions of the same package | | Aging Syndrome | Average dependency age too high |
π API Usage Example
You can also use it programmatically:
import { diagnose, generateReport, setLocale } from 'dependency-therapist';
// Set language (optional - defaults to 'en')
setLocale('ja'); // or 'en'
// Run diagnosis
const result = await diagnose('/path/to/project');
// Generate report
console.log(generateReport(result));
// Access scores
console.log(`Overall Score: ${result.score.overall}`);
console.log(`Symptoms: ${result.symptoms.length}`);π οΈ Development
# Install dependencies
npm install
# Build
npm run build
# Test
npm test
# Development mode
npm run devπ Roadmap
Phase 1 (MVP) - Completed β
- Basic scoring functionality
- Simple CLI
- Text-based reports
Phase 2 - Completed β
- Security vulnerability scanning (npm audit integration)
- HTML report generation
- Auto-fix functionality (heal command)
- Duplicate package detection
Phase 3 - In Progress π§
- β Interactive terminal visualization (charts & gauges)
- β Internationalization (English/Japanese)
- AI recommendation engine
- Failure prediction timeline
- Continuous monitoring
π€ Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
π License
MIT
π Acknowledgments
This project is inspired by the following tools and libraries:
- npm-check
- depcheck
- npm-outdated
Stop worrying about dependencies. π₯
dependency-therapist serves as your project's primary physician, watching over your dependency health 24/7/365.
