@chappibunny/repolens 0.4.1 → 0.4.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 CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to RepoLens will be documented in this file.
4
4
 
5
+ ## 0.4.3
6
+
7
+ ### šŸ› Bug Fixes
8
+ - **Migration Tool**: Fixed over-aggressive npm install removal
9
+ - Now only removes `npm install/ci` from legacy `cd tools/repolens` multi-line blocks
10
+ - Preserves legitimate dependency installation steps in release workflows
11
+ - Fixes YAML corruption that broke workflows with standalone npm ci/install steps
12
+ - Added test case to verify legitimate npm install steps are preserved
13
+
14
+ ## 0.4.2
15
+
16
+ ### šŸ› Bug Fixes
17
+ - **Migration Tool**: Fixed duplicate `run:` keys issue when adding environment variables
18
+ - Updated pattern to capture and preserve existing run command
19
+ - Properly positions `env:` block before `run:` with correct indentation
20
+ - Fixes GitHub Actions validation error: "'run' is already defined"
21
+ - Added test case to prevent regression
22
+
5
23
  ## 0.4.1
6
24
 
7
25
  ### ✨ New Features
@@ -21,6 +39,7 @@ All notable changes to RepoLens will be documented in this file.
21
39
  - Detects `npx repolens` without `@latest` suffix
22
40
  - Detects missing `actions/setup-node@v4` setup
23
41
  - Detects missing environment variables (NOTION_TOKEN, REPOLENS_AI_API_KEY)
42
+ - Migrates to `@chappibunny/repolens` scoped package
24
43
  - Automatically adds AI environment variables to existing env sections
25
44
  - Skips already-migrated workflows (no-op when up to date)
26
45
 
@@ -188,7 +207,7 @@ RepoLens is no longer just a "flashy code intelligence toy" — it's now a **doc
188
207
  ### šŸ“¦ Package Changes
189
208
  - Removed test artifacts from repository (cleaner npm package)
190
209
  - Updated .gitignore to exclude test files
191
- - Simplified workflow template to use `npx repolens@latest`
210
+ - Simplified workflow template to use `npx @chappibunny/repolens@latest`
192
211
 
193
212
  ## 0.2.0
194
213
 
package/README.md CHANGED
@@ -27,7 +27,7 @@ npm install github:CHAPIBUNNY/repolens
27
27
 
28
28
  **Step 2: Initialize** (creates config + GitHub Actions workflow)
29
29
  ```bash
30
- npx repolens init
30
+ npx @chappibunny/repolens init
31
31
  ```
32
32
 
33
33
  **Step 3: Configure Notion** (optional, skip if using Markdown only)
@@ -39,13 +39,13 @@ NOTION_PARENT_PAGE_ID=xxx
39
39
 
40
40
  **Step 4: Publish**
41
41
  ```bash
42
- npx repolens publish
42
+ npx @chappibunny/repolens publish
43
43
  ```
44
44
 
45
45
  **Done!** Your docs are now live in Notion and/or `.repolens/` directory.
46
46
 
47
47
  **šŸ”„ Upgrading from v0.3.0 or earlier?**
48
- Run `npx repolens migrate` to automatically update your workflow files. See [MIGRATION.md](MIGRATION.md) for details.
48
+ Run `npx @chappibunny/repolens migrate` to automatically update your workflow files. See [MIGRATION.md](MIGRATION.md) for details.
49
49
 
50
50
  ---
51
51
 
@@ -166,7 +166,7 @@ npm install -g repolens
166
166
  Run this in your project root:
167
167
 
168
168
  ```bash
169
- npx repolens init
169
+ npx @chappibunny/repolens init
170
170
  ```
171
171
 
172
172
  **What it creates:**
@@ -343,7 +343,7 @@ module_roots:
343
343
  Run locally to test:
344
344
 
345
345
  ```bash
346
- npx repolens publish
346
+ npx @chappibunny/repolens publish
347
347
  ```
348
348
 
349
349
  **Expected output:**
@@ -413,12 +413,12 @@ git push
413
413
 
414
414
  Auto-discovers `.repolens.yml`:
415
415
  ```bash
416
- npx repolens publish
416
+ npx @chappibunny/repolens publish
417
417
  ```
418
418
 
419
419
  Specify config path explicitly:
420
420
  ```bash
421
- npx repolens publish --config /path/to/.repolens.yml
421
+ npx @chappibunny/repolens publish --config /path/to/.repolens.yml
422
422
  ```
423
423
 
424
424
  Via npm script (add to package.json):
@@ -435,7 +435,7 @@ Via npm script (add to package.json):
435
435
  Check if your RepoLens setup is valid:
436
436
 
437
437
  ```bash
438
- npx repolens doctor
438
+ npx @chappibunny/repolens doctor
439
439
  ```
440
440
 
441
441
  Validates:
