@chappibunny/repolens 1.12.2 → 1.13.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +25 -36
  3. package/bin/repolens.js +21 -1
  4. package/package.json +20 -11
  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-schema.js +47 -1
  10. package/src/core/config.js +5 -2
  11. package/src/core/diff.js +43 -20
  12. package/src/core/scan.js +24 -4
  13. package/src/delivery/comment.js +5 -2
  14. package/src/docs/write-doc-set.js +9 -7
  15. package/src/doctor.js +16 -3
  16. package/src/help.js +54 -0
  17. package/src/index.js +13 -0
  18. package/src/init.js +99 -62
  19. package/src/integrations/discord.js +16 -2
  20. package/src/migrate.js +2 -2
  21. package/src/publishers/confluence.js +17 -3
  22. package/src/publishers/github-wiki.js +61 -32
  23. package/src/publishers/index.js +24 -9
  24. package/src/publishers/markdown.js +3 -2
  25. package/src/publishers/notion.js +10 -4
  26. package/src/publishers/obsidian.js +716 -0
  27. package/src/utils/branch.js +37 -42
  28. package/src/utils/github-repo.js +8 -0
  29. package/src/utils/interactive.js +20 -0
  30. package/src/utils/logger.js +5 -1
  31. package/src/utils/retry.js +30 -6
  32. package/src/utils/safe-path.js +50 -0
  33. package/src/utils/secrets.js +3 -1
  34. package/src/utils/telemetry.js +34 -6
  35. package/src/utils/update-check.js +23 -6
  36. package/src/utils/validate.js +70 -1
  37. package/src/utils/yaml.js +27 -0
  38. package/src/watch.js +1 -1
  39. package/docs/AI.md +0 -329
  40. package/docs/ARCHITECTURE.md +0 -145
  41. package/docs/CONFIGURATION.md +0 -121
  42. package/docs/DEVELOPMENT.md +0 -79
  43. package/docs/ENVIRONMENT.md +0 -79
  44. package/docs/INSTALLATION.md +0 -45
  45. package/docs/KNOWN_ISSUES.md +0 -309
  46. package/docs/MIGRATION.md +0 -311
  47. package/docs/ONBOARDING.md +0 -382
  48. package/docs/PRODUCTION_CHECKLIST.md +0 -470
  49. package/docs/RELEASE.md +0 -76
  50. package/docs/ROADMAP.md +0 -151
  51. package/docs/STABILITY.md +0 -265
  52. package/docs/TELEMETRY.md +0 -166
  53. package/docs/TROUBLESHOOTING.md +0 -377
@@ -1,9 +1,10 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { info } from "../utils/logger.js";
4
+ import { resolveOutputDir, safeFileName } from "../utils/safe-path.js";
4
5
 
5
6
  function outputDir(cfg) {
6
- return path.join(cfg.__repoRoot, ".repolens");
7
+ return resolveOutputDir(cfg.__repoRoot, ".repolens");
7
8
  }
8
9
 
9
10
  function pageFileName(key) {
@@ -27,7 +28,7 @@ function pageFileName(key) {
27
28
  code_health: "code_health.md"
28
29
  };
29
30
 
30
- return mapping[key] || `${key}.md`;
31
+ return safeFileName(mapping[key] || `${key}.md`);
31
32
  }
32
33
 
33
34
  export async function publishToMarkdown(cfg, renderedPages) {
@@ -1,10 +1,10 @@
1
- import fetch from "node-fetch";
2
1
  import fs from "node:fs/promises";
3
2
  import path from "node:path";
4
3
  import { log, warn } from "../utils/logger.js";
5
4
  import { fetchWithRetry } from "../utils/retry.js";
6
5
  import { executeNotionRequest } from "../utils/rate-limit.js";
7
6
  import { createRepoLensError } from "../utils/errors.js";
7
+ import { sanitizeSecrets } from "../utils/secrets.js";
8
8
 
9
9
  function notionHeaders() {
10
10
  const token = process.env.NOTION_TOKEN;
@@ -36,7 +36,8 @@ async function notionRequest(method, url, body) {
36
36
 
37
37
  if (!res.ok) {
38
38
  const text = await res.text();
39
- throw new Error(`Notion API error ${res.status}: ${text}`);
39
+ const clipped = sanitizeSecrets(String(text || "").replace(/\s+/g, " ").slice(0, 500));
40
+ throw new Error(`Notion API error ${res.status}: ${clipped}`);
40
41
  }
41
42
 
42
43
  return await res.json();
@@ -62,10 +63,15 @@ async function writeCache(cache) {
62
63
 
63
64
  async function getChildBlocks(blockId) {
64
65
  const results = [];
66
+ const seenCursors = new Set();
65
67
  let cursor = undefined;
66
68
 
67
- while (true) {
68
- const suffix = cursor ? `?start_cursor=${cursor}` : "";
69
+ while (results.length < 10000) {
70
+ if (cursor) {
71
+ if (seenCursors.has(cursor)) break;
72
+ seenCursors.add(cursor);
73
+ }
74
+ const suffix = cursor ? `?start_cursor=${encodeURIComponent(cursor)}` : "";
69
75
  const response = await notionRequest("GET", `/blocks/${blockId}/children${suffix}`);
70
76
 
71
77
  if (response.results?.length) {