@chappibunny/repolens 1.8.1 β 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 +19 -0
- package/README.md +14 -11
- package/package.json +1 -1
- package/src/ai/generate-sections.js +7 -7
- package/src/cli.js +46 -6
- package/src/init.js +55 -21
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
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
|
+
|
|
5
24
|
## 1.8.1
|
|
6
25
|
|
|
7
26
|
### π Documentation Refresh
|
package/README.md
CHANGED
|
@@ -148,16 +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 uninstall` | Remove all RepoLens files (config, docs, workflow) |
|
|
159
|
-
| `repolens uninstall --force` | Remove without confirmation prompt |
|
|
160
|
-
| `repolens feedback` | Send feedback to the team |
|
|
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`.
|
|
161
164
|
|
|
162
165
|
---
|
|
163
166
|
|
|
@@ -255,7 +258,7 @@ When you open a pull request, RepoLens posts:
|
|
|
255
258
|
- **Report issues**: Share bugs, edge cases, or UX friction
|
|
256
259
|
- **Request features**: Tell us what's missing
|
|
257
260
|
- **Build plugins**: Extend RepoLens with custom renderers and publishers
|
|
258
|
-
- **Share feedback**: `repolens feedback`
|
|
261
|
+
- **Share feedback**: `npx @chappibunny/repolens feedback`
|
|
259
262
|
|
|
260
263
|
---
|
|
261
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
|
@@ -338,6 +338,14 @@ async function main() {
|
|
|
338
338
|
process.exit(EXIT_VALIDATION);
|
|
339
339
|
}
|
|
340
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
|
+
|
|
341
349
|
// Load plugins
|
|
342
350
|
let pluginManager;
|
|
343
351
|
try {
|
|
@@ -472,6 +480,22 @@ async function main() {
|
|
|
472
480
|
};
|
|
473
481
|
}
|
|
474
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
|
+
|
|
475
499
|
try {
|
|
476
500
|
info("Scanning repository...");
|
|
477
501
|
const scanTimer = startTimer("scan");
|
|
@@ -495,10 +519,24 @@ async function main() {
|
|
|
495
519
|
info("Browse your docs: open the .repolens/ directory");
|
|
496
520
|
info("\nTo publish to Notion, Confluence, or GitHub Wiki, run: repolens publish");
|
|
497
521
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
info("
|
|
501
|
-
|
|
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("βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ");
|
|
502
540
|
}
|
|
503
541
|
|
|
504
542
|
printPerformanceSummary();
|
|
@@ -575,10 +613,12 @@ async function main() {
|
|
|
575
613
|
info("\nCI/test environment detected β skipping confirmation (use --force to suppress this message).");
|
|
576
614
|
} else {
|
|
577
615
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
578
|
-
const answer = await
|
|
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
|
+
});
|
|
579
619
|
rl.close();
|
|
580
620
|
|
|
581
|
-
if (answer.trim().toLowerCase() !== "y") {
|
|
621
|
+
if (!answer || answer.trim().toLowerCase() !== "y") {
|
|
582
622
|
info("Uninstall cancelled.");
|
|
583
623
|
await closeTelemetry();
|
|
584
624
|
return;
|
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
|
}
|