@chappibunny/repolens 0.4.3 → 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 +131 -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 +7 -0
- 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,137 @@
|
|
|
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
|
+
|
|
5
136
|
## 0.4.3
|
|
6
137
|
|
|
7
138
|
### 🐛 Bug Fixes
|
package/README.md
CHANGED
|
@@ -8,9 +8,15 @@
|
|
|
8
8
|
🔍 Repository Intelligence CLI 📊
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
[](https://github.com/CHAPIBUNNY/repolens/actions)
|
|
12
|
+
[](SECURITY.md)
|
|
13
|
+
[](SECURITY.md)
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
[](SECURITY.md)
|
|
16
|
+
|
|
11
17
|
AI-assisted documentation intelligence system that generates architecture docs for engineers AND readable system docs for stakeholders
|
|
12
18
|
|
|
13
|
-
**Current Status**: v0.
|
|
19
|
+
**Current Status**: v0.6.0 — Team Features & Observability Dashboard
|
|
14
20
|
|
|
15
21
|
RepoLens automatically generates and maintains living architecture documentation by analyzing your repository structure, extracting meaningful insights from your package.json, and creating visual dependency graphs. Run it once, or let it auto-update on every push.
|
|
16
22
|
|
|
@@ -22,7 +28,7 @@ RepoLens automatically generates and maintains living architecture documentation
|
|
|
22
28
|
|
|
23
29
|
**Step 1: Install**
|
|
24
30
|
```bash
|
|
25
|
-
npm install
|
|
31
|
+
npm install @chappibunny/repolens
|
|
26
32
|
```
|
|
27
33
|
|
|
28
34
|
**Step 2: Initialize** (creates config + GitHub Actions workflow)
|
|
@@ -30,19 +36,30 @@ npm install github:CHAPIBUNNY/repolens
|
|
|
30
36
|
npx @chappibunny/repolens init
|
|
31
37
|
```
|
|
32
38
|
|
|
33
|
-
**Step 3: Configure
|
|
39
|
+
**Step 3: Configure Publishing** (optional, skip if using Markdown only)
|
|
40
|
+
|
|
41
|
+
For Notion:
|
|
34
42
|
```bash
|
|
35
43
|
# Edit .env and add:
|
|
36
44
|
NOTION_TOKEN=secret_xxx
|
|
37
45
|
NOTION_PARENT_PAGE_ID=xxx
|
|
38
46
|
```
|
|
39
47
|
|
|
48
|
+
For Confluence:
|
|
49
|
+
```bash
|
|
50
|
+
# Edit .env and add:
|
|
51
|
+
CONFLUENCE_URL=https://your-company.atlassian.net/wiki
|
|
52
|
+
CONFLUENCE_EMAIL=your@email.com
|
|
53
|
+
CONFLUENCE_API_TOKEN=your-token
|
|
54
|
+
CONFLUENCE_SPACE_KEY=DOCS
|
|
55
|
+
```
|
|
56
|
+
|
|
40
57
|
**Step 4: Publish**
|
|
41
58
|
```bash
|
|
42
59
|
npx @chappibunny/repolens publish
|
|
43
60
|
```
|
|
44
61
|
|
|
45
|
-
**Done!** Your docs are now live in Notion and/or `.repolens/` directory.
|
|
62
|
+
**Done!** Your docs are now live in Notion, Confluence, and/or `.repolens/` directory.
|
|
46
63
|
|
|
47
64
|
**🔄 Upgrading from v0.3.0 or earlier?**
|
|
48
65
|
Run `npx @chappibunny/repolens migrate` to automatically update your workflow files. See [MIGRATION.md](MIGRATION.md) for details.
|
|
@@ -107,53 +124,148 @@ RepoLens automatically detects:
|
|
|
107
124
|
✅ **Deterministic Fallback** - Always generates docs even if AI unavailable
|
|
108
125
|
✅ **Business Domain Inference** - Automatically maps code to business functions
|
|
109
126
|
✅ **Data Flow Analysis** - Understands how information moves through your system
|
|
110
|
-
✅ **Multiple Publishers** - Output to Notion, Markdown, or
|
|
127
|
+
✅ **Multiple Publishers** - Output to Notion, Confluence, Markdown, or all three
|
|
111
128
|
✅ **Branch-Aware** - Prevent doc conflicts across branches
|
|
112
129
|
✅ **GitHub Actions** - Autonomous operation on every push
|
|
130
|
+
✅ **Team Notifications** - Discord integration with rich embeds (NEW in v0.6.0)
|
|
131
|
+
✅ **Observability Dashboard** - Interactive HTML metrics dashboard (NEW in v0.6.0)
|
|
132
|
+
✅ **Health Score Tracking** - Monitor documentation quality over time (NEW in v0.6.0)
|
|
133
|
+
✅ **GitHub Pages Deployment** - Automated public dashboard hosting (NEW in v0.6.0)
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 👥 Team Features & Observability (New in v0.6.0)
|
|
138
|
+
|
|
139
|
+
### 📊 Interactive Dashboard
|
|
140
|
+
|
|
141
|
+
RepoLens now generates a beautiful HTML dashboard with real-time metrics and trends:
|
|
142
|
+
|
|
143
|
+
**Features:**
|
|
144
|
+
- **Health Score** — 0-100 rating based on coverage, freshness, and quality
|
|
145
|
+
- **Coverage Metrics** — Module, API, and page documentation coverage with progress bars
|
|
146
|
+
- **Freshness Tracking** — Identifies stale documentation (>90 days old)
|
|
147
|
+
- **Quality Issues** — Lists undocumented modules, APIs, and pages with severity badges
|
|
148
|
+
- **Trend Charts** — SVG visualization of coverage and health score over time
|
|
149
|
+
- **Quick Links** — Direct links to Notion, GitHub, and Markdown documentation
|
|
150
|
+
|
|
151
|
+
**Access your dashboard:**
|
|
152
|
+
- **Local**: `.repolens/dashboard/index.html` after running `repolens publish`
|
|
153
|
+
- **Public**: `https://OWNER.github.io/REPO/` (with GitHub Pages enabled)
|
|
154
|
+
|
|
155
|
+
**Setup GitHub Pages (Optional):**
|
|
156
|
+
|
|
157
|
+
1. **Add workflow** (created by `repolens init` in v0.6.0+):
|
|
158
|
+
- File: `.github/workflows/deploy-dashboard.yml`
|
|
159
|
+
- Triggers: Runs on every push to main
|
|
160
|
+
|
|
161
|
+
2. **Enable GitHub Pages**:
|
|
162
|
+
- Go to repo Settings → Pages
|
|
163
|
+
- Source: **GitHub Actions**
|
|
164
|
+
- Save
|
|
165
|
+
|
|
166
|
+
3. **Add secrets** (if using publishers or notifications):
|
|
167
|
+
```
|
|
168
|
+
NOTION_TOKEN
|
|
169
|
+
NOTION_PARENT_PAGE_ID
|
|
170
|
+
CONFLUENCE_URL
|
|
171
|
+
CONFLUENCE_EMAIL
|
|
172
|
+
CONFLUENCE_API_TOKEN
|
|
173
|
+
CONFLUENCE_SPACE_KEY
|
|
174
|
+
CONFLUENCE_PARENT_PAGE_ID # Optional
|
|
175
|
+
DISCORD_WEBHOOK_URL # Optional
|
|
176
|
+
```
|
|
177
|
+
DISCORD_WEBHOOK_URL
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Your dashboard will be live at `https://OWNER.github.io/REPO/` within minutes!
|
|
181
|
+
|
|
182
|
+
### 💬 Discord Notifications
|
|
183
|
+
|
|
184
|
+
Get notified when documentation changes significantly:
|
|
185
|
+
|
|
186
|
+
**Features:**
|
|
187
|
+
- Rich embeds with coverage, health score, and change percentage
|
|
188
|
+
- Threshold-based notifications (only for significant changes)
|
|
189
|
+
- Branch filtering with glob pattern support
|
|
190
|
+
- Secure webhook configuration via environment variable
|
|
191
|
+
|
|
192
|
+
**Setup Discord Notifications:**
|
|
193
|
+
|
|
194
|
+
1. **Create a webhook** in your Discord server:
|
|
195
|
+
- Server Settings → Integrations → Webhooks → New Webhook
|
|
196
|
+
- Copy the webhook URL
|
|
197
|
+
|
|
198
|
+
2. **Add to environment**:
|
|
199
|
+
```bash
|
|
200
|
+
# .env (never commit!)
|
|
201
|
+
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/xxx/xxx
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
3. **Configure in `.repolens.yml`** (optional):
|
|
205
|
+
```yaml
|
|
206
|
+
discord:
|
|
207
|
+
enabled: true # Default: true (if webhook configured)
|
|
208
|
+
notifyOn: significant # Options: always, significant, never
|
|
209
|
+
significantThreshold: 10 # Notify if change >10% (default)
|
|
210
|
+
branches: # Which branches to notify (default: all)
|
|
211
|
+
- main
|
|
212
|
+
- develop
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
4. **Add GitHub Actions secret** (for CI/CD):
|
|
216
|
+
- Repo Settings → Secrets and variables → Actions
|
|
217
|
+
- New repository secret: `DISCORD_WEBHOOK_URL`
|
|
218
|
+
|
|
219
|
+
**Notification includes:**
|
|
220
|
+
- Branch and commit information
|
|
221
|
+
- Files scanned and modules analyzed
|
|
222
|
+
- Coverage percentage and health score
|
|
223
|
+
- Change percentage from previous run
|
|
224
|
+
- Direct links to dashboard, Notion, and GitHub
|
|
113
225
|
|
|
114
226
|
---
|
|
115
227
|
|
|
116
228
|
## 📦 Installation
|
|
117
229
|
|
|
118
|
-
### Recommended:
|
|
230
|
+
### Recommended: npm Registry
|
|
119
231
|
|
|
120
232
|
```bash
|
|
121
|
-
npm install
|
|
233
|
+
npm install @chappibunny/repolens
|
|
122
234
|
```
|
|
123
235
|
|
|
124
|
-
|
|
236
|
+
Installs from npm registry. ✨ **Now available in beta!**
|
|
125
237
|
|
|
126
238
|
### Alternative Methods
|
|
127
239
|
|
|
128
240
|
<details>
|
|
129
|
-
<summary><b>Option B:
|
|
241
|
+
<summary><b>Option B: GitHub Direct Install</b></summary>
|
|
130
242
|
|
|
131
|
-
|
|
243
|
+
Install from the latest GitHub commit:
|
|
132
244
|
|
|
133
245
|
```bash
|
|
134
|
-
|
|
135
|
-
cd repolens
|
|
136
|
-
npm link
|
|
246
|
+
npm install github:CHAPIBUNNY/repolens
|
|
137
247
|
```
|
|
138
248
|
</details>
|
|
139
249
|
|
|
140
250
|
<details>
|
|
141
|
-
<summary><b>Option C:
|
|
251
|
+
<summary><b>Option C: Local Development</b></summary>
|
|
142
252
|
|
|
143
|
-
|
|
253
|
+
Clone and link for development:
|
|
144
254
|
|
|
145
255
|
```bash
|
|
146
|
-
|
|
256
|
+
git clone https://github.com/CHAPIBUNNY/repolens.git
|
|
257
|
+
cd repolens
|
|
258
|
+
npm link
|
|
147
259
|
```
|
|
148
260
|
</details>
|
|
149
261
|
|
|
150
262
|
<details>
|
|
151
|
-
<summary><b>Option D:
|
|
263
|
+
<summary><b>Option D: GitHub Release Tarball</b></summary>
|
|
152
264
|
|
|
153
|
-
|
|
265
|
+
Install from a specific version:
|
|
154
266
|
|
|
155
267
|
```bash
|
|
156
|
-
npm install -
|
|
268
|
+
npm install https://github.com/CHAPIBUNNY/repolens/releases/download/v0.2.0/repolens-0.2.0.tgz
|
|
157
269
|
```
|
|
158
270
|
</details>
|
|
159
271
|
|
|
@@ -187,8 +299,9 @@ Open `.repolens.yml` and verify the `publishers` section:
|
|
|
187
299
|
|
|
188
300
|
```yaml
|
|
189
301
|
publishers:
|
|
190
|
-
- markdown
|
|
191
|
-
- notion
|
|
302
|
+
- markdown # Always works, no setup needed
|
|
303
|
+
- notion # Requires NOTION_TOKEN and NOTION_PARENT_PAGE_ID
|
|
304
|
+
- confluence # Requires CONFLUENCE_URL, CONFLUENCE_EMAIL, CONFLUENCE_API_TOKEN, CONFLUENCE_SPACE_KEY
|
|
192
305
|
```
|
|
193
306
|
|
|
194
307
|
**Markdown Only** (simplest):
|
|
@@ -196,6 +309,18 @@ publishers:
|
|
|
196
309
|
publishers:
|
|
197
310
|
- markdown
|
|
198
311
|
```
|
|
312
|
+
|
|
313
|
+
**Notion Only**:
|
|
314
|
+
```yaml
|
|
315
|
+
publishers:
|
|
316
|
+
- notion
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**Confluence Only**:
|
|
320
|
+
```yaml
|
|
321
|
+
publishers:
|
|
322
|
+
- confluence
|
|
323
|
+
```
|
|
199
324
|
Documentation lands in `.repolens/` directory. Commit these files or ignore them.
|
|
200
325
|
|
|
201
326
|
**Notion + Markdown** (recommended):
|
|
@@ -206,6 +331,23 @@ publishers:
|
|
|
206
331
|
```
|
|
207
332
|
Docs published to Notion for team visibility, plus local Markdown backups.
|
|
208
333
|
|
|
334
|
+
**Confluence + Markdown**:
|
|
335
|
+
```yaml
|
|
336
|
+
publishers:
|
|
337
|
+
- confluence
|
|
338
|
+
- markdown
|
|
339
|
+
```
|
|
340
|
+
Docs published to Confluence for enterprise teams, plus local Markdown backups.
|
|
341
|
+
|
|
342
|
+
**All Three**:
|
|
343
|
+
```yaml
|
|
344
|
+
publishers:
|
|
345
|
+
- notion
|
|
346
|
+
- confluence
|
|
347
|
+
- markdown
|
|
348
|
+
```
|
|
349
|
+
Maximum visibility: Notion for async collaboration, Confluence for enterprise docs, Markdown for local backups.
|
|
350
|
+
|
|
209
351
|
### Step 3: Enable AI Features (Optional)
|
|
210
352
|
|
|
211
353
|
**AI-enhanced documentation adds natural language explanations for non-technical audiences.**
|
|
@@ -296,15 +438,82 @@ Add as repository secrets:
|
|
|
296
438
|
- Name: `NOTION_TOKEN`, Value: `secret_xxxxx`
|
|
297
439
|
- Name: `NOTION_PARENT_PAGE_ID`, Value: `xxxxxx`
|
|
298
440
|
|
|
441
|
+
### Step 4a: Set Up Confluence Integration (Optional)
|
|
442
|
+
|
|
443
|
+
If using the Confluence publisher:
|
|
444
|
+
|
|
445
|
+
**4a.1: Generate Confluence API Token**
|
|
446
|
+
1. Go to [id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
|
|
447
|
+
2. Click **"Create API token"**
|
|
448
|
+
3. Name it **"RepoLens"**
|
|
449
|
+
4. Copy the generated token (save it securely - you won't see it again!)
|
|
450
|
+
|
|
451
|
+
**4a.2: Find Your Space Key**
|
|
452
|
+
1. Navigate to your Confluence space
|
|
453
|
+
2. Go to **Space Settings** → **Space details**
|
|
454
|
+
3. Note the **Space Key** (e.g., `DOCS`, `ENG`, `TECH`)
|
|
455
|
+
|
|
456
|
+
**4a.3: Get Parent Page ID (Optional)**
|
|
457
|
+
1. Navigate to the page where you want RepoLens docs nested
|
|
458
|
+
2. Click **"..."** menu → **"Page information"**
|
|
459
|
+
3. Copy the page ID from the URL: `pageId=123456789`
|
|
460
|
+
4. If skipped, docs will be created at space root level
|
|
461
|
+
|
|
462
|
+
**4a.4: Add Environment Variables**
|
|
463
|
+
|
|
464
|
+
**For Local Development:**
|
|
465
|
+
Create `.env` in your project root:
|
|
466
|
+
```bash
|
|
467
|
+
CONFLUENCE_URL=https://your-company.atlassian.net/wiki
|
|
468
|
+
CONFLUENCE_EMAIL=your@email.com
|
|
469
|
+
CONFLUENCE_API_TOKEN=your-api-token-here
|
|
470
|
+
CONFLUENCE_SPACE_KEY=DOCS
|
|
471
|
+
CONFLUENCE_PARENT_PAGE_ID=123456789 # Optional
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
**For Confluence Server/Data Center** (self-hosted):
|
|
475
|
+
```bash
|
|
476
|
+
CONFLUENCE_URL=https://confluence.yourcompany.com
|
|
477
|
+
CONFLUENCE_EMAIL=your-username # Use username instead of email
|
|
478
|
+
CONFLUENCE_API_TOKEN=your-personal-access-token
|
|
479
|
+
CONFLUENCE_SPACE_KEY=DOCS
|
|
480
|
+
CONFLUENCE_PARENT_PAGE_ID=123456789 # Optional
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
**For GitHub Actions:**
|
|
484
|
+
Add as repository secrets:
|
|
485
|
+
1. Go to your repo → **Settings** → **Secrets and variables** → **Actions**
|
|
486
|
+
2. Click **"New repository secret"**
|
|
487
|
+
3. Add:
|
|
488
|
+
- Name: `CONFLUENCE_URL`, Value: `https://your-company.atlassian.net/wiki`
|
|
489
|
+
- Name: `CONFLUENCE_EMAIL`, Value: `your@email.com`
|
|
490
|
+
- Name: `CONFLUENCE_API_TOKEN`, Value: `your-token`
|
|
491
|
+
- Name: `CONFLUENCE_SPACE_KEY`, Value: `DOCS`
|
|
492
|
+
- Name: `CONFLUENCE_PARENT_PAGE_ID`, Value: `123456789` (optional)
|
|
493
|
+
|
|
494
|
+
**Confluence + Notion + Markdown** (all three!):
|
|
495
|
+
```yaml
|
|
496
|
+
publishers:
|
|
497
|
+
- markdown
|
|
498
|
+
- notion
|
|
499
|
+
- confluence
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Docs published to both Notion and Confluence for maximum visibility!
|
|
503
|
+
|
|
299
504
|
### Step 5: Configure Branch Publishing (Recommended)
|
|
300
505
|
|
|
301
|
-
Prevent documentation conflicts by limiting which branches publish to Notion:
|
|
506
|
+
Prevent documentation conflicts by limiting which branches publish to Notion/Confluence:
|
|
302
507
|
|
|
303
508
|
```yaml
|
|
304
509
|
notion:
|
|
305
510
|
branches:
|
|
306
511
|
- main # Only main branch publishes
|
|
307
512
|
includeBranchInTitle: false # Clean titles (no [branch-name] suffix)
|
|
513
|
+
|
|
514
|
+
confluence:
|
|
515
|
+
branches:
|
|
516
|
+
- main # Only main branch publishes to Confluence
|
|
308
517
|
```
|
|
309
518
|
|
|
310
519
|
**Options:**
|
|
@@ -348,8 +557,8 @@ npx @chappibunny/repolens publish
|
|
|
348
557
|
|
|
349
558
|
**Expected output:**
|
|
350
559
|
```
|
|
351
|
-
|
|
352
|
-
|
|
560
|
+
RABITAI 🐰
|
|
561
|
+
────────────────────────────────────────────────────
|
|
353
562
|
[RepoLens] Using config: /path/to/.repolens.yml
|
|
354
563
|
[RepoLens] Loading configuration...
|
|
355
564
|
[RepoLens] Scanning repository...
|
|
@@ -547,6 +756,131 @@ When you open a pull request, RepoLens posts:
|
|
|
547
756
|
|
|
548
757
|
---
|
|
549
758
|
|
|
759
|
+
## 🔒 Privacy & Telemetry
|
|
760
|
+
|
|
761
|
+
RepoLens includes **opt-in** error tracking and usage telemetry to help improve reliability, understand adoption patterns, and prioritize features.
|
|
762
|
+
|
|
763
|
+
**Privacy First:**
|
|
764
|
+
- ✅ **Disabled by default** - telemetry is opt-in
|
|
765
|
+
- ✅ **No code collection** - your source code never leaves your machine
|
|
766
|
+
- ✅ **No secrets** - API keys and tokens are never sent
|
|
767
|
+
- ✅ **Anonymous** - no personal information or repository names
|
|
768
|
+
- ✅ **Transparent** - see exactly what data is collected
|
|
769
|
+
|
|
770
|
+
**To enable telemetry**, add to `.env`:
|
|
771
|
+
```bash
|
|
772
|
+
REPOLENS_TELEMETRY_ENABLED=true
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
**What's collected (when enabled):**
|
|
776
|
+
|
|
777
|
+
*Error Tracking (Phase 1):*
|
|
778
|
+
- Error messages and stack traces (for debugging)
|
|
779
|
+
- Command that failed (e.g., `publish`, `migrate`)
|
|
780
|
+
- Basic system info (Node version, platform)
|
|
781
|
+
|
|
782
|
+
*Usage Metrics (Phase 2):*
|
|
783
|
+
- Command execution times (scan, render, publish)
|
|
784
|
+
- Repository size (file count, module count)
|
|
785
|
+
- Feature usage (AI enabled, publishers used)
|
|
786
|
+
- Success/failure rates
|
|
787
|
+
|
|
788
|
+
**Why enable it?**
|
|
789
|
+
- 🐛 **Faster bug fixes** - issues you encounter are fixed proactively
|
|
790
|
+
- 📊 **Better features** - development focused on real-world usage
|
|
791
|
+
- ⚡ **Performance** - optimizations based on actual bottlenecks
|
|
792
|
+
- 🎯 **Prioritization** - roadmap guided by community needs
|
|
793
|
+
|
|
794
|
+
For full details and example data, see [TELEMETRY.md](TELEMETRY.md).
|
|
795
|
+
|
|
796
|
+
---
|
|
797
|
+
|
|
798
|
+
## 🛡️ Security
|
|
799
|
+
|
|
800
|
+
RepoLens implements **defense-in-depth** security to protect your credentials, code, and infrastructure.
|
|
801
|
+
|
|
802
|
+
### Security Architecture (Phase 3)
|
|
803
|
+
|
|
804
|
+
**Layer 1: Input Validation** (`src/utils/validate.js`)
|
|
805
|
+
- ✅ Schema validation with required field enforcement
|
|
806
|
+
- ✅ Injection attack detection (shell, command substitution)
|
|
807
|
+
- ✅ Directory traversal prevention (`..`, absolute paths, null bytes)
|
|
808
|
+
- ✅ Secret scanning in configuration files
|
|
809
|
+
- ✅ Circular reference protection (depth limit: 20 levels)
|
|
810
|
+
|
|
811
|
+
**Layer 2: Secret Detection** (`src/utils/secrets.js`)
|
|
812
|
+
- ✅ **15+ credential patterns**: OpenAI, GitHub, AWS, Notion, Generic API keys
|
|
813
|
+
- ✅ **Entropy-based detection**: High-entropy strings (Shannon entropy > 4.5)
|
|
814
|
+
- ✅ **Automatic sanitization**: All logger output, telemetry, error messages
|
|
815
|
+
- ✅ **Format**: `sk-abc123xyz` → `sk-ab***yz` (first 2 + last 2 chars visible)
|
|
816
|
+
|
|
817
|
+
**Layer 3: Rate Limiting** (`src/utils/rate-limit.js`)
|
|
818
|
+
- ✅ **Token bucket algorithm**: 3 requests/second for Notion & AI APIs
|
|
819
|
+
- ✅ **Exponential backoff**: Automatic retry with jitter (500ms → 1s → 2s)
|
|
820
|
+
- ✅ **Cost protection**: Prevents runaway API usage
|
|
821
|
+
- ✅ **Retryable errors**: 429, 500, 502, 503, 504, network timeouts
|
|
822
|
+
|
|
823
|
+
**Layer 4: Supply Chain Security**
|
|
824
|
+
- ✅ **Action pinning**: GitHub Actions pinned to commit SHAs (not tags)
|
|
825
|
+
- ✅ **Minimal permissions**: `contents: read` or `contents: write` only
|
|
826
|
+
- ✅ **Dependency audits**: CI/CD fails on critical/high vulnerabilities
|
|
827
|
+
- ✅ **npm audit**: 0 vulnerabilities in 519 dependencies
|
|
828
|
+
|
|
829
|
+
**Layer 5: Comprehensive Testing**
|
|
830
|
+
- ✅ **43 security tests**: Fuzzing, injection, boundary conditions
|
|
831
|
+
- ✅ **Attack vectors tested**: SQL, command, path, YAML, NoSQL, LDAP, XML
|
|
832
|
+
- ✅ **90 total tests**: 47 functional + 43 security (100% passing)
|
|
833
|
+
|
|
834
|
+
### Security Validation (Automatic)
|
|
835
|
+
|
|
836
|
+
```bash
|
|
837
|
+
# Every configuration load:
|
|
838
|
+
✅ No injection patterns detected (;|&`$())
|
|
839
|
+
✅ No secrets in configuration files
|
|
840
|
+
✅ Safe path patterns only (no .. or absolute paths)
|
|
841
|
+
✅ Valid schema (configVersion: 1)
|
|
842
|
+
|
|
843
|
+
# Every runtime operation:
|
|
844
|
+
✅ All logs sanitized (secrets redacted)
|
|
845
|
+
✅ Telemetry sanitized (no credentials sent)
|
|
846
|
+
✅ Rate limiting active (3 req/sec)
|
|
847
|
+
✅ Type validation active (prevents type confusion)
|
|
848
|
+
|
|
849
|
+
# Every CI/CD run:
|
|
850
|
+
✅ npm audit passing (0 vulnerabilities)
|
|
851
|
+
✅ Security tests passing (43/43)
|
|
852
|
+
✅ Secrets scanner passing (no hardcoded credentials)
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
### Vulnerability Reporting
|
|
856
|
+
|
|
857
|
+
- 📧 **Email**: [your-email@example.com] (replace with actual contact)
|
|
858
|
+
- 🚨 **DO NOT** open public issues for security bugs
|
|
859
|
+
- ⏱️ **Response**: Within 48 hours
|
|
860
|
+
- 🔒 **Fix Timeline**: Critical issues within 7 days, others within 30 days
|
|
861
|
+
- 📢 **Disclosure**: Coordinated disclosure after fix is released
|
|
862
|
+
|
|
863
|
+
### Security Best Practices
|
|
864
|
+
|
|
865
|
+
**✅ DO:**
|
|
866
|
+
- Store secrets in GitHub Secrets (not `.repolens.yml`)
|
|
867
|
+
- Use environment variables for sensitive data
|
|
868
|
+
- Review generated documentation before publishing
|
|
869
|
+
- Enable telemetry to catch security issues early
|
|
870
|
+
- Run `npm audit` regularly
|
|
871
|
+
- Pin workflows to specific versions
|
|
872
|
+
|
|
873
|
+
**❌ DON'T:**
|
|
874
|
+
- Commit API keys to version control
|
|
875
|
+
- Share `.env` files publicly
|
|
876
|
+
- Disable security validation
|
|
877
|
+
- Use overly broad scan patterns (`**/*`)
|
|
878
|
+
- Ignore security warnings
|
|
879
|
+
|
|
880
|
+
For complete security documentation and threat model, see [SECURITY.md](SECURITY.md).
|
|
881
|
+
|
|
882
|
+
---
|
|
883
|
+
|
|
550
884
|
## ⚙️ Configuration Reference
|
|
551
885
|
|
|
552
886
|
### Complete Example
|
|
@@ -571,6 +905,21 @@ notion:
|
|
|
571
905
|
- release/* # Glob patterns supported
|
|
572
906
|
includeBranchInTitle: false # Clean titles without [branch-name]
|
|
573
907
|
|
|
908
|
+
# Discord notifications (optional, new in v0.6.0)
|
|
909
|
+
discord:
|
|
910
|
+
enabled: true # Default: true (if DISCORD_WEBHOOK_URL set)
|
|
911
|
+
notifyOn: significant # Options: always, significant, never
|
|
912
|
+
significantThreshold: 10 # Notify if change >10% (default)
|
|
913
|
+
branches: # Which branches to notify (default: all)
|
|
914
|
+
- main
|
|
915
|
+
- develop
|
|
916
|
+
|
|
917
|
+
# Observability dashboard (optional, new in v0.6.0)
|
|
918
|
+
dashboard:
|
|
919
|
+
enabled: true # Default: true
|
|
920
|
+
githubPages: true # Deploy to GitHub Pages
|
|
921
|
+
staleThreshold: 90 # Flag docs older than 90 days
|
|
922
|
+
|
|
574
923
|
# GitHub integration (optional)
|
|
575
924
|
github:
|
|
576
925
|
owner: "your-username"
|
|
@@ -633,6 +982,13 @@ features:
|
|
|
633
982
|
| `publishers` | array | Yes | Output targets: `notion`, `markdown` |
|
|
634
983
|
| `notion.branches` | array | No | Branch whitelist for Notion publishing. Supports globs. |
|
|
635
984
|
| `notion.includeBranchInTitle` | boolean | No | Add `[branch-name]` to titles (default: `true`) |
|
|
985
|
+
| `discord.enabled` | boolean | No | Enable Discord notifications (default: `true` if webhook set) |
|
|
986
|
+
| `discord.notifyOn` | string | No | Notification policy: `always`, `significant`, `never` (default: `significant`) |
|
|
987
|
+
| `discord.significantThreshold` | number | No | Change % threshold for notifications (default: `10`) |
|
|
988
|
+
| `discord.branches` | array | No | Branch filter for notifications. Supports globs. (default: all) |
|
|
989
|
+
| `dashboard.enabled` | boolean | No | Generate HTML dashboard (default: `true`) |
|
|
990
|
+
| `dashboard.githubPages` | boolean | No | Deploy to GitHub Pages (default: `false`) |
|
|
991
|
+
| `dashboard.staleThreshold` | number | No | Days before docs flagged as stale (default: `90`) |
|
|
636
992
|
| `github.owner` | string | No | GitHub org/username for SVG hosting |
|
|
637
993
|
| `github.repo` | string | No | Repository name for SVG hosting |
|
|
638
994
|
| `scan.include` | array | Yes | Glob patterns for files to scan |
|
|
@@ -653,6 +1009,12 @@ Required for Notion publisher:
|
|
|
653
1009
|
| `NOTION_PARENT_PAGE_ID` | Yes | Page ID where docs will be created |
|
|
654
1010
|
| `NOTION_VERSION` | No | API version (default: `2022-06-28`) |
|
|
655
1011
|
|
|
1012
|
+
Optional for Discord notifications (new in v0.6.0):
|
|
1013
|
+
|
|
1014
|
+
| Variable | Required | Description |
|
|
1015
|
+
|----------|----------|-------------|
|
|
1016
|
+
| `DISCORD_WEBHOOK_URL` | No | Discord webhook URL for team notifications |
|
|
1017
|
+
|
|
656
1018
|
**Local Development:** Create `.env` file in project root
|
|
657
1019
|
**GitHub Actions:** Add as repository secrets in Settings → Secrets and variables → Actions
|
|
658
1020
|
|
|
@@ -894,6 +1256,6 @@ MIT
|
|
|
894
1256
|
|
|
895
1257
|
<div align="center">
|
|
896
1258
|
|
|
897
|
-
**Made with
|
|
1259
|
+
**Made with RABITAI for developers who care about architecture**
|
|
898
1260
|
|
|
899
1261
|
</div>
|