gitnexus 1.4.1 → 1.4.5

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 (169) hide show
  1. package/README.md +215 -194
  2. package/dist/cli/ai-context.d.ts +2 -1
  3. package/dist/cli/ai-context.js +117 -90
  4. package/dist/cli/analyze.d.ts +2 -0
  5. package/dist/cli/analyze.js +57 -30
  6. package/dist/cli/augment.js +1 -1
  7. package/dist/cli/eval-server.d.ts +1 -1
  8. package/dist/cli/eval-server.js +1 -1
  9. package/dist/cli/index.js +18 -25
  10. package/dist/cli/lazy-action.d.ts +6 -0
  11. package/dist/cli/lazy-action.js +18 -0
  12. package/dist/cli/mcp.js +1 -1
  13. package/dist/cli/setup.js +42 -32
  14. package/dist/cli/skill-gen.d.ts +26 -0
  15. package/dist/cli/skill-gen.js +549 -0
  16. package/dist/cli/status.js +13 -4
  17. package/dist/cli/tool.d.ts +1 -1
  18. package/dist/cli/tool.js +2 -2
  19. package/dist/cli/wiki.js +2 -2
  20. package/dist/config/ignore-service.d.ts +25 -0
  21. package/dist/config/ignore-service.js +76 -0
  22. package/dist/config/supported-languages.d.ts +1 -0
  23. package/dist/config/supported-languages.js +1 -1
  24. package/dist/core/augmentation/engine.js +99 -72
  25. package/dist/core/embeddings/embedder.d.ts +1 -1
  26. package/dist/core/embeddings/embedder.js +1 -1
  27. package/dist/core/embeddings/embedding-pipeline.d.ts +3 -3
  28. package/dist/core/embeddings/embedding-pipeline.js +74 -47
  29. package/dist/core/embeddings/types.d.ts +1 -1
  30. package/dist/core/graph/types.d.ts +5 -2
  31. package/dist/core/ingestion/ast-cache.js +3 -2
  32. package/dist/core/ingestion/call-processor.d.ts +6 -7
  33. package/dist/core/ingestion/call-processor.js +560 -282
  34. package/dist/core/ingestion/call-routing.d.ts +53 -0
  35. package/dist/core/ingestion/call-routing.js +108 -0
  36. package/dist/core/ingestion/cluster-enricher.js +16 -16
  37. package/dist/core/ingestion/constants.d.ts +16 -0
  38. package/dist/core/ingestion/constants.js +16 -0
  39. package/dist/core/ingestion/entry-point-scoring.d.ts +2 -1
  40. package/dist/core/ingestion/entry-point-scoring.js +94 -24
  41. package/dist/core/ingestion/export-detection.d.ts +18 -0
  42. package/dist/core/ingestion/export-detection.js +231 -0
  43. package/dist/core/ingestion/filesystem-walker.js +4 -3
  44. package/dist/core/ingestion/framework-detection.d.ts +5 -1
  45. package/dist/core/ingestion/framework-detection.js +48 -8
  46. package/dist/core/ingestion/heritage-processor.d.ts +13 -5
  47. package/dist/core/ingestion/heritage-processor.js +109 -55
  48. package/dist/core/ingestion/import-processor.d.ts +16 -20
  49. package/dist/core/ingestion/import-processor.js +202 -696
  50. package/dist/core/ingestion/language-config.d.ts +46 -0
  51. package/dist/core/ingestion/language-config.js +167 -0
  52. package/dist/core/ingestion/mro-processor.d.ts +45 -0
  53. package/dist/core/ingestion/mro-processor.js +369 -0
  54. package/dist/core/ingestion/named-binding-extraction.d.ts +61 -0
  55. package/dist/core/ingestion/named-binding-extraction.js +363 -0
  56. package/dist/core/ingestion/parsing-processor.d.ts +3 -11
  57. package/dist/core/ingestion/parsing-processor.js +82 -181
  58. package/dist/core/ingestion/pipeline.d.ts +5 -1
  59. package/dist/core/ingestion/pipeline.js +192 -116
  60. package/dist/core/ingestion/process-processor.js +2 -1
  61. package/dist/core/ingestion/resolution-context.d.ts +53 -0
  62. package/dist/core/ingestion/resolution-context.js +132 -0
  63. package/dist/core/ingestion/resolvers/csharp.d.ts +22 -0
  64. package/dist/core/ingestion/resolvers/csharp.js +109 -0
  65. package/dist/core/ingestion/resolvers/go.d.ts +19 -0
  66. package/dist/core/ingestion/resolvers/go.js +42 -0
  67. package/dist/core/ingestion/resolvers/index.d.ts +18 -0
  68. package/dist/core/ingestion/resolvers/index.js +13 -0
  69. package/dist/core/ingestion/resolvers/jvm.d.ts +23 -0
  70. package/dist/core/ingestion/resolvers/jvm.js +87 -0
  71. package/dist/core/ingestion/resolvers/php.d.ts +15 -0
  72. package/dist/core/ingestion/resolvers/php.js +35 -0
  73. package/dist/core/ingestion/resolvers/python.d.ts +19 -0
  74. package/dist/core/ingestion/resolvers/python.js +52 -0
  75. package/dist/core/ingestion/resolvers/ruby.d.ts +12 -0
  76. package/dist/core/ingestion/resolvers/ruby.js +15 -0
  77. package/dist/core/ingestion/resolvers/rust.d.ts +15 -0
  78. package/dist/core/ingestion/resolvers/rust.js +73 -0
  79. package/dist/core/ingestion/resolvers/standard.d.ts +28 -0
  80. package/dist/core/ingestion/resolvers/standard.js +123 -0
  81. package/dist/core/ingestion/resolvers/utils.d.ts +33 -0
  82. package/dist/core/ingestion/resolvers/utils.js +122 -0
  83. package/dist/core/ingestion/symbol-table.d.ts +15 -1
  84. package/dist/core/ingestion/symbol-table.js +20 -12
  85. package/dist/core/ingestion/tree-sitter-queries.d.ts +12 -11
  86. package/dist/core/ingestion/tree-sitter-queries.js +642 -485
  87. package/dist/core/ingestion/type-env.d.ts +49 -0
  88. package/dist/core/ingestion/type-env.js +559 -0
  89. package/dist/core/ingestion/type-extractors/c-cpp.d.ts +2 -0
  90. package/dist/core/ingestion/type-extractors/c-cpp.js +385 -0
  91. package/dist/core/ingestion/type-extractors/csharp.d.ts +2 -0
  92. package/dist/core/ingestion/type-extractors/csharp.js +369 -0
  93. package/dist/core/ingestion/type-extractors/go.d.ts +2 -0
  94. package/dist/core/ingestion/type-extractors/go.js +436 -0
  95. package/dist/core/ingestion/type-extractors/index.d.ts +22 -0
  96. package/dist/core/ingestion/type-extractors/index.js +31 -0
  97. package/dist/core/ingestion/type-extractors/jvm.d.ts +3 -0
  98. package/dist/core/ingestion/type-extractors/jvm.js +654 -0
  99. package/dist/core/ingestion/type-extractors/php.d.ts +2 -0
  100. package/dist/core/ingestion/type-extractors/php.js +411 -0
  101. package/dist/core/ingestion/type-extractors/python.d.ts +2 -0
  102. package/dist/core/ingestion/type-extractors/python.js +392 -0
  103. package/dist/core/ingestion/type-extractors/ruby.d.ts +2 -0
  104. package/dist/core/ingestion/type-extractors/ruby.js +389 -0
  105. package/dist/core/ingestion/type-extractors/rust.d.ts +2 -0
  106. package/dist/core/ingestion/type-extractors/rust.js +436 -0
  107. package/dist/core/ingestion/type-extractors/shared.d.ts +132 -0
  108. package/dist/core/ingestion/type-extractors/shared.js +571 -0
  109. package/dist/core/ingestion/type-extractors/swift.d.ts +2 -0
  110. package/dist/core/ingestion/type-extractors/swift.js +137 -0
  111. package/dist/core/ingestion/type-extractors/types.d.ts +95 -0
  112. package/dist/core/ingestion/type-extractors/types.js +1 -0
  113. package/dist/core/ingestion/type-extractors/typescript.d.ts +2 -0
  114. package/dist/core/ingestion/type-extractors/typescript.js +480 -0
  115. package/dist/core/ingestion/utils.d.ts +98 -0
  116. package/dist/core/ingestion/utils.js +1064 -9
  117. package/dist/core/ingestion/workers/parse-worker.d.ts +38 -4
  118. package/dist/core/ingestion/workers/parse-worker.js +248 -359
  119. package/dist/core/ingestion/workers/worker-pool.js +8 -0
  120. package/dist/core/{kuzu → lbug}/csv-generator.d.ts +1 -1
  121. package/dist/core/{kuzu → lbug}/csv-generator.js +20 -4
  122. package/dist/core/{kuzu/kuzu-adapter.d.ts → lbug/lbug-adapter.d.ts} +19 -19
  123. package/dist/core/{kuzu/kuzu-adapter.js → lbug/lbug-adapter.js} +82 -82
  124. package/dist/core/{kuzu → lbug}/schema.d.ts +4 -4
  125. package/dist/core/{kuzu → lbug}/schema.js +304 -289
  126. package/dist/core/search/bm25-index.d.ts +4 -4
  127. package/dist/core/search/bm25-index.js +17 -16
  128. package/dist/core/search/hybrid-search.d.ts +2 -2
  129. package/dist/core/search/hybrid-search.js +9 -9
  130. package/dist/core/tree-sitter/parser-loader.js +9 -2
  131. package/dist/core/wiki/generator.d.ts +4 -52
  132. package/dist/core/wiki/generator.js +53 -552
  133. package/dist/core/wiki/graph-queries.d.ts +4 -46
  134. package/dist/core/wiki/graph-queries.js +103 -282
  135. package/dist/core/wiki/html-viewer.js +192 -192
  136. package/dist/core/wiki/llm-client.js +11 -73
  137. package/dist/core/wiki/prompts.d.ts +8 -52
  138. package/dist/core/wiki/prompts.js +86 -200
  139. package/dist/mcp/compatible-stdio-transport.d.ts +25 -0
  140. package/dist/mcp/compatible-stdio-transport.js +200 -0
  141. package/dist/mcp/core/{kuzu-adapter.d.ts → lbug-adapter.d.ts} +7 -9
  142. package/dist/mcp/core/{kuzu-adapter.js → lbug-adapter.js} +77 -79
  143. package/dist/mcp/local/local-backend.d.ts +6 -6
  144. package/dist/mcp/local/local-backend.js +153 -146
  145. package/dist/mcp/resources.js +42 -42
  146. package/dist/mcp/server.js +18 -19
  147. package/dist/mcp/tools.js +103 -104
  148. package/dist/server/api.js +12 -12
  149. package/dist/server/mcp-http.d.ts +1 -1
  150. package/dist/server/mcp-http.js +1 -1
  151. package/dist/storage/repo-manager.d.ts +20 -2
  152. package/dist/storage/repo-manager.js +55 -1
  153. package/dist/types/pipeline.d.ts +1 -1
  154. package/hooks/claude/gitnexus-hook.cjs +238 -155
  155. package/hooks/claude/pre-tool-use.sh +79 -79
  156. package/hooks/claude/session-start.sh +42 -42
  157. package/package.json +98 -96
  158. package/scripts/patch-tree-sitter-swift.cjs +74 -74
  159. package/skills/gitnexus-cli.md +82 -82
  160. package/skills/gitnexus-debugging.md +89 -89
  161. package/skills/gitnexus-exploring.md +78 -78
  162. package/skills/gitnexus-guide.md +64 -64
  163. package/skills/gitnexus-impact-analysis.md +97 -97
  164. package/skills/gitnexus-pr-review.md +163 -163
  165. package/skills/gitnexus-refactoring.md +121 -121
  166. package/vendor/leiden/index.cjs +355 -355
  167. package/vendor/leiden/utils.cjs +392 -392
  168. package/dist/core/wiki/diagrams.d.ts +0 -27
  169. package/dist/core/wiki/diagrams.js +0 -163
