@chappibunny/repolens 1.12.0 → 1.12.4

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +4 -4
  3. package/bin/repolens.js +21 -1
  4. package/package.json +22 -12
  5. package/src/ai/provider.js +1 -2
  6. package/src/analyzers/monorepo-detector.js +8 -20
  7. package/src/cli-args.js +60 -0
  8. package/src/cli.js +80 -100
  9. package/src/core/config.js +5 -2
  10. package/src/core/diff.js +43 -20
  11. package/src/core/scan.js +24 -4
  12. package/src/delivery/comment.js +5 -2
  13. package/src/docs/write-doc-set.js +9 -7
  14. package/src/doctor.js +2 -2
  15. package/src/help.js +54 -0
  16. package/src/index.js +13 -0
  17. package/src/init.js +38 -41
  18. package/src/integrations/discord.js +16 -2
  19. package/src/migrate.js +2 -2
  20. package/src/publishers/confluence.js +17 -3
  21. package/src/publishers/github-wiki.js +61 -32
  22. package/src/publishers/index.js +4 -9
  23. package/src/publishers/markdown.js +3 -2
  24. package/src/publishers/notion.js +10 -4
  25. package/src/utils/branch.js +23 -44
  26. package/src/utils/github-repo.js +8 -0
  27. package/src/utils/interactive.js +20 -0
  28. package/src/utils/logger.js +5 -1
  29. package/src/utils/retry.js +30 -6
  30. package/src/utils/safe-path.js +50 -0
  31. package/src/utils/secrets.js +3 -1
  32. package/src/utils/telemetry.js +34 -6
  33. package/src/utils/update-check.js +23 -6
  34. package/src/utils/validate.js +7 -0
  35. package/src/utils/yaml.js +27 -0
  36. package/src/watch.js +1 -1
  37. package/docs/AI.md +0 -329
  38. package/docs/ARCHITECTURE.md +0 -145
  39. package/docs/CONFIGURATION.md +0 -121
  40. package/docs/DEVELOPMENT.md +0 -79
  41. package/docs/ENVIRONMENT.md +0 -79
  42. package/docs/INSTALLATION.md +0 -45
  43. package/docs/KNOWN_ISSUES.md +0 -309
  44. package/docs/MIGRATION.md +0 -311
  45. package/docs/ONBOARDING.md +0 -382
  46. package/docs/PRODUCTION_CHECKLIST.md +0 -470
  47. package/docs/RELEASE.md +0 -76
  48. package/docs/ROADMAP.md +0 -151
  49. package/docs/STABILITY.md +0 -265
  50. package/docs/TELEMETRY.md +0 -166
  51. package/docs/TROUBLESHOOTING.md +0 -377
