@chappibunny/repolens 0.4.2 → 0.6.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/CHANGELOG.md +140 -0
- package/README.md +387 -25
- package/package.json +16 -4
- package/src/ai/provider.js +48 -45
- package/src/cli.js +117 -9
- package/src/core/config-schema.js +69 -1
- package/src/core/config.js +20 -3
- package/src/core/scan.js +184 -3
- package/src/init.js +46 -4
- package/src/integrations/discord.js +265 -0
- package/src/migrate.js +17 -5
- package/src/publishers/confluence.js +426 -0
- package/src/publishers/index.js +141 -4
- package/src/publishers/notion.js +251 -15
- package/src/publishers/publish.js +1 -1
- package/src/renderers/render.js +32 -2
- package/src/renderers/renderDashboard.js +844 -0
- package/src/utils/branch.js +32 -0
- package/src/utils/logger.js +21 -4
- package/src/utils/metrics.js +361 -0
- package/src/utils/rate-limit.js +289 -0
- package/src/utils/secrets.js +240 -0
- package/src/utils/telemetry.js +375 -0
- package/src/utils/validate.js +382 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,146 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to RepoLens will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.6.0 (Phase 4: Team Features & Observability Dashboard)
|
|
6
|
+
|
|
7
|
+
### ✨ New Features
|
|
8
|
+
|
|
9
|
+
**Discord Integration** (`src/integrations/discord.js` - 268 lines):
|
|
10
|
+
- Rich embed notifications with coverage, health score, and change metrics
|
|
11
|
+
- Threshold-based notifications (default: >10% change)
|
|
12
|
+
- Branch filtering with glob pattern support
|
|
13
|
+
- Secure webhook configuration via `DISCORD_WEBHOOK_URL` environment variable
|
|
14
|
+
- Functions: `sendDiscordNotification()`, `buildDocUpdateNotification()`, `buildErrorNotification()`, `shouldNotify()`
|
|
15
|
+
- Color-coded embeds: success (green), warning (yellow), error (red), info (blue)
|
|
16
|
+
|
|
17
|
+
**Metrics Collection System** (`src/utils/metrics.js` - 412 lines):
|
|
18
|
+
- **Coverage Calculation**: Weighted average (modules 50%, APIs 30%, pages 20%)
|
|
19
|
+
- **Health Score Algorithm**: 0-100 rating (40% coverage + 30% freshness + 30% quality)
|
|
20
|
+
- **Staleness Detection**: Flags documentation >90 days old
|
|
21
|
+
- **Quality Analysis**: Identifies undocumented modules/APIs/pages with severity levels
|
|
22
|
+
- **Historical Tracking**: Persists metrics to `.repolens/metrics-history.json`
|
|
23
|
+
- **Trend Indicators**: Up/down/stable trend detection (>1% threshold)
|
|
24
|
+
- Functions: `calculateCoverage()`, `calculateHealthScore()`, `detectStaleness()`, `analyzeQuality()`, `trackMetrics()`, `calculateTrends()`, `collectMetrics()`
|
|
25
|
+
|
|
26
|
+
**Interactive Dashboard** (`src/renderers/renderDashboard.js` - 1,020 lines):
|
|
27
|
+
- Beautiful HTML dashboard with inline CSS (zero dependencies)
|
|
28
|
+
- **Health Score Card**: Color-coded 0-100 score (excellent/good/fair/poor)
|
|
29
|
+
- **Coverage Breakdown**: Module/API/page coverage with progress bars
|
|
30
|
+
- **Freshness Tracking**: Stale file detection with last updated timestamps
|
|
31
|
+
- **Quality Issues List**: Severity badges (high/medium/low) with actionable items
|
|
32
|
+
- **Trend Charts**: SVG visualization of coverage and health score over time
|
|
33
|
+
- **Quick Links**: Direct links to Notion, GitHub, and Markdown documentation
|
|
34
|
+
- Responsive design with animations and smooth transitions
|
|
35
|
+
- Generated at `.repolens/dashboard/index.html`
|
|
36
|
+
|
|
37
|
+
**GitHub Pages Deployment** (`.github/workflows/deploy-dashboard.yml` - 73 lines):
|
|
38
|
+
- Automated deployment to `https://OWNER.github.io/REPO/`
|
|
39
|
+
- Deploys on every push to main branch
|
|
40
|
+
- Uses local code during development (`npm link`)
|
|
41
|
+
- Graceful fallback for missing dashboard files
|
|
42
|
+
- Security-conscious environment variable handling
|
|
43
|
+
|
|
44
|
+
**Configuration Extensions** (`src/core/config-schema.js`):
|
|
45
|
+
- **Discord Configuration**:
|
|
46
|
+
* `discord.notifyOn`: "always", "significant", or "never"
|
|
47
|
+
* `discord.significantThreshold`: 0-100 (default: 10%)
|
|
48
|
+
* `discord.branches`: Array with glob pattern support
|
|
49
|
+
* `discord.enabled`: Boolean
|
|
50
|
+
- **Dashboard Configuration**:
|
|
51
|
+
* `dashboard.enabled`: Boolean (default: true)
|
|
52
|
+
* `dashboard.githubPages`: Boolean
|
|
53
|
+
* `dashboard.staleThreshold`: Number (default: 90 days)
|
|
54
|
+
|
|
55
|
+
**Publishing Integration** (`src/publishers/index.js`):
|
|
56
|
+
- Automatic metrics collection after publishing
|
|
57
|
+
- Dashboard generation integrated into publish flow
|
|
58
|
+
- Discord notifications sent after successful publish (if configured)
|
|
59
|
+
- Branch-aware notification filtering
|
|
60
|
+
- Graceful error handling (doesn't fail publish if dashboard/notifications fail)
|
|
61
|
+
|
|
62
|
+
### 🔧 Configuration
|
|
63
|
+
|
|
64
|
+
**Environment Variables** (`.env.example`):
|
|
65
|
+
- Added `DISCORD_WEBHOOK_URL` for team notifications
|
|
66
|
+
- Security warnings and setup instructions
|
|
67
|
+
- GitHub Actions secret configuration guidance
|
|
68
|
+
|
|
69
|
+
**GitHub Actions** (`.github/workflows/publish-docs.yml`):
|
|
70
|
+
- Added `DISCORD_WEBHOOK_URL` to workflow environment
|
|
71
|
+
|
|
72
|
+
### 📊 Testing
|
|
73
|
+
- All 90 tests passing (47 main + 43 security)
|
|
74
|
+
- No regressions from Phase 4 integration
|
|
75
|
+
- Metrics algorithms validated
|
|
76
|
+
- Dashboard generation tested
|
|
77
|
+
|
|
78
|
+
### 🐛 Bug Fixes
|
|
79
|
+
- **GitHub Pages Workflow**: Fixed deployment to use local code during development
|
|
80
|
+
* Changed from `npx @chappibunny/repolens@latest` to `npm link && npx repolens`
|
|
81
|
+
* Added file existence checks before copying dashboard
|
|
82
|
+
* Created graceful fallback with "Coming Soon" placeholder for missing files
|
|
83
|
+
|
|
84
|
+
## 0.5.0 (Phase 3: Security Audit)
|
|
85
|
+
|
|
86
|
+
### 🔒 Security Hardening
|
|
87
|
+
|
|
88
|
+
**Security Utilities** (1,296 lines of new code):
|
|
89
|
+
- **Secrets Detection** (`src/utils/secrets.js`):
|
|
90
|
+
* Detects 15+ secret patterns (OpenAI, GitHub, AWS, Notion, etc.)
|
|
91
|
+
* Entropy-based heuristic detection for unknown patterns
|
|
92
|
+
* Automatic sanitization in all logger and telemetry output
|
|
93
|
+
* Functions: `detectSecrets()`, `sanitizeSecrets()`, `isLikelySecret()`
|
|
94
|
+
|
|
95
|
+
- **Config Validation** (`src/utils/validate.js`):
|
|
96
|
+
* Validates configuration against injection attacks
|
|
97
|
+
* Detects: directory traversal, shell injection, command substitution
|
|
98
|
+
* Scans config tree for accidentally included secrets
|
|
99
|
+
* Circular reference handling with depth limit
|
|
100
|
+
* Path validation preventing `..` and absolute paths
|
|
101
|
+
|
|
102
|
+
- **Rate Limiting** (`src/utils/rate-limit.js`):
|
|
103
|
+
* Token bucket algorithm (3 req/sec for Notion and AI APIs)
|
|
104
|
+
* Exponential backoff with jitter (3 retries)
|
|
105
|
+
* Wrapper functions: `executeNotionRequest()`, `executeAIRequest()`
|
|
106
|
+
* Batch request processing
|
|
107
|
+
|
|
108
|
+
**Runtime Integration**:
|
|
109
|
+
- Config loader validates all inputs before loading
|
|
110
|
+
- Logger sanitizes all console output automatically
|
|
111
|
+
- Telemetry sanitizes error messages before sending to Sentry
|
|
112
|
+
- All Notion API calls rate-limited to 3 req/sec
|
|
113
|
+
- All AI API calls rate-limited to 3 req/sec
|
|
114
|
+
|
|
115
|
+
**GitHub Actions Hardening**:
|
|
116
|
+
- Actions pinned to commit SHAs (supply chain protection)
|
|
117
|
+
- Minimal permissions (`contents: read` or `contents: write` only)
|
|
118
|
+
- Security job with npm audit and secrets scanning
|
|
119
|
+
- Fail-early strategy on security issues
|
|
120
|
+
|
|
121
|
+
**Comprehensive Testing**:
|
|
122
|
+
- 43 new security tests (fuzzing, injection, boundary conditions)
|
|
123
|
+
- Total: 90 tests passing (47 main + 43 security)
|
|
124
|
+
- Attack vectors tested: SQL injection, command injection, path traversal, YAML bomb, NoSQL, LDAP, XML injection
|
|
125
|
+
|
|
126
|
+
**Documentation**:
|
|
127
|
+
- New `SECURITY.md` with threat model and security features
|
|
128
|
+
- Updated `README.md` with security section
|
|
129
|
+
- Updated `PRODUCTION_CHECKLIST.md` with security validation
|
|
130
|
+
- Security badge in README
|
|
131
|
+
|
|
132
|
+
### 📊 Testing
|
|
133
|
+
- All 90 tests passing
|
|
134
|
+
- 0 vulnerabilities in dependencies (519 packages audited)
|
|
135
|
+
|
|
136
|
+
## 0.4.3
|
|
137
|
+
|
|
138
|
+
### 🐛 Bug Fixes
|
|
139
|
+
- **Migration Tool**: Fixed over-aggressive npm install removal
|
|
140
|
+
- Now only removes `npm install/ci` from legacy `cd tools/repolens` multi-line blocks
|
|
141
|
+
- Preserves legitimate dependency installation steps in release workflows
|
|
142
|
+
- Fixes YAML corruption that broke workflows with standalone npm ci/install steps
|
|
143
|
+
- Added test case to verify legitimate npm install steps are preserved
|
|
144
|
+
|
|
5
145
|
## 0.4.2
|
|
6
146
|
|
|
7
147
|
### 🐛 Bug Fixes
|