@@ -1,27 +0,0 @@
1
- /**
2
- * Deterministic Visual Artifacts for Wiki Generation
3
- *
4
- * Pure functions converting graph data to Mermaid diagrams.
5
- * All node IDs use `n_` prefix to avoid reserved keyword collisions (per commit dfd3d17).
6
- */
7
- import type { CallEdge, ProcessInfo } from './graph-queries.js';
8
- /**
9
- * Build a Mermaid flowchart of internal call edges within a module.
10
- * Groups nodes into subgraphs by file. Returns null if no edges.
11
- */
12
- export declare function buildCallGraphMermaid(moduleName: string, edges: CallEdge[], maxNodes?: number): string | null;
13
- /**
14
- * Build a Mermaid sequence diagram from an execution flow.
15
- * Participants are unique files; messages are function calls between steps.
16
- * Returns null if fewer than 2 steps.
17
- */
18
- export declare function buildSequenceDiagram(process: ProcessInfo, maxSteps?: number): string | null;
19
- /**
20
- * Build a Mermaid graph showing relationships between documentation modules.
21
- * Prunes to top N modules by total edge weight. Returns null if no edges.
22
- */
23
- export declare function buildInterModuleDiagram(edges: Array<{
24
- from: string;
25
- to: string;
26
- count: number;
27
- }>, maxNodes?: number): string | null;
@@ -1,163 +0,0 @@
1
- /**
2
- * Deterministic Visual Artifacts for Wiki Generation
3
- *
4
- * Pure functions converting graph data to Mermaid diagrams.
5
- * All node IDs use `n_` prefix to avoid reserved keyword collisions (per commit dfd3d17).
6
- */
7
- import { shortPath } from './prompts.js';
8
- // ─── Helpers ──────────────────────────────────────────────────────────
9
- /**
10
- * Sanitize a string for use as a Mermaid node ID.
11
- * Prefixes with `n_` and strips non-alphanumeric characters.
12
- */
13
- function sanitizeMermaidId(name) {
14
- return 'n_' + name.replace(/[^a-zA-Z0-9_]/g, '_');
15
- }
16
- /**
17
- * Sanitize a string for use as a Mermaid label (inside quotes).
18
- * Escapes quotes and strips control characters.
19
- */
20
- function sanitizeMermaidLabel(label) {
21
- return label.replace(/"/g, "'").replace(/[\r\n]/g, ' ');
22
- }
23
- // ─── Internal Call Graph (Leaf Pages) ─────────────────────────────────
24
- /**
25
- * Build a Mermaid flowchart of internal call edges within a module.
26
- * Groups nodes into subgraphs by file. Returns null if no edges.
27
- */
28
- export function buildCallGraphMermaid(moduleName, edges, maxNodes = 12) {
29
- if (edges.length === 0)
30
- return null;
31
- // Collect unique nodes and group by file
32
- const nodeSet = new Map();
33
- for (const e of edges) {
34
- const fromKey = `${e.fromFile}::${e.fromName}`;
35
- const toKey = `${e.toFile}::${e.toName}`;
36
- if (!nodeSet.has(fromKey))
37
- nodeSet.set(fromKey, { name: e.fromName, file: e.fromFile });
38
- if (!nodeSet.has(toKey))
39
- nodeSet.set(toKey, { name: e.toName, file: e.toFile });
40
- }
41
- // Prune if too many nodes — keep nodes with most edges
42
- if (nodeSet.size > maxNodes) {
43
- const edgeCounts = new Map();
44
- for (const e of edges) {
45
- const fromKey = `${e.fromFile}::${e.fromName}`;
46
- const toKey = `${e.toFile}::${e.toName}`;
47
- edgeCounts.set(fromKey, (edgeCounts.get(fromKey) || 0) + 1);
48
- edgeCounts.set(toKey, (edgeCounts.get(toKey) || 0) + 1);
49
- }
50
- const sorted = Array.from(edgeCounts.entries()).sort((a, b) => b[1] - a[1]);
51
- const topKeys = new Set(sorted.slice(0, maxNodes).map(([k]) => k));
52
- for (const key of nodeSet.keys()) {
53
- if (!topKeys.has(key))
54
- nodeSet.delete(key);
55
- }
56
- }
57
- // Group nodes by file
58
- const fileGroups = new Map();
59
- for (const [key, node] of nodeSet) {
60
- let group = fileGroups.get(node.file);
61
- if (!group) {
62
- group = [];
63
- fileGroups.set(node.file, group);
64
- }
65
- group.push({ key, name: node.name });
66
- }
67
- // Build Mermaid output
68
- const lines = ['graph TD'];
69
- const validNodeKeys = new Set(nodeSet.keys());
70
- for (const [file, nodes] of fileGroups) {
71
- const subId = sanitizeMermaidId(file);
72
- lines.push(` subgraph ${subId}["${sanitizeMermaidLabel(shortPath(file))}"]`);
73
- for (const n of nodes) {
74
- const nodeId = sanitizeMermaidId(n.key);
75
- lines.push(` ${nodeId}["${sanitizeMermaidLabel(n.name)}"]`);
76
- }
77
- lines.push(' end');
78
- }
79
- // Add edges (only between valid nodes)
80
- for (const e of edges) {
81
- const fromKey = `${e.fromFile}::${e.fromName}`;
82
- const toKey = `${e.toFile}::${e.toName}`;
83
- if (validNodeKeys.has(fromKey) && validNodeKeys.has(toKey)) {
84
- lines.push(` ${sanitizeMermaidId(fromKey)} --> ${sanitizeMermaidId(toKey)}`);
85
- }
86
- }
87
- return lines.join('\n');
88
- }
89
- // ─── Sequence Diagram (Execution Flows) ───────────────────────────────
90
- /**
91
- * Build a Mermaid sequence diagram from an execution flow.
92
- * Participants are unique files; messages are function calls between steps.
93
- * Returns null if fewer than 2 steps.
94
- */
95
- export function buildSequenceDiagram(process, maxSteps = 10) {
96
- if (process.steps.length < 2)
97
- return null;
98
- const steps = process.steps.slice(0, maxSteps);
99
- // Collect unique participants (files)
100
- const participantOrder = [];
101
- const participantSet = new Set();
102
- for (const s of steps) {
103
- if (!participantSet.has(s.filePath)) {
104
- participantSet.add(s.filePath);
105
- participantOrder.push(s.filePath);
106
- }
107
- }
108
- const lines = ['sequenceDiagram'];
109
- for (const fp of participantOrder) {
110
- const alias = sanitizeMermaidId(fp);
111
- lines.push(` participant ${alias} as ${sanitizeMermaidLabel(shortPath(fp))}`);
112
- }
113
- // Generate messages between consecutive steps
114
- for (let i = 0; i < steps.length - 1; i++) {
115
- const from = sanitizeMermaidId(steps[i].filePath);
116
- const to = sanitizeMermaidId(steps[i + 1].filePath);
117
- const label = sanitizeMermaidLabel(steps[i + 1].name);
118
- if (from === to) {
119
- lines.push(` ${from} ->> ${from}: ${label}`);
120
- }
121
- else {
122
- lines.push(` ${from} ->> ${to}: ${label}`);
123
- }
124
- }
125
- return lines.join('\n');
126
- }
127
- // ─── Inter-Module Architecture Diagram (Overview Page) ────────────────
128
- /**
129
- * Build a Mermaid graph showing relationships between documentation modules.
130
- * Prunes to top N modules by total edge weight. Returns null if no edges.
131
- */
132
- export function buildInterModuleDiagram(edges, maxNodes = 10) {
133
- if (edges.length === 0)
134
- return null;
135
- // Compute total weight per module
136
- const moduleWeight = new Map();
137
- for (const e of edges) {
138
- moduleWeight.set(e.from, (moduleWeight.get(e.from) || 0) + e.count);
139
- moduleWeight.set(e.to, (moduleWeight.get(e.to) || 0) + e.count);
140
- }
141
- // Keep top N modules
142
- const topModules = new Set(Array.from(moduleWeight.entries())
143
- .sort((a, b) => b[1] - a[1])
144
- .slice(0, maxNodes)
145
- .map(([mod]) => mod));
146
- // Filter edges to only include top modules
147
- const filteredEdges = edges.filter(e => topModules.has(e.from) && topModules.has(e.to));
148
- if (filteredEdges.length === 0)
149
- return null;
150
- const lines = ['graph LR'];
151
- // Declare nodes
152
- for (const mod of topModules) {
153
- const nodeId = sanitizeMermaidId(mod);
154
- lines.push(` ${nodeId}["${sanitizeMermaidLabel(mod)}"]`);
155
- }
156
- // Add edges with labels
157
- for (const e of filteredEdges) {
158
- const fromId = sanitizeMermaidId(e.from);
159
- const toId = sanitizeMermaidId(e.to);
160
- lines.push(` ${fromId} -->|${e.count} calls| ${toId}`);
161
- }
162
- return lines.join('\n');
163
- }