@chappibunny/repolens 1.9.1 → 1.9.3
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 +50 -0
- package/README.md +18 -18
- package/docs/AI.md +329 -0
- package/docs/ARCHITECTURE.md +145 -0
- package/docs/CONFIGURATION.md +121 -0
- package/docs/DEVELOPMENT.md +79 -0
- package/docs/ENVIRONMENT.md +57 -0
- package/docs/INSTALLATION.md +45 -0
- package/docs/KNOWN_ISSUES.md +309 -0
- package/docs/MIGRATION.md +311 -0
- package/docs/ONBOARDING.md +382 -0
- package/docs/PRODUCTION_CHECKLIST.md +470 -0
- package/docs/ROADMAP.md +151 -0
- package/docs/STABILITY.md +265 -0
- package/docs/TELEMETRY.md +166 -0
- package/docs/TROUBLESHOOTING.md +377 -0
- package/package.json +3 -3
- package/src/ai/generate-sections.js +1224 -276
- package/src/cli.js +99 -41
- package/src/docs/generate-doc-set.js +15 -2
- package/src/publishers/confluence.js +37 -6
- package/src/publishers/notion.js +48 -0
- package/src/publishers/publish.js +36 -12
- /package/{RELEASE.md → docs/RELEASE.md} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to RepoLens will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 1.9.3
|
|
6
|
+
|
|
7
|
+
### ✨ Premium Deterministic Documentation
|
|
8
|
+
|
|
9
|
+
**Major overhaul of all 6 AI-fallback document generators.** Deterministic mode now produces documentation quality comparable to AI-enhanced mode:
|
|
10
|
+
|
|
11
|
+
- **Executive Summary**: Complete rewrite with health scoring (0-100 scale), monorepo structure detection, module composition breakdown by layer, codebase health tables with status indicators, key data flow summaries with criticality markers, and strategic observations based on actual patterns.
|
|
12
|
+
|
|
13
|
+
- **System Overview**: Enhanced with route pattern descriptions, dependency graph metrics, hub module analysis, and detailed route summaries explaining what each pattern (API, page, SSR) means.
|
|
14
|
+
|
|
15
|
+
- **Business Domains**: Rich domain capability descriptions, cross-domain dependency analysis with full module paths, domain health summary table, and business impact assessment per domain.
|
|
16
|
+
|
|
17
|
+
- **Architecture Overview**: Pattern explanation with benefits, system layers table with architectural insights, dependency health metrics, strengths and concerns sections, and hub module highlighting.
|
|
18
|
+
|
|
19
|
+
- **Data Flows**: Flow diagrams with step-by-step breakdowns explaining what each step does, shared libraries context, import network statistics, and actionable recommendations.
|
|
20
|
+
|
|
21
|
+
- **Developer Onboarding**: Getting Started checklist, codebase-at-a-glance statistics, key routes with explanations, framework and language learning tips, common pitfalls section, and module importance ratings.
|
|
22
|
+
|
|
23
|
+
**18+ new helper functions** added for intelligent content generation:
|
|
24
|
+
`inferDomainCapability()`, `getLayerResponsibility()`, `calculateHealthScore()`, `formatFileScale()`, `describeRoutePattern()`, `inferFrameworkPurpose()`, `explainPattern()`, `getBenefitsForPattern()`, `getLayerInsight()`, `getFrameworkArchitecturalImplication()`, `getLanguageImplication()`, `inferPageDescription()`, `inferAPIEndpointPurpose()`, `inferPackageDescription()`, `inferStepPurpose()`, `shouldStartHere()`, `getFrameworkLearningTip()`, `getLanguageLearningTip()`, `getModuleImportance()`
|
|
25
|
+
|
|
26
|
+
### 🔧 Why This Matters
|
|
27
|
+
|
|
28
|
+
Users without AI API keys now get production-quality documentation instead of sparse placeholders. The deterministic output includes:
|
|
29
|
+
- Health scores and assessments
|
|
30
|
+
- Business capability descriptions
|
|
31
|
+
- Architectural pattern explanations
|
|
32
|
+
- Actionable recommendations
|
|
33
|
+
- Framework-specific learning tips
|
|
34
|
+
- Rich tables with insights
|
|
35
|
+
|
|
36
|
+
### 🧪 Tests
|
|
37
|
+
|
|
38
|
+
- **380 tests passing** across 22 test files
|
|
39
|
+
- All deterministic enrichment tests updated and passing
|
|
40
|
+
|
|
41
|
+
## 1.9.2
|
|
42
|
+
|
|
43
|
+
### 🐛 Bug Fixes
|
|
44
|
+
|
|
45
|
+
- **Notion duplicate pages fixed**: Publishing no longer creates duplicate pages on every release. Added Notion Search API as primary lookup method for existing pages (more reliable than child block iteration), with case-insensitive title matching fallback.
|
|
46
|
+
- **Confluence empty pages fixed**: Executive Summary, System Overview, Business Domains and other AI-generated docs now publish correctly to Confluence. Added defensive null/empty content checks with helpful fallback messages instead of blank pages.
|
|
47
|
+
- **Document generation validation**: All document generators now validate output and provide error placeholders if generation fails, ensuring publishers always have content to work with.
|
|
48
|
+
- **Notion publisher robustness**: Now iterates over all rendered pages (not just config-defined ones), with content length logging for debugging.
|
|
49
|
+
|
|
50
|
+
### 🧪 Tests
|
|
51
|
+
|
|
52
|
+
- Added test for `markdownToConfluenceStorage` handling of empty/null content
|
|
53
|
+
- **380 tests passing** across 22 test files
|
|
54
|
+
|
|
5
55
|
## 1.8.2
|
|
6
56
|
|
|
7
57
|
### 🐛 Bug Fixes
|
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/@chappibunny/repolens)
|
|
12
12
|
[](https://marketplace.visualstudio.com/items?itemName=CHAPIBUNNY.repolens-architecture)
|
|
13
|
-
[](https://github.com/CHAPIBUNNY/repolens/actions)
|
|
14
14
|
[](LICENSE)
|
|
15
15
|
|
|
16
16
|
**Your architecture docs are already outdated.** RepoLens fixes that.
|
|
17
17
|
|
|
18
18
|
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.
|
|
19
19
|
|
|
20
|
-
> Stable as of v1.0 — [API guarantees](STABILITY.md) · [Security hardened](SECURITY.md) · v1.9.
|
|
20
|
+
> Stable as of v1.0 — [API guarantees](docs/STABILITY.md) · [Security hardened](SECURITY.md) · v1.9.2
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -77,7 +77,7 @@ npx @chappibunny/repolens publish
|
|
|
77
77
|
**Done!** Your docs are now live in Notion, Confluence, and/or `.repolens/` directory.
|
|
78
78
|
|
|
79
79
|
**🔄 Upgrading from v0.3.0 or earlier?**
|
|
80
|
-
Run `npx @chappibunny/repolens migrate` to automatically update your workflow files. See [MIGRATION.md](MIGRATION.md) for details.
|
|
80
|
+
Run `npx @chappibunny/repolens migrate` to automatically update your workflow files. See [MIGRATION.md](docs/MIGRATION.md) for details.
|
|
81
81
|
|
|
82
82
|
---
|
|
83
83
|
|
|
@@ -118,7 +118,7 @@ npm install @chappibunny/repolens
|
|
|
118
118
|
|
|
119
119
|
Or try instantly without installing: `npx @chappibunny/repolens demo`
|
|
120
120
|
|
|
121
|
-
For alternative methods, see [INSTALLATION.md](INSTALLATION.md).
|
|
121
|
+
For alternative methods, see [INSTALLATION.md](docs/INSTALLATION.md).
|
|
122
122
|
|
|
123
123
|
---
|
|
124
124
|
|
|
@@ -148,7 +148,7 @@ The extension reads your `.repolens.yml` configuration and provides an interacti
|
|
|
148
148
|
|
|
149
149
|
Step-by-step setup for publishers, AI features, Notion, Confluence, GitHub Wiki, Discord, and CI/CD automation.
|
|
150
150
|
|
|
151
|
-
**[→ Full Onboarding Guide](ONBOARDING.md)**
|
|
151
|
+
**[→ Full Onboarding Guide](docs/ONBOARDING.md)**
|
|
152
152
|
|
|
153
153
|
---
|
|
154
154
|
|
|
@@ -162,7 +162,7 @@ Step-by-step setup for publishers, AI features, Notion, Confluence, GitHub Wiki,
|
|
|
162
162
|
| `npx @chappibunny/repolens demo` | Quick local preview — no API keys needed |
|
|
163
163
|
| `npx @chappibunny/repolens doctor` | Validate your setup |
|
|
164
164
|
| `npx @chappibunny/repolens watch` | Auto-regenerate docs on file changes |
|
|
165
|
-
| `npx @chappibunny/repolens migrate` | Upgrade from v0.3.0 workflows ([details](MIGRATION.md)) |
|
|
165
|
+
| `npx @chappibunny/repolens migrate` | Upgrade from v0.3.0 workflows ([details](docs/MIGRATION.md)) |
|
|
166
166
|
| `npx @chappibunny/repolens uninstall` | Remove all RepoLens files (config, docs, workflow) |
|
|
167
167
|
| `npx @chappibunny/repolens uninstall --force` | Remove without confirmation prompt |
|
|
168
168
|
| `npx @chappibunny/repolens feedback` | Send feedback to the team |
|
|
@@ -236,7 +236,7 @@ When you open a pull request, RepoLens posts:
|
|
|
236
236
|
|
|
237
237
|
## 🔒 Privacy & Security
|
|
238
238
|
|
|
239
|
-
- **Telemetry is opt-in and disabled by default** — no code, secrets, or personal data leaves your machine. See [TELEMETRY.md](TELEMETRY.md).
|
|
239
|
+
- **Telemetry is opt-in and disabled by default** — no code, secrets, or personal data leaves your machine. See [TELEMETRY.md](docs/TELEMETRY.md).
|
|
240
240
|
- **Defense-in-depth security** — input validation, secret detection (15+ patterns), rate limiting, injection prevention, supply chain hardening. See [SECURITY.md](SECURITY.md).
|
|
241
241
|
- **Report vulnerabilities** to trades@rabitaitrades.com (not public issues). Response within 48 hours.
|
|
242
242
|
|
|
@@ -246,16 +246,16 @@ When you open a pull request, RepoLens posts:
|
|
|
246
246
|
|
|
247
247
|
| Guide | Description |
|
|
248
248
|
|---|---|
|
|
249
|
-
| [Onboarding Guide](ONBOARDING.md) | Step-by-step setup: publishers, AI, Notion, Confluence, Discord |
|
|
250
|
-
| [Configuration](CONFIGURATION.md) | Complete `.repolens.yml` schema and examples |
|
|
251
|
-
| [Environment Variables](ENVIRONMENT.md) | All env vars by publisher and feature |
|
|
252
|
-
| [Architecture](ARCHITECTURE.md) | Pipeline diagram, project structure |
|
|
253
|
-
| [Development](DEVELOPMENT.md) | Setup, tests (
|
|
249
|
+
| [Onboarding Guide](docs/ONBOARDING.md) | Step-by-step setup: publishers, AI, Notion, Confluence, Discord |
|
|
250
|
+
| [Configuration](docs/CONFIGURATION.md) | Complete `.repolens.yml` schema and examples |
|
|
251
|
+
| [Environment Variables](docs/ENVIRONMENT.md) | All env vars by publisher and feature |
|
|
252
|
+
| [Architecture](docs/ARCHITECTURE.md) | Pipeline diagram, project structure |
|
|
253
|
+
| [Development](docs/DEVELOPMENT.md) | Setup, tests (380 across 22 files), release process |
|
|
254
254
|
| [Security](SECURITY.md) | Threat model, secret detection, validation layers |
|
|
255
|
-
| [Telemetry](TELEMETRY.md) | Opt-in privacy-first usage analytics |
|
|
256
|
-
| [Troubleshooting](TROUBLESHOOTING.md) | Common issues and fixes |
|
|
257
|
-
| [Migration](MIGRATION.md) | Upgrading from v0.3.0 or earlier |
|
|
258
|
-
| [Stability](STABILITY.md) | API contract and semver guarantees |
|
|
255
|
+
| [Telemetry](docs/TELEMETRY.md) | Opt-in privacy-first usage analytics |
|
|
256
|
+
| [Troubleshooting](docs/TROUBLESHOOTING.md) | Common issues and fixes |
|
|
257
|
+
| [Migration](docs/MIGRATION.md) | Upgrading from v0.3.0 or earlier |
|
|
258
|
+
| [Stability](docs/STABILITY.md) | API contract and semver guarantees |
|
|
259
259
|
|
|
260
260
|
---
|
|
261
261
|
|
|
@@ -281,7 +281,7 @@ v1.0+ features complete — CLI, config schema, and plugin interface are frozen.
|
|
|
281
281
|
- [ ] Obsidian publisher
|
|
282
282
|
- [ ] GitHub App
|
|
283
283
|
|
|
284
|
-
See [ROADMAP.md](ROADMAP.md) for detailed planning.
|
|
284
|
+
See [ROADMAP.md](docs/ROADMAP.md) for detailed planning.
|
|
285
285
|
|
|
286
286
|
---
|
|
287
287
|
|
|
@@ -293,7 +293,7 @@ MIT
|
|
|
293
293
|
|
|
294
294
|
## 💬 Support & Contact
|
|
295
295
|
|
|
296
|
-
- **Troubleshooting**: [TROUBLESHOOTING.md](TROUBLESHOOTING.md) — installation, config, publishing, AI, and CI/CD issues
|
|
296
|
+
- **Troubleshooting**: [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) — installation, config, publishing, AI, and CI/CD issues
|
|
297
297
|
- **Diagnostics**: Run `npx @chappibunny/repolens doctor` to validate your setup
|
|
298
298
|
- **Issues**: [GitHub Issues](https://github.com/CHAPIBUNNY/repolens/issues)
|
|
299
299
|
- **Discussions**: [GitHub Discussions](https://github.com/CHAPIBUNNY/repolens/discussions)
|
package/docs/AI.md
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# AI-Enhanced Documentation
|
|
2
|
+
|
|
3
|
+
As of v0.4.0, RepoLens supports AI-powered documentation generation that creates clear, audience-specific documentation for both technical and non-technical readers. This feature is available in the current version (v1.4.0).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
RepoLens uses a hybrid approach:
|
|
8
|
+
|
|
9
|
+
1. **Deterministic extraction** - Scans your repository structure, files, routes, APIs, and technologies
|
|
10
|
+
2. **Structured context** - Builds intermediate JSON artifacts with facts about your codebase
|
|
11
|
+
3. **AI synthesis** - Uses LLMs to generate human-readable explanations and insights
|
|
12
|
+
4. **Audience-aware output** - Creates documents for engineers, PMs, stakeholders, and executives
|
|
13
|
+
|
|
14
|
+
This approach prevents hallucination while providing rich, readable documentation.
|
|
15
|
+
|
|
16
|
+
## Document Structure
|
|
17
|
+
|
|
18
|
+
RepoLens generates up to 15 documents:
|
|
19
|
+
|
|
20
|
+
### For Non-Technical Audiences
|
|
21
|
+
|
|
22
|
+
- **00-executive-summary.md** - What the system does, who it serves, key risks
|
|
23
|
+
- **02-business-domains.md** - Codebase structure in business language
|
|
24
|
+
|
|
25
|
+
### For Mixed Audiences
|
|
26
|
+
|
|
27
|
+
- **01-system-overview.md** - High-level technical snapshot
|
|
28
|
+
- **05-route-map.md** - User-facing pages and capabilities
|
|
29
|
+
- **07-data-flows.md** - How information moves through the system
|
|
30
|
+
- **08-change-impact.md** - PR/diff analysis in plain language
|
|
31
|
+
- **09-system-map.md** - Visual diagram with explanation
|
|
32
|
+
|
|
33
|
+
### For Technical Audiences
|
|
34
|
+
|
|
35
|
+
- **03-architecture-overview.md** - Layered architecture analysis
|
|
36
|
+
- **04-module-catalog.md** - Complete code module inventory
|
|
37
|
+
- **06-api-surface.md** - Backend API documentation
|
|
38
|
+
- **10-developer-onboarding.md** - Quick start for new engineers
|
|
39
|
+
|
|
40
|
+
### Extended Analysis (New in v0.8.0)
|
|
41
|
+
|
|
42
|
+
- **11-graphql-schema.md** - GraphQL types, queries, mutations, and resolvers
|
|
43
|
+
- **12-type-graph.md** - TypeScript interfaces, classes, and type relationships
|
|
44
|
+
- **13-dependency-graph.md** - Import analysis with circular dependency detection
|
|
45
|
+
- **14-architecture-drift.md** - Structural changes tracked against baseline
|
|
46
|
+
|
|
47
|
+
## Enabling AI Features
|
|
48
|
+
|
|
49
|
+
### 1. Set Environment Variables
|
|
50
|
+
|
|
51
|
+
Create a `.env` file (or set in GitHub Actions secrets):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Enable AI features
|
|
55
|
+
REPOLENS_AI_ENABLED=true
|
|
56
|
+
|
|
57
|
+
# Your OpenAI API key (or compatible provider)
|
|
58
|
+
REPOLENS_AI_API_KEY=sk-xxx
|
|
59
|
+
|
|
60
|
+
# API endpoint (optional, defaults to OpenAI)
|
|
61
|
+
REPOLENS_AI_BASE_URL=https://api.openai.com/v1
|
|
62
|
+
|
|
63
|
+
# Model to use
|
|
64
|
+
REPOLENS_AI_MODEL=gpt-5-mini
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Configure in .repolens.yml
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
features:
|
|
71
|
+
executive_summary: true
|
|
72
|
+
business_domains: true
|
|
73
|
+
architecture_overview: true
|
|
74
|
+
data_flows: true
|
|
75
|
+
developer_onboarding: true
|
|
76
|
+
ai_enrichment: true
|
|
77
|
+
|
|
78
|
+
ai:
|
|
79
|
+
enabled: true
|
|
80
|
+
mode: "hybrid" # deterministic facts + AI explanations
|
|
81
|
+
max_tokens: 2500
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 3. Run Publish
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npx @chappibunny/repolens publish
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## AI Providers
|
|
91
|
+
|
|
92
|
+
RepoLens supports multiple AI providers natively. Set `REPOLENS_AI_PROVIDER` to select one.
|
|
93
|
+
|
|
94
|
+
### GitHub Models (Free — Recommended for GitHub Actions)
|
|
95
|
+
|
|
96
|
+
Every GitHub repository gets free access to AI models via [GitHub Models](https://github.com/marketplace/models). In GitHub Actions, the `GITHUB_TOKEN` is already available — no API key signup needed.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
REPOLENS_AI_ENABLED=true
|
|
100
|
+
REPOLENS_AI_PROVIDER=github
|
|
101
|
+
# Uses GITHUB_TOKEN automatically — no REPOLENS_AI_API_KEY needed
|
|
102
|
+
# Default model: gpt-4o-mini (free tier)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**GitHub Actions workflow:**
|
|
106
|
+
```yaml
|
|
107
|
+
env:
|
|
108
|
+
REPOLENS_AI_ENABLED: true
|
|
109
|
+
REPOLENS_AI_PROVIDER: github
|
|
110
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
> **Free tier limits:** ~150 requests/day for gpt-4o-mini. RepoLens makes ~15 AI calls per run, so this is more than sufficient.
|
|
114
|
+
|
|
115
|
+
### OpenAI
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
REPOLENS_AI_PROVIDER=openai_compatible
|
|
119
|
+
REPOLENS_AI_BASE_URL=https://api.openai.com/v1
|
|
120
|
+
REPOLENS_AI_API_KEY=sk-xxx
|
|
121
|
+
REPOLENS_AI_MODEL=gpt-5-mini
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Anthropic
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
REPOLENS_AI_PROVIDER=anthropic
|
|
128
|
+
REPOLENS_AI_API_KEY=sk-ant-xxx
|
|
129
|
+
REPOLENS_AI_MODEL=claude-sonnet-4-20250514
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Google Gemini
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
REPOLENS_AI_PROVIDER=google
|
|
136
|
+
REPOLENS_AI_API_KEY=xxx
|
|
137
|
+
REPOLENS_AI_MODEL=gemini-pro
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Azure OpenAI
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
REPOLENS_AI_PROVIDER=openai_compatible
|
|
144
|
+
REPOLENS_AI_BASE_URL=https://your-resource.openai.azure.com/openai/deployments/your-deployment
|
|
145
|
+
REPOLENS_AI_API_KEY=xxx
|
|
146
|
+
REPOLENS_AI_MODEL=gpt-5-mini
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Local Models (Ollama, LM Studio, etc.)
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
REPOLENS_AI_PROVIDER=openai_compatible
|
|
153
|
+
REPOLENS_AI_BASE_URL=http://localhost:11434/v1
|
|
154
|
+
REPOLENS_AI_API_KEY=dummy # not used for local
|
|
155
|
+
REPOLENS_AI_MODEL=llama3
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Configuration Options
|
|
159
|
+
|
|
160
|
+
### AI Section
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
ai:
|
|
164
|
+
enabled: true # Master switch
|
|
165
|
+
|
|
166
|
+
mode: "hybrid" # Options: hybrid, full, off
|
|
167
|
+
# hybrid: Deterministic facts + AI explanations
|
|
168
|
+
# full: More AI-generated content
|
|
169
|
+
# off: Deterministic only
|
|
170
|
+
|
|
171
|
+
audience_default: "mixed" # Default target audience
|
|
172
|
+
# mixed: Readable by technical and non-technical
|
|
173
|
+
# technical: Developer-focused
|
|
174
|
+
# non-technical: Leadership/stakeholder-focused
|
|
175
|
+
|
|
176
|
+
max_tokens: 2500 # Maximum response length
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Business Domains
|
|
180
|
+
|
|
181
|
+
Help AI understand your codebase by defining business domains:
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
domains:
|
|
185
|
+
authentication:
|
|
186
|
+
match: ["auth", "login", "session"]
|
|
187
|
+
description: "User authentication flows"
|
|
188
|
+
|
|
189
|
+
payments:
|
|
190
|
+
match: ["payment", "stripe", "checkout"]
|
|
191
|
+
description: "Payment processing"
|
|
192
|
+
|
|
193
|
+
market_data:
|
|
194
|
+
match: ["stock", "chart", "price"]
|
|
195
|
+
description: "Financial market data"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Documentation Output
|
|
199
|
+
|
|
200
|
+
```yaml
|
|
201
|
+
documentation:
|
|
202
|
+
output_dir: ".repolens" # Where to write files
|
|
203
|
+
include_artifacts: true # Save JSON for debugging
|
|
204
|
+
file_prefix: true # Add 00-, 01- numbers
|
|
205
|
+
|
|
206
|
+
sections: # Which documents to generate
|
|
207
|
+
- executive_summary
|
|
208
|
+
- system_overview
|
|
209
|
+
- business_domains
|
|
210
|
+
- architecture_overview
|
|
211
|
+
- module_catalog
|
|
212
|
+
- route_map
|
|
213
|
+
- api_surface
|
|
214
|
+
- data_flows
|
|
215
|
+
- change_impact
|
|
216
|
+
- system_map
|
|
217
|
+
- developer_onboarding
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Cost Considerations
|
|
221
|
+
|
|
222
|
+
AI generation adds cost. Typical pricing (GPT-5-mini):
|
|
223
|
+
|
|
224
|
+
- Small repo (~50 modules): $0.10 - $0.30 per run
|
|
225
|
+
- Medium repo (~200 modules): $0.30 - $0.80 per run
|
|
226
|
+
- Large repo (~500 modules): $0.80 - $2.00 per run
|
|
227
|
+
|
|
228
|
+
Tips to reduce cost:
|
|
229
|
+
|
|
230
|
+
1. Use `gpt-5-nano` for faster, cheaper results
|
|
231
|
+
2. Disable documents you don't need in `documentation.sections`
|
|
232
|
+
3. Run on main branch only (configure `notion.branches`)
|
|
233
|
+
4. Use local models for free (quality varies)
|
|
234
|
+
|
|
235
|
+
## Fallback Behavior
|
|
236
|
+
|
|
237
|
+
If AI is disabled or fails, RepoLens generates deterministic documentation automatically. You'll see a note: "AI-enhanced documentation is disabled."
|
|
238
|
+
|
|
239
|
+
## Zero Hallucination Policy
|
|
240
|
+
|
|
241
|
+
RepoLens prompts are designed to prevent AI from inventing facts:
|
|
242
|
+
|
|
243
|
+
- AI receives only structured JSON context (not raw code)
|
|
244
|
+
- Prompts explicitly forbid fabrication
|
|
245
|
+
- AI must state uncertainty when context is insufficient
|
|
246
|
+
- Deterministic facts (file counts, routes, modules) are never AI-generated
|
|
247
|
+
|
|
248
|
+
## Example Outputs
|
|
249
|
+
|
|
250
|
+
### Executive Summary (with AI)
|
|
251
|
+
|
|
252
|
+
```markdown
|
|
253
|
+
# Executive Summary
|
|
254
|
+
|
|
255
|
+
## What this system does
|
|
256
|
+
|
|
257
|
+
Based on the detected modules and routing structure, this appears to be
|
|
258
|
+
a financial analytics platform that combines market data visualization,
|
|
259
|
+
user account management, and research content delivery.
|
|
260
|
+
|
|
261
|
+
## Who it serves
|
|
262
|
+
|
|
263
|
+
The system serves retail investors and financial analysts who need...
|
|
264
|
+
|
|
265
|
+
## Core capabilities
|
|
266
|
+
|
|
267
|
+
1. Real-time market data analysis with interactive charts
|
|
268
|
+
2. Portfolio tracking and trade management
|
|
269
|
+
3. Research articles and investment insights
|
|
270
|
+
...
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Executive Summary (without AI)
|
|
274
|
+
|
|
275
|
+
```markdown
|
|
276
|
+
# Executive Summary
|
|
277
|
+
|
|
278
|
+
## What this system does
|
|
279
|
+
|
|
280
|
+
my-project is a Next.js, React application with 271 modules across
|
|
281
|
+
1139 files.
|
|
282
|
+
|
|
283
|
+
## Main system areas
|
|
284
|
+
|
|
285
|
+
The codebase is organized into 12 main domains:
|
|
286
|
+
- Market Data & Analysis: 45 modules
|
|
287
|
+
- Authentication: 8 modules
|
|
288
|
+
...
|
|
289
|
+
|
|
290
|
+
Note: AI-enhanced documentation is disabled.
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Troubleshooting
|
|
294
|
+
|
|
295
|
+
### "AI features are disabled"
|
|
296
|
+
|
|
297
|
+
Set `REPOLENS_AI_ENABLED=true`
|
|
298
|
+
|
|
299
|
+
### "Missing API key"
|
|
300
|
+
|
|
301
|
+
Set `REPOLENS_AI_API_KEY=your-key`
|
|
302
|
+
|
|
303
|
+
### "Request timeout"
|
|
304
|
+
|
|
305
|
+
Increase timeout: `REPOLENS_AI_TIMEOUT_MS=120000` (2 minutes)
|
|
306
|
+
|
|
307
|
+
### "Rate limit exceeded"
|
|
308
|
+
|
|
309
|
+
Wait and retry, or reduce `max_tokens`
|
|
310
|
+
|
|
311
|
+
### Poor quality output
|
|
312
|
+
|
|
313
|
+
- Try `gpt-5.4` for highest quality output
|
|
314
|
+
- Increase `max_tokens`
|
|
315
|
+
- Add more detail to `domains` configuration
|
|
316
|
+
|
|
317
|
+
### Running costs too high
|
|
318
|
+
|
|
319
|
+
- Use `gpt-5-nano` instead of `gpt-5-mini`
|
|
320
|
+
- Reduce number of documents in `documentation.sections`
|
|
321
|
+
- Run less frequently (only on main branch merges)
|
|
322
|
+
|
|
323
|
+
## Next Steps
|
|
324
|
+
|
|
325
|
+
1. Start with default settings and `gpt-5-mini`
|
|
326
|
+
2. Review generated documentation
|
|
327
|
+
3. Add business domains to improve quality
|
|
328
|
+
4. Adjust `max_tokens` as needed
|
|
329
|
+
5. Switch to `gpt-5-nano` to reduce costs if quality is acceptable
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# 🏗️ Architecture & Design
|
|
2
|
+
|
|
3
|
+
## How RepoLens Works
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
1. SCAN 2. ANALYZE 3. RENDER 4. PUBLISH
|
|
7
|
+
──────────────────────────────────────────────────────────────────
|
|
8
|
+
Read files → Detect tech → Generate docs → Notion pages
|
|
9
|
+
from patterns stack patterns with insights + Confluence pages
|
|
10
|
+
+ Markdown files
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Scan Phase:**
|
|
14
|
+
- Uses `fast-glob` to match your `scan.include` patterns
|
|
15
|
+
- Filters out `scan.ignore` patterns
|
|
16
|
+
- Reads package.json for framework/tool detection
|
|
17
|
+
- Analyzes file paths for Next.js routes, API endpoints
|
|
18
|
+
|
|
19
|
+
**Analyze Phase:**
|
|
20
|
+
- Extracts frameworks (Next.js, React, Vue, Express, etc.)
|
|
21
|
+
- Detects build tools (Vite, Webpack, Turbo, esbuild)
|
|
22
|
+
- Identifies test frameworks (Vitest, Jest, Playwright)
|
|
23
|
+
- Infers module relationships and dependencies
|
|
24
|
+
|
|
25
|
+
**Render Phase:**
|
|
26
|
+
- Groups files into modules based on `module_roots`
|
|
27
|
+
- Generates Mermaid diagrams showing module dependencies
|
|
28
|
+
- Creates technical profiles with actual stack insights
|
|
29
|
+
- Renders Markdown documentation
|
|
30
|
+
|
|
31
|
+
**Publish Phase:**
|
|
32
|
+
- Markdown: Writes files to `.repolens/` directory
|
|
33
|
+
- Notion: Creates/updates pages via API with retry logic
|
|
34
|
+
- Confluence: Creates/updates pages via REST API v1 (storage format)
|
|
35
|
+
|
|
36
|
+
## Module Dependency Detection
|
|
37
|
+
|
|
38
|
+
RepoLens infers relationships by analyzing import patterns:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// In src/publishers/notion.js
|
|
42
|
+
import { renderSystemOverview } from "../renderers/render.js";
|
|
43
|
+
// → Publishers depend on Renderers
|
|
44
|
+
|
|
45
|
+
// In src/renderers/render.js
|
|
46
|
+
import { scanRepo } from "../core/scan.js";
|
|
47
|
+
// → Renderers depend on Core
|
|
48
|
+
|
|
49
|
+
// Result: Dependency graph shows Publishers → Renderers → Core
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## System Map
|
|
53
|
+
|
|
54
|
+
```mermaid
|
|
55
|
+
graph LR
|
|
56
|
+
CLI[bin/repolens<br/>1 file] --> Core[src/core<br/>4 files]
|
|
57
|
+
Publishers[src/publishers<br/>6 files] --> Core
|
|
58
|
+
Publishers --> Renderers[src/renderers<br/>4 files]
|
|
59
|
+
Publishers --> Utils[src/utils<br/>10 files]
|
|
60
|
+
Renderers --> Core
|
|
61
|
+
Delivery[src/delivery<br/>1 file] --> Publishers
|
|
62
|
+
Tests[tests<br/>15 files] -. tests .-> CLI
|
|
63
|
+
Tests -. tests .-> Core
|
|
64
|
+
Tests -. tests .-> Publishers
|
|
65
|
+
|
|
66
|
+
style CLI fill:#9b59b6,color:#fff
|
|
67
|
+
style Core fill:#f39c12,color:#000
|
|
68
|
+
style Publishers fill:#27ae60,color:#fff
|
|
69
|
+
style Renderers fill:#27ae60,color:#fff
|
|
70
|
+
style Delivery fill:#16a085,color:#fff
|
|
71
|
+
style Utils fill:#95a5a6,color:#000
|
|
72
|
+
style Tests fill:#e67e22,color:#fff
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Project Structure
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
repolens/
|
|
79
|
+
├── bin/
|
|
80
|
+
│ └── repolens.js # CLI executable wrapper
|
|
81
|
+
├── src/
|
|
82
|
+
│ ├── cli.js # Command orchestration + banner
|
|
83
|
+
│ ├── init.js # Scaffolding command (+ interactive wizard)
|
|
84
|
+
│ ├── doctor.js # Validation command
|
|
85
|
+
│ ├── migrate.js # Workflow migration (legacy → current)
|
|
86
|
+
│ ├── watch.js # Watch mode for local development
|
|
87
|
+
│ ├── core/
|
|
88
|
+
│ │ ├── config.js # Config loading + validation
|
|
89
|
+
│ │ ├── config-schema.js # Schema version tracking
|
|
90
|
+
│ │ ├── diff.js # Git diff operations
|
|
91
|
+
│ │ └── scan.js # Repository scanning + metadata extraction
|
|
92
|
+
│ ├── analyzers/
|
|
93
|
+
│ │ ├── domain-inference.js # Business domain mapping
|
|
94
|
+
│ │ ├── context-builder.js # Structured AI context assembly
|
|
95
|
+
│ │ ├── flow-inference.js # Data flow detection
|
|
96
|
+
│ │ ├── graphql-analyzer.js # GraphQL schema detection
|
|
97
|
+
│ │ ├── typescript-analyzer.js # TypeScript type graph analysis
|
|
98
|
+
│ │ ├── dependency-graph.js # Import graph with cycle detection
|
|
99
|
+
│ │ └── drift-detector.js # Architecture drift detection
|
|
100
|
+
│ ├── ai/
|
|
101
|
+
│ │ ├── provider.js # Provider-agnostic AI generation
|
|
102
|
+
│ │ ├── prompts.js # Strict prompt templates
|
|
103
|
+
│ │ ├── document-plan.js # Document structure definition
|
|
104
|
+
│ │ └── generate-sections.js # AI section generation + fallbacks
|
|
105
|
+
│ ├── docs/
|
|
106
|
+
│ │ ├── generate-doc-set.js # Document generation orchestration
|
|
107
|
+
│ │ └── write-doc-set.js # Write docs to disk
|
|
108
|
+
│ ├── renderers/
|
|
109
|
+
│ │ ├── render.js # System overview, catalog, API, routes
|
|
110
|
+
│ │ ├── renderDiff.js # Architecture diff rendering
|
|
111
|
+
│ │ ├── renderMap.js # Unicode dependency diagrams
|
|
112
|
+
│ │ └── renderAnalysis.js # Extended analysis renderers
|
|
113
|
+
│ ├── publishers/
|
|
114
|
+
│ │ ├── index.js # Publisher orchestration + branch filtering
|
|
115
|
+
│ │ ├── publish.js # Publishing pipeline
|
|
116
|
+
│ │ ├── notion.js # Notion API integration
|
|
117
|
+
│ │ ├── confluence.js # Confluence REST API integration
|
|
118
|
+
│ │ ├── github-wiki.js # GitHub Wiki publisher (git-based)
|
|
119
|
+
│ │ └── markdown.js # Local Markdown generation
|
|
120
|
+
│ ├── integrations/
|
|
121
|
+
│ │ └── discord.js # Discord webhook notifications
|
|
122
|
+
│ ├── delivery/
|
|
123
|
+
│ │ └── comment.js # PR comment delivery
|
|
124
|
+
│ ├── plugins/
|
|
125
|
+
│ │ ├── loader.js # Plugin resolution and dynamic import
|
|
126
|
+
│ │ └── manager.js # Plugin registry and lifecycle orchestration
|
|
127
|
+
│ └── utils/
|
|
128
|
+
│ ├── logger.js # Logging utilities
|
|
129
|
+
│ ├── retry.js # API retry logic (exponential backoff)
|
|
130
|
+
│ ├── branch.js # Branch detection (multi-platform)
|
|
131
|
+
│ ├── validate.js # Configuration validation & security
|
|
132
|
+
│ ├── metrics.js # Documentation coverage & health scoring
|
|
133
|
+
│ ├── rate-limit.js # Token bucket rate limiter for APIs
|
|
134
|
+
│ ├── secrets.js # Secret detection & sanitization
|
|
135
|
+
│ ├── telemetry.js # Opt-in error tracking + performance timers
|
|
136
|
+
│ ├── errors.js # Enhanced error messages with guidance
|
|
137
|
+
│ └── update-check.js # Version update notifications
|
|
138
|
+
├── tests/ # Vitest test suite (185 tests across 15 files)
|
|
139
|
+
├── .repolens.yml # Dogfooding config
|
|
140
|
+
├── package.json
|
|
141
|
+
├── CHANGELOG.md
|
|
142
|
+
├── STABILITY.md
|
|
143
|
+
├── RELEASE.md
|
|
144
|
+
└── ROADMAP.md
|
|
145
|
+
```
|