@@ -1,377 +0,0 @@
1
- # Troubleshooting
2
-
3
- Common issues and solutions when installing or using RepoLens.
4
-
5
- > **Quick fix for most problems:** Run `npx @chappibunny/repolens doctor` to diagnose your setup.
6
-
7
- ---
8
-
9
- ## Installation Issues
10
-
11
- ### `ENOTEMPTY: directory not empty` during `npm install`
12
-
13
- ```
14
- npm error code ENOTEMPTY
15
- npm error syscall rename
16
- npm error ENOTEMPTY: directory not empty, rename '…/node_modules/some-package' -> '…/node_modules/.some-package-…'
17
- ```
18
-
19
- **Cause:** Corrupted or stale `node_modules` directory — often from interrupted installs, version switches, or packages with special characters in folder names.
20
-
21
- **Fix:**
22
-
23
- ```bash
24
- rm -rf node_modules package-lock.json
25
- npm install
26
- ```
27
-
28
- If that doesn't work, also clear the npm cache:
29
-
30
- ```bash
31
- npm cache clean --force
32
- rm -rf node_modules package-lock.json
33
- npm install
34
- ```
35
-
36
- ---
37
-
38
- ### `command not found: repolens`
39
-
40
- **Cause:** RepoLens is not installed globally, or the npm bin directory is not in your PATH.
41
-
42
- **Fix — Option A:** Use npx (no global install needed):
43
-
44
- ```bash
45
- npx @chappibunny/repolens publish
46
- ```
47
-
48
- **Fix — Option B:** Install globally:
49
-
50
- ```bash
51
- npm install -g @chappibunny/repolens
52
- ```
53
-
54
- ---
55
-
56
- ### Old version still running after update
57
-
58
- **Cause:** npm cache or a stale global install.
59
-
60
- **Fix:**
61
-
62
- ```bash
63
- npm cache clean --force
64
- npm uninstall -g @chappibunny/repolens
65
- npm install -g @chappibunny/repolens@latest
66
- ```
67
-
68
- Verify: `npx @chappibunny/repolens version` should print the latest version.
69
-
70
- ---
71
-
72
- ### `npm ci` fails in GitHub Actions
73
-
74
- ```
75
- npm error could not resolve … @rollup/rollup-linux-x64-gnu
76
- ```
77
-
78
- **Cause:** `npm ci` with a macOS-generated lockfile fails to resolve platform-specific optional dependencies on Linux runners.
79
-
80
- **Fix:** Use `npm install` instead of `npm ci` in your workflow, and delete `package-lock.json` before install:
81
-
82
- ```yaml
83
- - run: rm -f package-lock.json && npm install
84
- ```
85
-
86
- See the [CI/CD section](README.md#-release-process) in the README for more details.
87
-
88
- ---
89
-
90
- ## Configuration Issues
91
-
92
- ### `Config file not found`
93
-
94
- **Cause:** No `.repolens.yml` in the current directory or any parent.
95
-
96
- **Fix:**
97
-
98
- ```bash
99
- npx @chappibunny/repolens init
100
- ```
101
-
102
- This scaffolds a default `.repolens.yml` in your project root.
103
-
104
- ---
105
-
106
- ### `Failed to parse .repolens.yml`
107
-
108
- **Cause:** Invalid YAML syntax (wrong indentation, mismatched quotes, tabs instead of spaces).
109
-
110
- **Fix:** Validate your YAML at [yamllint.com](https://www.yamllint.com/) or use a YAML linter in your editor.
111
-
112
- ---
113
-
114
- ### `Configuration validation failed`
115
-
116
- **Cause:** Missing required fields or invalid values in `.repolens.yml`.
117
-
118
- **Fix:** Run the doctor command to see exactly what's wrong:
119
-
120
- ```bash
121
- npx @chappibunny/repolens doctor
122
- ```
123
-
124
- Common issues:
125
- - Missing `configVersion: 1` — run `npx @chappibunny/repolens migrate` to auto-fix
126
- - Empty `publishers` array
127
- - Empty `scan.include` patterns
128
- - Invalid `ai.temperature` value (must be 0–2)
129
-
130
- ---
131
-
132
- ## Scanning Issues
133
-
134
- ### `No files matched scan patterns`
135
-
136
- **Cause:** Your `scan.include` patterns don't match any files in the repository.
137
-
138
- **Fix:** Check your patterns match your project structure:
139
-
140
- ```yaml
141
- scan:
142
- include:
143
- - "src/**"
144
- - "app/**"
145
- - "lib/**"
146
- ```
147
-
148
- Test your patterns:
149
-
150
- ```bash
151
- npx fast-glob "src/**/*.{js,ts,jsx,tsx}"
152
- ```
153
-
154
- ---
155
-
156
- ### `Repository exceeds file limit (50,000)`
157
-
158
- **Cause:** Too many files matched — likely including `node_modules` or build output.
159
-
160
- **Fix:** Add exclusions to your config:
161
-
162
- ```yaml
163
- scan:
164
- ignore:
165
- - "node_modules/**"
166
- - "dist/**"
167
- - ".next/**"
168
- - "build/**"
169
- ```
170
-
171
- ---
172
-
173
- ## Publishing Issues
174
-
175
- ### Notion: `NOTION_TOKEN not set`
176
-
177
- **Cause:** The `NOTION_TOKEN` environment variable is missing.
178
-
179
- **Fix:**
180
-
181
- 1. Create a Notion integration at [notion.so/my-integrations](https://www.notion.so/my-integrations)
182
- 2. Share your target page with the integration
183
- 3. Set the token:
184
- - **Locally:** Add to `.env` file: `NOTION_TOKEN=ntn_...`
185
- - **GitHub Actions:** Add to repository secrets: Settings → Secrets → Actions → `NOTION_TOKEN`
186
-
187
- ---
188
-
189
- ### Confluence: `Confluence credentials not configured`
190
-
191
- **Cause:** Missing one or more Confluence environment variables.
192
-
193
- **Fix:** Set all required variables:
194
-
195
- ```bash
196
- CONFLUENCE_URL=https://your-company.atlassian.net/wiki
197
- CONFLUENCE_EMAIL=your-email@company.com
198
- CONFLUENCE_API_TOKEN=your-api-token
199
- CONFLUENCE_SPACE_KEY=DOCS
200
- CONFLUENCE_PARENT_PAGE_ID=123456789
201
- ```
202
-
203
- Generate an API token at [id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens).
204
-
205
- ---
206
-
207
- ### GitHub Wiki: `Missing GITHUB_TOKEN`
208
-
209
- **Cause:** No `GITHUB_TOKEN` available for wiki publishing.
210
-
211
- **Fix:**
212
-
213
- - **GitHub Actions:** Add `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}` to your workflow env
214
- - **Locally:** Create a PAT with `repo` scope at [github.com/settings/tokens](https://github.com/settings/tokens) and set `GITHUB_TOKEN=ghp_...`
215
-
216
- Also ensure the Wiki tab is enabled in your repository settings (Settings → General → Features → Wikis).
217
-
218
- ---
219
-
220
- ### Discord: `Discord webhook URL is invalid`
221
-
222
- **Cause:** Malformed or expired webhook URL.
223
-
224
- **Fix:** Create a new webhook in Discord (Server Settings → Integrations → Webhooks) and update `DISCORD_WEBHOOK_URL`.
225
-
226
- ---
227
-
228
- ## AI Issues
229
-
230
- ### `Unsupported value: 'temperature' does not support X with this model`
231
-
232
- **Cause:** Some models (e.g. `gpt-5-mini`) only accept the default temperature value and reject any explicit value.
233
-
234
- **Fix:** Don't set `REPOLENS_AI_TEMPERATURE` or `ai.temperature` in your config. RepoLens omits temperature from API requests by default, letting the model use its own default. Only set temperature if your specific model supports it.
235
-
236
- ---
237
-
238
- ### `AI features are disabled`
239
-
240
- **Cause:** AI is not enabled — this is the default.
241
-
242
- **Fix:** Set `REPOLENS_AI_ENABLED=true` in your environment or `.env` file.
243
-
244
- ---
245
-
246
- ### `Missing API key`
247
-
248
- **Cause:** AI is enabled but no API key is configured.
249
-
250
- **Fix:** Set `REPOLENS_AI_API_KEY=sk-...` (or your provider's key format).
251
-
252
- ---
253
-
254
- ### `Request timeout`
255
-
256
- **Cause:** AI provider took too long to respond.
257
-
258
- **Fix:** Increase the timeout:
259
-
260
- ```bash
261
- REPOLENS_AI_TIMEOUT_MS=120000 # 2 minutes
262
- ```
263
-
264
- ---
265
-
266
- ### `Rate limit exceeded`
267
-
268
- **Cause:** Too many requests to the AI provider in a short time.
269
-
270
- **Fix:**
271
- - Wait and retry — RepoLens has built-in exponential backoff
272
- - Reduce `ai.max_tokens` to lower per-request cost
273
- - Use a cheaper model (`gpt-5-nano`) for lower-priority docs
274
-
275
- ---
276
-
277
- ### Poor AI output quality
278
-
279
- **Fix:**
280
- - Use `gpt-5.4` for highest quality
281
- - Increase `ai.max_tokens` (default: 2500)
282
- - Add more detail to `domains` configuration in `.repolens.yml`
283
- - AI receives only structured context, never raw code — richer scan data produces better output
284
-
285
- ---
286
-
287
- ### AI costs too high
288
-
289
- **Fix:**
290
- - Switch to `gpt-5-nano` instead of `gpt-5-mini`
291
- - Reduce the number of documents in `outputs.pages`
292
- - Run AI-enhanced docs less frequently (e.g., only on main branch merges)
293
- - Disable AI entirely — deterministic docs are always generated as fallback
294
-
295
- ---
296
-
297
- ## CI/CD Issues
298
-
299
- ### `Invalid workflow file`
300
-
301
- **Cause:** YAML syntax error in your GitHub Actions workflow.
302
-
303
- **Fix:**
304
-
305
- ```bash
306
- npx @chappibunny/repolens migrate
307
- ```
308
-
309
- This migrates legacy workflow patterns to the current format. Review the diff before committing.
310
-
311
- ---
312
-
313
- ### GitHub Actions using old RepoLens version
314
-
315
- **Cause:** Workflow pinned to an older version.
316
-
317
- **Fix:** Update your workflow to use `@latest`:
318
-
319
- ```yaml
320
- - run: npx @chappibunny/repolens@latest publish
321
- ```
322
-
323
- Or install from the repo directly:
324
-
325
- ```yaml
326
- - run: npm install && node bin/repolens.js publish
327
- ```
328
-
329
- ---
330
-
331
- ### `Permission denied` writing files
332
-
333
- **Cause:** The CI runner or local user doesn't have write access to the output directory.
334
-
335
- **Fix:**
336
- - Check that `.repolens/` is writable
337
- - In CI, ensure the checkout step has write permissions:
338
-
339
- ```yaml
340
- permissions:
341
- contents: write
342
- ```
343
-
344
- ---
345
-
346
- ## Doctor Command
347
-
348
- Run the built-in diagnostic tool to check your setup:
349
-
350
- ```bash
351
- npx @chappibunny/repolens doctor
352
- ```
353
-
354
- This validates:
355
-
356
- | Check | Required |
357
- |---|---|
358
- | `.repolens.yml` exists and parses | Yes |
359
- | `.github/workflows/repolens.yml` exists | Yes |
360
- | `publishers` array is non-empty | Yes |
361
- | `scan.include` has patterns | Yes |
362
- | `module_roots` has entries | Yes |
363
- | `outputs.pages` has page definitions | Yes |
364
- | `.env.example` exists | Warning only |
365
- | Known repo roots detected | Warning only |
366
- | Version is up to date | Informational |
367
-
368
- Exit codes: `0` = all checks pass, `1` = blocking failures found.
369
-
370
- ---
371
-
372
- ## Still Stuck?
373
-
374
- - **Run diagnostics:** `npx @chappibunny/repolens doctor`
375
- - **Check known issues:** [KNOWN_ISSUES.md](KNOWN_ISSUES.md)
376
- - **Open an issue:** [github.com/CHAPIBUNNY/repolens/issues](https://github.com/CHAPIBUNNY/repolens/issues)
377
- - **Discussions:** [github.com/CHAPIBUNNY/repolens/discussions](https://github.com/CHAPIBUNNY/repolens/discussions)