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.
- package/README.md +215 -194
- package/dist/cli/ai-context.d.ts +2 -1
- package/dist/cli/ai-context.js +117 -90
- package/dist/cli/analyze.d.ts +2 -0
- package/dist/cli/analyze.js +57 -30
- package/dist/cli/augment.js +1 -1
- package/dist/cli/eval-server.d.ts +1 -1
- package/dist/cli/eval-server.js +1 -1
- package/dist/cli/index.js +18 -25
- package/dist/cli/lazy-action.d.ts +6 -0
- package/dist/cli/lazy-action.js +18 -0
- package/dist/cli/mcp.js +1 -1
- package/dist/cli/setup.js +42 -32
- package/dist/cli/skill-gen.d.ts +26 -0
- package/dist/cli/skill-gen.js +549 -0
- package/dist/cli/status.js +13 -4
- package/dist/cli/tool.d.ts +1 -1
- package/dist/cli/tool.js +2 -2
- package/dist/cli/wiki.js +2 -2
- package/dist/config/ignore-service.d.ts +25 -0
- package/dist/config/ignore-service.js +76 -0
- package/dist/config/supported-languages.d.ts +1 -0
- package/dist/config/supported-languages.js +1 -1
- package/dist/core/augmentation/engine.js +99 -72
- package/dist/core/embeddings/embedder.d.ts +1 -1
- package/dist/core/embeddings/embedder.js +1 -1
- package/dist/core/embeddings/embedding-pipeline.d.ts +3 -3
- package/dist/core/embeddings/embedding-pipeline.js +74 -47
- package/dist/core/embeddings/types.d.ts +1 -1
- package/dist/core/graph/types.d.ts +5 -2
- package/dist/core/ingestion/ast-cache.js +3 -2
- package/dist/core/ingestion/call-processor.d.ts +6 -7
- package/dist/core/ingestion/call-processor.js +560 -282
- package/dist/core/ingestion/call-routing.d.ts +53 -0
- package/dist/core/ingestion/call-routing.js +108 -0
- package/dist/core/ingestion/cluster-enricher.js +16 -16
- package/dist/core/ingestion/constants.d.ts +16 -0
- package/dist/core/ingestion/constants.js +16 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +2 -1
- package/dist/core/ingestion/entry-point-scoring.js +94 -24
- package/dist/core/ingestion/export-detection.d.ts +18 -0
- package/dist/core/ingestion/export-detection.js +231 -0
- package/dist/core/ingestion/filesystem-walker.js +4 -3
- package/dist/core/ingestion/framework-detection.d.ts +5 -1
- package/dist/core/ingestion/framework-detection.js +48 -8
- package/dist/core/ingestion/heritage-processor.d.ts +13 -5
- package/dist/core/ingestion/heritage-processor.js +109 -55
- package/dist/core/ingestion/import-processor.d.ts +16 -20
- package/dist/core/ingestion/import-processor.js +202 -696
- package/dist/core/ingestion/language-config.d.ts +46 -0
- package/dist/core/ingestion/language-config.js +167 -0
- package/dist/core/ingestion/mro-processor.d.ts +45 -0
- package/dist/core/ingestion/mro-processor.js +369 -0
- package/dist/core/ingestion/named-binding-extraction.d.ts +61 -0
- package/dist/core/ingestion/named-binding-extraction.js +363 -0
- package/dist/core/ingestion/parsing-processor.d.ts +3 -11
- package/dist/core/ingestion/parsing-processor.js +82 -181
- package/dist/core/ingestion/pipeline.d.ts +5 -1
- package/dist/core/ingestion/pipeline.js +192 -116
- package/dist/core/ingestion/process-processor.js +2 -1
- package/dist/core/ingestion/resolution-context.d.ts +53 -0
- package/dist/core/ingestion/resolution-context.js +132 -0
- package/dist/core/ingestion/resolvers/csharp.d.ts +22 -0
- package/dist/core/ingestion/resolvers/csharp.js +109 -0
- package/dist/core/ingestion/resolvers/go.d.ts +19 -0
- package/dist/core/ingestion/resolvers/go.js +42 -0
- package/dist/core/ingestion/resolvers/index.d.ts +18 -0
- package/dist/core/ingestion/resolvers/index.js +13 -0
- package/dist/core/ingestion/resolvers/jvm.d.ts +23 -0
- package/dist/core/ingestion/resolvers/jvm.js +87 -0
- package/dist/core/ingestion/resolvers/php.d.ts +15 -0
- package/dist/core/ingestion/resolvers/php.js +35 -0
- package/dist/core/ingestion/resolvers/python.d.ts +19 -0
- package/dist/core/ingestion/resolvers/python.js +52 -0
- package/dist/core/ingestion/resolvers/ruby.d.ts +12 -0
- package/dist/core/ingestion/resolvers/ruby.js +15 -0
- package/dist/core/ingestion/resolvers/rust.d.ts +15 -0
- package/dist/core/ingestion/resolvers/rust.js +73 -0
- package/dist/core/ingestion/resolvers/standard.d.ts +28 -0
- package/dist/core/ingestion/resolvers/standard.js +123 -0
- package/dist/core/ingestion/resolvers/utils.d.ts +33 -0
- package/dist/core/ingestion/resolvers/utils.js +122 -0
- package/dist/core/ingestion/symbol-table.d.ts +15 -1
- package/dist/core/ingestion/symbol-table.js +20 -12
- package/dist/core/ingestion/tree-sitter-queries.d.ts +12 -11
- package/dist/core/ingestion/tree-sitter-queries.js +642 -485
- package/dist/core/ingestion/type-env.d.ts +49 -0
- package/dist/core/ingestion/type-env.js +559 -0
- package/dist/core/ingestion/type-extractors/c-cpp.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/c-cpp.js +385 -0
- package/dist/core/ingestion/type-extractors/csharp.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/csharp.js +369 -0
- package/dist/core/ingestion/type-extractors/go.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/go.js +436 -0
- package/dist/core/ingestion/type-extractors/index.d.ts +22 -0
- package/dist/core/ingestion/type-extractors/index.js +31 -0
- package/dist/core/ingestion/type-extractors/jvm.d.ts +3 -0
- package/dist/core/ingestion/type-extractors/jvm.js +654 -0
- package/dist/core/ingestion/type-extractors/php.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/php.js +411 -0
- package/dist/core/ingestion/type-extractors/python.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/python.js +392 -0
- package/dist/core/ingestion/type-extractors/ruby.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/ruby.js +389 -0
- package/dist/core/ingestion/type-extractors/rust.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/rust.js +436 -0
- package/dist/core/ingestion/type-extractors/shared.d.ts +132 -0
- package/dist/core/ingestion/type-extractors/shared.js +571 -0
- package/dist/core/ingestion/type-extractors/swift.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/swift.js +137 -0
- package/dist/core/ingestion/type-extractors/types.d.ts +95 -0
- package/dist/core/ingestion/type-extractors/types.js +1 -0
- package/dist/core/ingestion/type-extractors/typescript.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/typescript.js +480 -0
- package/dist/core/ingestion/utils.d.ts +98 -0
- package/dist/core/ingestion/utils.js +1064 -9
- package/dist/core/ingestion/workers/parse-worker.d.ts +38 -4
- package/dist/core/ingestion/workers/parse-worker.js +248 -359
- package/dist/core/ingestion/workers/worker-pool.js +8 -0
- package/dist/core/{kuzu → lbug}/csv-generator.d.ts +1 -1
- package/dist/core/{kuzu → lbug}/csv-generator.js +20 -4
- package/dist/core/{kuzu/kuzu-adapter.d.ts → lbug/lbug-adapter.d.ts} +19 -19
- package/dist/core/{kuzu/kuzu-adapter.js → lbug/lbug-adapter.js} +82 -82
- package/dist/core/{kuzu → lbug}/schema.d.ts +4 -4
- package/dist/core/{kuzu → lbug}/schema.js +304 -289
- package/dist/core/search/bm25-index.d.ts +4 -4
- package/dist/core/search/bm25-index.js +17 -16
- package/dist/core/search/hybrid-search.d.ts +2 -2
- package/dist/core/search/hybrid-search.js +9 -9
- package/dist/core/tree-sitter/parser-loader.js +9 -2
- package/dist/core/wiki/generator.d.ts +4 -52
- package/dist/core/wiki/generator.js +53 -552
- package/dist/core/wiki/graph-queries.d.ts +4 -46
- package/dist/core/wiki/graph-queries.js +103 -282
- package/dist/core/wiki/html-viewer.js +192 -192
- package/dist/core/wiki/llm-client.js +11 -73
- package/dist/core/wiki/prompts.d.ts +8 -52
- package/dist/core/wiki/prompts.js +86 -200
- package/dist/mcp/compatible-stdio-transport.d.ts +25 -0
- package/dist/mcp/compatible-stdio-transport.js +200 -0
- package/dist/mcp/core/{kuzu-adapter.d.ts → lbug-adapter.d.ts} +7 -9
- package/dist/mcp/core/{kuzu-adapter.js → lbug-adapter.js} +77 -79
- package/dist/mcp/local/local-backend.d.ts +6 -6
- package/dist/mcp/local/local-backend.js +153 -146
- package/dist/mcp/resources.js +42 -42
- package/dist/mcp/server.js +18 -19
- package/dist/mcp/tools.js +103 -104
- package/dist/server/api.js +12 -12
- package/dist/server/mcp-http.d.ts +1 -1
- package/dist/server/mcp-http.js +1 -1
- package/dist/storage/repo-manager.d.ts +20 -2
- package/dist/storage/repo-manager.js +55 -1
- package/dist/types/pipeline.d.ts +1 -1
- package/hooks/claude/gitnexus-hook.cjs +238 -155
- package/hooks/claude/pre-tool-use.sh +79 -79
- package/hooks/claude/session-start.sh +42 -42
- package/package.json +98 -96
- package/scripts/patch-tree-sitter-swift.cjs +74 -74
- package/skills/gitnexus-cli.md +82 -82
- package/skills/gitnexus-debugging.md +89 -89
- package/skills/gitnexus-exploring.md +78 -78
- package/skills/gitnexus-guide.md +64 -64
- package/skills/gitnexus-impact-analysis.md +97 -97
- package/skills/gitnexus-pr-review.md +163 -163
- package/skills/gitnexus-refactoring.md +121 -121
- package/vendor/leiden/index.cjs +355 -355
- package/vendor/leiden/utils.cjs +392 -392
- package/dist/core/wiki/diagrams.d.ts +0 -27
- 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
|
-
}
|