dep-oracle 1.0.0 → 1.1.1

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
@@ -1,11 +1,31 @@
1
- # dep-oracle 🔮
2
-
3
- > Your dependencies have dependencies. Who's watching them?
1
+ <p align="center">
2
+ <h1 align="center">dep-oracle</h1>
3
+ <p align="center"><strong>Predictive Dependency Security Engine</strong></p>
4
+ <p align="center">
5
+ <a href="https://www.npmjs.com/package/dep-oracle"><img src="https://img.shields.io/npm/v/dep-oracle.svg" alt="npm version"></a>
6
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
7
+ <a href="https://www.npmjs.com/package/dep-oracle"><img src="https://img.shields.io/npm/dm/dep-oracle.svg" alt="npm downloads"></a>
8
+ <a href="https://github.com/ertugrulakben/dep-oracle"><img src="https://img.shields.io/github/stars/ertugrulakben/dep-oracle.svg?style=social" alt="GitHub stars"></a>
9
+ </p>
10
+ <p align="center">
11
+ <a href="#quick-start">Quick Start</a> &middot;
12
+ <a href="#features">Features</a> &middot;
13
+ <a href="#trust-score-algorithm">Algorithm</a> &middot;
14
+ <a href="#claude-code-integration-mcp">MCP</a> &middot;
15
+ <a href="#comparison">Comparison</a>
16
+ </p>
17
+ <p align="center">
18
+ <strong>English</strong> | <a href="README.tr.md">Turkce</a>
19
+ </p>
20
+ </p>
21
+
22
+ ---
23
+
24
+ > **Your dependencies have dependencies. Who's watching them?**
4
25
 
5
26
  **dep-oracle** is a predictive dependency security engine that calculates **Trust Scores** (0-100) for every package in your dependency tree. It detects zombie dependencies, measures blast radius, catches typosquatting attempts, and predicts future risks — before they become vulnerabilities.
6
27
 