@@ -450,17 +450,17 @@ Validates:
450
450
  **🚨 Upgrading from v0.3.0 or earlier?** Automatically update your GitHub Actions workflows:
451
451
 
452
452
  ```bash
453
- npx repolens migrate
453
+ npx @chappibunny/repolens migrate
454
454
  ```
455
455
 
456
456
  Preview changes without applying:
457
457
  ```bash
458
- npx repolens migrate --dry-run
458
+ npx @chappibunny/repolens migrate --dry-run
459
459
  ```
460
460
 
461
461
  What it fixes:
462
462
  - āŒ Removes outdated `cd tools/repolens` commands
463
- - āœ… Updates to `npx repolens@latest publish`
463
+ - āœ… Updates to `npx @chappibunny/repolens@latest publish`
464
464
  - āœ… Adds Node.js setup step if missing
465
465
  - āœ… Adds environment variables (NOTION_TOKEN, REPOLENS_AI_API_KEY)
466
466
  - šŸ’¾ Creates backup files for safety
@@ -477,8 +477,8 @@ See [MIGRATION.md](MIGRATION.md) for detailed upgrade guide.
477
477
  ### Get Help
478
478
 
479
479
  ```bash
480
- npx repolens --help
481
- npx repolens --version
480
+ npx @chappibunny/repolens --help
481
+ npx @chappibunny/repolens --version
482
482
  ```
483
483
 
484
484
  ---
package/RELEASE.md CHANGED
@@ -47,6 +47,6 @@ To test that users can upgrade successfully:
47
47
 
48
48
  ```bash
49
49
  # In a test project
50
- npx repolens@latest --version
51
- npx repolens@latest publish
50
+ npx @chappibunny/repolens@latest --version
51
+ npx @chappibunny/repolens@latest publish
52
52
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chappibunny/repolens",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "AI-assisted documentation intelligence system for technical and non-technical audiences",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,7 +36,7 @@
36
36
  "author": "Charl van Zyl",
37
37
  "scripts": {
38
38
  "test:notion": "node notion-test.js",
39
- "publish": "node src/cli.js publish --config ../../.repolens.yml",
39
+ "docs:publish": "node src/cli.js publish --config ../../.repolens.yml",
40
40
  "init:test": "node src/cli.js init --target /tmp/repolens-init-test",
41
41
  "test": "NODE_ENV=test vitest run --no-watch --reporter=verbose",
42
42
  "pack:check": "npm pack",
package/src/init.js CHANGED
@@ -46,7 +46,7 @@ jobs:
46
46
  env:
47
47
  NOTION_TOKEN: \${{ secrets.NOTION_TOKEN }}
48
48
  NOTION_PARENT_PAGE_ID: \${{ secrets.NOTION_PARENT_PAGE_ID }}
49
- run: npx repolens@latest publish
49
+ run: npx @chappibunny/repolens@latest publish
50
50
  `;
51
51
 
