@duytransipher/gitnexus 1.4.6-sipher.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 (224) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +261 -0
  3. package/dist/cli/ai-context.d.ts +23 -0
  4. package/dist/cli/ai-context.js +265 -0
  5. package/dist/cli/analyze.d.ts +12 -0
  6. package/dist/cli/analyze.js +345 -0
  7. package/dist/cli/augment.d.ts +13 -0
  8. package/dist/cli/augment.js +33 -0
  9. package/dist/cli/clean.d.ts +10 -0
  10. package/dist/cli/clean.js +60 -0
  11. package/dist/cli/eval-server.d.ts +37 -0
  12. package/dist/cli/eval-server.js +389 -0
  13. package/dist/cli/index.d.ts +2 -0
  14. package/dist/cli/index.js +137 -0
  15. package/dist/cli/lazy-action.d.ts +6 -0
  16. package/dist/cli/lazy-action.js +18 -0
  17. package/dist/cli/list.d.ts +6 -0
  18. package/dist/cli/list.js +30 -0
  19. package/dist/cli/mcp.d.ts +8 -0
  20. package/dist/cli/mcp.js +36 -0
  21. package/dist/cli/serve.d.ts +4 -0
  22. package/dist/cli/serve.js +6 -0
  23. package/dist/cli/setup.d.ts +8 -0
  24. package/dist/cli/setup.js +367 -0
  25. package/dist/cli/sipher-patched.d.ts +2 -0
  26. package/dist/cli/sipher-patched.js +77 -0
  27. package/dist/cli/skill-gen.d.ts +26 -0
  28. package/dist/cli/skill-gen.js +549 -0
  29. package/dist/cli/status.d.ts +6 -0
  30. package/dist/cli/status.js +36 -0
  31. package/dist/cli/tool.d.ts +60 -0
  32. package/dist/cli/tool.js +180 -0
  33. package/dist/cli/wiki.d.ts +15 -0
  34. package/dist/cli/wiki.js +365 -0
  35. package/dist/config/ignore-service.d.ts +26 -0
  36. package/dist/config/ignore-service.js +284 -0
  37. package/dist/config/supported-languages.d.ts +15 -0
  38. package/dist/config/supported-languages.js +16 -0
  39. package/dist/core/augmentation/engine.d.ts +26 -0
  40. package/dist/core/augmentation/engine.js +240 -0
  41. package/dist/core/embeddings/embedder.d.ts +60 -0
  42. package/dist/core/embeddings/embedder.js +251 -0
  43. package/dist/core/embeddings/embedding-pipeline.d.ts +51 -0
  44. package/dist/core/embeddings/embedding-pipeline.js +356 -0
  45. package/dist/core/embeddings/index.d.ts +9 -0
  46. package/dist/core/embeddings/index.js +9 -0
  47. package/dist/core/embeddings/text-generator.d.ts +24 -0
  48. package/dist/core/embeddings/text-generator.js +182 -0
  49. package/dist/core/embeddings/types.d.ts +87 -0
  50. package/dist/core/embeddings/types.js +32 -0
  51. package/dist/core/graph/graph.d.ts +2 -0
  52. package/dist/core/graph/graph.js +66 -0
  53. package/dist/core/graph/types.d.ts +66 -0
  54. package/dist/core/graph/types.js +1 -0
  55. package/dist/core/ingestion/ast-cache.d.ts +11 -0
  56. package/dist/core/ingestion/ast-cache.js +35 -0
  57. package/dist/core/ingestion/call-processor.d.ts +23 -0
  58. package/dist/core/ingestion/call-processor.js +793 -0
  59. package/dist/core/ingestion/call-routing.d.ts +68 -0
  60. package/dist/core/ingestion/call-routing.js +129 -0
  61. package/dist/core/ingestion/cluster-enricher.d.ts +38 -0
  62. package/dist/core/ingestion/cluster-enricher.js +170 -0
  63. package/dist/core/ingestion/community-processor.d.ts +39 -0
  64. package/dist/core/ingestion/community-processor.js +312 -0
  65. package/dist/core/ingestion/constants.d.ts +16 -0
  66. package/dist/core/ingestion/constants.js +16 -0
  67. package/dist/core/ingestion/entry-point-scoring.d.ts +40 -0
  68. package/dist/core/ingestion/entry-point-scoring.js +353 -0
  69. package/dist/core/ingestion/export-detection.d.ts +18 -0
  70. package/dist/core/ingestion/export-detection.js +231 -0
  71. package/dist/core/ingestion/filesystem-walker.d.ts +28 -0
  72. package/dist/core/ingestion/filesystem-walker.js +81 -0
  73. package/dist/core/ingestion/framework-detection.d.ts +54 -0
  74. package/dist/core/ingestion/framework-detection.js +411 -0
  75. package/dist/core/ingestion/heritage-processor.d.ts +28 -0
  76. package/dist/core/ingestion/heritage-processor.js +251 -0
  77. package/dist/core/ingestion/import-processor.d.ts +34 -0
  78. package/dist/core/ingestion/import-processor.js +398 -0
  79. package/dist/core/ingestion/language-config.d.ts +46 -0
  80. package/dist/core/ingestion/language-config.js +167 -0
  81. package/dist/core/ingestion/mro-processor.d.ts +45 -0
  82. package/dist/core/ingestion/mro-processor.js +369 -0
  83. package/dist/core/ingestion/named-binding-extraction.d.ts +61 -0
  84. package/dist/core/ingestion/named-binding-extraction.js +363 -0
  85. package/dist/core/ingestion/parsing-processor.d.ts +19 -0
  86. package/dist/core/ingestion/parsing-processor.js +315 -0
  87. package/dist/core/ingestion/pipeline.d.ts +6 -0
  88. package/dist/core/ingestion/pipeline.js +401 -0
  89. package/dist/core/ingestion/process-processor.d.ts +51 -0
  90. package/dist/core/ingestion/process-processor.js +315 -0
  91. package/dist/core/ingestion/resolution-context.d.ts +53 -0
  92. package/dist/core/ingestion/resolution-context.js +132 -0
  93. package/dist/core/ingestion/resolvers/csharp.d.ts +22 -0
  94. package/dist/core/ingestion/resolvers/csharp.js +109 -0
  95. package/dist/core/ingestion/resolvers/go.d.ts +19 -0
  96. package/dist/core/ingestion/resolvers/go.js +42 -0
  97. package/dist/core/ingestion/resolvers/index.d.ts +18 -0
  98. package/dist/core/ingestion/resolvers/index.js +13 -0
  99. package/dist/core/ingestion/resolvers/jvm.d.ts +23 -0
  100. package/dist/core/ingestion/resolvers/jvm.js +87 -0
  101. package/dist/core/ingestion/resolvers/php.d.ts +15 -0
  102. package/dist/core/ingestion/resolvers/php.js +35 -0
  103. package/dist/core/ingestion/resolvers/python.d.ts +19 -0
  104. package/dist/core/ingestion/resolvers/python.js +52 -0
  105. package/dist/core/ingestion/resolvers/ruby.d.ts +12 -0
  106. package/dist/core/ingestion/resolvers/ruby.js +15 -0
  107. package/dist/core/ingestion/resolvers/rust.d.ts +15 -0
  108. package/dist/core/ingestion/resolvers/rust.js +73 -0
  109. package/dist/core/ingestion/resolvers/standard.d.ts +28 -0
  110. package/dist/core/ingestion/resolvers/standard.js +123 -0
  111. package/dist/core/ingestion/resolvers/utils.d.ts +33 -0
  112. package/dist/core/ingestion/resolvers/utils.js +122 -0
  113. package/dist/core/ingestion/structure-processor.d.ts +2 -0
  114. package/dist/core/ingestion/structure-processor.js +36 -0
  115. package/dist/core/ingestion/symbol-table.d.ts +63 -0
  116. package/dist/core/ingestion/symbol-table.js +85 -0
  117. package/dist/core/ingestion/tree-sitter-queries.d.ts +15 -0
  118. package/dist/core/ingestion/tree-sitter-queries.js +888 -0
  119. package/dist/core/ingestion/type-env.d.ts +49 -0
  120. package/dist/core/ingestion/type-env.js +613 -0
  121. package/dist/core/ingestion/type-extractors/c-cpp.d.ts +2 -0
  122. package/dist/core/ingestion/type-extractors/c-cpp.js +385 -0
  123. package/dist/core/ingestion/type-extractors/csharp.d.ts +2 -0
  124. package/dist/core/ingestion/type-extractors/csharp.js +383 -0
  125. package/dist/core/ingestion/type-extractors/go.d.ts +2 -0
  126. package/dist/core/ingestion/type-extractors/go.js +467 -0
  127. package/dist/core/ingestion/type-extractors/index.d.ts +22 -0
  128. package/dist/core/ingestion/type-extractors/index.js +31 -0
  129. package/dist/core/ingestion/type-extractors/jvm.d.ts +3 -0
  130. package/dist/core/ingestion/type-extractors/jvm.js +681 -0
  131. package/dist/core/ingestion/type-extractors/php.d.ts +2 -0
  132. package/dist/core/ingestion/type-extractors/php.js +549 -0
  133. package/dist/core/ingestion/type-extractors/python.d.ts +2 -0
  134. package/dist/core/ingestion/type-extractors/python.js +455 -0
  135. package/dist/core/ingestion/type-extractors/ruby.d.ts +2 -0
  136. package/dist/core/ingestion/type-extractors/ruby.js +389 -0
  137. package/dist/core/ingestion/type-extractors/rust.d.ts +2 -0
  138. package/dist/core/ingestion/type-extractors/rust.js +456 -0
  139. package/dist/core/ingestion/type-extractors/shared.d.ts +145 -0
  140. package/dist/core/ingestion/type-extractors/shared.js +810 -0
  141. package/dist/core/ingestion/type-extractors/swift.d.ts +2 -0
  142. package/dist/core/ingestion/type-extractors/swift.js +137 -0
  143. package/dist/core/ingestion/type-extractors/types.d.ts +127 -0
  144. package/dist/core/ingestion/type-extractors/types.js +1 -0
  145. package/dist/core/ingestion/type-extractors/typescript.d.ts +2 -0
  146. package/dist/core/ingestion/type-extractors/typescript.js +494 -0
  147. package/dist/core/ingestion/utils.d.ts +138 -0
  148. package/dist/core/ingestion/utils.js +1290 -0
  149. package/dist/core/ingestion/workers/parse-worker.d.ts +122 -0
  150. package/dist/core/ingestion/workers/parse-worker.js +1126 -0
  151. package/dist/core/ingestion/workers/worker-pool.d.ts +16 -0
  152. package/dist/core/ingestion/workers/worker-pool.js +128 -0
  153. package/dist/core/lbug/csv-generator.d.ts +33 -0
  154. package/dist/core/lbug/csv-generator.js +366 -0
  155. package/dist/core/lbug/lbug-adapter.d.ts +103 -0
  156. package/dist/core/lbug/lbug-adapter.js +769 -0
  157. package/dist/core/lbug/schema.d.ts +53 -0
  158. package/dist/core/lbug/schema.js +430 -0
  159. package/dist/core/search/bm25-index.d.ts +23 -0
  160. package/dist/core/search/bm25-index.js +96 -0
  161. package/dist/core/search/hybrid-search.d.ts +49 -0
  162. package/dist/core/search/hybrid-search.js +118 -0
  163. package/dist/core/tree-sitter/parser-loader.d.ts +5 -0
  164. package/dist/core/tree-sitter/parser-loader.js +63 -0
  165. package/dist/core/wiki/generator.d.ts +120 -0
  166. package/dist/core/wiki/generator.js +939 -0
  167. package/dist/core/wiki/graph-queries.d.ts +80 -0
  168. package/dist/core/wiki/graph-queries.js +238 -0
  169. package/dist/core/wiki/html-viewer.d.ts +10 -0
  170. package/dist/core/wiki/html-viewer.js +297 -0
  171. package/dist/core/wiki/llm-client.d.ts +43 -0
  172. package/dist/core/wiki/llm-client.js +186 -0
  173. package/dist/core/wiki/prompts.d.ts +53 -0
  174. package/dist/core/wiki/prompts.js +174 -0
  175. package/dist/lib/utils.d.ts +1 -0
  176. package/dist/lib/utils.js +3 -0
  177. package/dist/mcp/compatible-stdio-transport.d.ts +25 -0
  178. package/dist/mcp/compatible-stdio-transport.js +200 -0
  179. package/dist/mcp/core/embedder.d.ts +27 -0
  180. package/dist/mcp/core/embedder.js +108 -0
  181. package/dist/mcp/core/lbug-adapter.d.ts +57 -0
  182. package/dist/mcp/core/lbug-adapter.js +455 -0
  183. package/dist/mcp/local/local-backend.d.ts +181 -0
  184. package/dist/mcp/local/local-backend.js +1722 -0
  185. package/dist/mcp/resources.d.ts +31 -0
  186. package/dist/mcp/resources.js +411 -0
  187. package/dist/mcp/server.d.ts +23 -0
  188. package/dist/mcp/server.js +296 -0
  189. package/dist/mcp/staleness.d.ts +15 -0
  190. package/dist/mcp/staleness.js +29 -0
  191. package/dist/mcp/tools.d.ts +24 -0
  192. package/dist/mcp/tools.js +292 -0
  193. package/dist/server/api.d.ts +10 -0
  194. package/dist/server/api.js +344 -0
  195. package/dist/server/mcp-http.d.ts +13 -0
  196. package/dist/server/mcp-http.js +100 -0
  197. package/dist/storage/git.d.ts +6 -0
  198. package/dist/storage/git.js +35 -0
  199. package/dist/storage/repo-manager.d.ts +138 -0
  200. package/dist/storage/repo-manager.js +299 -0
  201. package/dist/types/pipeline.d.ts +32 -0
  202. package/dist/types/pipeline.js +18 -0
  203. package/dist/unreal/bridge.d.ts +4 -0
  204. package/dist/unreal/bridge.js +113 -0
  205. package/dist/unreal/config.d.ts +6 -0
  206. package/dist/unreal/config.js +55 -0
  207. package/dist/unreal/types.d.ts +105 -0
  208. package/dist/unreal/types.js +1 -0
  209. package/hooks/claude/gitnexus-hook.cjs +238 -0
  210. package/hooks/claude/pre-tool-use.sh +79 -0
  211. package/hooks/claude/session-start.sh +42 -0
  212. package/package.json +100 -0
  213. package/scripts/ensure-cli-executable.cjs +21 -0
  214. package/scripts/patch-tree-sitter-swift.cjs +74 -0
  215. package/scripts/setup-unreal-gitnexus.ps1 +191 -0
  216. package/skills/gitnexus-cli.md +82 -0
  217. package/skills/gitnexus-debugging.md +89 -0
  218. package/skills/gitnexus-exploring.md +78 -0
  219. package/skills/gitnexus-guide.md +64 -0
  220. package/skills/gitnexus-impact-analysis.md +97 -0
  221. package/skills/gitnexus-pr-review.md +163 -0
  222. package/skills/gitnexus-refactoring.md +121 -0
  223. package/vendor/leiden/index.cjs +355 -0
  224. package/vendor/leiden/utils.cjs +392 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Hybrid Search with Reciprocal Rank Fusion (RRF)