7
- [![npm version](https://img.shields.io/npm/v/dep-oracle.svg)](https://www.npmjs.com/package/dep-oracle)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
28
+ **Claude Code Security** scans YOUR code. **dep-oracle** scans everything your code **depends on**.
9
29
 
10
30
  ## Why?
11
31
 
@@ -14,8 +34,6 @@
14
34
  - `npm audit` only catches **known** CVEs — dep-oracle **predicts** future risks
15
35
  - You audit your code. But do you audit your **trust**?
16
36
 
17
- **Claude Code Security** scans YOUR code. **dep-oracle** scans everything your code **depends on**.
18
-
19
37
  ## Quick Start
20
38
 
21
39
  ```bash
@@ -25,19 +43,25 @@ npx dep-oracle
25
43
  # Or install globally
26
44
  npm install -g dep-oracle
27
45
  dep-oracle scan
46
+
47
+ # Check a single package
48
+ dep-oracle check express
28
49
  ```
29
50
 
30
- ## What It Does
51
+ ## Features
31
52
 
32
53
  | Feature | Description |
33
54
  |---------|-------------|
34
- | **Trust Score** | 0-100 weighted score per package (maintainer health, security, activity, popularity, funding, license) |
55
+ | **Trust Score** | 0-100 weighted score per package (security, maintainer health, activity, popularity, funding, license) |
35
56
  | **Zombie Detection** | Finds unmaintained but critical packages (no commits in 12+ months) |
36
57
  | **Blast Radius** | Shows how many files are affected if a dependency is compromised |
37
- | **Typosquat Detection** | Catches suspicious package names similar to popular packages |
38
- | **Trend Prediction** | 3-month risk projection based on download/commit trends |
39
- | **Migration Advisor** | Suggests safer alternatives for risky dependencies |
58
+ | **Typosquat Detection** | 1,847+ known packages + live npm registry lookup to catch suspicious names |
59
+ | **Trend Prediction** | 3-month risk projection based on download/commit/release trends |
60
+ | **Migration Advisor** | 131 package mappings with 192 safer alternatives for risky dependencies |
40
61
  | **Offline Mode** | Works from cache without internet (`--offline`) |
62
+ | **MCP Server** | Native Claude Code integration — ask about your dependencies in natural language |
63
+ | **Multi-Format Output** | Terminal (colored tree), HTML, JSON, and SARIF |
64
+ | **GitHub Action** | Automate trust checks in your CI/CD pipeline |
41
65
 
42
66
  ## Usage
43
67
 
@@ -45,28 +69,32 @@ dep-oracle scan
45
69
  # Scan current project
46
70
  dep-oracle scan
47
71
 
48
- # Scan with specific output
72
+ # Scan with specific output format
49
73
  dep-oracle scan --format json
50
74
  dep-oracle scan --format html
51
75
  dep-oracle scan --format sarif
52
76
 
53
77
  # Check a single package
54
78
  dep-oracle check lodash
79
+ dep-oracle check express@4.18.2
55
80
 
56
- # Offline mode (uses cached data)
81
+ # Offline mode (uses cached data only)
57
82
  dep-oracle scan --offline
58
83
 
59
- # Set minimum score threshold (CI/CD)
84
+ # Set minimum score threshold (exit code 1 if below)
60
85
  dep-oracle scan --threshold 60
61
86
 
62
87
  # Ignore specific packages
63
88
  dep-oracle scan --ignore deprecated-but-needed,legacy-pkg
89
+
90
+ # Verbose logging
91
+ dep-oracle scan --verbose
64
92
  ```
65
93
 
66
94
  ## Output Example
67
95
 
68
96
  ```
69
- 🔮 dep-oracle v1.0.0
97
+ dep-oracle v1.1.0
70
98
  Scanning package.json...
71
99
  Found 47 direct dependencies, 683 transitive
72
100
  Collecting data... [=============================] 100% (2.3s)
@@ -74,19 +102,19 @@ Collecting data... [=============================] 100% (2.3s)
74
102
  DEPENDENCY TRUST REPORT
75
103
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
76
104
 
77
- 🚫 CRITICAL (score < 50)
105
+ CRITICAL (score < 50)
78
106
 
79
- ■ event-stream@3.3.6 Score: 12 💀 ZOMBIE
107
+ ■ event-stream@3.3.6 Score: 12 ZOMBIE
80
108
  Last commit: 2018 | 0 maintainers active
81
109
  Blast radius: 14 files | Alternative: highland
82
110
 
83
- WARNING (score 50-79)
111
+ WARNING (score 50-79)
84
112
 
85
- ■ moment@2.29.4 Score: 58 💀 ZOMBIE
113
+ ■ moment@2.29.4 Score: 58 ZOMBIE
86
114
  Maintenance mode | No new features
87
- Blast radius: 23 files | Alternative: dayjs
115
+ Blast radius: 23 files | Alternative: dayjs, date-fns, luxon
88
116
 
89
- SAFE (score 80+): 679 packages
117
+ SAFE (score 80+): 679 packages
90
118
 
91
119
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
92
120
  SUMMARY
@@ -101,14 +129,63 @@ Each package is scored 0-100 based on six weighted metrics:
101
129
 
102
130
  | Metric | Weight | What It Measures |
103
131
  |--------|--------|------------------|
104
- | Security History | 25% | CVE count, average patch time, vulnerability density |
132
+ | Security History | 25% | CVE count with diminishing penalty, average patch time, fast-patch bonus |
105
133
  | Maintainer Health | 25% | Active maintainers (bus factor), issue response time, PR merge speed |
106
- | Activity | 20% | Commit frequency trend, release cadence, last publish date |
134
+ | Activity | 20% | Commit frequency trend, release cadence, last publish recency |
107
135
  | Popularity | 15% | Weekly downloads, dependent count, GitHub stars |
108
136
  | Funding | 10% | GitHub Sponsors, OpenCollective, corporate backing |
109
137
  | License | 5% | MIT/Apache = safe, GPL = risk, Unknown = red flag |
110
138
 
111
- **Score Ranges:** 80-100 Safe | 50-79 ⚠️ Warning | 0-49 🚫 Critical
139
+ **Score Ranges:** 80-100 Safe | 50-79 Warning | 0-49 Critical
140
+
141
+ ### Security Scoring (v1.1.0)
142
+
143
+ The security metric uses a **diminishing penalty** model — the first vulnerability has the highest impact, and each additional one has progressively less effect:
144
+
145
+ | Vulnerabilities | Security Score |
146
+ |-----------------|---------------|
147
+ | 0 | 100 |
148
+ | 1 | 85 |
149
+ | 2 | 72 |
150
+ | 3 | 60 |
151
+ | 4 | 50 |
152
+ | 5+ | max(20, 100 - n*12) |
153
+
154
+ Packages that patch vulnerabilities quickly (within 7 days) receive a **+10 bonus**. Slower patches (within 30 days) receive **+5**.
155
+
156
+ ### Graceful Degradation
157
+
158
+ If an API is unreachable (GitHub down, no internet, rate limited), dep-oracle doesn't crash. The missing metric weight is redistributed across available metrics. If 3+ metrics are unavailable, a reliability warning is shown.
159
+
160
+ ## Typosquat Detection
161
+
162
+ dep-oracle uses a multi-layer approach to catch typosquatting:
163
+
164
+ 1. **Static registry** — 1,847+ known popular package names across 40+ categories (React, Vue, Angular, Express, testing, CLI tools, etc.)
165
+ 2. **Dynamic npm lookup** — Fetches the top 5,000 most-downloaded packages from npm and caches them for 7 days
166
+ 3. **Pattern matching** — Levenshtein distance, prefix/suffix manipulation, character swap, missing/extra letter detection
167
+
168
+ ```bash
169
+ dep-oracle check expresss # Catches: similar to "express" (distance: 1)
170
+ dep-oracle check lodashe # Catches: similar to "lodash" (distance: 1)
171
+ dep-oracle check react-js # Catches: suffix pattern of "react"
172
+ ```
173
+
174
+ ## Migration Advisor
175
+
176
+ When a package scores low or is flagged as a zombie, dep-oracle suggests safer alternatives from a curated database of **131 package mappings** with **192 alternatives**:
177
+
178
+ ```
179
+ moment → dayjs, date-fns, luxon
180
+ request → axios, got, node-fetch, undici
181
+ lodash → lodash-es, radash, just (native alternatives)
182
+ express → fastify, koa, hono
183
+ gulp → esbuild, tsup, vite
184
+ mocha → vitest, jest, node:test
185
+ ...and 125 more
186
+ ```
187
+
188
+ Each suggestion includes difficulty rating (easy/moderate/hard) and migration context.
112
189
 
113
190
  ## Claude Code Integration (MCP)
114
191
 
@@ -127,9 +204,20 @@ dep-oracle works as an MCP server for Claude Code:
127
204
  ```
128
205
 
129
206
  Then in Claude Code, just ask:
130
- - "What's the riskiest dependency in this project?"
131
- - "Is lodash safe to use?"
132
- - "Show me zombie dependencies"
207
+ - *"What's the riskiest dependency in this project?"*
208
+ - *"Is lodash safe to use?"*
209
+ - *"Show me zombie dependencies"*
210
+ - *"Suggest alternatives for moment.js"*
211
+
212
+ **Available MCP Tools:**
213
+
214
+ | Tool | Description |
215
+ |------|-------------|
216
+ | `dep_oracle_scan` | Full project dependency scan |
217
+ | `dep_oracle_trust_score` | Trust score for a single package |
218
+ | `dep_oracle_blast_radius` | Impact analysis for a package |
219
+ | `dep_oracle_zombies` | List all zombie dependencies |
220
+ | `dep_oracle_suggest_migration` | Get alternative package suggestions |
133
221
 
134
222
  ## GitHub Action
135
223
 
@@ -174,35 +262,112 @@ Or add to `package.json`:
174
262
  }
175
263
  ```
176
264
 
265
+ ### Configuration Options
266
+
267
+ | Option | Default | Description |
268
+ |--------|---------|-------------|
269
+ | `threshold` | `60` | Minimum trust score. Packages below trigger warnings and non-zero exit |
270
+ | `ignore` | `[]` | Packages to skip during scanning |
271
+ | `format` | `"terminal"` | Output format: `terminal`, `json`, `html`, `sarif` |
272
+ | `offline` | `false` | Use only cached data, skip all API calls |
273
+ | `githubToken` | `null` | GitHub token for higher API rate limits (5000/hr vs 60/hr) |
274
+ | `cacheTtl` | `86400` | Cache TTL in seconds (default: 24 hours) |
275
+
177
276
  ## Supported Package Managers
178
277
 
179
278
  | Manager | Manifest | Lock File | Status |
180
279
  |---------|----------|-----------|--------|
181
- | npm | `package.json` | `package-lock.json` | Supported |
182
- | yarn | `package.json` | `yarn.lock` | Supported |
183
- | pnpm | `package.json` | `pnpm-lock.yaml` | Supported |
184
- | pip | `requirements.txt` | `Pipfile.lock` | Supported |
185
- | poetry | `pyproject.toml` | `poetry.lock` | Supported |
280
+ | npm | `package.json` | `package-lock.json` | Supported |
281
+ | yarn | `package.json` | `yarn.lock` | Supported |
282
+ | pnpm | `package.json` | `pnpm-lock.yaml` | Supported |
283
+ | pip | `requirements.txt` | `Pipfile.lock` | Supported |
284
+ | poetry | `pyproject.toml` | `poetry.lock` | Supported |
186
285
 
187
286
  ## Comparison
188
287
 
189
288
  | Feature | npm audit | Dependabot | Socket.dev | Snyk | **dep-oracle** |
190
289
  |---------|-----------|------------|------------|------|----------------|
191
- | Known CVE scan | | | | | |
192
- | Predictive risk | | | Partial | | **✅** |
193
- | Trust Score (0-100) | | | | | **✅** |
194
- | Zombie detection | | | | | **✅** |
195
- | Blast radius | | | | | **✅** |
196
- | Typosquat detection | | | | | **✅** |
197
- | Trend prediction | | | | | **✅** |
198
- | MCP integration | | | | | **✅** |
199
- | Zero install (npx) | | | | | **✅** |
200
- | Free | | | Freemium | Freemium | **✅** |
290
+ | Known CVE scan | Yes | Yes | Yes | Yes | **Yes** |
291
+ | Predictive risk | No | No | Partial | No | **Yes** |
292
+ | Trust Score (0-100) | No | No | No | No | **Yes** |
293
+ | Zombie detection | No | No | No | No | **Yes** |
294
+ | Blast radius | No | No | No | No | **Yes** |
295
+ | Typosquat detection | No | No | Yes | No | **Yes** |
296
+ | Trend prediction | No | No | No | No | **Yes** |
297
+ | Migration advisor | No | Partial | No | Partial | **Yes (131 pkgs)** |
298
+ | MCP integration | No | No | Yes | Yes | **Yes** |
299
+ | Zero install (npx) | Yes | No | No | No | **Yes** |
300
+ | Free & open source | Yes | Yes | Freemium | Freemium | **Yes** |
301
+
302
+ ## Programmatic API
303
+
304
+ ```typescript
305
+ import { scan, checkPackage } from 'dep-oracle';
306
+
307
+ // Scan a project
308
+ const report = await scan({ dir: './my-project', format: 'json' });
309
+
310
+ // Check a single package
311
+ const result = await checkPackage('express');
312
+ console.log(result.trustScore); // 74
313
+ console.log(result.isZombie); // false
314
+ ```
315
+
316
+ ## Test Suite
317
+
318
+ dep-oracle has comprehensive test coverage:
319
+
320
+ ```
321
+ 10 test files | 144 tests | 100% passing
322
+
323
+ trust-score.test.ts 34 tests Scoring engine, metrics, edge cases
324
+ zombie-detector.test.ts 10 tests Zombie detection logic
325
+ typosquat.test.ts 15 tests Typosquat pattern matching
326
+ migration-advisor.test.ts 12 tests Migration suggestions
327
+ trend-predictor.test.ts 10 tests Trend prediction engine
328
+ parsers.test.ts 17 tests npm + Python parsers
329
+ cache.test.ts 15 tests Cache store operations
330
+ logger.test.ts 17 tests Logger utility
331
+ rate-limiter.test.ts 6 tests Rate limiter
332
+ schema.test.ts 8 tests Zod schema validation
333
+ ```
334
+
335
+ ```bash
336
+ npm test # Run all tests
337
+ npm run lint # TypeScript type checking
338
+ ```
339
+
340
+ ## Changelog
341
+
342
+ ### v1.1.0 (2025-02-22)
343
+
344
+ - **Typosquat Detection**: Expanded to 1,847+ known packages across 40+ categories, plus dynamic npm registry fetch (top 5,000 packages, 7-day cache)
345
+ - **Migration Advisor**: Expanded to 131 package mappings with 192 safer alternatives
346
+ - **Trust Score Calibration**: Diminishing vulnerability penalty (first CVE has highest impact), fast-patch bonus (+10 for <=7 days)
347
+ - **Poetry.lock Support**: Full poetry.lock parsing for Python projects
348
+ - **Comprehensive Test Suite**: 10 test files, 144 tests covering all analyzers, parsers, cache, and utilities
349
+ - **Turkish README**: Full Turkish documentation (README.tr.md)
350
+ - **Dynamic CLI Version**: Version automatically synced from package.json
351
+
352
+ ### v1.0.0 (2025-02-22)
353
+
354
+ - Initial release
355
+ - Trust Score engine with 6 weighted metrics
356
+ - npm + Python (pip, poetry, pyproject.toml) parsers
357
+ - Zombie detection, blast radius analysis
358
+ - Typosquat detection with Levenshtein distance
359
+ - Trend prediction (3-month risk projection)
360
+ - Migration advisor with curated alternatives
361
+ - Terminal, HTML, JSON, SARIF output formats
362
+ - MCP server for Claude Code integration
363
+ - GitHub Action support
364
+ - Offline mode with SQLite-compatible cache
365
+ - Badge generator (SVG)
201
366
 
202
367
  ## Contributing
203
368
 
204
- See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding standards, and how to add new collectors/parsers.
369
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding standards, and how to add new collectors, parsers, or analyzers.
205
370
 
206
371
  ## License
207
372
 
208
- [MIT](LICENSE) — Ertugrul Akben
373
+ [MIT](LICENSE) — [Ertugrul Akben](https://ertugrulakben.com)