52
52
  const DEFAULT_ENV_EXAMPLE = `# Notion Publishing
@@ -81,7 +81,7 @@ This repository is configured to use [RepoLens](https://github.com/CHAPIBUNNY/re
81
81
 
82
82
  \`\`\`bash
83
83
  # Test documentation generation locally
84
- npx repolens publish
84
+ npx @chappibunny/repolens publish
85
85
  \`\`\`
86
86
 
87
87
  ### Notion Publishing
@@ -514,7 +514,7 @@ NOTION_VERSION=2022-06-28
514
514
  info(" Your credentials are stored in .env (gitignored)\n");
515
515
  info("Next steps:");
516
516
  info(" 1. Review .repolens.yml to customize your documentation");
517
- info(" 2. Run 'npx repolens publish' to generate your first docs (deterministic mode)");
517
+ info(" 2. Run 'npx @chappibunny/repolens publish' to generate your first docs (deterministic mode)");
518
518
  info(" 3. (Optional) Enable AI features by adding to .env:");
519
519
  info(" REPOLENS_AI_ENABLED=true");
520
520
  info(" REPOLENS_AI_API_KEY=sk-...");
@@ -534,7 +534,7 @@ NOTION_VERSION=2022-06-28
534
534
  info(" REPOLENS_AI_ENABLED=true");
535
535
  info(" REPOLENS_AI_API_KEY=sk-...");
536
536
  info(" See: https://github.com/CHAPIBUNNY/repolens/blob/main/AI.md");
537
- info(" 4. Run 'npx repolens publish' to test locally");
537
+ info(" 4. Run 'npx @chappibunny/repolens publish' to test locally");
538
538
  info(" 5. Commit the generated files");
539
539
  }
540
540
  }
package/src/migrate.js CHANGED
@@ -43,14 +43,19 @@ function detectLegacyPatterns(content) {
43
43
  function migrateWorkflowContent(content) {
44
44
  let migrated = content;
45
45
 
46
- // Remove cd tools/repolens commands
47
- migrated = migrated.replace(/cd\s+tools\/repolens\s*\n?/gi, "");
48
-
49
- // Remove standalone npm ci/install that's part of old setup
50
- migrated = migrated.replace(/npm\s+(?:ci|install)\s*\n/g, "");
46
+ // Remove cd tools/repolens commands and associated npm install in the same run block
47
+ // This handles the legacy pattern: run: | cd tools/repolens; npm install; npx repolens publish
48
+ if (/cd\s+tools\/repolens/i.test(migrated)) {
49
+ // Remove cd command
50
+ migrated = migrated.replace(/cd\s+tools\/repolens\s*\n?/gi, "");
51
+
52
+ // Only remove npm install/ci if it appears in what looks like a multi-line run block
53
+ // after we've removed the cd command (indicates it was part of the legacy pattern)
54
+ migrated = migrated.replace(/(run:\s*\|[^\n]*\n(?:\s+[^\n]*\n)*?\s+)npm\s+(?:ci|install)\s*\n/g, "$1");
55
+ }
51
56
 
52
- // Update npx repolens to npx repolens@latest
53
- migrated = migrated.replace(/npx\s+repolens\s+/g, "npx repolens@latest ");
57
+ // Update npx repolens to npx @chappibunny/repolens@latest
58
+ migrated = migrated.replace(/npx\s+repolens\s+/g, "npx @chappibunny/repolens@latest ");
54
59
 
55
60
  // Add Node.js setup if missing (insert after checkout step)
56
61
  if (!migrated.includes("actions/setup-node@")) {
@@ -70,17 +75,18 @@ function migrateWorkflowContent(content) {
70
75
 
71
76
  // Add environment variables if missing
72
77
  if (!migrated.includes("NOTION_TOKEN") && !migrated.includes("env:")) {
73
- // Find the publish/generate documentation step
74
- const publishPattern = /(- name: .*(?:publish|generate).*documentation.*\n)/i;
78
+ // Find the publish/generate documentation step with its run command
79
+ // Pattern captures: step name, indentation before run, and run command
80
+ const publishPattern = /(- name: .*(?:publish|generate).*documentation.*\n)(\s+)(run:.*)/i;
75
81
  if (publishPattern.test(migrated)) {
76
82
  migrated = migrated.replace(
77
83
  publishPattern,
78
- `$1 env:
79
- NOTION_TOKEN: \${{ secrets.NOTION_TOKEN }}
80
- NOTION_PARENT_PAGE_ID: \${{ secrets.NOTION_PARENT_PAGE_ID }}
81
- REPOLENS_AI_API_KEY: \${{ secrets.REPOLENS_AI_API_KEY }}
82
- REPOLENS_AI_PROVIDER: openai
83
- `
84
+ `$1$2env:
85
+ $2 NOTION_TOKEN: \${{ secrets.NOTION_TOKEN }}
86
+ $2 NOTION_PARENT_PAGE_ID: \${{ secrets.NOTION_PARENT_PAGE_ID }}
87
+ $2 REPOLENS_AI_API_KEY: \${{ secrets.REPOLENS_AI_API_KEY }}
88
+ $2 REPOLENS_AI_PROVIDER: openai
89
+ $2$3`
84
90
  );
85
91
  }
86
92
  }
@@ -226,7 +232,7 @@ export async function runMigrate(targetDir = process.cwd(), options = {}) {
226
232
  if (!dryRun) {
227
233
  console.log("\nšŸ“ Next steps:");
228
234
  console.log(" 1. Review the changes: git diff .github/workflows/");
229
- console.log(" 2. Test locally: npx repolens@latest publish");
235
+ console.log(" 2. Test locally: npx @chappibunny/repolens@latest publish");
230
236
  console.log(" 3. Commit: git add .github/workflows/ && git commit -m 'chore: migrate RepoLens workflow to v0.4.0'");
231
237
  console.log(" 4. Push: git push");
232
238
  console.log("\nšŸ’” Tip: Backups saved as *.backup - delete them once verified");
@@ -112,9 +112,9 @@ function showUpdateMessage(current, latest) {
112
112
  warn("│ │");
113
113
  warn("│ Run one of these commands to update: │");
114
114
  warn("│ │");
115
- warn("│ • npm install -g repolens@latest (global install) │");
116
- warn("│ • npm install repolens@latest (local install) │");
117
- warn("│ • npx repolens@latest <command> (always latest) │");
115
+ warn("│ • npm install -g @chappibunny/repolens@latest (global) │");
116
+ warn("│ • npm install @chappibunny/repolens@latest (local) │");
117
+ warn("│ • npx @chappibunny/repolens@latest <command> (latest) │");
118
118
  warn("│ │");
119
119
  warn("│ Release notes: https://github.com/CHAPIBUNNY/repolens │");
120
120
  warn("ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜");