devcompass 1.0.5 → 2.2.0
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 +472 -27
- package/bin/devcompass.js +13 -1
- package/data/issues-db.json +60 -0
- package/package.json +14 -5
- package/src/alerts/formatter.js +69 -0
- package/src/alerts/index.js +32 -0
- package/src/alerts/matcher.js +51 -0
- package/src/alerts/resolver.js +46 -0
- package/src/analyzers/outdated.js +2 -0
- package/src/analyzers/scoring.js +14 -3
- package/src/analyzers/unused-deps.js +1 -0
- package/src/cache/manager.js +90 -0
- package/src/commands/analyze.js +200 -31
- package/src/commands/fix.js +247 -0
- package/src/config/loader.js +72 -0
- package/src/utils/ci-handler.js +33 -0
- package/src/utils/json-formatter.js +44 -0
- package/src/utils/logger.js +1 -0
- package/src/index.js +0 -0
package/README.md
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
# 🧭 DevCompass
|
|
2
2
|
|
|
3
|
-
**Dependency health checker for JavaScript/TypeScript projects**
|
|
3
|
+
**Dependency health checker with ecosystem intelligence for JavaScript/TypeScript projects**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/devcompass)
|
|
6
6
|
[](https://www.npmjs.com/package/devcompass)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
-
Analyze your JavaScript projects to find unused dependencies, outdated packages, and
|
|
9
|
+
Analyze your JavaScript projects to find unused dependencies, outdated packages, **detect known security issues**, and **automatically fix them** with a single command. Perfect for **CI/CD pipelines** with JSON output and exit codes.
|
|
10
|
+
|
|
11
|
+
> **NEW in v2.2:** CI/CD integration with JSON output & smart caching! 🚀
|
|
12
|
+
> **NEW in v2.1:** Auto-fix command! 🔧 Fix critical issues automatically!
|
|
13
|
+
> **NEW in v2.0:** Real-time ecosystem alerts for known issues! 🚨
|
|
10
14
|
|
|
11
15
|
## ✨ Features
|
|
12
16
|
|
|
17
|
+
- 🚀 **CI/CD Integration** (NEW in v2.2!) - JSON output, exit codes, and silent mode
|
|
18
|
+
- ⚡ **Smart Caching** (NEW in v2.2!) - 70% faster on repeated runs
|
|
19
|
+
- 🎛️ **Advanced Filtering** (NEW in v2.2!) - Control alerts by severity level
|
|
20
|
+
- 🔧 **Auto-Fix Command** (v2.1) - Fix issues automatically with one command
|
|
21
|
+
- 🚨 **Ecosystem Intelligence** (v2.0) - Detect known issues before they break production
|
|
13
22
|
- 🔍 **Detect unused dependencies** - Find packages you're not actually using
|
|
14
23
|
- 📦 **Check for outdated packages** - See what needs updating
|
|
24
|
+
- 🔐 **Security alerts** - Critical vulnerabilities and deprecated packages
|
|
15
25
|
- 📊 **Project health score** - Get a 0-10 rating for your dependencies
|
|
16
|
-
- 🎨 **Beautiful terminal UI** - Colored output with
|
|
17
|
-
- ⚡ **Fast analysis** - Scans projects in seconds
|
|
26
|
+
- 🎨 **Beautiful terminal UI** - Colored output with severity indicators
|
|
18
27
|
- 🔧 **Framework-aware** - Handles React, Next.js, Angular, NestJS, PostCSS, Tailwind
|
|
19
28
|
|
|
20
29
|
## 🚀 Installation
|
|
@@ -36,48 +45,359 @@ npx devcompass analyze
|
|
|
36
45
|
|
|
37
46
|
## 📖 Usage
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
### Basic Commands
|
|
40
49
|
```bash
|
|
50
|
+
# Analyze your project
|
|
41
51
|
devcompass analyze
|
|
52
|
+
|
|
53
|
+
# Auto-fix issues
|
|
54
|
+
devcompass fix
|
|
55
|
+
|
|
56
|
+
# JSON output (for CI/CD)
|
|
57
|
+
devcompass analyze --json
|
|
58
|
+
|
|
59
|
+
# CI mode (exit code 1 if score < threshold)
|
|
60
|
+
devcompass analyze --ci
|
|
61
|
+
|
|
62
|
+
# Silent mode (no output)
|
|
63
|
+
devcompass analyze --silent
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 🚀 NEW in v2.2: CI/CD Integration
|
|
67
|
+
|
|
68
|
+
### JSON Output
|
|
69
|
+
Perfect for parsing in CI/CD pipelines:
|
|
70
|
+
```bash
|
|
71
|
+
devcompass analyze --json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Output:**
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"version": "2.2.0",
|
|
78
|
+
"timestamp": "2026-04-01T15:51:10.395Z",
|
|
79
|
+
"summary": {
|
|
80
|
+
"healthScore": 7.5,
|
|
81
|
+
"totalDependencies": 15,
|
|
82
|
+
"ecosystemAlerts": 2,
|
|
83
|
+
"unusedDependencies": 3,
|
|
84
|
+
"outdatedPackages": 5
|
|
85
|
+
},
|
|
86
|
+
"ecosystemAlerts": [...],
|
|
87
|
+
"unusedDependencies": [...],
|
|
88
|
+
"outdatedPackages": [...],
|
|
89
|
+
"scoreBreakdown": {
|
|
90
|
+
"unusedPenalty": 0.8,
|
|
91
|
+
"outdatedPenalty": 1.7,
|
|
92
|
+
"alertsPenalty": 3.5
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### CI Mode
|
|
98
|
+
Automatically fail builds if health score is too low:
|
|
99
|
+
```bash
|
|
100
|
+
devcompass analyze --ci
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- ✅ **Exit code 0** if score ≥ threshold (default: 7/10)
|
|
104
|
+
- ❌ **Exit code 1** if score < threshold
|
|
105
|
+
|
|
106
|
+
**GitHub Actions Example:**
|
|
107
|
+
```yaml
|
|
108
|
+
name: Dependency Health Check
|
|
109
|
+
|
|
110
|
+
on: [push, pull_request]
|
|
111
|
+
|
|
112
|
+
jobs:
|
|
113
|
+
health-check:
|
|
114
|
+
runs-on: ubuntu-latest
|
|
115
|
+
steps:
|
|
116
|
+
- uses: actions/checkout@v3
|
|
117
|
+
- uses: actions/setup-node@v3
|
|
118
|
+
- run: npm install -g devcompass
|
|
119
|
+
- run: devcompass analyze --ci
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Silent Mode
|
|
123
|
+
For background checks or scripts:
|
|
124
|
+
```bash
|
|
125
|
+
devcompass analyze --silent
|
|
126
|
+
echo $? # Check exit code
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## ⚡ NEW in v2.2: Smart Caching
|
|
130
|
+
|
|
131
|
+
DevCompass now caches results to improve performance:
|
|
132
|
+
|
|
133
|
+
- **First run:** Normal speed (fetches all data)
|
|
134
|
+
- **Cached runs:** ~70% faster
|
|
135
|
+
- **Cache duration:** 1 hour
|
|
136
|
+
- **Cache file:** `.devcompass-cache.json` (auto-gitignored)
|
|
137
|
+
|
|
138
|
+
**Disable caching:**
|
|
139
|
+
```json
|
|
140
|
+
// devcompass.config.json
|
|
141
|
+
{
|
|
142
|
+
"cache": false
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## 🎛️ NEW in v2.2: Advanced Configuration
|
|
147
|
+
|
|
148
|
+
Create `devcompass.config.json` in your project root:
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"ignore": ["lodash", "moment"],
|
|
152
|
+
"ignoreSeverity": ["low"],
|
|
153
|
+
"minSeverity": "medium",
|
|
154
|
+
"minScore": 7,
|
|
155
|
+
"cache": true
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Configuration Options
|
|
160
|
+
|
|
161
|
+
| Option | Type | Description | Example |
|
|
162
|
+
|--------|------|-------------|---------|
|
|
163
|
+
| `ignore` | `string[]` | Ignore specific packages from alerts | `["lodash", "axios"]` |
|
|
164
|
+
| `ignoreSeverity` | `string[]` | Ignore severity levels | `["low", "medium"]` |
|
|
165
|
+
| `minSeverity` | `string` | Only show alerts above this level | `"high"` (shows critical + high) |
|
|
166
|
+
| `minScore` | `number` | Minimum score for CI mode | `7` (fails if < 7) |
|
|
167
|
+
| `cache` | `boolean` | Enable/disable caching | `true` |
|
|
168
|
+
|
|
169
|
+
### Severity Levels (highest to lowest)
|
|
170
|
+
1. **critical** - Immediate security risk
|
|
171
|
+
2. **high** - Production stability issues
|
|
172
|
+
3. **medium** - Maintenance concerns
|
|
173
|
+
4. **low** - Minor issues
|
|
174
|
+
|
|
175
|
+
### Example Configurations
|
|
176
|
+
|
|
177
|
+
**Only show critical security issues:**
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"minSeverity": "critical",
|
|
181
|
+
"minScore": 8
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Ignore low-priority alerts:**
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"ignoreSeverity": ["low"]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Strict CI mode:**
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"minScore": 9,
|
|
196
|
+
"minSeverity": "high"
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## 🔧 Auto-Fix Command
|
|
201
|
+
|
|
202
|
+
DevCompass can now **automatically fix issues** in your project!
|
|
203
|
+
|
|
204
|
+
### What it does:
|
|
205
|
+
- 🔴 **Fixes critical security issues** - Upgrades packages with known vulnerabilities
|
|
206
|
+
- 🧹 **Removes unused dependencies** - Cleans up packages you're not using
|
|
207
|
+
- ⬆️ **Safe updates** - Applies patch and minor updates automatically
|
|
208
|
+
- ⚠️ **Skips breaking changes** - Major updates require manual review
|
|
209
|
+
|
|
210
|
+
### Usage
|
|
211
|
+
```bash
|
|
212
|
+
# Interactive mode (asks for confirmation)
|
|
213
|
+
devcompass fix
|
|
214
|
+
|
|
215
|
+
# Auto-apply without confirmation (for CI/CD)
|
|
216
|
+
devcompass fix --yes
|
|
217
|
+
devcompass fix -y
|
|
218
|
+
|
|
219
|
+
# Fix specific directory
|
|
220
|
+
devcompass fix --path /path/to/project
|
|
42
221
|
```
|
|
43
222
|
|
|
44
223
|
### Example Output
|
|
45
224
|
```
|
|
46
|
-
|
|
225
|
+
🔧 DevCompass Fix - Analyzing and fixing your project...
|
|
226
|
+
|
|
227
|
+
🔴 CRITICAL ISSUES TO FIX:
|
|
228
|
+
|
|
229
|
+
🔴 lodash@4.17.19
|
|
230
|
+
Issue: Prototype pollution vulnerability
|
|
231
|
+
Fix: Upgrade to 4.17.21
|
|
232
|
+
|
|
233
|
+
🟠 axios@1.6.0
|
|
234
|
+
Issue: Memory leak in request interceptors
|
|
235
|
+
Fix: Upgrade to 1.6.2
|
|
236
|
+
|
|
237
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
238
|
+
|
|
239
|
+
🧹 UNUSED DEPENDENCIES TO REMOVE:
|
|
240
|
+
|
|
241
|
+
● moment
|
|
242
|
+
● express
|
|
243
|
+
|
|
244
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
245
|
+
|
|
246
|
+
⬆️ SAFE UPDATES (patch/minor):
|
|
247
|
+
|
|
248
|
+
react-dom: 18.2.0 → 18.2.1 (patch update)
|
|
249
|
+
|
|
250
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
251
|
+
|
|
252
|
+
⚠️ MAJOR UPDATES (skipped - may have breaking changes):
|
|
253
|
+
|
|
254
|
+
express: 4.18.0 → 5.2.1
|
|
255
|
+
|
|
256
|
+
Run these manually after reviewing changelog:
|
|
257
|
+
npm install express@5.2.1
|
|
258
|
+
|
|
259
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
260
|
+
|
|
261
|
+
📊 FIX SUMMARY:
|
|
262
|
+
|
|
263
|
+
Critical fixes: 2
|
|
264
|
+
Remove unused: 2
|
|
265
|
+
Safe updates: 1
|
|
266
|
+
Skipped major: 1
|
|
267
|
+
|
|
268
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
269
|
+
|
|
270
|
+
❓ Apply these fixes? (y/N): y
|
|
271
|
+
|
|
272
|
+
🔧 Applying fixes...
|
|
273
|
+
|
|
274
|
+
✔ ✅ Removed 2 unused packages
|
|
275
|
+
✔ ✅ Fixed lodash@4.17.21
|
|
276
|
+
✔ ✅ Fixed axios@1.6.2
|
|
277
|
+
✔ ✅ Updated 1 packages
|
|
278
|
+
|
|
279
|
+
✨ All fixes applied successfully!
|
|
280
|
+
|
|
281
|
+
💡 Run devcompass analyze to see the new health score.
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Safety Features
|
|
285
|
+
- ✅ Shows what will be changed before applying
|
|
286
|
+
- ✅ Requires confirmation (unless `--yes` flag used)
|
|
287
|
+
- ✅ Skips major updates (may have breaking changes)
|
|
288
|
+
- ✅ Groups actions by priority (critical → cleanup → updates)
|
|
289
|
+
- ✅ Provides clear summary of changes
|
|
290
|
+
|
|
291
|
+
### Workflow Example
|
|
292
|
+
```bash
|
|
293
|
+
# 1. Analyze your project
|
|
294
|
+
devcompass analyze
|
|
295
|
+
|
|
296
|
+
# 2. If issues found, auto-fix them
|
|
297
|
+
devcompass fix
|
|
298
|
+
|
|
299
|
+
# 3. Verify the improvements
|
|
300
|
+
devcompass analyze
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## 📊 Analyze Command
|
|
304
|
+
|
|
305
|
+
### Example Output (v2.2)
|
|
306
|
+
```
|
|
307
|
+
🔍 DevCompass v2.2.0 - Analyzing your project...
|
|
47
308
|
✔ Scanned 15 dependencies in project
|
|
309
|
+
|
|
310
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
311
|
+
|
|
312
|
+
🚨 ECOSYSTEM ALERTS (2)
|
|
313
|
+
|
|
314
|
+
🔴 CRITICAL
|
|
315
|
+
lodash@4.17.19
|
|
316
|
+
Issue: Prototype pollution vulnerability
|
|
317
|
+
Affected: <4.17.21
|
|
318
|
+
Fix: 4.17.21
|
|
319
|
+
Source: npm advisory 1523
|
|
320
|
+
|
|
321
|
+
🟠 HIGH
|
|
322
|
+
axios@1.6.0
|
|
323
|
+
Issue: Memory leak in request interceptors
|
|
324
|
+
Affected: >=1.5.0 <1.6.2
|
|
325
|
+
Fix: 1.6.2
|
|
326
|
+
Source: GitHub Issue #5456
|
|
327
|
+
|
|
48
328
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
49
329
|
|
|
50
330
|
🔴 UNUSED DEPENDENCIES (2)
|
|
51
|
-
● lodash
|
|
52
331
|
● moment
|
|
332
|
+
● request
|
|
53
333
|
|
|
54
334
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
55
335
|
|
|
56
336
|
🟡 OUTDATED PACKAGES (3)
|
|
57
337
|
react 18.2.0 → ^19.0.0 (major update)
|
|
58
|
-
axios 1.4.0 → ^1.6.0 (minor update)
|
|
59
338
|
express 4.18.0 → ^4.19.0 (patch update)
|
|
60
339
|
|
|
61
340
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
62
341
|
|
|
63
342
|
📊 PROJECT HEALTH
|
|
64
|
-
Overall Score:
|
|
343
|
+
Overall Score: 5.5/10
|
|
65
344
|
Total Dependencies: 15
|
|
345
|
+
Ecosystem Alerts: 2
|
|
66
346
|
Unused: 2
|
|
67
347
|
Outdated: 3
|
|
68
348
|
|
|
69
349
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
70
350
|
|
|
71
|
-
💡 QUICK
|
|
72
|
-
|
|
73
|
-
|
|
351
|
+
💡 QUICK WINS
|
|
352
|
+
🔴 Fix critical issues:
|
|
353
|
+
|
|
354
|
+
npm install lodash@4.17.21
|
|
355
|
+
npm install axios@1.6.2
|
|
356
|
+
|
|
357
|
+
🧹 Clean up unused dependencies:
|
|
358
|
+
|
|
359
|
+
npm uninstall moment request
|
|
74
360
|
|
|
75
361
|
Expected impact:
|
|
362
|
+
✓ Resolve critical security/stability issues
|
|
76
363
|
✓ Remove 2 unused packages
|
|
77
364
|
✓ Reduce node_modules size
|
|
78
|
-
✓ Improve health score →
|
|
365
|
+
✓ Improve health score → 8.5/10
|
|
366
|
+
|
|
367
|
+
💡 TIP: Run 'devcompass fix' to apply these fixes automatically!
|
|
79
368
|
```
|
|
80
369
|
|
|
370
|
+
## 🚨 Ecosystem Intelligence
|
|
371
|
+
|
|
372
|
+
DevCompass tracks **real-world issues** in popular packages and warns you before they break production!
|
|
373
|
+
|
|
374
|
+
### What Gets Detected:
|
|
375
|
+
- 🔴 **Critical security vulnerabilities** - Zero-day exploits, prototype pollution
|
|
376
|
+
- 🟠 **High-severity bugs** - Memory leaks, data corruption, breaking changes
|
|
377
|
+
- 🟡 **Deprecated packages** - Unmaintained dependencies
|
|
378
|
+
- ⚪ **Low-priority issues** - Minor bugs, cosmetic problems
|
|
379
|
+
|
|
380
|
+
### Severity Levels:
|
|
381
|
+
- **CRITICAL** - Immediate security risk or data loss (−2.0 points per issue)
|
|
382
|
+
- **HIGH** - Production stability issues (−1.5 points per issue)
|
|
383
|
+
- **MEDIUM** - Maintenance concerns, deprecations (−0.5 points per issue)
|
|
384
|
+
- **LOW** - Minor issues (−0.2 points per issue)
|
|
385
|
+
|
|
386
|
+
### Currently Tracked Packages:
|
|
387
|
+
- **axios** - Memory leaks, breaking changes
|
|
388
|
+
- **lodash** - Security vulnerabilities (prototype pollution)
|
|
389
|
+
- **moment** - Deprecation notice
|
|
390
|
+
- **express** - Security issues in dependencies
|
|
391
|
+
- **request** - Package deprecated
|
|
392
|
+
|
|
393
|
+
> More packages being added regularly! [Suggest a package](https://github.com/AjayBThorat-20/devcompass/issues)
|
|
394
|
+
|
|
395
|
+
### How It Works:
|
|
396
|
+
1. Reads your actual installed versions from `node_modules`
|
|
397
|
+
2. Matches against curated issues database
|
|
398
|
+
3. Uses semantic versioning for precise detection
|
|
399
|
+
4. Shows actionable fix commands
|
|
400
|
+
|
|
81
401
|
## 🎯 What It Detects
|
|
82
402
|
|
|
83
403
|
### Unused Dependencies
|
|
@@ -100,25 +420,95 @@ DevCompass won't flag these as unused (they're typically used in config files):
|
|
|
100
420
|
- Shows current vs latest versions
|
|
101
421
|
- Indicates update type (major/minor/patch)
|
|
102
422
|
|
|
103
|
-
### Health Score
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
423
|
+
### Health Score (Enhanced in v2.0)
|
|
424
|
+
Calculated from 0-10 based on:
|
|
425
|
+
- Percentage of unused dependencies (−4 points per 100%)
|
|
426
|
+
- Percentage of outdated packages (−3 points per 100%)
|
|
427
|
+
- Ecosystem alerts by severity (−0.2 to −2.0 per issue)
|
|
107
428
|
- Higher score = healthier project
|
|
108
429
|
|
|
109
|
-
## ⚙️ Options
|
|
430
|
+
## ⚙️ Commands & Options
|
|
431
|
+
|
|
432
|
+
### Commands
|
|
110
433
|
```bash
|
|
111
|
-
# Analyze
|
|
434
|
+
# Analyze project dependencies
|
|
112
435
|
devcompass analyze
|
|
113
436
|
|
|
114
|
-
#
|
|
115
|
-
devcompass
|
|
437
|
+
# Auto-fix issues
|
|
438
|
+
devcompass fix
|
|
116
439
|
|
|
117
440
|
# Show version
|
|
118
441
|
devcompass --version
|
|
442
|
+
devcompass -v
|
|
119
443
|
|
|
120
444
|
# Show help
|
|
121
445
|
devcompass --help
|
|
446
|
+
devcompass -h
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Analyze Options
|
|
450
|
+
```bash
|
|
451
|
+
# Analyze specific directory
|
|
452
|
+
devcompass analyze --path /path/to/project
|
|
453
|
+
|
|
454
|
+
# JSON output (for CI/CD)
|
|
455
|
+
devcompass analyze --json
|
|
456
|
+
|
|
457
|
+
# CI mode (fail if score < threshold)
|
|
458
|
+
devcompass analyze --ci
|
|
459
|
+
|
|
460
|
+
# Silent mode (no output)
|
|
461
|
+
devcompass analyze --silent
|
|
462
|
+
|
|
463
|
+
# Combine options
|
|
464
|
+
devcompass analyze --path ./my-project --json
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Fix Options
|
|
468
|
+
```bash
|
|
469
|
+
# Fix specific directory
|
|
470
|
+
devcompass fix --path /path/to/project
|
|
471
|
+
|
|
472
|
+
# Auto-apply without confirmation
|
|
473
|
+
devcompass fix --yes
|
|
474
|
+
devcompass fix -y
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## 🔄 Complete Workflows
|
|
478
|
+
|
|
479
|
+
### Local Development Workflow
|
|
480
|
+
```bash
|
|
481
|
+
# Check project health
|
|
482
|
+
devcompass analyze
|
|
483
|
+
|
|
484
|
+
# Fix issues automatically
|
|
485
|
+
devcompass fix
|
|
486
|
+
|
|
487
|
+
# Verify improvements
|
|
488
|
+
devcompass analyze
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### CI/CD Pipeline Workflow
|
|
492
|
+
```bash
|
|
493
|
+
# Analyze and export JSON
|
|
494
|
+
devcompass analyze --json > health-report.json
|
|
495
|
+
|
|
496
|
+
# Fail build if score too low
|
|
497
|
+
devcompass analyze --ci
|
|
498
|
+
|
|
499
|
+
# Or combine with other checks
|
|
500
|
+
devcompass analyze --ci && npm test && npm run build
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### Pre-commit Hook Workflow
|
|
504
|
+
```bash
|
|
505
|
+
# .husky/pre-commit
|
|
506
|
+
#!/bin/sh
|
|
507
|
+
devcompass analyze --silent
|
|
508
|
+
if [ $? -ne 0 ]; then
|
|
509
|
+
echo "❌ Dependency health check failed!"
|
|
510
|
+
exit 1
|
|
511
|
+
fi
|
|
122
512
|
```
|
|
123
513
|
|
|
124
514
|
## ⚠️ Known Issues & Best Practices
|
|
@@ -139,6 +529,11 @@ DevCompass is smart about config-based dependencies, but occasionally may flag p
|
|
|
139
529
|
|
|
140
530
|
If you encounter a false positive, please [report it](https://github.com/AjayBThorat-20/devcompass/issues)!
|
|
141
531
|
|
|
532
|
+
### Cache Management
|
|
533
|
+
- Cache files (`.devcompass-cache.json`) are automatically gitignored
|
|
534
|
+
- Cache expires after 1 hour
|
|
535
|
+
- Delete cache file manually if needed: `rm .devcompass-cache.json`
|
|
536
|
+
|
|
142
537
|
## 🛠️ Requirements
|
|
143
538
|
|
|
144
539
|
- Node.js >= 14.0.0
|
|
@@ -147,9 +542,13 @@ If you encounter a false positive, please [report it](https://github.com/AjayBTh
|
|
|
147
542
|
## 💡 Tips
|
|
148
543
|
|
|
149
544
|
1. **Run regularly** - Add to your CI/CD pipeline or git hooks
|
|
150
|
-
2. **
|
|
151
|
-
3. **
|
|
152
|
-
4. **
|
|
545
|
+
2. **Use fix command** - Let DevCompass handle routine maintenance
|
|
546
|
+
3. **Configure severity levels** - Filter out noise with `minSeverity`
|
|
547
|
+
4. **Enable CI mode** - Catch issues before they reach production
|
|
548
|
+
5. **Use JSON output** - Integrate with your monitoring tools
|
|
549
|
+
6. **Fix critical alerts first** - Prioritize security and stability
|
|
550
|
+
7. **Review major updates** - Always check changelogs before major version bumps
|
|
551
|
+
8. **Verify before uninstalling** - DevCompass helps identify candidates, but always verify
|
|
153
552
|
|
|
154
553
|
## 🤝 Contributing
|
|
155
554
|
|
|
@@ -161,6 +560,27 @@ Contributions are welcome! Feel free to:
|
|
|
161
560
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
162
561
|
5. Open a Pull Request
|
|
163
562
|
|
|
563
|
+
### Adding Issues to Database
|
|
564
|
+
Want to add known issues for a package?
|
|
565
|
+
|
|
566
|
+
1. Edit `data/issues-db.json`
|
|
567
|
+
2. Follow the existing format:
|
|
568
|
+
```json
|
|
569
|
+
{
|
|
570
|
+
"package-name": [
|
|
571
|
+
{
|
|
572
|
+
"title": "Brief issue description",
|
|
573
|
+
"severity": "critical|high|medium|low",
|
|
574
|
+
"affected": "semver range (e.g., >=1.0.0 <2.0.0)",
|
|
575
|
+
"fix": "Fixed version or migration advice",
|
|
576
|
+
"source": "GitHub Issue #123 or npm advisory",
|
|
577
|
+
"reported": "YYYY-MM-DD"
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
3. Submit a PR with your additions!
|
|
583
|
+
|
|
164
584
|
### Development
|
|
165
585
|
```bash
|
|
166
586
|
# Clone the repo
|
|
@@ -172,10 +592,15 @@ npm install
|
|
|
172
592
|
|
|
173
593
|
# Test locally
|
|
174
594
|
node bin/devcompass.js analyze
|
|
595
|
+
node bin/devcompass.js fix
|
|
175
596
|
|
|
176
597
|
# Run on test projects
|
|
177
|
-
cd
|
|
178
|
-
|
|
598
|
+
cd /tmp
|
|
599
|
+
mkdir test-project && cd test-project
|
|
600
|
+
npm init -y
|
|
601
|
+
npm install axios@1.6.0 lodash@4.17.19
|
|
602
|
+
node ~/devcompass/bin/devcompass.js analyze
|
|
603
|
+
node ~/devcompass/bin/devcompass.js fix
|
|
179
604
|
```
|
|
180
605
|
|
|
181
606
|
## 📝 License
|
|
@@ -197,6 +622,7 @@ Built with:
|
|
|
197
622
|
- [chalk](https://github.com/chalk/chalk) - Terminal colors
|
|
198
623
|
- [ora](https://github.com/sindresorhus/ora) - Spinners
|
|
199
624
|
- [commander](https://github.com/tj/commander.js) - CLI framework
|
|
625
|
+
- [semver](https://github.com/npm/node-semver) - Semantic versioning
|
|
200
626
|
|
|
201
627
|
## 📈 Stats
|
|
202
628
|
|
|
@@ -204,8 +630,27 @@ Check out DevCompass stats:
|
|
|
204
630
|
- [npm trends](https://npmtrends.com/devcompass)
|
|
205
631
|
- [npm-stat](https://npm-stat.com/charts.html?package=devcompass)
|
|
206
632
|
|
|
633
|
+
## 🌟 What's Next?
|
|
634
|
+
|
|
635
|
+
### Roadmap (v2.3+)
|
|
636
|
+
- [x] ~~Automatic fix command~~ ✅ **Added in v2.1!**
|
|
637
|
+
- [x] ~~CI/CD integration with JSON output~~ ✅ **Added in v2.2!**
|
|
638
|
+
- [x] ~~Smart caching system~~ ✅ **Added in v2.2!**
|
|
639
|
+
- [x] ~~Custom ignore rules via config file~~ ✅ **Added in v2.2!**
|
|
640
|
+
- [ ] Integration with `npm audit` for automated security scanning
|
|
641
|
+
- [ ] GitHub Issues API for real-time issue tracking
|
|
642
|
+
- [ ] Web dashboard for team health monitoring
|
|
643
|
+
- [ ] More tracked packages (React, Next.js, Vue, Angular)
|
|
644
|
+
- [ ] Bundle size analysis
|
|
645
|
+
- [ ] Automated security patch suggestions
|
|
646
|
+
- [ ] Team collaboration features
|
|
647
|
+
|
|
648
|
+
Want to contribute? Pick an item and open an issue! 🚀
|
|
649
|
+
|
|
207
650
|
---
|
|
208
651
|
|
|
209
652
|
**Made with ❤️ by [Ajay Thorat](https://github.com/AjayBThorat-20)**
|
|
210
653
|
|
|
211
|
-
*DevCompass - Keep your dependencies healthy!* 🧭
|
|
654
|
+
*DevCompass - Keep your dependencies healthy!* 🧭
|
|
655
|
+
|
|
656
|
+
**Like Lighthouse for your dependencies** ⚡
|
package/bin/devcompass.js
CHANGED
|
@@ -4,6 +4,7 @@ const { Command } = require('commander');
|
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const { analyze } = require('../src/commands/analyze');
|
|
7
|
+
const { fix } = require('../src/commands/fix');
|
|
7
8
|
const packageJson = require('../package.json');
|
|
8
9
|
|
|
9
10
|
// Check if running from local node_modules
|
|
@@ -29,6 +30,17 @@ program
|
|
|
29
30
|
.command('analyze')
|
|
30
31
|
.description('Analyze your project dependencies')
|
|
31
32
|
.option('-p, --path <path>', 'Project path', process.cwd())
|
|
33
|
+
.option('--json', 'Output results as JSON')
|
|
34
|
+
.option('--ci', 'CI mode - exit with error code if score below threshold')
|
|
35
|
+
.option('--silent', 'Silent mode - no output')
|
|
32
36
|
.action(analyze);
|
|
33
37
|
|
|
34
|
-
program
|
|
38
|
+
program
|
|
39
|
+
.command('fix')
|
|
40
|
+
.description('Fix issues automatically (remove unused, update safe packages)')
|
|
41
|
+
.option('-p, --path <path>', 'Project path', process.cwd())
|
|
42
|
+
.option('-y, --yes', 'Skip confirmation prompt', false)
|
|
43
|
+
.action(fix);
|
|
44
|
+
|
|
45
|
+
program.parse();
|
|
46
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"axios": [
|
|
3
|
+
{
|
|
4
|
+
"title": "Memory leak in request interceptors",
|
|
5
|
+
"severity": "high",
|
|
6
|
+
"affected": ">=1.5.0 <1.6.2",
|
|
7
|
+
"fix": "1.6.2",
|
|
8
|
+
"source": "GitHub Issue #5456",
|
|
9
|
+
"reported": "2024-01-15"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"title": "Breaking change in error handling",
|
|
13
|
+
"severity": "medium",
|
|
14
|
+
"affected": ">=1.4.0 <1.5.0",
|
|
15
|
+
"fix": "1.5.0",
|
|
16
|
+
"source": "GitHub Release Notes",
|
|
17
|
+
"reported": "2023-11-20"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"lodash": [
|
|
21
|
+
{
|
|
22
|
+
"title": "Prototype pollution vulnerability",
|
|
23
|
+
"severity": "critical",
|
|
24
|
+
"affected": "<4.17.21",
|
|
25
|
+
"fix": "4.17.21",
|
|
26
|
+
"source": "npm advisory 1523",
|
|
27
|
+
"reported": "2021-02-15"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"moment": [
|
|
31
|
+
{
|
|
32
|
+
"title": "Package is deprecated - no longer maintained",
|
|
33
|
+
"severity": "medium",
|
|
34
|
+
"affected": "*",
|
|
35
|
+
"fix": "Use dayjs or date-fns instead",
|
|
36
|
+
"source": "npm deprecation notice",
|
|
37
|
+
"reported": "2023-09-01"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"request": [
|
|
41
|
+
{
|
|
42
|
+
"title": "Package deprecated - use node-fetch or axios",
|
|
43
|
+
"severity": "high",
|
|
44
|
+
"affected": "*",
|
|
45
|
+
"fix": "Migrate to axios or node-fetch",
|
|
46
|
+
"source": "npm deprecation notice",
|
|
47
|
+
"reported": "2020-02-11"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"express": [
|
|
51
|
+
{
|
|
52
|
+
"title": "Security vulnerability in qs dependency",
|
|
53
|
+
"severity": "medium",
|
|
54
|
+
"affected": ">=4.0.0 <4.18.2",
|
|
55
|
+
"fix": "4.18.2",
|
|
56
|
+
"source": "npm advisory 1867",
|
|
57
|
+
"reported": "2022-11-26"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|