@chappibunny/repolens 1.2.0 → 1.3.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/CHANGELOG.md +27 -1
- package/README.md +78 -1108
- package/RELEASE.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +92 -1
package/README.md
CHANGED
|
@@ -8,19 +8,25 @@
|
|
|
8
8
|
Repository Intelligence CLI
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
[](SECURITY.md)
|
|
11
|
+
[](https://www.npmjs.com/package/@chappibunny/repolens)
|
|
12
|
+
[](https://github.com/CHAPIBUNNY/repolens/actions)
|
|
14
13
|
[](LICENSE)
|
|
15
|
-
[](SECURITY.md)
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
**Your architecture docs are already outdated.** RepoLens fixes that.
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
RepoLens scans your repository, generates living architecture documentation, and publishes it to Notion, Confluence, GitHub Wiki, or Markdown — automatically on every push. Engineers get technical docs. Stakeholders get readable system overviews. Nobody writes a word.
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
> Stable as of v1.0 — [API guarantees](STABILITY.md) · [Security hardened](SECURITY.md) · v1.3.1
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🎬 Demo
|
|
24
|
+
|
|
25
|
+
> **Try it now** — no installation required. Run `npx @chappibunny/repolens demo` on any repo for an instant local preview.
|
|
26
|
+
|
|
27
|
+
[](https://youtu.be/hNd7xim_rTE)
|
|
28
|
+
|
|
29
|
+
▶️ *Click to watch on YouTube*
|
|
24
30
|
|
|
25
31
|
---
|
|
26
32
|
|
|
@@ -66,604 +72,67 @@ Run `npx @chappibunny/repolens migrate` to automatically update your workflow fi
|
|
|
66
72
|
|
|
67
73
|
---
|
|
68
74
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
## 🎯 What RepoLens Does
|
|
72
|
-
|
|
73
|
-
RepoLens transforms repositories into documented, understandable systems with **AI-assisted documentation intelligence**:
|
|
74
|
-
|
|
75
|
-
### 🤖 Two Output Modes
|
|
76
|
-
|
|
77
|
-
**Deterministic Mode (Default)**
|
|
78
|
-
- Fast, free, always reliable
|
|
79
|
-
- Generates technical documentation from repository structure
|
|
80
|
-
- Perfect for code inventories and reference docs
|
|
81
|
-
|
|
82
|
-
**AI-Enhanced Mode (Optional)**
|
|
83
|
-
- Adds natural language explanations and insights
|
|
84
|
-
- Creates audience-specific documentation (technical + non-technical)
|
|
85
|
-
- Understands business context and data flows
|
|
86
|
-
- Provider-agnostic (OpenAI, Anthropic, Azure, local models)
|
|
87
|
-
|
|
88
|
-
### 📋 Documentation Types
|
|
89
|
-
|
|
90
|
-
**Non-Technical Documents** (readable by founders, PMs, ops):
|
|
91
|
-
- **Executive Summary** — Project overview, capabilities, tech summary
|
|
92
|
-
- **Business Domains** — What the system does by functional area
|
|
93
|
-
- **Data Flows** — How information moves through the system
|
|
94
|
-
|
|
95
|
-
**Mixed-Audience Documents** (useful for everyone):
|
|
96
|
-
- **System Overview** — Tech stack, scale, module inventory
|
|
97
|
-
- **Developer Onboarding** — How to get started contributing
|
|
98
|
-
- **Change Impact** — Architecture diff with context
|
|
99
|
-
|
|
100
|
-
**Technical Documents** (engineers only):
|
|
101
|
-
- **Architecture Overview** — Layered technical analysis
|
|
102
|
-
- **Module Catalog** — Complete code inventory with patterns
|
|
103
|
-
- **API Surface** — REST endpoints, methods, routes
|
|
104
|
-
- **Route Map** — Frontend routes and pages
|
|
105
|
-
- **System Map** — Visual architecture diagrams
|
|
106
|
-
|
|
107
|
-
### 🔍 Smart Detection
|
|
108
|
-
|
|
109
|
-
RepoLens automatically detects:
|
|
110
|
-
- **Frameworks**: Next.js, React, Vue, Express, NestJS, and more
|
|
111
|
-
- **Languages**: TypeScript, JavaScript
|
|
112
|
-
- **Build Tools**: Vite, Webpack, Turbo, esbuild
|
|
113
|
-
- **Testing**: Vitest, Jest, Playwright, Cypress
|
|
114
|
-
- **Business Domains**: Authentication, Market Data, Payments, Content, etc.
|
|
115
|
-
- **Data Flows**: How information moves through your system
|
|
116
|
-
- **Architectural Patterns**: Module relationships and dependencies
|
|
117
|
-
|
|
118
|
-
### ✨ Key Features
|
|
119
|
-
|
|
120
|
-
✅ **AI-Assisted Documentation** - Optional AI layer for natural language explanations
|
|
121
|
-
✅ **Multi-Audience Output** - Technical docs for engineers + readable docs for stakeholders
|
|
122
|
-
✅ **Zero Hallucination Policy** - AI receives only structured context, never raw code
|
|
123
|
-
✅ **Provider Agnostic** - Works with any OpenAI-compatible API
|
|
124
|
-
✅ **Deterministic Fallback** - Always generates docs even if AI unavailable
|
|
125
|
-
✅ **Business Domain Inference** - Automatically maps code to business functions
|
|
126
|
-
✅ **Data Flow Analysis** - Understands how information moves through your system
|
|
127
|
-
✅ **Multiple Publishers** - Output to Notion, Confluence, GitHub Wiki, Markdown, or all four
|
|
128
|
-
✅ **Branch-Aware** - Prevent doc conflicts across branches
|
|
129
|
-
✅ **GitHub Actions** - Autonomous operation on every push
|
|
130
|
-
✅ **Team Notifications** - Discord integration with rich embeds (NEW in v0.6.0)
|
|
131
|
-
✅ **Health Score Tracking** - Monitor documentation quality over time
|
|
132
|
-
✅ **Watch Mode** - Auto-regenerate docs on file changes (NEW in v0.7.0)
|
|
133
|
-
✅ **Interactive Setup** - Step-by-step configuration wizard (NEW in v0.7.0)
|
|
134
|
-
✅ **Performance Metrics** - Timing breakdown for scan/render/publish (NEW in v0.7.0)
|
|
135
|
-
✅ **Actionable Errors** - Enhanced error messages with fix guidance (NEW in v0.7.0)
|
|
136
|
-
✅ **GraphQL Schema Detection** - Discover types, queries, mutations, and resolvers (NEW in v0.8.0)
|
|
137
|
-
✅ **TypeScript Type Graph** - Map interfaces, classes, and type relationships (NEW in v0.8.0)
|
|
138
|
-
✅ **Dependency Graph** - Import analysis with circular dependency detection (NEW in v0.8.0)
|
|
139
|
-
✅ **Architecture Drift** - Track structural changes against a baseline (NEW in v0.8.0)
|
|
140
|
-
✅ **Plugin System** - Extend with custom renderers, publishers, and hooks (NEW in v0.9.0)
|
|
141
|
-
✅ **Stable API** - CLI, config, and plugin interface frozen with semver guarantees (v1.0.0)
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## 👥 Team Features (New in v0.6.0)
|
|
146
|
-
|
|
147
|
-
### 💬 Discord Notifications
|
|
148
|
-
|
|
149
|
-
Get notified when documentation changes significantly:
|
|
75
|
+
## 📋 What It Generates
|
|
150
76
|
|
|
151
|
-
**
|
|
152
|
-
- Rich embeds with coverage, health score, and change percentage
|
|
153
|
-
- Threshold-based notifications (only for significant changes)
|
|
154
|
-
- Branch filtering with glob pattern support
|
|
155
|
-
- Secure webhook configuration via environment variable
|
|
77
|
+
**11 document types** for three audiences — no manual writing required:
|
|
156
78
|
|
|
157
|
-
|
|
79
|
+
| Audience | Documents |
|
|
80
|
+
|---|---|
|
|
81
|
+
| **Stakeholders** (founders, PMs, ops) | Executive Summary · Business Domains · Data Flows |
|
|
82
|
+
| **Everyone** | System Overview · Developer Onboarding · Change Impact |
|
|
83
|
+
| **Engineers** | Architecture Overview · Module Catalog · API Surface · Route Map · System Map |
|
|
158
84
|
|
|
159
|
-
|
|
160
|
-
- Server Settings → Integrations → Webhooks → New Webhook
|
|
161
|
-
- Copy the webhook URL
|
|
85
|
+
**Two modes:** Deterministic (free, fast, always works) or AI-Enhanced (optional — OpenAI, Anthropic, Azure, Ollama).
|
|
162
86
|
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
# .env (never commit!)
|
|
166
|
-
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/xxx/xxx
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
3. **Configure in `.repolens.yml`** (optional):
|
|
170
|
-
```yaml
|
|
171
|
-
discord:
|
|
172
|
-
enabled: true # Default: true (if webhook configured)
|
|
173
|
-
notifyOn: significant # Options: always, significant, never
|
|
174
|
-
significantThreshold: 10 # Notify if change >10% (default)
|
|
175
|
-
branches: # Which branches to notify (default: all)
|
|
176
|
-
- main
|
|
177
|
-
- develop
|
|
178
|
-
```
|
|
87
|
+
---
|
|
179
88
|
|
|
180
|
-
|
|
181
|
-
- Repo Settings → Secrets and variables → Actions
|
|
182
|
-
- New repository secret: `DISCORD_WEBHOOK_URL`
|
|
89
|
+
## ✨ Why RepoLens
|
|
183
90
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
91
|
+
| | |
|
|
92
|
+
|---|---|
|
|
93
|
+
| 🤖 **Autonomous** | Runs on every push via GitHub Actions — docs stay evergreen |
|
|
94
|
+
| 👥 **Multi-Audience** | Technical docs + stakeholder-readable overviews from one scan |
|
|
95
|
+
| 📤 **Multi-Publisher** | Notion, Confluence, GitHub Wiki, Markdown — or all four at once |
|
|
96
|
+
| 🧠 **AI-Assisted** | Optional AI with zero-hallucination policy (structured context only) |
|
|
97
|
+
| 🔍 **Smart Detection** | Frameworks, domains, data flows, dependencies, drift — all automatic |
|
|
98
|
+
| 🔌 **Extensible** | Plugin system for custom renderers, publishers, and hooks |
|
|
99
|
+
| 🛡️ **Secure** | Secret detection, injection prevention, rate limiting, supply chain hardening |
|
|
100
|
+
| ⚡ **Fast** | Handles repos up to 50k files with performance guardrails |
|
|
190
101
|
|
|
191
102
|
---
|
|
192
103
|
|
|
193
104
|
## 📦 Installation
|
|
194
105
|
|
|
195
|
-
### Recommended: npm Registry
|
|
196
|
-
|
|
197
106
|
```bash
|
|
198
107
|
npm install @chappibunny/repolens
|
|
199
108
|
```
|
|
200
109
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
### Alternative Methods
|
|
204
|
-
|
|
205
|
-
<details>
|
|
206
|
-
<summary><b>Option B: GitHub Direct Install</b></summary>
|
|
207
|
-
|
|
208
|
-
Install from the latest GitHub commit:
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
npm install github:CHAPIBUNNY/repolens
|
|
212
|
-
```
|
|
213
|
-
</details>
|
|
214
|
-
|
|
215
|
-
<details>
|
|
216
|
-
<summary><b>Option C: Local Development</b></summary>
|
|
217
|
-
|
|
218
|
-
Clone and link for development:
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
git clone https://github.com/CHAPIBUNNY/repolens.git
|
|
222
|
-
cd repolens
|
|
223
|
-
npm link
|
|
224
|
-
```
|
|
225
|
-
</details>
|
|
226
|
-
|
|
227
|
-
<details>
|
|
228
|
-
<summary><b>Option D: GitHub Release Tarball</b></summary>
|
|
229
|
-
|
|
230
|
-
Install from a specific version:
|
|
110
|
+
Or try instantly without installing: `npx @chappibunny/repolens demo`
|
|
231
111
|
|
|
232
|
-
|
|
233
|
-
npm install https://github.com/CHAPIBUNNY/repolens/releases/download/v1.2.0/chappibunny-repolens-1.2.0.tgz
|
|
234
|
-
```
|
|
235
|
-
</details>
|
|
236
|
-
|
|
237
|
-
> **Having install problems?** See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for solutions to common issues like `ENOTEMPTY`, `npm ci` failures, and stale versions.
|
|
112
|
+
For alternative methods, see [INSTALLATION.md](INSTALLATION.md).
|
|
238
113
|
|
|
239
114
|
---
|
|
240
115
|
|
|
241
|
-
## 🎓
|
|
242
|
-
|
|
243
|
-
### Step 1: Initialize RepoLens
|
|
244
|
-
|
|
245
|
-
Run this in your project root:
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
npx @chappibunny/repolens init
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
**What it creates:**
|
|
252
|
-
- `.repolens.yml` — Configuration file
|
|
253
|
-
- `.github/workflows/repolens.yml` — Auto-publishing workflow
|
|
254
|
-
- `.env.example` — Environment variable template
|
|
255
|
-
- `README.repolens.md` — Quick reference guide
|
|
256
|
-
|
|
257
|
-
**Default configuration works for:**
|
|
258
|
-
- Next.js projects
|
|
259
|
-
- React applications
|
|
260
|
-
- Node.js backends
|
|
261
|
-
- Monorepos with common structure
|
|
262
|
-
|
|
263
|
-
### Step 2: Configure Publishers
|
|
264
|
-
|
|
265
|
-
Open `.repolens.yml` and verify the `publishers` section:
|
|
266
|
-
|
|
267
|
-
```yaml
|
|
268
|
-
publishers:
|
|
269
|
-
- markdown # Always works, no setup needed
|
|
270
|
-
- notion # Requires NOTION_TOKEN and NOTION_PARENT_PAGE_ID
|
|
271
|
-
- confluence # Requires CONFLUENCE_URL, CONFLUENCE_EMAIL, CONFLUENCE_API_TOKEN, CONFLUENCE_SPACE_KEY
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
**Markdown Only** (simplest):
|
|
275
|
-
```yaml
|
|
276
|
-
publishers:
|
|
277
|
-
- markdown
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**Notion Only**:
|
|
281
|
-
```yaml
|
|
282
|
-
publishers:
|
|
283
|
-
- notion
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
**Confluence Only**:
|
|
287
|
-
```yaml
|
|
288
|
-
publishers:
|
|
289
|
-
- confluence
|
|
290
|
-
```
|
|
291
|
-
Documentation lands in `.repolens/` directory. Commit these files or ignore them.
|
|
292
|
-
|
|
293
|
-
**Notion + Markdown** (recommended):
|
|
294
|
-
```yaml
|
|
295
|
-
publishers:
|
|
296
|
-
- notion
|
|
297
|
-
- markdown
|
|
298
|
-
```
|
|
299
|
-
Docs published to Notion for team visibility, plus local Markdown backups.
|
|
300
|
-
|
|
301
|
-
**Confluence + Markdown**:
|
|
302
|
-
```yaml
|
|
303
|
-
publishers:
|
|
304
|
-
- confluence
|
|
305
|
-
- markdown
|
|
306
|
-
```
|
|
307
|
-
Docs published to Confluence for enterprise teams, plus local Markdown backups.
|
|
308
|
-
|
|
309
|
-
**All Three**:
|
|
310
|
-
```yaml
|
|
311
|
-
publishers:
|
|
312
|
-
- notion
|
|
313
|
-
- confluence
|
|
314
|
-
- markdown
|
|
315
|
-
```
|
|
316
|
-
Maximum visibility: Notion for async collaboration, Confluence for enterprise docs, Markdown for local backups.
|
|
317
|
-
|
|
318
|
-
**GitHub Wiki** (ideal for open source):
|
|
319
|
-
```yaml
|
|
320
|
-
publishers:
|
|
321
|
-
- github_wiki
|
|
322
|
-
- markdown
|
|
323
|
-
```
|
|
324
|
-
Docs live alongside your code — accessible from the repo's Wiki tab. Requires `GITHUB_TOKEN`.
|
|
325
|
-
|
|
326
|
-
### Step 3: Enable AI Features (Optional)
|
|
327
|
-
|
|
328
|
-
**AI-enhanced documentation adds natural language explanations for non-technical audiences.**
|
|
329
|
-
|
|
330
|
-
**3.1: Choose an AI Provider**
|
|
331
|
-
|
|
332
|
-
RepoLens works with any OpenAI-compatible API:
|
|
333
|
-
- **OpenAI** (gpt-5-mini, gpt-5.4, gpt-5-nano)
|
|
334
|
-
- **Anthropic Claude** (via API gateway)
|
|
335
|
-
- **Azure OpenAI** (enterprise deployments)
|
|
336
|
-
- **Local Models** (Ollama, LM Studio, etc.)
|
|
337
|
-
|
|
338
|
-
**3.2: Add Environment Variables**
|
|
339
|
-
|
|
340
|
-
Create `.env` in your project root:
|
|
341
|
-
```bash
|
|
342
|
-
# Enable AI features
|
|
343
|
-
REPOLENS_AI_ENABLED=true
|
|
344
|
-
REPOLENS_AI_API_KEY=sk-xxxxxxxxxxxxx
|
|
345
|
-
|
|
346
|
-
# Optional: Customize provider
|
|
347
|
-
REPOLENS_AI_BASE_URL=https://api.openai.com/v1
|
|
348
|
-
REPOLENS_AI_MODEL=gpt-5-mini
|
|
349
|
-
REPOLENS_AI_MAX_TOKENS=2000
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
**3.3: Configure AI in .repolens.yml**
|
|
353
|
-
|
|
354
|
-
```yaml
|
|
355
|
-
ai:
|
|
356
|
-
enabled: true # Enable AI features
|
|
357
|
-
mode: hybrid # hybrid, full, or off
|
|
358
|
-
max_tokens: 2000 # Token limit per request
|
|
359
|
-
|
|
360
|
-
features:
|
|
361
|
-
executive_summary: true # Non-technical overview
|
|
362
|
-
business_domains: true # Functional area descriptions
|
|
363
|
-
architecture_overview: true # Layered technical analysis
|
|
364
|
-
data_flows: true # System data flow explanations
|
|
365
|
-
developer_onboarding: true # Getting started guide
|
|
366
|
-
change_impact: true # Architecture diff with context
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
**Cost Estimates** (with gpt-5-mini):
|
|
370
|
-
- Small repo (<50 files): $0.10-$0.30 per run
|
|
371
|
-
- Medium repo (50-200 files): $0.30-$0.80 per run
|
|
372
|
-
- Large repo (200+ files): $0.80-$2.00 per run
|
|
373
|
-
|
|
374
|
-
**For GitHub Actions**, add as repository secret:
|
|
375
|
-
- Name: `AI_KEY`, Value: `sk-xxxxx` (your OpenAI API key)
|
|
376
|
-
|
|
377
|
-
See [AI.md](AI.md) for complete AI documentation and provider setup.
|
|
378
|
-
|
|
379
|
-
### Step 4: Set Up Notion Integration (Optional)
|
|
380
|
-
|
|
381
|
-
If using the Notion publisher:
|
|
382
|
-
|
|
383
|
-
**4.1: Create Notion Integration**
|
|
384
|
-
1. Go to [notion.so/my-integrations](https://www.notion.so/my-integrations)
|
|
385
|
-
2. Click **"+ New Integration"**
|
|
386
|
-
3. Name it **"RepoLens"**
|
|
387
|
-
4. Select your workspace
|
|
388
|
-
5. Copy the **Internal Integration Token** (starts with `secret_`)
|
|
389
|
-
|
|
390
|
-
**4.2: Create Parent Page**
|
|
391
|
-
1. Create a new page in Notion (e.g., "📚 Architecture Docs")
|
|
392
|
-
2. Click **"..."** menu → **"Add connections"** → Select **"RepoLens"**
|
|
393
|
-
3. Copy the page URL: `https://notion.so/workspace/PAGE_ID?xxx`
|
|
394
|
-
4. Extract the `PAGE_ID` (32-character hex string)
|
|
395
|
-
|
|
396
|
-
**4.3: Add Environment Variables**
|
|
397
|
-
|
|
398
|
-
**For Local Development:**
|
|
399
|
-
Create `.env` in your project root:
|
|
400
|
-
```bash
|
|
401
|
-
NOTION_TOKEN=secret_xxxxxxxxxxxxx
|
|
402
|
-
NOTION_PARENT_PAGE_ID=xxxxxxxxxxxxx
|
|
403
|
-
NOTION_VERSION=2022-06-28
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
**For GitHub Actions:**
|
|
407
|
-
Add as repository secrets:
|
|
408
|
-
1. Go to your repo → **Settings** → **Secrets and variables** → **Actions**
|
|
409
|
-
2. Click **"New repository secret"**
|
|
410
|
-
3. Add:
|
|
411
|
-
- Name: `NOTION_TOKEN`, Value: `secret_xxxxx`
|
|
412
|
-
- Name: `NOTION_PARENT_PAGE_ID`, Value: `xxxxxx`
|
|
413
|
-
|
|
414
|
-
### Step 4a: Set Up Confluence Integration (Optional)
|
|
415
|
-
|
|
416
|
-
If using the Confluence publisher:
|
|
417
|
-
|
|
418
|
-
**4a.1: Generate Confluence API Token**
|
|
419
|
-
1. Go to [id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
|
|
420
|
-
2. Click **"Create API token"**
|
|
421
|
-
3. Name it **"RepoLens"**
|
|
422
|
-
4. Copy the generated token (save it securely - you won't see it again!)
|
|
423
|
-
|
|
424
|
-
**4a.2: Find Your Space Key**
|
|
425
|
-
1. Navigate to your Confluence space
|
|
426
|
-
2. Go to **Space Settings** → **Space details**
|
|
427
|
-
3. Note the **Space Key** (e.g., `DOCS`, `ENG`, `TECH`)
|
|
428
|
-
|
|
429
|
-
**4a.3: Get Parent Page ID (Optional)**
|
|
430
|
-
1. Navigate to the page where you want RepoLens docs nested
|
|
431
|
-
2. Click **"..."** menu → **"Page information"**
|
|
432
|
-
3. Copy the page ID from the URL: `pageId=123456789`
|
|
433
|
-
4. If skipped, docs will be created at space root level
|
|
434
|
-
|
|
435
|
-
**4a.4: Add Environment Variables**
|
|
436
|
-
|
|
437
|
-
**For Local Development:**
|
|
438
|
-
Create `.env` in your project root:
|
|
439
|
-
```bash
|
|
440
|
-
CONFLUENCE_URL=https://your-company.atlassian.net/wiki
|
|
441
|
-
CONFLUENCE_EMAIL=your-email@example.com
|
|
442
|
-
CONFLUENCE_API_TOKEN=your-api-token-here
|
|
443
|
-
CONFLUENCE_SPACE_KEY=DOCS
|
|
444
|
-
CONFLUENCE_PARENT_PAGE_ID=123456789 # Optional
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
**For Confluence Server/Data Center** (self-hosted):
|
|
448
|
-
```bash
|
|
449
|
-
CONFLUENCE_URL=https://confluence.yourcompany.com
|
|
450
|
-
CONFLUENCE_EMAIL=your-username # Use username instead of email
|
|
451
|
-
CONFLUENCE_API_TOKEN=your-personal-access-token
|
|
452
|
-
CONFLUENCE_SPACE_KEY=DOCS
|
|
453
|
-
CONFLUENCE_PARENT_PAGE_ID=123456789 # Optional
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
**For GitHub Actions:**
|
|
457
|
-
Add as repository secrets:
|
|
458
|
-
1. Go to your repo → **Settings** → **Secrets and variables** → **Actions**
|
|
459
|
-
2. Click **"New repository secret"**
|
|
460
|
-
3. Add:
|
|
461
|
-
- Name: `CONFLUENCE_URL`, Value: `https://your-company.atlassian.net/wiki`
|
|
462
|
-
- Name: `CONFLUENCE_EMAIL`, Value: `your-email@example.com`
|
|
463
|
-
- Name: `CONFLUENCE_API_TOKEN`, Value: `your-token`
|
|
464
|
-
- Name: `CONFLUENCE_SPACE_KEY`, Value: `DOCS`
|
|
465
|
-
- Name: `CONFLUENCE_PARENT_PAGE_ID`, Value: `123456789` (optional)
|
|
466
|
-
|
|
467
|
-
**Confluence + Notion + Markdown** (all three!):
|
|
468
|
-
```yaml
|
|
469
|
-
publishers:
|
|
470
|
-
- markdown
|
|
471
|
-
- notion
|
|
472
|
-
- confluence
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
Docs published to both Notion and Confluence for maximum visibility!
|
|
476
|
-
|
|
477
|
-
### Step 5: Configure Branch Publishing (Recommended)
|
|
478
|
-
|
|
479
|
-
Prevent documentation conflicts by limiting which branches publish to Notion/Confluence:
|
|
480
|
-
|
|
481
|
-
```yaml
|
|
482
|
-
notion:
|
|
483
|
-
branches:
|
|
484
|
-
- main # Only main branch publishes
|
|
485
|
-
includeBranchInTitle: false # Clean titles (no [branch-name] suffix)
|
|
486
|
-
|
|
487
|
-
confluence:
|
|
488
|
-
branches:
|
|
489
|
-
- main # Only main branch publishes to Confluence
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
**Options:**
|
|
493
|
-
- `branches: [main]` — Only main publishes (recommended)
|
|
494
|
-
- `branches: [main, staging, release/*]` — Multiple branches with glob support
|
|
495
|
-
- Omit `branches` entirely — All branches publish (may cause conflicts)
|
|
496
|
-
|
|
497
|
-
**Markdown publisher always runs on all branches** (local files don't conflict).
|
|
498
|
-
|
|
499
|
-
### Step 6: Customize Scan Patterns (Optional)
|
|
500
|
-
|
|
501
|
-
Adjust what files RepoLens scans:
|
|
502
|
-
|
|
503
|
-
```yaml
|
|
504
|
-
scan:
|
|
505
|
-
include:
|
|
506
|
-
- "src/**/*.{ts,tsx,js,jsx}"
|
|
507
|
-
- "app/**/*.{ts,tsx,js,jsx}"
|
|
508
|
-
- "lib/**/*.{ts,tsx,js,jsx}"
|
|
509
|
-
ignore:
|
|
510
|
-
- "node_modules/**"
|
|
511
|
-
- ".next/**"
|
|
512
|
-
- "dist/**"
|
|
513
|
-
- "build/**"
|
|
514
|
-
|
|
515
|
-
module_roots:
|
|
516
|
-
- "src"
|
|
517
|
-
- "app"
|
|
518
|
-
- "lib"
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
**Performance Note:** RepoLens warns at 10k files and limits at 50k files.
|
|
522
|
-
|
|
523
|
-
### Step 7: Generate Documentation
|
|
524
|
-
|
|
525
|
-
Run locally to test:
|
|
526
|
-
|
|
527
|
-
```bash
|
|
528
|
-
npx @chappibunny/repolens publish
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
**Expected output:**
|
|
532
|
-
```
|
|
533
|
-
RepoLens 🔍
|
|
534
|
-
────────────────────────────────────────────────────
|
|
535
|
-
[RepoLens] Using config: /path/to/.repolens.yml
|
|
536
|
-
[RepoLens] Loading configuration...
|
|
537
|
-
[RepoLens] Scanning repository...
|
|
538
|
-
[RepoLens] Detected 42 modules
|
|
539
|
-
[RepoLens] Publishing documentation...
|
|
540
|
-
[RepoLens] Publishing to Notion from branch: main
|
|
541
|
-
[RepoLens] ✓ System Overview published
|
|
542
|
-
[RepoLens] ✓ Module Catalog published
|
|
543
|
-
[RepoLens] ✓ API Surface published
|
|
544
|
-
[RepoLens] ✓ Route Map published
|
|
545
|
-
[RepoLens] ✓ System Map published
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
### Step 8: Verify Output
|
|
549
|
-
|
|
550
|
-
**Markdown Output:****
|
|
551
|
-
```bash
|
|
552
|
-
ls .repolens/
|
|
553
|
-
# system_overview.md
|
|
554
|
-
# module_catalog.md
|
|
555
|
-
# api_surface.md
|
|
556
|
-
# route_map.md
|
|
557
|
-
# system_map.md
|
|
558
|
-
# system_map.md
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
**Notion Output:**
|
|
562
|
-
Open your Notion parent page and verify child pages were created:
|
|
563
|
-
- 📊 RepoLens — Executive Summary (if AI enabled)
|
|
564
|
-
- 📈 RepoLens — Business Domains (if AI enabled)
|
|
565
|
-
- 📊 RepoLens — System Overview
|
|
566
|
-
- 📚 RepoLens — Developer Onboarding (if AI enabled)
|
|
567
|
-
- 📊 RepoLens — Architecture Overview (if AI enabled)
|
|
568
|
-
- 📊 RepoLens — Data Flows (if AI enabled)
|
|
569
|
-
- 📌 RepoLens — Module Catalog
|
|
570
|
-
- 🔌 RepoLens — API Surface
|
|
571
|
-
- 🗺️ RepoLens — Route Map
|
|
572
|
-
- 🏛️ RepoLens — System Map
|
|
573
|
-
|
|
574
|
-
### Step 9: Enable GitHub Actions (Automatic Updates)
|
|
575
|
-
|
|
576
|
-
**Commit the workflow:**
|
|
577
|
-
```bash
|
|
578
|
-
git add .github/workflows/repolens.yml .repolens.yml
|
|
579
|
-
git commit -m "Add RepoLens documentation automation"
|
|
580
|
-
git push
|
|
581
|
-
```
|
|
116
|
+
## 🎓 Onboarding Guide
|
|
582
117
|
|
|
583
|
-
|
|
584
|
-
- ✅ Every push to `main` regenerates docs
|
|
585
|
-
- ✅ Pull requests get architecture diff comments
|
|
586
|
-
- ✅ Documentation stays evergreen automatically
|
|
118
|
+
Step-by-step setup for publishers, AI features, Notion, Confluence, GitHub Wiki, Discord, and CI/CD automation.
|
|
587
119
|
|
|
588
|
-
**
|
|
120
|
+
**[→ Full Onboarding Guide](ONBOARDING.md)**
|
|
589
121
|
|
|
590
122
|
---
|
|
591
123
|
|
|
592
|
-
## 🎮
|
|
593
|
-
|
|
594
|
-
### Publish Documentation
|
|
595
|
-
|
|
596
|
-
Auto-discovers `.repolens.yml`:
|
|
597
|
-
```bash
|
|
598
|
-
npx @chappibunny/repolens publish
|
|
599
|
-
```
|
|
124
|
+
## 🎮 Commands
|
|
600
125
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
### Validate Setup
|
|
616
|
-
|
|
617
|
-
Check if your RepoLens setup is valid:
|
|
618
|
-
|
|
619
|
-
```bash
|
|
620
|
-
npx @chappibunny/repolens doctor
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
Validates:
|
|
624
|
-
- ✅ `.repolens.yml` exists and is valid YAML
|
|
625
|
-
- ✅ Required config fields present
|
|
626
|
-
- ✅ Publishers configured correctly
|
|
627
|
-
- ✅ Scan patterns defined
|
|
628
|
-
- ✅ Publisher configuration valid
|
|
629
|
-
|
|
630
|
-
### Migrate Workflows
|
|
631
|
-
|
|
632
|
-
**🚨 Upgrading from v0.3.0 or earlier?** Automatically update your GitHub Actions workflows:
|
|
633
|
-
|
|
634
|
-
```bash
|
|
635
|
-
npx @chappibunny/repolens migrate
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
Preview changes without applying:
|
|
639
|
-
```bash
|
|
640
|
-
npx @chappibunny/repolens migrate --dry-run
|
|
641
|
-
```
|
|
642
|
-
|
|
643
|
-
What it fixes:
|
|
644
|
-
- ❌ Removes outdated `cd tools/repolens` commands
|
|
645
|
-
- ✅ Updates to `npx @chappibunny/repolens@latest publish`
|
|
646
|
-
- ✅ Adds Node.js setup step if missing
|
|
647
|
-
- ✅ Adds environment variables (NOTION_TOKEN, REPOLENS_AI_API_KEY)
|
|
648
|
-
- 💾 Creates backup files for safety
|
|
649
|
-
|
|
650
|
-
**Common error it fixes:**
|
|
651
|
-
```
|
|
652
|
-
Run cd tools/repolens
|
|
653
|
-
cd: tools/repolens: No such file or directory
|
|
654
|
-
Error: Process completed with exit code 1.
|
|
655
|
-
```
|
|
656
|
-
|
|
657
|
-
See [MIGRATION.md](MIGRATION.md) for detailed upgrade guide.
|
|
658
|
-
|
|
659
|
-
### Get Help
|
|
660
|
-
|
|
661
|
-
```bash
|
|
662
|
-
npx @chappibunny/repolens --help
|
|
663
|
-
npx @chappibunny/repolens --version
|
|
664
|
-
```
|
|
665
|
-
|
|
666
|
-
---
|
|
126
|
+
| Command | Description |
|
|
127
|
+
|---|---|
|
|
128
|
+
| `repolens init` | Scaffold config + GitHub Actions workflow |
|
|
129
|
+
| `repolens init --interactive` | Step-by-step configuration wizard |
|
|
130
|
+
| `repolens publish` | Scan, generate, and publish documentation |
|
|
131
|
+
| `repolens demo` | Quick local preview — no API keys needed |
|
|
132
|
+
| `repolens doctor` | Validate your setup |
|
|
133
|
+
| `repolens watch` | Auto-regenerate docs on file changes |
|
|
134
|
+
| `repolens migrate` | Upgrade from v0.3.0 workflows ([details](MIGRATION.md)) |
|
|
135
|
+
| `repolens feedback` | Send feedback to the team |
|
|
667
136
|
|
|
668
137
|
---
|
|
669
138
|
|
|
@@ -673,13 +142,13 @@ npx @chappibunny/repolens --version
|
|
|
673
142
|
|
|
674
143
|
```mermaid
|
|
675
144
|
graph LR
|
|
676
|
-
CLI[bin/repolens<br/>1 file] --> Core[src/core<br/>
|
|
677
|
-
Publishers[src/publishers<br/>
|
|
678
|
-
Publishers --> Renderers[src/renderers<br/>
|
|
679
|
-
Publishers --> Utils[src/utils<br/>
|
|
145
|
+
CLI[bin/repolens<br/>1 file] --> Core[src/core<br/>4 files]
|
|
146
|
+
Publishers[src/publishers<br/>6 files] --> Core
|
|
147
|
+
Publishers --> Renderers[src/renderers<br/>4 files]
|
|
148
|
+
Publishers --> Utils[src/utils<br/>10 files]
|
|
680
149
|
Renderers --> Core
|
|
681
150
|
Delivery[src/delivery<br/>1 file] --> Publishers
|
|
682
|
-
Tests[tests<br/>
|
|
151
|
+
Tests[tests<br/>15 files] -. tests .-> CLI
|
|
683
152
|
Tests -. tests .-> Core
|
|
684
153
|
Tests -. tests .-> Publishers
|
|
685
154
|
|
|
@@ -729,491 +198,28 @@ When you open a pull request, RepoLens posts:
|
|
|
729
198
|
|
|
730
199
|
---
|
|
731
200
|
|
|
732
|
-
## 🔒 Privacy &
|
|
733
|
-
|
|
734
|
-
RepoLens includes **opt-in** error tracking and usage telemetry to help improve reliability, understand adoption patterns, and prioritize features.
|
|
735
|
-
|
|
736
|
-
**Privacy First:**
|
|
737
|
-
- ✅ **Disabled by default** - telemetry is opt-in
|
|
738
|
-
- ✅ **No code collection** - your source code never leaves your machine
|
|
739
|
-
- ✅ **No secrets** - API keys and tokens are never sent
|
|
740
|
-
- ✅ **Anonymous** - no personal information or repository names
|
|
741
|
-
- ✅ **Transparent** - see exactly what data is collected
|
|
742
|
-
|
|
743
|
-
**To enable telemetry**, add to `.env`:
|
|
744
|
-
```bash
|
|
745
|
-
REPOLENS_TELEMETRY_ENABLED=true
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
**What's collected (when enabled):**
|
|
749
|
-
|
|
750
|
-
*Error Tracking (Phase 1):*
|
|
751
|
-
- Error messages and stack traces (for debugging)
|
|
752
|
-
- Command that failed (e.g., `publish`, `migrate`)
|
|
753
|
-
- Basic system info (Node version, platform)
|
|
754
|
-
|
|
755
|
-
*Usage Metrics (Phase 2):*
|
|
756
|
-
- Command execution times (scan, render, publish)
|
|
757
|
-
- Repository size (file count, module count)
|
|
758
|
-
- Feature usage (AI enabled, publishers used)
|
|
759
|
-
- Success/failure rates
|
|
760
|
-
|
|
761
|
-
**Why enable it?**
|
|
762
|
-
- 🐛 **Faster bug fixes** - issues you encounter are fixed proactively
|
|
763
|
-
- 📊 **Better features** - development focused on real-world usage
|
|
764
|
-
- ⚡ **Performance** - optimizations based on actual bottlenecks
|
|
765
|
-
- 🎯 **Prioritization** - roadmap guided by community needs
|
|
766
|
-
|
|
767
|
-
For full details and example data, see [TELEMETRY.md](TELEMETRY.md).
|
|
768
|
-
|
|
769
|
-
---
|
|
770
|
-
|
|
771
|
-
## 🛡️ Security
|
|
772
|
-
|
|
773
|
-
RepoLens implements **defense-in-depth** security to protect your credentials, code, and infrastructure.
|
|
774
|
-
|
|
775
|
-
### Security Architecture (Phase 3)
|
|
776
|
-
|
|
777
|
-
**Layer 1: Input Validation** (`src/utils/validate.js`)
|
|
778
|
-
- ✅ Schema validation with required field enforcement
|
|
779
|
-
- ✅ Injection attack detection (shell, command substitution)
|
|
780
|
-
- ✅ Directory traversal prevention (`..`, absolute paths, null bytes)
|
|
781
|
-
- ✅ Secret scanning in configuration files
|
|
782
|
-
- ✅ Circular reference protection (depth limit: 20 levels)
|
|
783
|
-
|
|
784
|
-
**Layer 2: Secret Detection** (`src/utils/secrets.js`)
|
|
785
|
-
- ✅ **15+ credential patterns**: OpenAI, GitHub, AWS, Notion, Generic API keys
|
|
786
|
-
- ✅ **Entropy-based detection**: High-entropy strings (Shannon entropy > 4.5)
|
|
787
|
-
- ✅ **Automatic sanitization**: All logger output, telemetry, error messages
|
|
788
|
-
- ✅ **Format**: `sk-abc123xyz` → `sk-ab***yz` (first 2 + last 2 chars visible)
|
|
789
|
-
|
|
790
|
-
**Layer 3: Rate Limiting** (`src/utils/rate-limit.js`)
|
|
791
|
-
- ✅ **Token bucket algorithm**: 3 requests/second for Notion & AI APIs
|
|
792
|
-
- ✅ **Exponential backoff**: Automatic retry with jitter (500ms → 1s → 2s)
|
|
793
|
-
- ✅ **Cost protection**: Prevents runaway API usage
|
|
794
|
-
- ✅ **Retryable errors**: 429, 500, 502, 503, 504, network timeouts
|
|
795
|
-
|
|
796
|
-
**Layer 4: Supply Chain Security**
|
|
797
|
-
- ✅ **Action pinning**: GitHub Actions pinned to commit SHAs (not tags)
|
|
798
|
-
- ✅ **Minimal permissions**: `contents: read` or `contents: write` only
|
|
799
|
-
- ✅ **Dependency audits**: CI/CD fails on critical/high vulnerabilities
|
|
800
|
-
- ✅ **npm audit**: 0 vulnerabilities in 519 dependencies
|
|
801
|
-
|
|
802
|
-
**Layer 5: Comprehensive Testing**
|
|
803
|
-
- ✅ **43 security tests**: Fuzzing, injection, boundary conditions
|
|
804
|
-
- ✅ **Attack vectors tested**: SQL, command, path, YAML, NoSQL, LDAP, XML
|
|
805
|
-
- ✅ **90 total tests**: 47 functional + 43 security (100% passing)
|
|
806
|
-
|
|
807
|
-
### Security Validation (Automatic)
|
|
201
|
+
## 🔒 Privacy & Security
|
|
808
202
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
✅ No secrets in configuration files
|
|
813
|
-
✅ Safe path patterns only (no .. or absolute paths)
|
|
814
|
-
✅ Valid schema (configVersion: 1)
|
|
815
|
-
|
|
816
|
-
# Every runtime operation:
|
|
817
|
-
✅ All logs sanitized (secrets redacted)
|
|
818
|
-
✅ Telemetry sanitized (no credentials sent)
|
|
819
|
-
✅ Rate limiting active (3 req/sec)
|
|
820
|
-
✅ Type validation active (prevents type confusion)
|
|
821
|
-
|
|
822
|
-
# Every CI/CD run:
|
|
823
|
-
✅ npm audit passing (0 vulnerabilities)
|
|
824
|
-
✅ Security tests passing (43/43)
|
|
825
|
-
✅ Secrets scanner passing (no hardcoded credentials)
|
|
826
|
-
```
|
|
827
|
-
|
|
828
|
-
### Vulnerability Reporting
|
|
829
|
-
|
|
830
|
-
- 📧 **Email**: trades@rabitaitrades.com
|
|
831
|
-
- 🚨 **DO NOT** open public issues for security bugs
|
|
832
|
-
- ⏱️ **Response**: Within 48 hours
|
|
833
|
-
- 🔒 **Fix Timeline**: Critical issues within 7 days, others within 30 days
|
|
834
|
-
- 📢 **Disclosure**: Coordinated disclosure after fix is released
|
|
835
|
-
|
|
836
|
-
### Security Best Practices
|
|
837
|
-
|
|
838
|
-
**✅ DO:**
|
|
839
|
-
- Store secrets in GitHub Secrets (not `.repolens.yml`)
|
|
840
|
-
- Use environment variables for sensitive data
|
|
841
|
-
- Review generated documentation before publishing
|
|
842
|
-
- Enable telemetry to catch security issues early
|
|
843
|
-
- Run `npm audit` regularly
|
|
844
|
-
- Pin workflows to specific versions
|
|
845
|
-
|
|
846
|
-
**❌ DON'T:**
|
|
847
|
-
- Commit API keys to version control
|
|
848
|
-
- Share `.env` files publicly
|
|
849
|
-
- Disable security validation
|
|
850
|
-
- Use overly broad scan patterns (`**/*`)
|
|
851
|
-
- Ignore security warnings
|
|
852
|
-
|
|
853
|
-
For complete security documentation and threat model, see [SECURITY.md](SECURITY.md).
|
|
203
|
+
- **Telemetry is opt-in and disabled by default** — no code, secrets, or personal data leaves your machine. See [TELEMETRY.md](TELEMETRY.md).
|
|
204
|
+
- **Defense-in-depth security** — input validation, secret detection (15+ patterns), rate limiting, injection prevention, supply chain hardening. See [SECURITY.md](SECURITY.md).
|
|
205
|
+
- **Report vulnerabilities** to trades@rabitaitrades.com (not public issues). Response within 48 hours.
|
|
854
206
|
|
|
855
207
|
---
|
|
856
208
|
|
|
857
|
-
##
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
project
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
- confluence
|
|
872
|
-
- markdown
|
|
873
|
-
|
|
874
|
-
# Notion-specific settings (optional)
|
|
875
|
-
notion:
|
|
876
|
-
branches:
|
|
877
|
-
- main # Only main branch publishes
|
|
878
|
-
- staging # Also staging
|
|
879
|
-
- release/* # Glob patterns supported
|
|
880
|
-
includeBranchInTitle: false # Clean titles without [branch-name]
|
|
881
|
-
|
|
882
|
-
# Confluence-specific settings (optional)
|
|
883
|
-
confluence:
|
|
884
|
-
branches:
|
|
885
|
-
- main # Only main branch publishes to Confluence
|
|
886
|
-
|
|
887
|
-
# Discord notifications (optional, new in v0.6.0)
|
|
888
|
-
discord:
|
|
889
|
-
enabled: true # Default: true (if DISCORD_WEBHOOK_URL set)
|
|
890
|
-
notifyOn: significant # Options: always, significant, never
|
|
891
|
-
significantThreshold: 10 # Notify if change >10% (default)
|
|
892
|
-
branches: # Which branches to notify (default: all)
|
|
893
|
-
- main
|
|
894
|
-
- develop
|
|
895
|
-
|
|
896
|
-
# GitHub integration (optional)
|
|
897
|
-
github:
|
|
898
|
-
owner: "your-username"
|
|
899
|
-
repo: "your-repo-name"
|
|
900
|
-
|
|
901
|
-
# File scanning configuration
|
|
902
|
-
scan:
|
|
903
|
-
include:
|
|
904
|
-
- "src/**/*.{ts,tsx,js,jsx}"
|
|
905
|
-
- "app/**/*.{ts,tsx,js,jsx}"
|
|
906
|
-
- "pages/**/*.{ts,tsx,js,jsx}"
|
|
907
|
-
- "lib/**/*.{ts,tsx,js,jsx}"
|
|
908
|
-
ignore:
|
|
909
|
-
- "node_modules/**"
|
|
910
|
-
- ".next/**"
|
|
911
|
-
- "dist/**"
|
|
912
|
-
- "build/**"
|
|
913
|
-
- "coverage/**"
|
|
914
|
-
|
|
915
|
-
# Module organization
|
|
916
|
-
module_roots:
|
|
917
|
-
- "src"
|
|
918
|
-
- "app"
|
|
919
|
-
- "lib"
|
|
920
|
-
- "pages"
|
|
921
|
-
|
|
922
|
-
# Documentation pages to generate
|
|
923
|
-
outputs:
|
|
924
|
-
pages:
|
|
925
|
-
- key: "system_overview"
|
|
926
|
-
title: "System Overview"
|
|
927
|
-
description: "High-level snapshot and tech stack"
|
|
928
|
-
- key: "module_catalog"
|
|
929
|
-
title: "Module Catalog"
|
|
930
|
-
description: "Complete module inventory"
|
|
931
|
-
- key: "api_surface"
|
|
932
|
-
title: "API Surface"
|
|
933
|
-
description: "REST endpoints and methods"
|
|
934
|
-
- key: "route_map"
|
|
935
|
-
title: "Route Map"
|
|
936
|
-
description: "Frontend routes and pages"
|
|
937
|
-
- key: "system_map"
|
|
938
|
-
title: "System Map"
|
|
939
|
-
description: "Visual dependency graph"
|
|
940
|
-
|
|
941
|
-
# Feature flags (optional, experimental)
|
|
942
|
-
features:
|
|
943
|
-
architecture_diff: true
|
|
944
|
-
route_map: true
|
|
945
|
-
visual_diagrams: true
|
|
946
|
-
```
|
|
947
|
-
|
|
948
|
-
### Configuration Fields
|
|
949
|
-
|
|
950
|
-
| Field | Type | Required | Description |
|
|
951
|
-
|-------|------|----------|-------------|
|
|
952
|
-
| `configVersion` | number | **Yes** | Schema version (must be `1`) |
|
|
953
|
-
| `project.name` | string | Yes | Project name |
|
|
954
|
-
| `project.docs_title_prefix` | string | No | Prefix for documentation titles (default: project name) |
|
|
955
|
-
| `publishers` | array | Yes | Output targets: `notion`, `confluence`, `github_wiki`, `markdown` (+ plugin publishers) |
|
|
956
|
-
| `plugins` | array | No | Plugin paths or npm package names |
|
|
957
|
-
| `notion.branches` | array | No | Branch whitelist for Notion publishing. Supports globs. |
|
|
958
|
-
| `notion.includeBranchInTitle` | boolean | No | Add `[branch-name]` to titles (default: `true`) |
|
|
959
|
-
| `confluence.branches` | array | No | Branch whitelist for Confluence publishing. Supports globs. |
|
|
960
|
-
| `github_wiki.branches` | array | No | Branch whitelist for GitHub Wiki publishing. Supports globs. |
|
|
961
|
-
| `github_wiki.sidebar` | boolean | No | Generate `_Sidebar.md` navigation (default: `true`) |
|
|
962
|
-
| `github_wiki.footer` | boolean | No | Generate `_Footer.md` (default: `true`) |
|
|
963
|
-
| `discord.enabled` | boolean | No | Enable Discord notifications (default: `true` if webhook set) |
|
|
964
|
-
| `discord.notifyOn` | string | No | Notification policy: `always`, `significant`, `never` (default: `significant`) |
|
|
965
|
-
| `discord.significantThreshold` | number | No | Change % threshold for notifications (default: `10`) |
|
|
966
|
-
| `discord.branches` | array | No | Branch filter for notifications. Supports globs. (default: all) |
|
|
967
|
-
| `github.owner` | string | No | GitHub org/username |
|
|
968
|
-
| `github.repo` | string | No | Repository name |
|
|
969
|
-
| `scan.include` | array | Yes | Glob patterns for files to scan |
|
|
970
|
-
| `scan.ignore` | array | Yes | Glob patterns to exclude |
|
|
971
|
-
| `module_roots` | array | No | Root directories for module detection |
|
|
972
|
-
| `outputs.pages` | array | Yes | Documentation pages to generate |
|
|
973
|
-
| `features` | object | No | Feature flags (boolean values) |
|
|
974
|
-
| `ai.enabled` | boolean | No | Enable AI-powered documentation |
|
|
975
|
-
| `ai.mode` | string | No | AI mode: `hybrid`, `full`, or `off` |
|
|
976
|
-
| `ai.temperature` | number | No | Generation temperature (0–2). Not supported by all models (e.g. gpt-5-mini ignores it) |
|
|
977
|
-
| `ai.max_tokens` | number | No | Max completion tokens per request (>0) |
|
|
978
|
-
|
|
979
|
-
---
|
|
980
|
-
|
|
981
|
-
## 🔐 Environment Variables
|
|
982
|
-
|
|
983
|
-
Required for Notion publisher:
|
|
984
|
-
|
|
985
|
-
| Variable | Required | Description |
|
|
986
|
-
|----------|----------|-------------|
|
|
987
|
-
| `NOTION_TOKEN` | Yes | Integration token from notion.so/my-integrations |
|
|
988
|
-
| `NOTION_PARENT_PAGE_ID` | Yes | Page ID where docs will be created |
|
|
989
|
-
| `NOTION_VERSION` | No | API version (default: `2022-06-28`) |
|
|
990
|
-
|
|
991
|
-
Required for Confluence publisher:
|
|
992
|
-
|
|
993
|
-
| Variable | Required | Description |
|
|
994
|
-
|----------|----------|-------------|
|
|
995
|
-
| `CONFLUENCE_URL` | Yes | Base URL (e.g., `https://your-company.atlassian.net/wiki`) |
|
|
996
|
-
| `CONFLUENCE_EMAIL` | Yes | Atlassian account email |
|
|
997
|
-
| `CONFLUENCE_API_TOKEN` | Yes | API token from [Atlassian](https://id.atlassian.com/manage-profile/security/api-tokens) |
|
|
998
|
-
| `CONFLUENCE_SPACE_KEY` | Yes | Target space key (e.g., `DOCS`, `ENG`) |
|
|
999
|
-
| `CONFLUENCE_PARENT_PAGE_ID` | No | Parent page ID (docs created at space root if omitted) |
|
|
1000
|
-
|
|
1001
|
-
Optional for Discord notifications:
|
|
1002
|
-
|
|
1003
|
-
| Variable | Required | Description |
|
|
1004
|
-
|----------|----------|-------------|
|
|
1005
|
-
| `DISCORD_WEBHOOK_URL` | No | Discord webhook URL for team notifications |
|
|
1006
|
-
|
|
1007
|
-
Required for GitHub Wiki publisher:
|
|
1008
|
-
|
|
1009
|
-
| Variable | Required | Description |
|
|
1010
|
-
|----------|----------|-------------|
|
|
1011
|
-
| `GITHUB_TOKEN` | Yes | Personal access token or Actions `${{ secrets.GITHUB_TOKEN }}` |
|
|
1012
|
-
| `GITHUB_REPOSITORY` | No | `owner/repo` (auto-detected from git remote in Actions) |
|
|
1013
|
-
|
|
1014
|
-
**Local Development:** Create `.env` file in project root
|
|
1015
|
-
**GitHub Actions:** Add as repository secrets in Settings → Secrets and variables → Actions
|
|
1016
|
-
|
|
1017
|
-
---
|
|
1018
|
-
|
|
1019
|
-
## 🏗️ Architecture & Design
|
|
1020
|
-
|
|
1021
|
-
### How RepoLens Works
|
|
1022
|
-
|
|
1023
|
-
```
|
|
1024
|
-
1. SCAN 2. ANALYZE 3. RENDER 4. PUBLISH
|
|
1025
|
-
──────────────────────────────────────────────────────────────────
|
|
1026
|
-
Read files → Detect tech → Generate docs → Notion pages
|
|
1027
|
-
from patterns stack patterns with insights + Confluence pages
|
|
1028
|
-
+ Markdown files
|
|
1029
|
-
```
|
|
1030
|
-
|
|
1031
|
-
**Scan Phase:**
|
|
1032
|
-
- Uses `fast-glob` to match your `scan.include` patterns
|
|
1033
|
-
- Filters out `scan.ignore` patterns
|
|
1034
|
-
- Reads package.json for framework/tool detection
|
|
1035
|
-
- Analyzes file paths for Next.js routes, API endpoints
|
|
1036
|
-
|
|
1037
|
-
**Analyze Phase:**
|
|
1038
|
-
- Extracts frameworks (Next.js, React, Vue, Express, etc.)
|
|
1039
|
-
- Detects build tools (Vite, Webpack, Turbo, esbuild)
|
|
1040
|
-
- Identifies test frameworks (Vitest, Jest, Playwright)
|
|
1041
|
-
- Infers module relationships and dependencies
|
|
1042
|
-
|
|
1043
|
-
**Render Phase:**
|
|
1044
|
-
- Groups files into modules based on `module_roots`
|
|
1045
|
-
- Generates Mermaid diagrams showing module dependencies
|
|
1046
|
-
- Creates technical profiles with actual stack insights
|
|
1047
|
-
- Renders Markdown documentation
|
|
1048
|
-
|
|
1049
|
-
**Publish Phase:**
|
|
1050
|
-
- Markdown: Writes files to `.repolens/` directory
|
|
1051
|
-
- Notion: Creates/updates pages via API with retry logic
|
|
1052
|
-
- Confluence: Creates/updates pages via REST API v1 (storage format)
|
|
1053
|
-
|
|
1054
|
-
### Module Dependency Detection
|
|
1055
|
-
|
|
1056
|
-
RepoLens infers relationships by analyzing import patterns:
|
|
1057
|
-
|
|
1058
|
-
```typescript
|
|
1059
|
-
// In src/publishers/notion.js
|
|
1060
|
-
import { renderSystemOverview } from "../renderers/render.js";
|
|
1061
|
-
// → Publishers depend on Renderers
|
|
1062
|
-
|
|
1063
|
-
// In src/renderers/render.js
|
|
1064
|
-
import { scanRepo } from "../core/scan.js";
|
|
1065
|
-
// → Renderers depend on Core
|
|
1066
|
-
|
|
1067
|
-
// Result: Dependency graph shows Publishers → Renderers → Core
|
|
1068
|
-
```
|
|
1069
|
-
|
|
1070
|
-
---
|
|
1071
|
-
|
|
1072
|
-
---
|
|
1073
|
-
|
|
1074
|
-
## 🧪 Development
|
|
1075
|
-
|
|
1076
|
-
### Setup
|
|
1077
|
-
|
|
1078
|
-
```bash
|
|
1079
|
-
git clone https://github.com/CHAPIBUNNY/repolens.git
|
|
1080
|
-
cd repolens
|
|
1081
|
-
npm install
|
|
1082
|
-
npm link # Makes 'repolens' command available globally
|
|
1083
|
-
```
|
|
1084
|
-
|
|
1085
|
-
### Run Tests
|
|
1086
|
-
|
|
1087
|
-
```bash
|
|
1088
|
-
npm test
|
|
1089
|
-
```
|
|
1090
|
-
|
|
1091
|
-
**Test Suite:**
|
|
1092
|
-
- Config discovery and validation
|
|
1093
|
-
- Branch detection (GitHub/GitLab/CircleCI)
|
|
1094
|
-
- Markdown publisher
|
|
1095
|
-
- Integration workflows
|
|
1096
|
-
- Doctor command validation
|
|
1097
|
-
|
|
1098
|
-
**Coverage:** 180 tests passing across 15 test files
|
|
1099
|
-
|
|
1100
|
-
### Test Package Installation Locally
|
|
1101
|
-
|
|
1102
|
-
Simulates the full user installation experience:
|
|
1103
|
-
|
|
1104
|
-
```bash
|
|
1105
|
-
# Pack the tarball
|
|
1106
|
-
npm pack
|
|
1107
|
-
|
|
1108
|
-
# Install globally from tarball
|
|
1109
|
-
npm install -g chappibunny-repolens-1.2.0.tgz
|
|
1110
|
-
|
|
1111
|
-
# Verify
|
|
1112
|
-
repolens --version
|
|
1113
|
-
```
|
|
1114
|
-
|
|
1115
|
-
### Project Structure
|
|
1116
|
-
|
|
1117
|
-
```
|
|
1118
|
-
repolens/
|
|
1119
|
-
├── bin/
|
|
1120
|
-
│ └── repolens.js # CLI executable wrapper
|
|
1121
|
-
├── src/
|
|
1122
|
-
│ ├── cli.js # Command orchestration + banner
|
|
1123
|
-
│ ├── init.js # Scaffolding command (+ interactive wizard)
|
|
1124
|
-
│ ├── doctor.js # Validation command
|
|
1125
|
-
│ ├── migrate.js # Workflow migration (legacy → current)
|
|
1126
|
-
│ ├── watch.js # Watch mode for local development
|
|
1127
|
-
│ ├── core/
|
|
1128
|
-
│ │ ├── config.js # Config loading + validation
|
|
1129
|
-
│ │ ├── config-schema.js # Schema version tracking
|
|
1130
|
-
│ │ ├── diff.js # Git diff operations
|
|
1131
|
-
│ │ └── scan.js # Repository scanning + metadata extraction
|
|
1132
|
-
│ ├── analyzers/
|
|
1133
|
-
│ │ ├── domain-inference.js # Business domain mapping
|
|
1134
|
-
│ │ ├── context-builder.js # Structured AI context assembly
|
|
1135
|
-
│ │ ├── flow-inference.js # Data flow detection
|
|
1136
|
-
│ │ ├── graphql-analyzer.js # GraphQL schema detection
|
|
1137
|
-
│ │ ├── typescript-analyzer.js # TypeScript type graph analysis
|
|
1138
|
-
│ │ ├── dependency-graph.js # Import graph with cycle detection
|
|
1139
|
-
│ │ └── drift-detector.js # Architecture drift detection
|
|
1140
|
-
│ ├── ai/
|
|
1141
|
-
│ │ ├── provider.js # Provider-agnostic AI generation
|
|
1142
|
-
│ │ ├── prompts.js # Strict prompt templates
|
|
1143
|
-
│ │ ├── document-plan.js # Document structure definition
|
|
1144
|
-
│ │ └── generate-sections.js # AI section generation + fallbacks
|
|
1145
|
-
│ ├── docs/
|
|
1146
|
-
│ │ ├── generate-doc-set.js # Document generation orchestration
|
|
1147
|
-
│ │ └── write-doc-set.js # Write docs to disk
|
|
1148
|
-
│ ├── renderers/
|
|
1149
|
-
│ │ ├── render.js # System overview, catalog, API, routes
|
|
1150
|
-
│ │ ├── renderDiff.js # Architecture diff rendering
|
|
1151
|
-
│ │ ├── renderMap.js # Unicode dependency diagrams
|
|
1152
|
-
│ │ └── renderAnalysis.js # Extended analysis renderers
|
|
1153
|
-
│ ├── publishers/
|
|
1154
|
-
│ │ ├── index.js # Publisher orchestration + branch filtering
|
|
1155
|
-
│ │ ├── publish.js # Publishing pipeline
|
|
1156
|
-
│ │ ├── notion.js # Notion API integration
|
|
1157
|
-
│ │ ├── confluence.js # Confluence REST API integration
|
|
1158
|
-
│ │ ├── github-wiki.js # GitHub Wiki publisher (git-based)
|
|
1159
|
-
│ │ └── markdown.js # Local Markdown generation
|
|
1160
|
-
│ ├── integrations/
|
|
1161
|
-
│ │ └── discord.js # Discord webhook notifications
|
|
1162
|
-
│ ├── delivery/
|
|
1163
|
-
│ │ └── comment.js # PR comment delivery
|
|
1164
|
-
│ ├── plugins/
|
|
1165
|
-
│ │ ├── loader.js # Plugin resolution and dynamic import
|
|
1166
|
-
│ │ └── manager.js # Plugin registry and lifecycle orchestration
|
|
1167
|
-
│ └── utils/
|
|
1168
|
-
│ ├── logger.js # Logging utilities
|
|
1169
|
-
│ ├── retry.js # API retry logic (exponential backoff)
|
|
1170
|
-
│ ├── branch.js # Branch detection (multi-platform)
|
|
1171
|
-
│ ├── validate.js # Configuration validation & security
|
|
1172
|
-
│ ├── metrics.js # Documentation coverage & health scoring
|
|
1173
|
-
│ ├── rate-limit.js # Token bucket rate limiter for APIs
|
|
1174
|
-
│ ├── secrets.js # Secret detection & sanitization
|
|
1175
|
-
│ ├── telemetry.js # Opt-in error tracking + performance timers
|
|
1176
|
-
│ ├── errors.js # Enhanced error messages with guidance
|
|
1177
|
-
│ └── update-check.js # Version update notifications
|
|
1178
|
-
├── tests/ # Vitest test suite (180 tests across 15 files)
|
|
1179
|
-
├── .repolens.yml # Dogfooding config
|
|
1180
|
-
├── package.json
|
|
1181
|
-
├── CHANGELOG.md
|
|
1182
|
-
├── STABILITY.md
|
|
1183
|
-
├── RELEASE.md
|
|
1184
|
-
└── ROADMAP.md
|
|
1185
|
-
```
|
|
1186
|
-
|
|
1187
|
-
---
|
|
1188
|
-
|
|
1189
|
-
## 🚀 Release Process
|
|
1190
|
-
|
|
1191
|
-
RepoLens uses automated GitHub Actions releases.
|
|
1192
|
-
|
|
1193
|
-
### Creating a Release
|
|
1194
|
-
|
|
1195
|
-
```bash
|
|
1196
|
-
# Patch version (1.0.0 → 1.0.1) - Bug fixes
|
|
1197
|
-
npm run release:patch
|
|
1198
|
-
|
|
1199
|
-
# Minor version (1.0.0 → 1.1.0) - New features
|
|
1200
|
-
npm run release:minor
|
|
1201
|
-
|
|
1202
|
-
# Major version (1.0.0 → 2.0.0) - Breaking changes
|
|
1203
|
-
npm run release:major
|
|
1204
|
-
|
|
1205
|
-
# Push the tag to trigger workflow
|
|
1206
|
-
git push --follow-tags
|
|
1207
|
-
```
|
|
1208
|
-
|
|
1209
|
-
**What happens:**
|
|
1210
|
-
1. ✅ Security audit runs (dependency audit + secret scanning)
|
|
1211
|
-
2. ✅ All tests run
|
|
1212
|
-
3. ✅ Package tarball created
|
|
1213
|
-
4. ✅ GitHub Release published with tarball attached
|
|
1214
|
-
5. ✅ npm package published to `@chappibunny/repolens`
|
|
1215
|
-
|
|
1216
|
-
See [RELEASE.md](./RELEASE.md) for detailed workflow.
|
|
209
|
+
## 📚 Documentation
|
|
210
|
+
|
|
211
|
+
| Guide | Description |
|
|
212
|
+
|---|---|
|
|
213
|
+
| [Onboarding Guide](ONBOARDING.md) | Step-by-step setup: publishers, AI, Notion, Confluence, Discord |
|
|
214
|
+
| [Configuration](CONFIGURATION.md) | Complete `.repolens.yml` schema and examples |
|
|
215
|
+
| [Environment Variables](ENVIRONMENT.md) | All env vars by publisher and feature |
|
|
216
|
+
| [Architecture](ARCHITECTURE.md) | Pipeline diagram, project structure |
|
|
217
|
+
| [Development](DEVELOPMENT.md) | Setup, tests (185 across 15 files), release process |
|
|
218
|
+
| [Security](SECURITY.md) | Threat model, secret detection, validation layers |
|
|
219
|
+
| [Telemetry](TELEMETRY.md) | Opt-in privacy-first usage analytics |
|
|
220
|
+
| [Troubleshooting](TROUBLESHOOTING.md) | Common issues and fixes |
|
|
221
|
+
| [Migration](MIGRATION.md) | Upgrading from v0.3.0 or earlier |
|
|
222
|
+
| [Stability](STABILITY.md) | API contract and semver guarantees |
|
|
1217
223
|
|
|
1218
224
|
---
|
|
1219
225
|
|
|
@@ -1230,50 +236,14 @@ See [RELEASE.md](./RELEASE.md) for detailed workflow.
|
|
|
1230
236
|
|
|
1231
237
|
## 🗺️ Roadmap
|
|
1232
238
|
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
- [x] CLI commands: `init`, `doctor`, `publish`, `migrate`, `watch`, `feedback`, `version`, `help`
|
|
1238
|
-
- [x] Config schema v1 with validation (frozen)
|
|
1239
|
-
- [x] Auto-discovery of `.repolens.yml`
|
|
1240
|
-
- [x] Publishers: Notion + Confluence + GitHub Wiki + Markdown
|
|
1241
|
-
- [x] Branch-aware publishing with filtering
|
|
1242
|
-
- [x] Smart tech stack detection from package.json
|
|
1243
|
-
- [x] Unicode dependency diagrams (no external deps)
|
|
1244
|
-
- [x] AI-assisted documentation intelligence (provider-agnostic)
|
|
1245
|
-
- [x] Business domain inference & data flow analysis
|
|
1246
|
-
- [x] GitHub Actions automation (publish + release)
|
|
1247
|
-
- [x] PR architecture diff comments
|
|
1248
|
-
- [x] Performance guardrails (10k warning, 50k limit)
|
|
1249
|
-
- [x] Comprehensive test suite (180 tests across 15 files)
|
|
1250
|
-
- [x] Security hardening (secret detection, injection prevention, fuzzing)
|
|
1251
|
-
- [x] Discord notifications with rich embeds
|
|
1252
|
-
- [x] Documentation coverage & health scoring
|
|
1253
|
-
- [x] Opt-in telemetry (Sentry)
|
|
1254
|
-
- [x] npm registry publication (`@chappibunny/repolens`)
|
|
1255
|
-
- [x] Automated npm releases via GitHub Actions
|
|
1256
|
-
- [x] Workflow migration command (`repolens migrate`)
|
|
1257
|
-
- [x] Interactive configuration wizard (`repolens init --interactive`)
|
|
1258
|
-
- [x] Watch mode for local development (`repolens watch`)
|
|
1259
|
-
- [x] Enhanced error messages with actionable guidance
|
|
1260
|
-
- [x] Performance monitoring (scan/render/publish timing)
|
|
1261
|
-
- [x] Improved documentation coverage scoring
|
|
1262
|
-
- [x] GraphQL schema detection (queries, mutations, types, resolvers)
|
|
1263
|
-
- [x] TypeScript type graph analysis (interfaces, classes, relationships)
|
|
1264
|
-
- [x] Dependency graph with circular dependency detection
|
|
1265
|
-
- [x] Architecture drift detection (baseline comparison)
|
|
1266
|
-
- [x] Plugin system for custom renderers and publishers
|
|
1267
|
-
- [x] Stability audit: CLI, config schema, and plugin interface frozen
|
|
1268
|
-
- [x] [STABILITY.md](STABILITY.md): Public API contract with semver guarantees
|
|
1269
|
-
|
|
1270
|
-
### Future
|
|
1271
|
-
|
|
1272
|
-
- [ ] Additional publishers (Obsidian)
|
|
239
|
+
v1.0+ features complete — CLI, config schema, and plugin interface are frozen.
|
|
240
|
+
|
|
241
|
+
**Next:**
|
|
242
|
+
- [ ] Obsidian publisher
|
|
1273
243
|
- [ ] VS Code extension
|
|
1274
244
|
- [ ] GitHub App
|
|
1275
245
|
|
|
1276
|
-
See [ROADMAP.md](
|
|
246
|
+
See [ROADMAP.md](ROADMAP.md) for detailed planning.
|
|
1277
247
|
|
|
1278
248
|
---
|
|
1279
249
|
|