3
+ *
4
+ * Combines BM25 (keyword) and semantic (embedding) search results.
5
+ * Uses RRF to merge rankings without needing score normalization.
6
+ *
7
+ * This is the same approach used by Elasticsearch, Pinecone, and other
8
+ * production search systems.
9
+ */
10
+ import { searchFTSFromLbug } from './bm25-index.js';
11
+ /**
12
+ * RRF constant - standard value used in the literature
13
+ * Higher values give more weight to lower-ranked results
14
+ */
15
+ const RRF_K = 60;
16
+ /**
17
+ * Perform hybrid search combining BM25 and semantic results
18
+ *
19
+ * @param bm25Results - Results from BM25 keyword search
20
+ * @param semanticResults - Results from semantic/embedding search
21
+ * @param limit - Maximum results to return
22
+ * @returns Merged and re-ranked results
23
+ */
24
+ export const mergeWithRRF = (bm25Results, semanticResults, limit = 10) => {
25
+ const merged = new Map();
26
+ // Process BM25 results
27
+ for (let i = 0; i < bm25Results.length; i++) {
28
+ const r = bm25Results[i];
29
+ const rrfScore = 1 / (RRF_K + i + 1); // i+1 because rank starts at 1
30
+ merged.set(r.filePath, {
31
+ filePath: r.filePath,
32
+ score: rrfScore,
33
+ rank: 0, // Will be set after sorting
34
+ sources: ['bm25'],
35
+ bm25Score: r.score,
36
+ });
37
+ }
38
+ // Process semantic results and merge
39
+ for (let i = 0; i < semanticResults.length; i++) {
40
+ const r = semanticResults[i];
41
+ const rrfScore = 1 / (RRF_K + i + 1);
42
+ const existing = merged.get(r.filePath);
43
+ if (existing) {
44
+ // Found by both methods - add scores
45
+ existing.score += rrfScore;
46
+ existing.sources.push('semantic');
47
+ existing.semanticScore = 1 - r.distance;
48
+ // Add semantic metadata
49
+ existing.nodeId = r.nodeId;
50
+ existing.name = r.name;
51
+ existing.label = r.label;
52
+ existing.startLine = r.startLine;
53
+ existing.endLine = r.endLine;
54
+ }
55
+ else {
56
+ // Only found by semantic
57
+ merged.set(r.filePath, {
58
+ filePath: r.filePath,
59
+ score: rrfScore,
60
+ rank: 0,
61
+ sources: ['semantic'],
62
+ semanticScore: 1 - r.distance,
63
+ nodeId: r.nodeId,
64
+ name: r.name,
65
+ label: r.label,
66
+ startLine: r.startLine,
67
+ endLine: r.endLine,
68
+ });
69
+ }
70
+ }
71
+ // Sort by RRF score descending
72
+ const sorted = Array.from(merged.values())
73
+ .sort((a, b) => b.score - a.score)
74
+ .slice(0, limit);
75
+ // Assign final ranks
76
+ sorted.forEach((r, i) => {
77
+ r.rank = i + 1;
78
+ });
79
+ return sorted;
80
+ };
81
+ /**
82
+ * Check if hybrid search is available
83
+ * LadybugDB FTS is always available once the database is initialized.
84
+ * Semantic search is optional - hybrid works with just FTS if embeddings aren't ready.
85
+ */
86
+ export const isHybridSearchReady = () => {
87
+ return true; // FTS is always available via LadybugDB when DB is open
88
+ };
89
+ /**
90
+ * Format hybrid results for LLM consumption
91
+ */
92
+ export const formatHybridResults = (results) => {
93
+ if (results.length === 0) {
94
+ return 'No results found.';
95
+ }
96
+ const formatted = results.map((r, i) => {
97
+ const sources = r.sources.join(' + ');
98
+ const location = r.startLine ? ` (lines ${r.startLine}-${r.endLine})` : '';
99
+ const label = r.label ? `${r.label}: ` : 'File: ';
100
+ const name = r.name || r.filePath.split('/').pop() || r.filePath;
101
+ return `[${i + 1}] ${label}${name}
102
+ File: ${r.filePath}${location}
103
+ Found by: ${sources}
104
+ Relevance: ${r.score.toFixed(4)}`;
105
+ });
106
+ return `Found ${results.length} results:\n\n${formatted.join('\n\n')}`;
107
+ };
108
+ /**
109
+ * Execute BM25 + semantic search and merge with RRF.
110
+ * Uses LadybugDB FTS for always-fresh BM25 results (no cached data).
111
+ * The semanticSearch function is injected to keep this module environment-agnostic.
112
+ */
113
+ export const hybridSearch = async (query, limit, executeQuery, semanticSearch) => {
114
+ // Use LadybugDB FTS for always-fresh BM25 results
115
+ const bm25Results = await searchFTSFromLbug(query, limit);
116
+ const semanticResults = await semanticSearch(executeQuery, query, limit);
117
+ return mergeWithRRF(bm25Results, semanticResults, limit);
118
+ };
@@ -0,0 +1,5 @@
1
+ import Parser from 'tree-sitter';
2
+ import { SupportedLanguages } from '../../config/supported-languages.js';
3
+ export declare const isLanguageAvailable: (language: SupportedLanguages) => boolean;
4
+ export declare const loadParser: () => Promise<Parser>;
5
+ export declare const loadLanguage: (language: SupportedLanguages, filePath?: string) => Promise<void>;
@@ -0,0 +1,63 @@
1
+ import Parser from 'tree-sitter';
2
+ import JavaScript from 'tree-sitter-javascript';
3
+ import TypeScript from 'tree-sitter-typescript';
4
+ import Python from 'tree-sitter-python';
5
+ import Java from 'tree-sitter-java';
6
+ import C from 'tree-sitter-c';
7
+ import CPP from 'tree-sitter-cpp';
8
+ import CSharp from 'tree-sitter-c-sharp';
9
+ import Go from 'tree-sitter-go';
10
+ import Rust from 'tree-sitter-rust';
11
+ import PHP from 'tree-sitter-php';
12
+ import Ruby from 'tree-sitter-ruby';
13
+ import { createRequire } from 'node:module';
14
+ import { SupportedLanguages } from '../../config/supported-languages.js';
15
+ // tree-sitter-swift is an optionalDependency — may not be installed
16
+ const _require = createRequire(import.meta.url);
17
+ let Swift = null;
18
+ try {
19
+ Swift = _require('tree-sitter-swift');
20
+ }
21
+ catch { }
22
+ // tree-sitter-kotlin is an optionalDependency — may not be installed
23
+ let Kotlin = null;
24
+ try {
25
+ Kotlin = _require('tree-sitter-kotlin');
26
+ }
27
+ catch { }
28
+ let parser = null;
29
+ const languageMap = {
30
+ [SupportedLanguages.JavaScript]: JavaScript,
31
+ [SupportedLanguages.TypeScript]: TypeScript.typescript,
32
+ [`${SupportedLanguages.TypeScript}:tsx`]: TypeScript.tsx,
33
+ [SupportedLanguages.Python]: Python,
34
+ [SupportedLanguages.Java]: Java,
35
+ [SupportedLanguages.C]: C,
36
+ [SupportedLanguages.CPlusPlus]: CPP,
37
+ [SupportedLanguages.CSharp]: CSharp,
38
+ [SupportedLanguages.Go]: Go,
39
+ [SupportedLanguages.Rust]: Rust,
40
+ ...(Kotlin ? { [SupportedLanguages.Kotlin]: Kotlin } : {}),
41
+ [SupportedLanguages.PHP]: PHP.php_only,
42
+ [SupportedLanguages.Ruby]: Ruby,
43
+ ...(Swift ? { [SupportedLanguages.Swift]: Swift } : {}),
44
+ };
45
+ export const isLanguageAvailable = (language) => language in languageMap;
46
+ export const loadParser = async () => {
47
+ if (parser)
48
+ return parser;
49
+ parser = new Parser();
50
+ return parser;
51
+ };
52
+ export const loadLanguage = async (language, filePath) => {
53
+ if (!parser)
54
+ await loadParser();
55
+ const key = language === SupportedLanguages.TypeScript && filePath?.endsWith('.tsx')
56
+ ? `${language}:tsx`
57
+ : language;
58
+ const lang = languageMap[key];
59
+ if (!lang) {
60
+ throw new Error(`Unsupported language: ${language}`);
61
+ }
62
+ parser.setLanguage(lang);
63
+ };
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Wiki Generator
3
+ *
4
+ * Orchestrates the full wiki generation pipeline:
5
+ * Phase 0: Validate prerequisites + gather graph structure
6
+ * Phase 1: Build module tree (one LLM call)
7
+ * Phase 2: Generate module pages (one LLM call per module, bottom-up)
8
+ * Phase 3: Generate overview page
9
+ *
10
+ * Supports incremental updates via git diff + module-file mapping.
11
+ */
12
+ import { type FileWithExports } from './graph-queries.js';
13
+ import { type LLMConfig } from './llm-client.js';
14
+ export interface WikiOptions {
15
+ force?: boolean;
16
+ model?: string;
17
+ baseUrl?: string;
18
+ apiKey?: string;
19
+ maxTokensPerModule?: number;
20
+ concurrency?: number;
21
+ }
22
+ export interface WikiMeta {
23
+ fromCommit: string;
24
+ generatedAt: string;
25
+ model: string;
26
+ moduleFiles: Record<string, string[]>;
27
+ moduleTree: ModuleTreeNode[];
28
+ }
29
+ export interface ModuleTreeNode {
30
+ name: string;
31
+ slug: string;
32
+ files: string[];
33
+ children?: ModuleTreeNode[];
34
+ }
35
+ export type ProgressCallback = (phase: string, percent: number, detail?: string) => void;
36
+ export declare const MAX_WIKI_PROMPT_TOKENS = 120000;
37
+ export declare function isWikiPromptExcludedPath(filePath: string): boolean;
38
+ export declare function isWikiCodeFilePath(filePath: string): boolean;
39
+ export declare function filterWikiPromptPaths(filePaths: string[]): string[];
40
+ export declare function estimateGroupingPromptTokens(files: FileWithExports[]): number;
41
+ export declare function shouldUseDeterministicGrouping(fileCount: number, promptTokens: number): boolean;
42
+ export declare class WikiGenerator {
43
+ private repoPath;
44
+ private storagePath;
45
+ private wikiDir;
46
+ private lbugPath;
47
+ private llmConfig;
48
+ private maxTokensPerModule;
49
+ private concurrency;
50
+ private options;
51
+ private onProgress;
52
+ private failedModules;
53
+ constructor(repoPath: string, storagePath: string, lbugPath: string, llmConfig: LLMConfig, options?: WikiOptions, onProgress?: ProgressCallback);
54
+ private lastPercent;
55
+ /**
56
+ * Create streaming options that report LLM progress to the progress bar.
57
+ * Uses the last known percent so streaming doesn't reset the bar backwards.
58
+ */
59
+ private streamOpts;
60
+ /**
61
+ * Main entry point. Runs the full pipeline or incremental update.
62
+ */
63
+ run(): Promise<{
64
+ pagesGenerated: number;
65
+ mode: 'full' | 'incremental' | 'up-to-date';
66
+ failedModules: string[];
67
+ }>;
68
+ private ensureHTMLViewer;
69
+ private fullGeneration;
70
+ private buildModuleTree;
71
+ /**
72
+ * Parse LLM grouping response. Validates all files are assigned.
73
+ */
74
+ private parseGroupingResponse;
75
+ /**
76
+ * Fallback grouping by top-level directory when LLM parsing fails.
77
+ */
78
+ private fallbackGrouping;
79
+ /**
80
+ * Split a large module into sub-modules by subdirectory.
81
+ */
82
+ private splitBySubdirectory;
83
+ /**
84
+ * Generate a leaf module page from source code + graph data.
85
+ */
86
+ private generateLeafPage;
87
+ /**
88
+ * Generate a parent module page from children's documentation.
89
+ */
90
+ private generateParentPage;
91
+ private generateOverview;
92
+ private incrementalUpdate;
93
+ private getCurrentCommit;
94
+ private getChangedFiles;
95
+ private readSourceFiles;
96
+ private truncateSource;
97
+ private estimateModuleTokens;
98
+ private readProjectInfo;
99
+ private assertPromptWithinBudget;
100
+ private buildDeterministicModuleTree;
101
+ private chunkFiles;
102
+ private extractModuleFiles;
103
+ private countModules;
104
+ /**
105
+ * Flatten the module tree into leaf nodes and parent nodes.
106
+ * Leaves can be processed in parallel; parents must wait for children.
107
+ */
108
+ private flattenModuleTree;
109
+ /**
110
+ * Run async tasks in parallel with a concurrency limit and adaptive rate limiting.
111
+ * If a 429 rate limit is hit, concurrency is temporarily reduced.
112
+ */
113
+ private runParallel;
114
+ private findNodeBySlug;
115
+ private slugify;
116
+ private fileExists;
117
+ private loadWikiMeta;
118
+ private saveWikiMeta;
119
+ private saveModuleTree;
120
+ }