@chappibunny/repolens 0.8.0 β 1.0.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 +54 -0
- package/README.md +43 -29
- package/RELEASE.md +1 -1
- package/package.json +1 -1
- package/src/ai/generate-sections.js +179 -55
- package/src/ai/provider.js +13 -8
- package/src/cli.js +53 -18
- package/src/core/config-schema.js +52 -16
- package/src/docs/generate-doc-set.js +65 -5
- package/src/init.js +2 -2
- package/src/migrate.js +2 -2
- package/src/plugins/loader.js +128 -0
- package/src/plugins/manager.js +103 -0
- package/src/publishers/confluence.js +158 -55
- package/src/publishers/index.js +23 -1
- package/src/publishers/notion.js +186 -45
- package/src/publishers/publish.js +2 -1
- package/src/renderers/render.js +172 -142
- package/src/renderers/renderAnalysis.js +133 -32
- package/src/utils/rate-limit.js +4 -2
- package/src/utils/telemetry.js +6 -2
- package/src/utils/update-check.js +2 -2
- package/src/utils/validate.js +32 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,60 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to RepoLens will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 1.0.0
|
|
6
|
+
|
|
7
|
+
### π Stable Release
|
|
8
|
+
|
|
9
|
+
RepoLens v1.0.0 marks the first stable release with a frozen public API. All CLI commands, configuration schema, and plugin interfaces are now covered by semantic versioning guarantees. See [STABILITY.md](STABILITY.md) for the full contract.
|
|
10
|
+
|
|
11
|
+
### π Bug Fixes
|
|
12
|
+
- **Doctor false-success**: `repolens doctor` now correctly exits with code 2 when `runDoctor()` reports failures (previously always printed "validation passed")
|
|
13
|
+
- **Feedback exit code**: `repolens feedback` now exits with code 1 when feedback fails to send (previously exited 0)
|
|
14
|
+
- **Unknown flags**: `repolens --unknown-flag` now prints an error instead of silently running publish
|
|
15
|
+
- **scan.ignore security bypass**: Security validator now checks `scan.ignore` patterns (was incorrectly checking non-existent `scan.exclude`)
|
|
16
|
+
- **Domains type mismatch**: Both validators now expect `domains` as an object (was array in security validator, object in schema validator)
|
|
17
|
+
- **Plugin publisher crash isolation**: Plugin publisher errors are now caught and logged instead of crashing the pipeline
|
|
18
|
+
|
|
19
|
+
### β
Config Stability
|
|
20
|
+
- `configVersion: 1` is now **required** (was optional in schema validator)
|
|
21
|
+
- Added `confluence` config section validation (branches array)
|
|
22
|
+
- Added `ai.temperature` range validation (0β2)
|
|
23
|
+
- Added `ai.max_tokens` range validation (>0)
|
|
24
|
+
- AI config values from `.repolens.yml` are now used as fallbacks when env vars are not set
|
|
25
|
+
|
|
26
|
+
### π§ Improvements
|
|
27
|
+
- Standardized exit codes: `EXIT_SUCCESS=0`, `EXIT_ERROR=1`, `EXIT_VALIDATION=2` as named constants
|
|
28
|
+
- Replaced all `console.log`/`console.warn` in production code with logger utilities
|
|
29
|
+
- Removed stale "v0.4.0" references from CLI help text and migrate command
|
|
30
|
+
- Sentry DSN moved to `REPOLENS_SENTRY_DSN` env var (with backwards-compatible default)
|
|
31
|
+
- Hardcoded email in `init` scaffolding replaced with `your-email@example.com` placeholder
|
|
32
|
+
|
|
33
|
+
### π Documentation
|
|
34
|
+
- Added [STABILITY.md](STABILITY.md): Complete public API contract (CLI, config schema, plugin interface, exit codes, env vars)
|
|
35
|
+
|
|
36
|
+
## 0.9.0
|
|
37
|
+
|
|
38
|
+
### β¨ New Features
|
|
39
|
+
- **Plugin System** (`src/plugins/`): Extensible architecture for custom renderers and publishers
|
|
40
|
+
- `loader.js`: Resolves and imports plugins from local paths or npm packages
|
|
41
|
+
- `manager.js`: `PluginManager` class β registry, getters, and lifecycle hook runner
|
|
42
|
+
- Plugin interface: `register()` β `{ name, version, renderers, publishers, hooks }`
|
|
43
|
+
- **Custom Renderers**: Plugins can register new document types with `render(context)` functions
|
|
44
|
+
- **Custom Publishers**: Plugins can register new output targets with `publish(cfg, renderedPages)` functions
|
|
45
|
+
- **Lifecycle Hooks**: `afterScan`, `afterRender`, `afterPublish` β transform data or trigger side effects
|
|
46
|
+
- Hooks run in plugin load order; errors are caught per-plugin without breaking the pipeline
|
|
47
|
+
- Config: `plugins: ["./my-plugin.js", "@org/repolens-plugin-foo"]` in `.repolens.yml`
|
|
48
|
+
- Config schema updated: `plugins` array validated, custom publisher names accepted
|
|
49
|
+
|
|
50
|
+
### π§ͺ Tests
|
|
51
|
+
- Added 21 new plugin tests + 21 publisher parser tests (163 tests across 14 files)
|
|
52
|
+
|
|
53
|
+
### π§ Output Quality
|
|
54
|
+
- **Notion Publisher**: Full table support (table blocks with `table_row` children), blockquote β callout, dividers, numbered lists, h3 headings, inline rich text (`**bold**`, `*italic*`, `` `code` ``)
|
|
55
|
+
- **Confluence Publisher**: Rewritten as line-by-line parser β proper `<table>` HTML output, blockquotes β info panels, merged `<ul>`/`<ol>` lists, fixed code block HTML entity escaping bug
|
|
56
|
+
- **Renderers**: Tables replace bullet-point lists across all 8 renderers, descriptive prose, removed ASCII banner art
|
|
57
|
+
- **Fallback Generators**: All 6 deterministic fallbacks rewritten with tables, descriptive paragraphs, and module descriptions
|
|
58
|
+
|
|
5
59
|
## 0.8.0
|
|
6
60
|
|
|
7
61
|
### β¨ New Features
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
Repository Intelligence CLI
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
[](https://github.com/CHAPIBUNNY/repolens/actions)
|
|
12
12
|
[](SECURITY.md)
|
|
13
13
|
[](SECURITY.md)
|
|
14
14
|
[](LICENSE)
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
AI-assisted documentation intelligence system that generates architecture docs for engineers AND readable system docs for stakeholders
|
|
18
18
|
|
|
19
|
-
**Current Status**:
|
|
19
|
+
**Current Status**: v1.0.0 β Stable Release
|
|
20
20
|
|
|
21
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.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The CLI, configuration schema, and plugin interface are **stable** as of v1.0. See [STABILITY.md](STABILITY.md) for the full API contract and semver guarantees.
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
@@ -49,7 +49,7 @@ For Confluence:
|
|
|
49
49
|
```bash
|
|
50
50
|
# Edit .env and add:
|
|
51
51
|
CONFLUENCE_URL=https://your-company.atlassian.net/wiki
|
|
52
|
-
CONFLUENCE_EMAIL=
|
|
52
|
+
CONFLUENCE_EMAIL=your-email@example.com
|
|
53
53
|
CONFLUENCE_API_TOKEN=your-token
|
|
54
54
|
CONFLUENCE_SPACE_KEY=DOCS
|
|
55
55
|
```
|
|
@@ -137,6 +137,8 @@ RepoLens automatically detects:
|
|
|
137
137
|
β
**TypeScript Type Graph** - Map interfaces, classes, and type relationships (NEW in v0.8.0)
|
|
138
138
|
β
**Dependency Graph** - Import analysis with circular dependency detection (NEW in v0.8.0)
|
|
139
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)
|
|
140
142
|
|
|
141
143
|
---
|
|
142
144
|
|
|
@@ -228,7 +230,7 @@ npm link
|
|
|
228
230
|
Install from a specific version:
|
|
229
231
|
|
|
230
232
|
```bash
|
|
231
|
-
npm install https://github.com/CHAPIBUNNY/repolens/releases/download/
|
|
233
|
+
npm install https://github.com/CHAPIBUNNY/repolens/releases/download/v1.0.0/chappibunny-repolens-1.0.0.tgz
|
|
232
234
|
```
|
|
233
235
|
</details>
|
|
234
236
|
|
|
@@ -318,7 +320,7 @@ Maximum visibility: Notion for async collaboration, Confluence for enterprise do
|
|
|
318
320
|
**3.1: Choose an AI Provider**
|
|
319
321
|
|
|
320
322
|
RepoLens works with any OpenAI-compatible API:
|
|
321
|
-
- **OpenAI** (gpt-
|
|
323
|
+
- **OpenAI** (gpt-5-mini, gpt-5.4, gpt-5-nano)
|
|
322
324
|
- **Anthropic Claude** (via API gateway)
|
|
323
325
|
- **Azure OpenAI** (enterprise deployments)
|
|
324
326
|
- **Local Models** (Ollama, LM Studio, etc.)
|
|
@@ -333,7 +335,7 @@ REPOLENS_AI_API_KEY=sk-xxxxxxxxxxxxx
|
|
|
333
335
|
|
|
334
336
|
# Optional: Customize provider
|
|
335
337
|
REPOLENS_AI_BASE_URL=https://api.openai.com/v1
|
|
336
|
-
REPOLENS_AI_MODEL=gpt-
|
|
338
|
+
REPOLENS_AI_MODEL=gpt-5-mini
|
|
337
339
|
REPOLENS_AI_TEMPERATURE=0.3
|
|
338
340
|
REPOLENS_AI_MAX_TOKENS=2000
|
|
339
341
|
```
|
|
@@ -356,7 +358,7 @@ features:
|
|
|
356
358
|
change_impact: true # Architecture diff with context
|
|
357
359
|
```
|
|
358
360
|
|
|
359
|
-
**Cost Estimates** (with gpt-
|
|
361
|
+
**Cost Estimates** (with gpt-5-mini):
|
|
360
362
|
- Small repo (<50 files): $0.10-$0.30 per run
|
|
361
363
|
- Medium repo (50-200 files): $0.30-$0.80 per run
|
|
362
364
|
- Large repo (200+ files): $0.80-$2.00 per run
|
|
@@ -428,7 +430,7 @@ If using the Confluence publisher:
|
|
|
428
430
|
Create `.env` in your project root:
|
|
429
431
|
```bash
|
|
430
432
|
CONFLUENCE_URL=https://your-company.atlassian.net/wiki
|
|
431
|
-
CONFLUENCE_EMAIL=
|
|
433
|
+
CONFLUENCE_EMAIL=your-email@example.com
|
|
432
434
|
CONFLUENCE_API_TOKEN=your-api-token-here
|
|
433
435
|
CONFLUENCE_SPACE_KEY=DOCS
|
|
434
436
|
CONFLUENCE_PARENT_PAGE_ID=123456789 # Optional
|
|
@@ -449,7 +451,7 @@ Add as repository secrets:
|
|
|
449
451
|
2. Click **"New repository secret"**
|
|
450
452
|
3. Add:
|
|
451
453
|
- Name: `CONFLUENCE_URL`, Value: `https://your-company.atlassian.net/wiki`
|
|
452
|
-
- Name: `CONFLUENCE_EMAIL`, Value: `
|
|
454
|
+
- Name: `CONFLUENCE_EMAIL`, Value: `your-email@example.com`
|
|
453
455
|
- Name: `CONFLUENCE_API_TOKEN`, Value: `your-token`
|
|
454
456
|
- Name: `CONFLUENCE_SPACE_KEY`, Value: `DOCS`
|
|
455
457
|
- Name: `CONFLUENCE_PARENT_PAGE_ID`, Value: `123456789` (optional)
|
|
@@ -939,10 +941,11 @@ features:
|
|
|
939
941
|
|
|
940
942
|
| Field | Type | Required | Description |
|
|
941
943
|
|-------|------|----------|-------------|
|
|
942
|
-
| `configVersion` | number |
|
|
944
|
+
| `configVersion` | number | **Yes** | Schema version (must be `1`) |
|
|
943
945
|
| `project.name` | string | Yes | Project name |
|
|
944
946
|
| `project.docs_title_prefix` | string | No | Prefix for documentation titles (default: project name) |
|
|
945
|
-
| `publishers` | array | Yes | Output targets: `notion`, `confluence`, `markdown` |
|
|
947
|
+
| `publishers` | array | Yes | Output targets: `notion`, `confluence`, `markdown` (+ plugin publishers) |
|
|
948
|
+
| `plugins` | array | No | Plugin paths or npm package names |
|
|
946
949
|
| `notion.branches` | array | No | Branch whitelist for Notion publishing. Supports globs. |
|
|
947
950
|
| `notion.includeBranchInTitle` | boolean | No | Add `[branch-name]` to titles (default: `true`) |
|
|
948
951
|
| `confluence.branches` | array | No | Branch whitelist for Confluence publishing. Supports globs. |
|
|
@@ -956,7 +959,11 @@ features:
|
|
|
956
959
|
| `scan.ignore` | array | Yes | Glob patterns to exclude |
|
|
957
960
|
| `module_roots` | array | No | Root directories for module detection |
|
|
958
961
|
| `outputs.pages` | array | Yes | Documentation pages to generate |
|
|
959
|
-
| `features` | object | No |
|
|
962
|
+
| `features` | object | No | Feature flags (boolean values) |
|
|
963
|
+
| `ai.enabled` | boolean | No | Enable AI-powered documentation |
|
|
964
|
+
| `ai.mode` | string | No | AI mode: `hybrid`, `full`, or `off` |
|
|
965
|
+
| `ai.temperature` | number | No | Generation temperature (0\u20132) |
|
|
966
|
+
| `ai.max_tokens` | number | No | Max tokens per request (>0) |
|
|
960
967
|
|
|
961
968
|
---
|
|
962
969
|
|
|
@@ -1070,7 +1077,7 @@ npm test
|
|
|
1070
1077
|
- Integration workflows
|
|
1071
1078
|
- Doctor command validation
|
|
1072
1079
|
|
|
1073
|
-
**Coverage:**
|
|
1080
|
+
**Coverage:** 163 tests passing across 14 test files
|
|
1074
1081
|
|
|
1075
1082
|
### Test Package Installation Locally
|
|
1076
1083
|
|
|
@@ -1081,7 +1088,7 @@ Simulates the full user installation experience:
|
|
|
1081
1088
|
npm pack
|
|
1082
1089
|
|
|
1083
1090
|
# Install globally from tarball
|
|
1084
|
-
npm install -g chappibunny-repolens-0.
|
|
1091
|
+
npm install -g chappibunny-repolens-1.0.0.tgz
|
|
1085
1092
|
|
|
1086
1093
|
# Verify
|
|
1087
1094
|
repolens --version
|
|
@@ -1135,6 +1142,9 @@ repolens/
|
|
|
1135
1142
|
β β βββ discord.js # Discord webhook notifications
|
|
1136
1143
|
β βββ delivery/
|
|
1137
1144
|
β β βββ comment.js # PR comment delivery
|
|
1145
|
+
β βββ plugins/
|
|
1146
|
+
β β βββ loader.js # Plugin resolution and dynamic import
|
|
1147
|
+
β β βββ manager.js # Plugin registry and lifecycle orchestration
|
|
1138
1148
|
β βββ utils/
|
|
1139
1149
|
β βββ logger.js # Logging utilities
|
|
1140
1150
|
β βββ retry.js # API retry logic (exponential backoff)
|
|
@@ -1146,10 +1156,11 @@ repolens/
|
|
|
1146
1156
|
β βββ telemetry.js # Opt-in error tracking + performance timers
|
|
1147
1157
|
β βββ errors.js # Enhanced error messages with guidance
|
|
1148
1158
|
β βββ update-check.js # Version update notifications
|
|
1149
|
-
βββ tests/ # Vitest test suite (
|
|
1159
|
+
βββ tests/ # Vitest test suite (163 tests across 14 files)
|
|
1150
1160
|
βββ .repolens.yml # Dogfooding config
|
|
1151
1161
|
βββ package.json
|
|
1152
1162
|
βββ CHANGELOG.md
|
|
1163
|
+
βββ STABILITY.md
|
|
1153
1164
|
βββ RELEASE.md
|
|
1154
1165
|
βββ ROADMAP.md
|
|
1155
1166
|
```
|
|
@@ -1163,13 +1174,13 @@ RepoLens uses automated GitHub Actions releases.
|
|
|
1163
1174
|
### Creating a Release
|
|
1164
1175
|
|
|
1165
1176
|
```bash
|
|
1166
|
-
# Patch version (0.
|
|
1177
|
+
# Patch version (1.0.0 β 1.0.1) - Bug fixes
|
|
1167
1178
|
npm run release:patch
|
|
1168
1179
|
|
|
1169
|
-
# Minor version (0.
|
|
1180
|
+
# Minor version (1.0.0 β 1.1.0) - New features
|
|
1170
1181
|
npm run release:minor
|
|
1171
1182
|
|
|
1172
|
-
# Major version (0.
|
|
1183
|
+
# Major version (1.0.0 β 2.0.0) - Breaking changes
|
|
1173
1184
|
npm run release:major
|
|
1174
1185
|
|
|
1175
1186
|
# Push the tag to trigger workflow
|
|
@@ -1189,24 +1200,23 @@ See [RELEASE.md](./RELEASE.md) for detailed workflow.
|
|
|
1189
1200
|
|
|
1190
1201
|
## π€ Contributing
|
|
1191
1202
|
|
|
1192
|
-
RepoLens is currently in early access. v1.0 will open for community contributions.
|
|
1193
|
-
|
|
1194
1203
|
**Ways to help:**
|
|
1195
1204
|
- **Try it out**: Install and use in your projects
|
|
1196
1205
|
- **Report issues**: Share bugs, edge cases, or UX friction
|
|
1197
1206
|
- **Request features**: Tell us what's missing
|
|
1198
|
-
- **
|
|
1207
|
+
- **Build plugins**: Extend RepoLens with custom renderers and publishers
|
|
1208
|
+
- **Share feedback**: `repolens feedback`
|
|
1199
1209
|
|
|
1200
1210
|
---
|
|
1201
1211
|
|
|
1202
|
-
## πΊοΈ Roadmap
|
|
1212
|
+
## πΊοΈ Roadmap
|
|
1203
1213
|
|
|
1204
|
-
**Current Status:**
|
|
1214
|
+
**Current Status:** v1.0.0 β Stable Release
|
|
1205
1215
|
|
|
1206
|
-
###
|
|
1216
|
+
### v1.0 β Complete β
|
|
1207
1217
|
|
|
1208
1218
|
- [x] CLI commands: `init`, `doctor`, `publish`, `migrate`, `watch`, `feedback`, `version`, `help`
|
|
1209
|
-
- [x] Config schema v1 with validation
|
|
1219
|
+
- [x] Config schema v1 with validation (frozen)
|
|
1210
1220
|
- [x] Auto-discovery of `.repolens.yml`
|
|
1211
1221
|
- [x] Publishers: Notion + Confluence + Markdown
|
|
1212
1222
|
- [x] Branch-aware publishing with filtering
|
|
@@ -1217,7 +1227,7 @@ RepoLens is currently in early access. v1.0 will open for community contribution
|
|
|
1217
1227
|
- [x] GitHub Actions automation (publish + release)
|
|
1218
1228
|
- [x] PR architecture diff comments
|
|
1219
1229
|
- [x] Performance guardrails (10k warning, 50k limit)
|
|
1220
|
-
- [x] Comprehensive test suite (
|
|
1230
|
+
- [x] Comprehensive test suite (163 tests across 14 files)
|
|
1221
1231
|
- [x] Security hardening (secret detection, injection prevention, fuzzing)
|
|
1222
1232
|
- [x] Discord notifications with rich embeds
|
|
1223
1233
|
- [x] Documentation coverage & health scoring
|
|
@@ -1234,11 +1244,15 @@ RepoLens is currently in early access. v1.0 will open for community contribution
|
|
|
1234
1244
|
- [x] TypeScript type graph analysis (interfaces, classes, relationships)
|
|
1235
1245
|
- [x] Dependency graph with circular dependency detection
|
|
1236
1246
|
- [x] Architecture drift detection (baseline comparison)
|
|
1247
|
+
- [x] Plugin system for custom renderers and publishers
|
|
1248
|
+
- [x] Stability audit: CLI, config schema, and plugin interface frozen
|
|
1249
|
+
- [x] [STABILITY.md](STABILITY.md): Public API contract with semver guarantees
|
|
1237
1250
|
|
|
1238
|
-
###
|
|
1251
|
+
### Future
|
|
1239
1252
|
|
|
1240
|
-
- [ ] Plugin system for custom renderers
|
|
1241
1253
|
- [ ] Additional publishers (GitHub Wiki, Obsidian)
|
|
1254
|
+
- [ ] VS Code extension
|
|
1255
|
+
- [ ] GitHub App
|
|
1242
1256
|
|
|
1243
1257
|
See [ROADMAP.md](./ROADMAP.md) for detailed planning.
|
|
1244
1258
|
|
package/RELEASE.md
CHANGED
|
@@ -22,7 +22,7 @@ RepoLens uses semantic versioning:
|
|
|
22
22
|
8. Push branch and tag: `git push --follow-tags`
|
|
23
23
|
9. GitHub Actions `release.yml` runs automatically:
|
|
24
24
|
- Security audit (dependency + secrets scanning)
|
|
25
|
-
- Test suite (
|
|
25
|
+
- Test suite (163 tests)
|
|
26
26
|
- Create GitHub Release with tarball
|
|
27
27
|
- Publish to npm (`npm publish --access public`)
|
|
28
28
|
10. Verify on npm: `npm view @chappibunny/repolens version`
|
package/package.json
CHANGED
|
@@ -145,127 +145,251 @@ export async function generateDeveloperOnboarding(context) {
|
|
|
145
145
|
// Fallback generators (deterministic, no AI)
|
|
146
146
|
|
|
147
147
|
function getFallbackExecutiveSummary(context) {
|
|
148
|
+
const frameworkList = context.techStack.frameworks.join(", ") || "general-purpose";
|
|
149
|
+
const languageList = context.techStack.languages.join(", ") || "multiple languages";
|
|
150
|
+
const domainSummary = context.domains.slice(0, 5).map(d => d.name).join(", ");
|
|
151
|
+
|
|
148
152
|
return `# Executive Summary
|
|
149
153
|
|
|
150
|
-
## What
|
|
154
|
+
## What This System Does
|
|
155
|
+
|
|
156
|
+
${context.project.name} is a ${frameworkList} application built with ${languageList}. The codebase contains **${context.project.modulesDetected} modules** spread across **${context.project.filesScanned} files**, organized into ${context.domains.length} functional domain${context.domains.length === 1 ? "" : "s"}.
|
|
151
157
|
|
|
152
|
-
${context.project.
|
|
158
|
+
${context.project.apiRoutesDetected > 0 ? `The system exposes **${context.project.apiRoutesDetected} API endpoint${context.project.apiRoutesDetected === 1 ? "" : "s"}** and` : "It"} serves **${context.project.pagesDetected} application page${context.project.pagesDetected === 1 ? "" : "s"}** to end users.
|
|
153
159
|
|
|
154
|
-
##
|
|
160
|
+
## Primary Functional Areas
|
|
155
161
|
|
|
156
|
-
The
|
|
162
|
+
The application is organized around the following business domains:
|
|
157
163
|
|
|
158
|
-
|
|
164
|
+
| Domain | Modules | Description |
|
|
165
|
+
|--------|---------|-------------|
|
|
166
|
+
${context.domains.map(d => `| ${d.name} | ${d.moduleCount} | ${d.description || "β"} |`).join("\n")}
|
|
159
167
|
|
|
160
|
-
## Technology
|
|
168
|
+
## Technology Profile
|
|
161
169
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
| Category | Details |
|
|
171
|
+
|----------|---------|
|
|
172
|
+
| Frameworks | ${context.techStack.frameworks.join(", ") || "Not detected"} |
|
|
173
|
+
| Languages | ${context.techStack.languages.join(", ") || "Not detected"} |
|
|
174
|
+
| Build Tools | ${context.techStack.buildTools.join(", ") || "Not detected"} |
|
|
165
175
|
|
|
166
|
-
## Key
|
|
176
|
+
## Key Observations
|
|
167
177
|
|
|
168
|
-
|
|
169
|
-
- ${context.project.apiRoutesDetected} API routes detected
|
|
170
|
-
- Architecture patterns: ${context.patterns.join(", ") || "Standard patterns"}
|
|
178
|
+
The codebase follows ${context.patterns.length > 0 ? context.patterns.join(", ") : "standard"} architectural patterns. ${domainSummary ? `The core functional areas β ${domainSummary} β account for the majority of the application logic.` : ""}
|
|
171
179
|
|
|
172
|
-
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
*This summary is generated deterministically from repository structure. Enable AI enhancement (\`REPOLENS_AI_ENABLED=true\`) for natural language insights tailored to non-technical readers.*`;
|
|
173
183
|
}
|
|
174
184
|
|
|
175
185
|
function getFallbackSystemOverview(context) {
|
|
186
|
+
const sizeLabel = context.project.modulesDetected > 50 ? "large-scale" :
|
|
187
|
+
context.project.modulesDetected > 20 ? "medium-sized" : "focused";
|
|
188
|
+
|
|
176
189
|
return `# System Overview
|
|
177
190
|
|
|
178
|
-
## Repository
|
|
191
|
+
## Repository Snapshot
|
|
192
|
+
|
|
193
|
+
This is a ${sizeLabel} codebase organized into **${context.project.modulesDetected} modules** across **${context.project.filesScanned} files**.
|
|
194
|
+
|
|
195
|
+
| Metric | Value |
|
|
196
|
+
|--------|-------|
|
|
197
|
+
| Files scanned | ${context.project.filesScanned} |
|
|
198
|
+
| Modules | ${context.project.modulesDetected} |
|
|
199
|
+
| Application pages | ${context.project.pagesDetected} |
|
|
200
|
+
| API endpoints | ${context.project.apiRoutesDetected} |
|
|
201
|
+
|
|
202
|
+
## Detected Patterns
|
|
179
203
|
|
|
180
|
-
|
|
181
|
-
- Modules: ${context.project.modulesDetected}
|
|
182
|
-
- Pages: ${context.project.pagesDetected}
|
|
183
|
-
- APIs: ${context.project.apiRoutesDetected}
|
|
204
|
+
${context.patterns.length > 0 ? context.patterns.map(p => `- ${p}`).join("\n") : "No specific architectural patterns were detected. This typically means the project uses a straightforward directory-based organization."}
|
|
184
205
|
|
|
185
|
-
##
|
|
206
|
+
## Dominant Domains
|
|
186
207
|
|
|
187
|
-
|
|
208
|
+
The following domains represent the largest areas of the codebase by file count:
|
|
188
209
|
|
|
189
|
-
|
|
210
|
+
| Rank | Domain | Files |
|
|
211
|
+
|------|--------|-------|
|
|
212
|
+
${context.domains.slice(0, 5).map((d, i) => `| ${i + 1} | ${d.name} | ${d.fileCount} |`).join("\n")}
|
|
190
213
|
|
|
191
|
-
|
|
214
|
+
---
|
|
192
215
|
|
|
193
|
-
|
|
216
|
+
*This overview is generated deterministically. Enable AI enhancement (\`REPOLENS_AI_ENABLED=true\`) for richer contextual explanations.*`;
|
|
194
217
|
}
|
|
195
218
|
|
|
196
219
|
function getFallbackBusinessDomains(context) {
|
|
197
220
|
let output = `# Business Domains\n\n`;
|
|
221
|
+
output += `> This document maps the codebase into business-oriented functional areas. Each domain represents a distinct area of responsibility.\n\n`;
|
|
222
|
+
output += `**Total domains identified:** ${context.domains.length}\n\n`;
|
|
223
|
+
output += `---\n\n`;
|
|
198
224
|
|
|
199
225
|
for (const domain of context.domains) {
|
|
200
|
-
output += `##
|
|
201
|
-
output += `${domain.description}\n\n`;
|
|
202
|
-
output +=
|
|
203
|
-
output +=
|
|
204
|
-
output +=
|
|
205
|
-
output +=
|
|
206
|
-
|
|
226
|
+
output += `## ${domain.name}\n\n`;
|
|
227
|
+
output += `${domain.description || "This domain covers a distinct functional area of the application."}\n\n`;
|
|
228
|
+
output += `| Metric | Value |\n`;
|
|
229
|
+
output += `|--------|-------|\n`;
|
|
230
|
+
output += `| Modules | ${domain.moduleCount} |\n`;
|
|
231
|
+
output += `| Files | ${domain.fileCount} |\n\n`;
|
|
232
|
+
if (domain.topModules?.length > 0) {
|
|
233
|
+
output += `**Key modules:** ${domain.topModules.slice(0, 5).map(m => `\`${m}\``).join(", ")}\n\n`;
|
|
234
|
+
}
|
|
207
235
|
}
|
|
208
236
|
|
|
209
|
-
output +=
|
|
237
|
+
output += `---\n\n*Domain mapping is based on directory naming conventions. Enable AI enhancement (\`REPOLENS_AI_ENABLED=true\`) for natural language descriptions aimed at non-technical stakeholders.*`;
|
|
210
238
|
|
|
211
239
|
return output;
|
|
212
240
|
}
|
|
213
241
|
|
|
214
242
|
function getFallbackArchitectureOverview(context) {
|
|
243
|
+
const patternDesc = context.patterns.length > 0
|
|
244
|
+
? `The detected architectural patterns are **${context.patterns.join(", ")}**. These patterns shape how data and control flow through the system.`
|
|
245
|
+
: "No specific architectural patterns were detected. The project appears to follow a straightforward directory-based organization.";
|
|
246
|
+
|
|
215
247
|
return `# Architecture Overview
|
|
216
248
|
|
|
217
|
-
##
|
|
249
|
+
## Architectural Style
|
|
250
|
+
|
|
251
|
+
${patternDesc}
|
|
252
|
+
|
|
253
|
+
## System Layers
|
|
218
254
|
|
|
219
|
-
|
|
255
|
+
The codebase is organized into ${context.domains.length} functional layers, each encapsulating a distinct area of responsibility:
|
|
220
256
|
|
|
221
|
-
|
|
257
|
+
| Layer | Description |
|
|
258
|
+
|-------|-------------|
|
|
259
|
+
${context.domains.slice(0, 8).map(d => `| **${d.name}** | ${d.description || "Handles a distinct functional concern"} |`).join("\n")}
|
|
222
260
|
|
|
223
|
-
|
|
261
|
+
## Technology Stack
|
|
224
262
|
|
|
225
|
-
|
|
263
|
+
| Category | Technologies |
|
|
264
|
+
|----------|-------------|
|
|
265
|
+
| Frameworks | ${context.techStack.frameworks.join(", ") || "Not detected"} |
|
|
266
|
+
| Languages | ${context.techStack.languages.join(", ") || "Not detected"} |
|
|
267
|
+
| Build Tools | ${context.techStack.buildTools.join(", ") || "Not detected"} |
|
|
226
268
|
|
|
227
|
-
|
|
228
|
-
- Languages: ${context.techStack.languages.join(", ")}
|
|
229
|
-
- Build tools: ${context.techStack.buildTools.join(", ")}
|
|
269
|
+
## Scale & Complexity
|
|
230
270
|
|
|
231
|
-
|
|
271
|
+
The repository comprises **${context.project.filesScanned} files** organized into **${context.project.modulesDetected} modules**. ${context.project.apiRoutesDetected > 0 ? `It exposes **${context.project.apiRoutesDetected} API endpoint${context.project.apiRoutesDetected === 1 ? "" : "s"}** and` : "It"} serves **${context.project.pagesDetected} application page${context.project.pagesDetected === 1 ? "" : "s"}**.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
*This architecture overview is generated deterministically. Enable AI enhancement (\`REPOLENS_AI_ENABLED=true\`) for deeper architectural narratives.*`;
|
|
232
276
|
}
|
|
233
277
|
|
|
234
278
|
function getFallbackDataFlows(flows) {
|
|
235
279
|
let output = `# Data Flows\n\n`;
|
|
280
|
+
output += `> Data flows describe how information moves through the system β from external inputs through processing layers to storage or presentation.\n\n`;
|
|
281
|
+
|
|
282
|
+
if (!flows || flows.length === 0) {
|
|
283
|
+
output += `No data flows were detected. This typically means the system uses straightforward requestβresponse patterns without distinct multi-step pipelines.\n\n`;
|
|
284
|
+
output += `---\n\n*Enable AI enhancement (\`REPOLENS_AI_ENABLED=true\`) for heuristic-based flow descriptions.*`;
|
|
285
|
+
return output;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
output += `**${flows.length} flow${flows.length === 1 ? "" : "s"} detected** in the codebase.\n\n---\n\n`;
|
|
236
289
|
|
|
237
290
|
for (const flow of flows) {
|
|
238
291
|
output += `## ${flow.name}\n\n`;
|
|
239
292
|
output += `${flow.description}\n\n`;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
293
|
+
if (flow.steps && flow.steps.length > 0) {
|
|
294
|
+
output += `| Step | Action |\n`;
|
|
295
|
+
output += `|------|--------|\n`;
|
|
296
|
+
output += flow.steps.map((s, i) => `| ${i + 1} | ${s} |`).join("\n");
|
|
297
|
+
output += `\n\n`;
|
|
298
|
+
}
|
|
299
|
+
if (flow.modules && flow.modules.length > 0) {
|
|
300
|
+
output += `**Involved modules:** ${flow.modules.map(m => `\`${m}\``).join(", ")}\n\n`;
|
|
301
|
+
}
|
|
243
302
|
}
|
|
244
303
|
|
|
245
|
-
output +=
|
|
304
|
+
output += `---\n\n*Flow detection is based on naming conventions and import patterns. Enable AI enhancement (\`REPOLENS_AI_ENABLED=true\`) for natural language flow narratives.*`;
|
|
246
305
|
|
|
247
306
|
return output;
|
|
248
307
|
}
|
|
249
308
|
|
|
250
309
|
function getFallbackDeveloperOnboarding(context) {
|
|
310
|
+
const frameworkList = context.techStack.frameworks.join(", ") || "general-purpose tools";
|
|
311
|
+
const languageList = context.techStack.languages.join(", ") || "standard languages";
|
|
312
|
+
|
|
251
313
|
return `# Developer Onboarding
|
|
252
314
|
|
|
253
|
-
##
|
|
315
|
+
## Welcome
|
|
316
|
+
|
|
317
|
+
This guide helps new contributors get oriented in the **${context.project.name}** repository. The project is built with ${frameworkList} and ${languageList}, containing **${context.project.modulesDetected} modules** across **${context.project.filesScanned} files**.
|
|
318
|
+
|
|
319
|
+
## Repository Structure
|
|
320
|
+
|
|
321
|
+
The top-level directory is organized as follows:
|
|
254
322
|
|
|
255
|
-
|
|
323
|
+
| Directory | Purpose |
|
|
324
|
+
|-----------|---------|
|
|
325
|
+
${context.repoRoots.map(root => `| \`${root}\` | ${describeRoot(root)} |`).join("\n")}
|
|
256
326
|
|
|
257
|
-
##
|
|
327
|
+
## Technology Stack
|
|
258
328
|
|
|
259
|
-
|
|
329
|
+
| Category | Technologies |
|
|
330
|
+
|----------|-------------|
|
|
331
|
+
| Frameworks | ${context.techStack.frameworks.join(", ") || "Not detected"} |
|
|
332
|
+
| Languages | ${context.techStack.languages.join(", ") || "Not detected"} |
|
|
333
|
+
| Build Tools | ${context.techStack.buildTools.join(", ") || "Not detected"} |
|
|
260
334
|
|
|
261
|
-
##
|
|
335
|
+
## Largest Modules
|
|
262
336
|
|
|
263
|
-
|
|
264
|
-
- ${context.techStack.languages.join(", ")}
|
|
337
|
+
These are the primary modules by file count β good starting points for understanding the system:
|
|
265
338
|
|
|
266
|
-
|
|
339
|
+
| Module | Files | Description |
|
|
340
|
+
|--------|-------|-------------|
|
|
341
|
+
${context.topModules.slice(0, 10).map((m, i) => `| \`${m.key}\` | ${m.fileCount} | ${describeOnboardingModule(m.key)} |`).join("\n")}
|
|
267
342
|
|
|
268
|
-
|
|
343
|
+
## Getting Started
|
|
344
|
+
|
|
345
|
+
1. Clone the repository and install dependencies
|
|
346
|
+
2. Review the top-level directories above to understand the project layout
|
|
347
|
+
3. Start with the largest modules listed above β they contain the core functionality
|
|
348
|
+
4. Check for a \`README.md\` or \`CONTRIBUTING.md\` file for project-specific setup instructions
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
*This onboarding guide is generated deterministically. Enable AI enhancement (\`REPOLENS_AI_ENABLED=true\`) for a narrative-style guide with tips and common pitfalls.*`;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function describeRoot(root) {
|
|
356
|
+
const lower = root.toLowerCase().replace(/\/$/, "");
|
|
357
|
+
if (/^src$|^lib$/.test(lower)) return "Application source code";
|
|
358
|
+
if (/^test|^__test|^spec/.test(lower)) return "Test suites";
|
|
359
|
+
if (/^doc/.test(lower)) return "Documentation";
|
|
360
|
+
if (/^bin$|^scripts?$/.test(lower)) return "CLI entry points and scripts";
|
|
361
|
+
if (/^config/.test(lower)) return "Configuration files";
|
|
362
|
+
if (/^public$|^static$|^assets$/.test(lower)) return "Static assets";
|
|
363
|
+
if (/^dist$|^build$|^out$/.test(lower)) return "Build output";
|
|
364
|
+
if (/^\.github$/.test(lower)) return "GitHub Actions and workflows";
|
|
365
|
+
if (/^api$/.test(lower)) return "API definitions";
|
|
366
|
+
if (/^components?$/.test(lower)) return "Shared UI components";
|
|
367
|
+
if (/^pages?$|^views?$|^screens?$/.test(lower)) return "Application pages/views";
|
|
368
|
+
if (/^utils?$|^helpers?$/.test(lower)) return "Utility functions";
|
|
369
|
+
if (/^services?$/.test(lower)) return "Service layer";
|
|
370
|
+
if (/^hooks?$/.test(lower)) return "Custom hooks";
|
|
371
|
+
return "Project files";
|
|
372
|
+
}
|
|
269
373
|
|
|
270
|
-
|
|
374
|
+
function describeOnboardingModule(key) {
|
|
375
|
+
const lower = key.toLowerCase();
|
|
376
|
+
if (/auth/.test(lower)) return "Authentication and authorization logic";
|
|
377
|
+
if (/api|route|endpoint/.test(lower)) return "API layer and route handlers";
|
|
378
|
+
if (/component|widget|ui/.test(lower)) return "User interface components";
|
|
379
|
+
if (/hook/.test(lower)) return "Custom hooks and shared state logic";
|
|
380
|
+
if (/util|helper|lib/.test(lower)) return "Utility and helper functions";
|
|
381
|
+
if (/service/.test(lower)) return "Service layer / business logic";
|
|
382
|
+
if (/model|schema|entity/.test(lower)) return "Data models and schemas";
|
|
383
|
+
if (/config|setting/.test(lower)) return "Configuration management";
|
|
384
|
+
if (/test|spec/.test(lower)) return "Test infrastructure";
|
|
385
|
+
if (/style|css|theme/.test(lower)) return "Styling and theming";
|
|
386
|
+
if (/page|view|screen/.test(lower)) return "Application pages and views";
|
|
387
|
+
if (/store|state|redux/.test(lower)) return "State management";
|
|
388
|
+
if (/middleware/.test(lower)) return "Request/response middleware";
|
|
389
|
+
if (/database|db|migration/.test(lower)) return "Database layer";
|
|
390
|
+
if (/render/.test(lower)) return "Rendering and template logic";
|
|
391
|
+
if (/publish/.test(lower)) return "Publishing and output delivery";
|
|
392
|
+
if (/scan/.test(lower)) return "File and repository scanning";
|
|
393
|
+
if (/analyz/.test(lower)) return "Code analysis and inference";
|
|
394
|
+
return "Core application module";
|
|
271
395
|
}
|