@chappibunny/repolens 1.8.0 ā 1.8.2
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 +30 -2
- package/README.md +20 -15
- package/package.json +1 -1
- package/src/ai/generate-sections.js +7 -7
- package/src/cli.js +138 -5
- package/src/init.js +55 -21
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to RepoLens will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 1.8.2
|
|
6
|
+
|
|
7
|
+
### š Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **Uninstall crash fixed**: `repolens uninstall` crashed with `Cannot read properties of undefined (reading 'trim')` when run via `npx`. The readline prompt used the callback-based `node:readline` API incorrectly with `await`. Fixed by wrapping in a proper Promise with null guard.
|
|
10
|
+
|
|
11
|
+
### ⨠AI Auto-Detection
|
|
12
|
+
|
|
13
|
+
- **GITHUB_TOKEN auto-enables AI**: `demo`, `publish`, and `init` commands now detect `GITHUB_TOKEN` in the environment and automatically enable AI-enhanced docs via GitHub Models (free). No manual configuration needed.
|
|
14
|
+
- **Workflow template enables AI by default**: The generated `.github/workflows/repolens.yml` now has `REPOLENS_AI_ENABLED`, `REPOLENS_AI_PROVIDER`, and `GITHUB_TOKEN` enabled (not commented out) since GitHub Models is free.
|
|
15
|
+
- **Init auto-configures AI**: Non-interactive `repolens init` writes `ai.enabled: true` and `ai.provider: github` to `.repolens.yml` when `GITHUB_TOKEN` is detected.
|
|
16
|
+
- **Better AI messaging**: Demo and publish commands show prominent status about AI mode (enabled/deterministic) with specific guidance on what AI adds.
|
|
17
|
+
- **Sharper deterministic upsell**: All 6 fallback document types now explain exactly what AI adds (e.g., "adds plain-language explanations, strategic recommendations, and risk assessments") and mention `GITHUB_TOKEN` auto-detection.
|
|
18
|
+
|
|
19
|
+
### š Documentation
|
|
20
|
+
|
|
21
|
+
- **Scoped package name everywhere**: All user-facing docs now use `npx @chappibunny/repolens` instead of bare `repolens`. Added warning about the squatted `repolens@0.0.1` placeholder package on npm.
|
|
22
|
+
- Updated: README.md (commands table + warning), TROUBLESHOOTING.md, MIGRATION.md (6 instances), KNOWN_ISSUES.md (2 instances), bug report template.
|
|
23
|
+
|
|
24
|
+
## 1.8.1
|
|
25
|
+
|
|
26
|
+
### š Documentation Refresh
|
|
27
|
+
|
|
28
|
+
- **README overhaul**: Updated test badge (379 passing), version reference (v1.8.1), document count (15 types), expanded audience table to include all 15 documents (GraphQL Schema, TypeScript Type Graph, Dependency Graph, Architecture Drift), added `uninstall` and `uninstall --force` to commands table.
|
|
29
|
+
- **DEVELOPMENT.md**: Updated test coverage (379 across 22 files), expanded test suite description to cover all test categories, fixed tarball version in install example.
|
|
30
|
+
- **CLI version test**: Now reads version from `package.json` dynamically instead of hardcoding ā won't break on future version bumps.
|
|
31
|
+
|
|
5
32
|
## 1.8.0
|
|
6
33
|
|
|
7
34
|
### ⨠GitHub Models ā First-Class AI Provider
|
|
@@ -11,6 +38,7 @@ All notable changes to RepoLens will be documented in this file.
|
|
|
11
38
|
- **Config-driven AI settings**: `ai.enabled`, `ai.provider`, `ai.model`, `ai.temperature`, and `ai.base_url` in `.repolens.yml` are now fully respected at runtime (env vars still take precedence). Previously these config values were ignored.
|
|
12
39
|
- **Init wizard fixes**: Provider selection now uses correct runtime values (`github`, `openai_compatible`, `anthropic`, `google`) instead of mismatched labels. The wizard now emits `ai.provider` to the generated YAML. Added `github_wiki` to publisher choices.
|
|
13
40
|
- **Demo AI upsell**: `repolens demo` now shows a hint about GitHub Models (free) when AI is not enabled, guiding users to `repolens init --interactive`.
|
|
41
|
+
- **Uninstall command**: `repolens uninstall` removes all RepoLens-generated files (`.repolens/`, `.repolens.yml`, workflow, `.env.example`, `README.repolens.md`) with confirmation prompt and `--force` flag.
|
|
14
42
|
- **Doctor validation**: `repolens doctor` now checks for `GITHUB_TOKEN` when provider is `github`, and `REPOLENS_AI_API_KEY` for other providers.
|
|
15
43
|
|
|
16
44
|
### š Documentation
|
|
@@ -21,8 +49,8 @@ All notable changes to RepoLens will be documented in this file.
|
|
|
21
49
|
|
|
22
50
|
### š§Ŗ Tests
|
|
23
51
|
|
|
24
|
-
-
|
|
25
|
-
- **
|
|
52
|
+
- 29 new tests: provider config fallbacks, `isAIEnabled` with config, `getAIConfig` with config, GitHub Models defaults, init wizard content, doctor env validation, uninstall command (5 scenarios)
|
|
53
|
+
- **379 tests passing** across 22 test files
|
|
26
54
|
|
|
27
55
|
## 1.7.1
|
|
28
56
|
|
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.
|
|
20
|
+
> Stable as of v1.0 ā [API guarantees](STABILITY.md) Ā· [Security hardened](SECURITY.md) Ā· v1.8.1
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -75,13 +75,13 @@ Run `npx @chappibunny/repolens migrate` to automatically update your workflow fi
|
|
|
75
75
|
|
|
76
76
|
## š What It Generates
|
|
77
77
|
|
|
78
|
-
**
|
|
78
|
+
**15 document types** for three audiences ā no manual writing required:
|
|
79
79
|
|
|
80
80
|
| Audience | Documents |
|
|
81
81
|
|---|---|
|
|
82
82
|
| **Stakeholders** (founders, PMs, ops) | Executive Summary Ā· Business Domains Ā· Data Flows |
|
|
83
|
-
| **Everyone** | System Overview Ā· Developer Onboarding Ā· Change Impact |
|
|
84
|
-
| **Engineers** | Architecture Overview Ā· Module Catalog Ā· API Surface Ā· Route Map Ā· System Map |
|
|
83
|
+
| **Everyone** | System Overview Ā· Developer Onboarding Ā· Change Impact Ā· Architecture Drift |
|
|
84
|
+
| **Engineers** | Architecture Overview Ā· Module Catalog Ā· API Surface Ā· Route Map Ā· System Map Ā· GraphQL Schema Ā· TypeScript Type Graph Ā· Dependency Graph |
|
|
85
85
|
|
|
86
86
|
**Two modes:** Deterministic (free, fast, always works) or AI-Enhanced (optional ā GitHub Models, OpenAI, Anthropic, Google, Azure, Ollama).
|
|
87
87
|
|
|
@@ -148,14 +148,19 @@ Step-by-step setup for publishers, AI features, Notion, Confluence, GitHub Wiki,
|
|
|
148
148
|
|
|
149
149
|
| Command | Description |
|
|
150
150
|
|---|---|
|
|
151
|
-
| `repolens init` | Scaffold config + GitHub Actions workflow |
|
|
152
|
-
| `repolens init --interactive` | Step-by-step configuration wizard |
|
|
153
|
-
| `repolens publish` | Scan, generate, and publish documentation |
|
|
154
|
-
| `repolens demo` | Quick local preview ā no API keys needed |
|
|
155
|
-
| `repolens doctor` | Validate your setup |
|
|
156
|
-
| `repolens watch` | Auto-regenerate docs on file changes |
|
|
157
|
-
| `repolens migrate` | Upgrade from v0.3.0 workflows ([details](MIGRATION.md)) |
|
|
158
|
-
| `repolens
|
|
151
|
+
| `npx @chappibunny/repolens init` | Scaffold config + GitHub Actions workflow |
|
|
152
|
+
| `npx @chappibunny/repolens init --interactive` | Step-by-step configuration wizard |
|
|
153
|
+
| `npx @chappibunny/repolens publish` | Scan, generate, and publish documentation |
|
|
154
|
+
| `npx @chappibunny/repolens demo` | Quick local preview ā no API keys needed |
|
|
155
|
+
| `npx @chappibunny/repolens doctor` | Validate your setup |
|
|
156
|
+
| `npx @chappibunny/repolens watch` | Auto-regenerate docs on file changes |
|
|
157
|
+
| `npx @chappibunny/repolens migrate` | Upgrade from v0.3.0 workflows ([details](MIGRATION.md)) |
|
|
158
|
+
| `npx @chappibunny/repolens uninstall` | Remove all RepoLens files (config, docs, workflow) |
|
|
159
|
+
| `npx @chappibunny/repolens uninstall --force` | Remove without confirmation prompt |
|
|
160
|
+
| `npx @chappibunny/repolens feedback` | Send feedback to the team |
|
|
161
|
+
|
|
162
|
+
> **Note:** If you installed globally with `npm install -g @chappibunny/repolens`, you can use the shorter `repolens <command>` form.
|
|
163
|
+
> **Warning:** Do not run bare `npx repolens` ā there is an unrelated `repolens@0.0.1` placeholder package on npm. Always use the scoped name `@chappibunny/repolens`.
|
|
159
164
|
|
|
160
165
|
---
|
|
161
166
|
|
|
@@ -237,7 +242,7 @@ When you open a pull request, RepoLens posts:
|
|
|
237
242
|
| [Configuration](CONFIGURATION.md) | Complete `.repolens.yml` schema and examples |
|
|
238
243
|
| [Environment Variables](ENVIRONMENT.md) | All env vars by publisher and feature |
|
|
239
244
|
| [Architecture](ARCHITECTURE.md) | Pipeline diagram, project structure |
|
|
240
|
-
| [Development](DEVELOPMENT.md) | Setup, tests (
|
|
245
|
+
| [Development](DEVELOPMENT.md) | Setup, tests (379 across 22 files), release process |
|
|
241
246
|
| [Security](SECURITY.md) | Threat model, secret detection, validation layers |
|
|
242
247
|
| [Telemetry](TELEMETRY.md) | Opt-in privacy-first usage analytics |
|
|
243
248
|
| [Troubleshooting](TROUBLESHOOTING.md) | Common issues and fixes |
|
|
@@ -253,7 +258,7 @@ When you open a pull request, RepoLens posts:
|
|
|
253
258
|
- **Report issues**: Share bugs, edge cases, or UX friction
|
|
254
259
|
- **Request features**: Tell us what's missing
|
|
255
260
|
- **Build plugins**: Extend RepoLens with custom renderers and publishers
|
|
256
|
-
- **Share feedback**: `repolens feedback`
|
|
261
|
+
- **Share feedback**: `npx @chappibunny/repolens feedback`
|
|
257
262
|
|
|
258
263
|
---
|
|
259
264
|
|
package/package.json
CHANGED
|
@@ -245,7 +245,7 @@ The codebase follows ${context.patterns.length > 0 ? context.patterns.join(", ")
|
|
|
245
245
|
|
|
246
246
|
---
|
|
247
247
|
|
|
248
|
-
*This summary
|
|
248
|
+
*This summary was generated from repository structure analysis. Set \`GITHUB_TOKEN\` to auto-enable AI-enhanced summaries via GitHub Models (free) \u2014 adds plain-language explanations for non-technical readers, strategic recommendations, and risk assessments.*`;
|
|
249
249
|
|
|
250
250
|
return output;
|
|
251
251
|
}
|
|
@@ -353,7 +353,7 @@ ${context.domains.slice(0, 5).map((d, i) => `| ${i + 1} | ${d.name} | ${d.fileCo
|
|
|
353
353
|
|
|
354
354
|
output += `---
|
|
355
355
|
|
|
356
|
-
*This overview
|
|
356
|
+
*This overview was generated from repository structure analysis. Set \`GITHUB_TOKEN\` to auto-enable AI via GitHub Models (free) \u2014 adds narrative context, architectural rationale, and technology trade-off analysis.*`;
|
|
357
357
|
|
|
358
358
|
return output;
|
|
359
359
|
}
|
|
@@ -412,7 +412,7 @@ function getFallbackBusinessDomains(context, enrichment = {}) {
|
|
|
412
412
|
output += "\n";
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
output += `---\n\n*Domain mapping is based on directory naming conventions.
|
|
415
|
+
output += `---\n\n*Domain mapping is based on directory naming conventions. Set \`GITHUB_TOKEN\` to auto-enable AI via GitHub Models (free) \u2014 adds business-language descriptions, stakeholder impact analysis, and cross-domain relationship narratives.*`;
|
|
416
416
|
|
|
417
417
|
return output;
|
|
418
418
|
}
|
|
@@ -533,7 +533,7 @@ The repository comprises **${context.project.filesScanned} files** organized int
|
|
|
533
533
|
|
|
534
534
|
output += `---
|
|
535
535
|
|
|
536
|
-
*This architecture overview
|
|
536
|
+
*This architecture overview was generated from repository structure analysis. Set \`GITHUB_TOKEN\` to auto-enable AI via GitHub Models (free) \u2014 adds architectural narratives, design rationale, scalability analysis, and refactoring recommendations.*`;
|
|
537
537
|
|
|
538
538
|
return output;
|
|
539
539
|
}
|
|
@@ -559,7 +559,7 @@ function getFallbackDataFlows(flows, context, enrichment = {}) {
|
|
|
559
559
|
|
|
560
560
|
if (allFlows.length === 0) {
|
|
561
561
|
output += `No data flows were detected. This typically means the system uses straightforward requestāresponse patterns without distinct multi-step pipelines.\n\n`;
|
|
562
|
-
output += `---\n\n*
|
|
562
|
+
output += `---\n\n*Set \`GITHUB_TOKEN\` to auto-enable AI via GitHub Models (free) \u2014 AI can infer data flows from import patterns even when heuristics find none.*`;
|
|
563
563
|
return output;
|
|
564
564
|
}
|
|
565
565
|
|
|
@@ -603,7 +603,7 @@ function getFallbackDataFlows(flows, context, enrichment = {}) {
|
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
|
|
606
|
-
output += `---\n\n*Flow detection is based on naming conventions and import patterns.
|
|
606
|
+
output += `---\n\n*Flow detection is based on naming conventions and import patterns. Set \`GITHUB_TOKEN\` to auto-enable AI via GitHub Models (free) \u2014 adds end-to-end flow narratives, failure mode analysis, and data transformation descriptions.*`;
|
|
607
607
|
|
|
608
608
|
return output;
|
|
609
609
|
}
|
|
@@ -715,7 +715,7 @@ ${context.topModules.slice(0, 10).map(m => `| \`${m.key}\` | ${m.fileCount} | ${
|
|
|
715
715
|
|
|
716
716
|
output += `\n\n---
|
|
717
717
|
|
|
718
|
-
*This onboarding guide
|
|
718
|
+
*This onboarding guide was generated from repository structure analysis. Set \`GITHUB_TOKEN\` to auto-enable AI via GitHub Models (free) \u2014 adds narrative walkthroughs, common pitfalls, debugging tips, and contribution guidelines.*`;
|
|
719
719
|
|
|
720
720
|
return output;
|
|
721
721
|
}
|
package/src/cli.js
CHANGED
|
@@ -145,6 +145,7 @@ Commands:
|
|
|
145
145
|
publish Scan, render, and publish documentation
|
|
146
146
|
demo Generate local docs without API keys (quick preview)
|
|
147
147
|
watch Watch for file changes and regenerate docs
|
|
148
|
+
uninstall Remove all RepoLens-generated files from your repository
|
|
148
149
|
feedback Send feedback to the RepoLens team
|
|
149
150
|
version Print the current RepoLens version
|
|
150
151
|
|
|
@@ -169,6 +170,8 @@ Examples:
|
|
|
169
170
|
repolens publish --config /path/.repolens.yml # Explicit config path
|
|
170
171
|
repolens demo # Quick local preview (no API keys)
|
|
171
172
|
repolens watch # Watch mode (Markdown only)
|
|
173
|
+
repolens uninstall # Remove all RepoLens files
|
|
174
|
+
repolens uninstall --target /tmp/my-repo # Uninstall from specific repo
|
|
172
175
|
repolens --version
|
|
173
176
|
`);
|
|
174
177
|
}
|
|
@@ -335,6 +338,14 @@ async function main() {
|
|
|
335
338
|
process.exit(EXIT_VALIDATION);
|
|
336
339
|
}
|
|
337
340
|
|
|
341
|
+
// Auto-detect GITHUB_TOKEN and enable AI with GitHub Models (free)
|
|
342
|
+
if (!cfg.ai?.enabled && process.env.REPOLENS_AI_ENABLED !== "true" && process.env.GITHUB_TOKEN) {
|
|
343
|
+
info("⨠GITHUB_TOKEN detected ā enabling AI-enhanced docs via GitHub Models (free)");
|
|
344
|
+
cfg.ai = { enabled: true, provider: "github" };
|
|
345
|
+
process.env.REPOLENS_AI_ENABLED = "true";
|
|
346
|
+
process.env.REPOLENS_AI_PROVIDER = "github";
|
|
347
|
+
}
|
|
348
|
+
|
|
338
349
|
// Load plugins
|
|
339
350
|
let pluginManager;
|
|
340
351
|
try {
|
|
@@ -469,6 +480,22 @@ async function main() {
|
|
|
469
480
|
};
|
|
470
481
|
}
|
|
471
482
|
|
|
483
|
+
// Auto-detect GITHUB_TOKEN and enable AI with GitHub Models (free)
|
|
484
|
+
const aiAlreadyConfigured = cfg.ai?.enabled || process.env.REPOLENS_AI_ENABLED === "true";
|
|
485
|
+
let aiAutoEnabled = false;
|
|
486
|
+
if (!aiAlreadyConfigured && process.env.GITHUB_TOKEN) {
|
|
487
|
+
info("\n⨠GITHUB_TOKEN detected ā enabling AI-enhanced docs via GitHub Models (free)");
|
|
488
|
+
cfg.ai = { enabled: true, provider: "github" };
|
|
489
|
+
process.env.REPOLENS_AI_ENABLED = "true";
|
|
490
|
+
process.env.REPOLENS_AI_PROVIDER = "github";
|
|
491
|
+
aiAutoEnabled = true;
|
|
492
|
+
} else if (aiAlreadyConfigured) {
|
|
493
|
+
info("\nš¤ AI-enhanced documentation enabled");
|
|
494
|
+
} else {
|
|
495
|
+
info("\nš Running in deterministic mode (no GITHUB_TOKEN detected)");
|
|
496
|
+
info(" Set GITHUB_TOKEN to auto-enable free AI-enhanced docs via GitHub Models");
|
|
497
|
+
}
|
|
498
|
+
|
|
472
499
|
try {
|
|
473
500
|
info("Scanning repository...");
|
|
474
501
|
const scanTimer = startTimer("scan");
|
|
@@ -492,10 +519,24 @@ async function main() {
|
|
|
492
519
|
info("Browse your docs: open the .repolens/ directory");
|
|
493
520
|
info("\nTo publish to Notion, Confluence, or GitHub Wiki, run: repolens publish");
|
|
494
521
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
info("
|
|
498
|
-
|
|
522
|
+
if (aiAutoEnabled) {
|
|
523
|
+
info("\nš¤ AI-enhanced docs were generated using GitHub Models (free tier)");
|
|
524
|
+
info(" To keep AI enabled permanently, run: repolens init --interactive");
|
|
525
|
+
} else if (!cfg.ai?.enabled && process.env.REPOLENS_AI_ENABLED !== "true") {
|
|
526
|
+
info("\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā");
|
|
527
|
+
info("š” Your docs are missing AI-enhanced sections:");
|
|
528
|
+
info(" ⢠Executive Summary ā plain language overview for leadership");
|
|
529
|
+
info(" ⢠Business Domains ā what the system does for stakeholders");
|
|
530
|
+
info(" ⢠Architecture Overview ā deeper narrative for architects");
|
|
531
|
+
info(" ⢠Data Flows ā how information moves through your system");
|
|
532
|
+
info(" ⢠Developer Onboarding ā getting started guide for new hires");
|
|
533
|
+
info("");
|
|
534
|
+
info(" To enable for FREE with GitHub Models:");
|
|
535
|
+
info(" export GITHUB_TOKEN=<your-token>");
|
|
536
|
+
info(" repolens demo");
|
|
537
|
+
info("");
|
|
538
|
+
info(" Or run: repolens init --interactive ā select GitHub Models");
|
|
539
|
+
info("āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā");
|
|
499
540
|
}
|
|
500
541
|
|
|
501
542
|
printPerformanceSummary();
|
|
@@ -521,6 +562,98 @@ async function main() {
|
|
|
521
562
|
return;
|
|
522
563
|
}
|
|
523
564
|
|
|
565
|
+
if (command === "uninstall") {
|
|
566
|
+
await printBanner();
|
|
567
|
+
|
|
568
|
+
const targetDir = getArg("--target") || process.cwd();
|
|
569
|
+
const forceFlag = process.argv.includes("--force");
|
|
570
|
+
|
|
571
|
+
info("Scanning for RepoLens files...\n");
|
|
572
|
+
|
|
573
|
+
// All files/directories that RepoLens creates
|
|
574
|
+
const candidates = [
|
|
575
|
+
{ path: path.join(targetDir, ".repolens"), type: "dir", label: ".repolens/", source: "demo/publish" },
|
|
576
|
+
{ path: path.join(targetDir, ".repolens.yml"), type: "file", label: ".repolens.yml", source: "init" },
|
|
577
|
+
{ path: path.join(targetDir, ".github", "workflows", "repolens.yml"), type: "file", label: ".github/workflows/repolens.yml", source: "init" },
|
|
578
|
+
{ path: path.join(targetDir, ".env.example"), type: "file", label: ".env.example", source: "init" },
|
|
579
|
+
{ path: path.join(targetDir, "README.repolens.md"), type: "file", label: "README.repolens.md", source: "init" },
|
|
580
|
+
];
|
|
581
|
+
|
|
582
|
+
// Check which files exist
|
|
583
|
+
const found = [];
|
|
584
|
+
for (const item of candidates) {
|
|
585
|
+
try {
|
|
586
|
+
const stat = await fs.stat(item.path);
|
|
587
|
+
if ((item.type === "dir" && stat.isDirectory()) || (item.type === "file" && stat.isFile())) {
|
|
588
|
+
found.push(item);
|
|
589
|
+
}
|
|
590
|
+
} catch {
|
|
591
|
+
// File doesn't exist ā skip
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (found.length === 0) {
|
|
596
|
+
info("No RepoLens files found. Nothing to remove.");
|
|
597
|
+
await closeTelemetry();
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
info("Found the following RepoLens files:\n");
|
|
602
|
+
for (const item of found) {
|
|
603
|
+
const icon = item.type === "dir" ? "š" : "š";
|
|
604
|
+
info(` ${icon} ${item.label} (created by ${item.source})`);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// Confirm unless --force
|
|
608
|
+
if (!forceFlag) {
|
|
609
|
+
const isCI = process.env.CI || process.env.GITHUB_ACTIONS;
|
|
610
|
+
const isTest = process.env.NODE_ENV === "test" || process.env.VITEST;
|
|
611
|
+
|
|
612
|
+
if (isCI || isTest) {
|
|
613
|
+
info("\nCI/test environment detected ā skipping confirmation (use --force to suppress this message).");
|
|
614
|
+
} else {
|
|
615
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
616
|
+
const answer = await new Promise((resolve) => {
|
|
617
|
+
rl.question(`\nRemove ${found.length} item${found.length === 1 ? "" : "s"}? This cannot be undone. (y/N): `, resolve);
|
|
618
|
+
});
|
|
619
|
+
rl.close();
|
|
620
|
+
|
|
621
|
+
if (!answer || answer.trim().toLowerCase() !== "y") {
|
|
622
|
+
info("Uninstall cancelled.");
|
|
623
|
+
await closeTelemetry();
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// Remove files
|
|
630
|
+
let removed = 0;
|
|
631
|
+
for (const item of found) {
|
|
632
|
+
try {
|
|
633
|
+
if (item.type === "dir") {
|
|
634
|
+
await fs.rm(item.path, { recursive: true, force: true });
|
|
635
|
+
} else {
|
|
636
|
+
await fs.unlink(item.path);
|
|
637
|
+
}
|
|
638
|
+
info(` ā Removed ${item.label}`);
|
|
639
|
+
removed++;
|
|
640
|
+
} catch (err) {
|
|
641
|
+
error(` ā Failed to remove ${item.label}: ${err.message}`);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
info(`\nā Removed ${removed}/${found.length} RepoLens file${found.length === 1 ? "" : "s"}.`);
|
|
646
|
+
|
|
647
|
+
if (removed > 0) {
|
|
648
|
+
info("\nTo reinstall, run: repolens init");
|
|
649
|
+
info("To uninstall the npm package: npm uninstall @chappibunny/repolens");
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
trackUsage("uninstall", "success", { removed, total: found.length });
|
|
653
|
+
await closeTelemetry();
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
|
|
524
657
|
if (command === "feedback") {
|
|
525
658
|
await printBanner();
|
|
526
659
|
info("Send feedback to the RepoLens team");
|
|
@@ -567,7 +700,7 @@ async function main() {
|
|
|
567
700
|
}
|
|
568
701
|
|
|
569
702
|
error(`Unknown command: ${command}`);
|
|
570
|
-
error("Available commands: init, doctor, migrate, publish, demo, watch, feedback, version, help");
|
|
703
|
+
error("Available commands: init, doctor, migrate, publish, demo, watch, uninstall, feedback, version, help");
|
|
571
704
|
process.exit(EXIT_ERROR);
|
|
572
705
|
}
|
|
573
706
|
|
package/src/init.js
CHANGED
|
@@ -89,10 +89,10 @@ jobs:
|
|
|
89
89
|
CONFLUENCE_API_TOKEN: \${{ secrets.CONFLUENCE_API_TOKEN }}
|
|
90
90
|
CONFLUENCE_SPACE_KEY: \${{ secrets.CONFLUENCE_SPACE_KEY }}
|
|
91
91
|
CONFLUENCE_PARENT_PAGE_ID: \${{ secrets.CONFLUENCE_PARENT_PAGE_ID }}
|
|
92
|
-
#
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
# AI-enhanced docs via GitHub Models (free)
|
|
93
|
+
REPOLENS_AI_ENABLED: true
|
|
94
|
+
REPOLENS_AI_PROVIDER: github
|
|
95
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
96
96
|
run: npx @chappibunny/repolens@latest publish
|
|
97
97
|
`;
|
|
98
98
|
|
|
@@ -324,9 +324,10 @@ function buildIgnorePatterns() {
|
|
|
324
324
|
];
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
function buildRepoLensConfig(projectName, detectedRoots) {
|
|
327
|
+
function buildRepoLensConfig(projectName, detectedRoots, options = {}) {
|
|
328
328
|
const includePatterns = buildIncludePatterns(detectedRoots);
|
|
329
329
|
const ignorePatterns = buildIgnorePatterns();
|
|
330
|
+
const enableAI = options.enableAI || false;
|
|
330
331
|
|
|
331
332
|
const lines = [
|
|
332
333
|
`configVersion: 1`,
|
|
@@ -358,10 +359,35 @@ function buildRepoLensConfig(projectName, detectedRoots) {
|
|
|
358
359
|
`# owner: "your-username"`,
|
|
359
360
|
`# repo: "your-repo-name"`,
|
|
360
361
|
``,
|
|
361
|
-
`scan:`,
|
|
362
|
-
` include:`
|
|
363
362
|
];
|
|
364
363
|
|
|
364
|
+
// AI configuration
|
|
365
|
+
if (enableAI) {
|
|
366
|
+
lines.push(`# AI-enhanced documentation (auto-detected GITHUB_TOKEN)`);
|
|
367
|
+
lines.push(`ai:`);
|
|
368
|
+
lines.push(` enabled: true`);
|
|
369
|
+
lines.push(` provider: github`);
|
|
370
|
+
lines.push(``);
|
|
371
|
+
lines.push(`features:`);
|
|
372
|
+
lines.push(` executive_summary: true`);
|
|
373
|
+
lines.push(` business_domains: true`);
|
|
374
|
+
lines.push(` architecture_overview: true`);
|
|
375
|
+
lines.push(` data_flows: true`);
|
|
376
|
+
lines.push(` developer_onboarding: true`);
|
|
377
|
+
lines.push(` change_impact: true`);
|
|
378
|
+
lines.push(``);
|
|
379
|
+
} else {
|
|
380
|
+
lines.push(`# AI-enhanced documentation (free via GitHub Models)`);
|
|
381
|
+
lines.push(`# Uncomment to enable ā or set GITHUB_TOKEN and it auto-activates:`);
|
|
382
|
+
lines.push(`# ai:`);
|
|
383
|
+
lines.push(`# enabled: true`);
|
|
384
|
+
lines.push(`# provider: github`);
|
|
385
|
+
lines.push(``);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
lines.push(`scan:`);
|
|
389
|
+
lines.push(` include:`);
|
|
390
|
+
|
|
365
391
|
if (includePatterns.length) {
|
|
366
392
|
for (const pattern of includePatterns) {
|
|
367
393
|
lines.push(` - "${pattern}"`);
|
|
@@ -725,9 +751,12 @@ export async function runInit(targetDir = process.cwd(), options = {}) {
|
|
|
725
751
|
|
|
726
752
|
const projectName = wizardAnswers?.projectName || detectProjectName(repoRoot);
|
|
727
753
|
const detectedRoots = wizardAnswers ? [] : await detectRepoStructure(repoRoot);
|
|
754
|
+
|
|
755
|
+
// Auto-detect GITHUB_TOKEN for AI enablement
|
|
756
|
+
const hasGitHubToken = !!process.env.GITHUB_TOKEN;
|
|
728
757
|
const configContent = wizardAnswers
|
|
729
758
|
? buildWizardConfig(wizardAnswers)
|
|
730
|
-
: buildRepoLensConfig(projectName, detectedRoots);
|
|
759
|
+
: buildRepoLensConfig(projectName, detectedRoots, { enableAI: hasGitHubToken });
|
|
731
760
|
|
|
732
761
|
info(`Detected project name: ${projectName}`);
|
|
733
762
|
|
|
@@ -786,8 +815,11 @@ NOTION_VERSION=2022-06-28
|
|
|
786
815
|
}
|
|
787
816
|
|
|
788
817
|
info("\n⨠RepoLens initialization complete!\n");
|
|
789
|
-
|
|
790
|
-
|
|
818
|
+
if (hasGitHubToken && !wizardAnswers) {
|
|
819
|
+
info("š¤ Detected GITHUB_TOKEN ā AI-enhanced docs enabled via GitHub Models (free)");
|
|
820
|
+
info(" Your workflow and config are pre-configured. No extra setup needed.\n");
|
|
821
|
+
}
|
|
822
|
+
if (notionCredentials) {
|
|
791
823
|
info("š Notion publishing is ready!");
|
|
792
824
|
info(" Your credentials are stored in .env (gitignored)\n");
|
|
793
825
|
info("Next steps:");
|
|
@@ -812,16 +844,18 @@ NOTION_VERSION=2022-06-28
|
|
|
812
844
|
info(" 2. To enable Notion publishing:");
|
|
813
845
|
info(" - Copy .env.example to .env and add your credentials, OR");
|
|
814
846
|
info(" - Add GitHub secrets: NOTION_TOKEN, NOTION_PARENT_PAGE_ID");
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
847
|
+
if (!hasGitHubToken) {
|
|
848
|
+
info(" 3. (Optional) Enable AI features:");
|
|
849
|
+
info(" \u2500\u2500 FREE: GitHub Models (recommended for GitHub Actions) \u2500\u2500");
|
|
850
|
+
info(" REPOLENS_AI_ENABLED=true");
|
|
851
|
+
info(" REPOLENS_AI_PROVIDER=github");
|
|
852
|
+
info(" (Uses your GITHUB_TOKEN automatically \u2014 no API key signup needed)");
|
|
853
|
+
info(" \u2500\u2500 Or: OpenAI / Anthropic / Google \u2500\u2500");
|
|
854
|
+
info(" REPOLENS_AI_ENABLED=true");
|
|
855
|
+
info(" REPOLENS_AI_API_KEY=sk-...");
|
|
856
|
+
info(" See: https://github.com/CHAPIBUNNY/repolens/blob/main/AI.md");
|
|
857
|
+
}
|
|
858
|
+
info(` ${hasGitHubToken ? "3" : "4"}. Run 'npx @chappibunny/repolens publish' to test locally`);
|
|
859
|
+
info(` ${hasGitHubToken ? "4" : "5"}. Commit the generated files`);
|
|
826
860
|
}
|
|
827
861
|
}
|