gitnexus 1.4.10 → 1.5.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.
- package/README.md +6 -5
- package/dist/cli/ai-context.d.ts +4 -1
- package/dist/cli/ai-context.js +19 -11
- package/dist/cli/analyze.d.ts +6 -0
- package/dist/cli/analyze.js +105 -251
- package/dist/cli/eval-server.js +20 -11
- package/dist/cli/index-repo.js +20 -22
- package/dist/cli/index.js +8 -7
- package/dist/cli/mcp.js +1 -1
- package/dist/cli/serve.js +29 -1
- package/dist/cli/setup.js +9 -9
- package/dist/cli/skill-gen.js +15 -9
- package/dist/cli/wiki.d.ts +2 -0
- package/dist/cli/wiki.js +141 -26
- package/dist/config/ignore-service.js +102 -22
- package/dist/config/supported-languages.d.ts +8 -42
- package/dist/config/supported-languages.js +8 -43
- package/dist/core/augmentation/engine.js +19 -7
- package/dist/core/embeddings/embedder.js +19 -15
- package/dist/core/embeddings/embedding-pipeline.js +6 -6
- package/dist/core/embeddings/http-client.js +3 -3
- package/dist/core/embeddings/text-generator.js +9 -24
- package/dist/core/embeddings/types.d.ts +1 -1
- package/dist/core/embeddings/types.js +1 -7
- package/dist/core/graph/graph.js +6 -2
- package/dist/core/graph/types.d.ts +9 -59
- package/dist/core/ingestion/ast-cache.js +3 -3
- package/dist/core/ingestion/call-processor.d.ts +20 -2
- package/dist/core/ingestion/call-processor.js +347 -144
- package/dist/core/ingestion/call-routing.js +10 -4
- package/dist/core/ingestion/call-sites/extract-language-call-site.d.ts +10 -0
- package/dist/core/ingestion/call-sites/extract-language-call-site.js +22 -0
- package/dist/core/ingestion/call-sites/java.d.ts +9 -0
- package/dist/core/ingestion/call-sites/java.js +30 -0
- package/dist/core/ingestion/cluster-enricher.js +6 -8
- package/dist/core/ingestion/cobol/cobol-copy-expander.js +10 -3
- package/dist/core/ingestion/cobol/cobol-preprocessor.js +287 -81
- package/dist/core/ingestion/cobol/jcl-parser.js +1 -1
- package/dist/core/ingestion/cobol/jcl-processor.js +1 -1
- package/dist/core/ingestion/cobol-processor.js +102 -56
- package/dist/core/ingestion/community-processor.js +21 -15
- package/dist/core/ingestion/entry-point-scoring.d.ts +1 -1
- package/dist/core/ingestion/entry-point-scoring.js +5 -6
- package/dist/core/ingestion/export-detection.js +32 -9
- package/dist/core/ingestion/field-extractor.d.ts +1 -1
- package/dist/core/ingestion/field-extractors/configs/c-cpp.js +8 -12
- package/dist/core/ingestion/field-extractors/configs/csharp.js +45 -2
- package/dist/core/ingestion/field-extractors/configs/dart.js +5 -3
- package/dist/core/ingestion/field-extractors/configs/go.js +3 -7
- package/dist/core/ingestion/field-extractors/configs/helpers.d.ts +5 -0
- package/dist/core/ingestion/field-extractors/configs/helpers.js +14 -0
- package/dist/core/ingestion/field-extractors/configs/jvm.js +7 -7
- package/dist/core/ingestion/field-extractors/configs/php.js +9 -11
- package/dist/core/ingestion/field-extractors/configs/python.js +1 -1
- package/dist/core/ingestion/field-extractors/configs/ruby.js +4 -3
- package/dist/core/ingestion/field-extractors/configs/rust.js +2 -5
- package/dist/core/ingestion/field-extractors/configs/swift.js +9 -7
- package/dist/core/ingestion/field-extractors/configs/typescript-javascript.js +2 -6
- package/dist/core/ingestion/field-extractors/generic.d.ts +5 -2
- package/dist/core/ingestion/field-extractors/generic.js +6 -0
- package/dist/core/ingestion/field-extractors/typescript.d.ts +1 -1
- package/dist/core/ingestion/field-extractors/typescript.js +1 -1
- package/dist/core/ingestion/field-types.d.ts +4 -2
- package/dist/core/ingestion/filesystem-walker.js +3 -3
- package/dist/core/ingestion/framework-detection.d.ts +1 -1
- package/dist/core/ingestion/framework-detection.js +355 -85
- package/dist/core/ingestion/heritage-processor.d.ts +24 -0
- package/dist/core/ingestion/heritage-processor.js +99 -8
- package/dist/core/ingestion/import-processor.js +44 -15
- package/dist/core/ingestion/import-resolvers/csharp.js +7 -3
- package/dist/core/ingestion/import-resolvers/dart.js +1 -1
- package/dist/core/ingestion/import-resolvers/go.js +4 -2
- package/dist/core/ingestion/import-resolvers/jvm.js +4 -4
- package/dist/core/ingestion/import-resolvers/php.js +4 -4
- package/dist/core/ingestion/import-resolvers/python.js +1 -1
- package/dist/core/ingestion/import-resolvers/rust.js +9 -3
- package/dist/core/ingestion/import-resolvers/standard.d.ts +1 -1
- package/dist/core/ingestion/import-resolvers/standard.js +6 -5
- package/dist/core/ingestion/import-resolvers/swift.js +2 -1
- package/dist/core/ingestion/import-resolvers/utils.js +26 -7
- package/dist/core/ingestion/language-config.js +5 -4
- package/dist/core/ingestion/language-provider.d.ts +7 -2
- package/dist/core/ingestion/languages/c-cpp.js +106 -21
- package/dist/core/ingestion/languages/cobol.js +1 -1
- package/dist/core/ingestion/languages/csharp.js +96 -19
- package/dist/core/ingestion/languages/dart.js +23 -7
- package/dist/core/ingestion/languages/go.js +1 -1
- package/dist/core/ingestion/languages/index.d.ts +1 -1
- package/dist/core/ingestion/languages/index.js +2 -3
- package/dist/core/ingestion/languages/java.js +4 -1
- package/dist/core/ingestion/languages/kotlin.js +60 -13
- package/dist/core/ingestion/languages/php.js +102 -25
- package/dist/core/ingestion/languages/python.js +28 -5
- package/dist/core/ingestion/languages/ruby.js +56 -14
- package/dist/core/ingestion/languages/rust.js +55 -11
- package/dist/core/ingestion/languages/swift.js +112 -27
- package/dist/core/ingestion/languages/typescript.js +95 -19
- package/dist/core/ingestion/markdown-processor.js +5 -5
- package/dist/core/ingestion/method-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/csharp.js +283 -0
- package/dist/core/ingestion/method-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/method-extractors/configs/jvm.js +326 -0
- package/dist/core/ingestion/method-extractors/generic.d.ts +5 -0
- package/dist/core/ingestion/method-extractors/generic.js +137 -0
- package/dist/core/ingestion/method-types.d.ts +61 -0
- package/dist/core/ingestion/method-types.js +2 -0
- package/dist/core/ingestion/mro-processor.d.ts +1 -1
- package/dist/core/ingestion/mro-processor.js +12 -8
- package/dist/core/ingestion/named-binding-processor.js +2 -2
- package/dist/core/ingestion/named-bindings/rust.js +3 -1
- package/dist/core/ingestion/parsing-processor.js +74 -24
- package/dist/core/ingestion/pipeline.d.ts +2 -1
- package/dist/core/ingestion/pipeline.js +208 -102
- package/dist/core/ingestion/process-processor.js +12 -10
- package/dist/core/ingestion/resolution-context.js +3 -3
- package/dist/core/ingestion/route-extractors/middleware.js +31 -7
- package/dist/core/ingestion/route-extractors/php.js +2 -1
- package/dist/core/ingestion/route-extractors/response-shapes.js +8 -4
- package/dist/core/ingestion/structure-processor.d.ts +1 -1
- package/dist/core/ingestion/structure-processor.js +4 -4
- package/dist/core/ingestion/symbol-table.d.ts +1 -1
- package/dist/core/ingestion/symbol-table.js +22 -6
- package/dist/core/ingestion/tree-sitter-queries.d.ts +1 -1
- package/dist/core/ingestion/tree-sitter-queries.js +1 -1
- package/dist/core/ingestion/type-env.d.ts +2 -2
- package/dist/core/ingestion/type-env.js +75 -50
- package/dist/core/ingestion/type-extractors/c-cpp.js +33 -30
- package/dist/core/ingestion/type-extractors/csharp.js +24 -14
- package/dist/core/ingestion/type-extractors/dart.js +6 -8
- package/dist/core/ingestion/type-extractors/go.js +7 -6
- package/dist/core/ingestion/type-extractors/jvm.js +10 -21
- package/dist/core/ingestion/type-extractors/php.js +26 -13
- package/dist/core/ingestion/type-extractors/python.js +11 -15
- package/dist/core/ingestion/type-extractors/ruby.js +8 -3
- package/dist/core/ingestion/type-extractors/rust.js +6 -8
- package/dist/core/ingestion/type-extractors/shared.js +134 -50
- package/dist/core/ingestion/type-extractors/swift.js +16 -13
- package/dist/core/ingestion/type-extractors/typescript.js +23 -15
- package/dist/core/ingestion/utils/ast-helpers.d.ts +8 -8
- package/dist/core/ingestion/utils/ast-helpers.js +72 -35
- package/dist/core/ingestion/utils/call-analysis.d.ts +2 -0
- package/dist/core/ingestion/utils/call-analysis.js +96 -49
- package/dist/core/ingestion/utils/event-loop.js +1 -1
- package/dist/core/ingestion/workers/parse-worker.d.ts +7 -2
- package/dist/core/ingestion/workers/parse-worker.js +364 -84
- package/dist/core/ingestion/workers/worker-pool.js +5 -10
- package/dist/core/lbug/csv-generator.js +54 -15
- package/dist/core/lbug/lbug-adapter.d.ts +5 -0
- package/dist/core/lbug/lbug-adapter.js +86 -23
- package/dist/core/lbug/schema.d.ts +3 -6
- package/dist/core/lbug/schema.js +6 -30
- package/dist/core/run-analyze.d.ts +49 -0
- package/dist/core/run-analyze.js +257 -0
- package/dist/core/tree-sitter/parser-loader.d.ts +1 -1
- package/dist/core/tree-sitter/parser-loader.js +1 -1
- package/dist/core/wiki/cursor-client.js +2 -7
- package/dist/core/wiki/generator.js +38 -23
- package/dist/core/wiki/graph-queries.js +10 -10
- package/dist/core/wiki/html-viewer.js +7 -3
- package/dist/core/wiki/llm-client.d.ts +23 -2
- package/dist/core/wiki/llm-client.js +96 -26
- package/dist/core/wiki/prompts.js +7 -6
- package/dist/mcp/core/embedder.js +1 -1
- package/dist/mcp/core/lbug-adapter.d.ts +4 -1
- package/dist/mcp/core/lbug-adapter.js +17 -7
- package/dist/mcp/local/local-backend.js +247 -95
- package/dist/mcp/resources.js +14 -6
- package/dist/mcp/server.js +13 -5
- package/dist/mcp/staleness.js +5 -1
- package/dist/mcp/tools.js +100 -23
- package/dist/server/analyze-job.d.ts +53 -0
- package/dist/server/analyze-job.js +146 -0
- package/dist/server/analyze-worker.d.ts +13 -0
- package/dist/server/analyze-worker.js +59 -0
- package/dist/server/api.js +795 -44
- package/dist/server/git-clone.d.ts +25 -0
- package/dist/server/git-clone.js +91 -0
- package/dist/storage/git.js +1 -3
- package/dist/storage/repo-manager.d.ts +5 -2
- package/dist/storage/repo-manager.js +4 -4
- package/dist/types/pipeline.d.ts +1 -21
- package/dist/types/pipeline.js +1 -18
- package/hooks/claude/gitnexus-hook.cjs +52 -22
- package/package.json +3 -2
- package/dist/core/ingestion/utils/language-detection.d.ts +0 -9
- package/dist/core/ingestion/utils/language-detection.js +0 -70
|
@@ -61,15 +61,21 @@ export function routeRubyCall(calledName, callNode) {
|
|
|
61
61
|
return SKIP_RESULT;
|
|
62
62
|
const items = [];
|
|
63
63
|
const argList = callNode.childForFieldName?.('arguments');
|
|
64
|
-
for (const arg of
|
|
64
|
+
for (const arg of argList?.children ?? []) {
|
|
65
65
|
if (arg.type === 'constant' || arg.type === 'scope_resolution') {
|
|
66
|
-
items.push({
|
|
66
|
+
items.push({
|
|
67
|
+
enclosingClass,
|
|
68
|
+
mixinName: arg.text,
|
|
69
|
+
heritageKind: calledName,
|
|
70
|
+
});
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
return items.length > 0 ? { kind: 'heritage', items } : SKIP_RESULT;
|
|
70
74
|
}
|
|
71
75
|
// ── attr_accessor / attr_reader / attr_writer → property definitions ───
|
|
72
|
-
if (calledName === 'attr_accessor' ||
|
|
76
|
+
if (calledName === 'attr_accessor' ||
|
|
77
|
+
calledName === 'attr_reader' ||
|
|
78
|
+
calledName === 'attr_writer') {
|
|
73
79
|
// Extract YARD @return [Type] from preceding comment (e.g. `# @return [Address]`)
|
|
74
80
|
let yardType;
|
|
75
81
|
let sibling = callNode.previousSibling;
|
|
@@ -92,7 +98,7 @@ export function routeRubyCall(calledName, callNode) {
|
|
|
92
98
|
}
|
|
93
99
|
const items = [];
|
|
94
100
|
const argList = callNode.childForFieldName?.('arguments');
|
|
95
|
-
for (const arg of
|
|
101
|
+
for (const arg of argList?.children ?? []) {
|
|
96
102
|
if (arg.type === 'simple_symbol') {
|
|
97
103
|
items.push({
|
|
98
104
|
propName: arg.text.startsWith(':') ? arg.text.slice(1) : arg.text,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Non-generic @call shapes → { calledName, callForm, receiverName? } (used from call-processor / parse-worker). */
|
|
2
|
+
import { SupportedLanguages } from '../../../config/supported-languages.js';
|
|
3
|
+
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
|
4
|
+
export type ParsedCallSite = {
|
|
5
|
+
calledName: string;
|
|
6
|
+
callForm: 'free' | 'member' | 'constructor';
|
|
7
|
+
receiverName?: string;
|
|
8
|
+
};
|
|
9
|
+
/** Non-null → seed replaces @call.name; null → use @call.name + inferCallForm / extractReceiverName. */
|
|
10
|
+
export declare function extractParsedCallSite(language: SupportedLanguages, callNode: SyntaxNode): ParsedCallSite | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Non-generic @call shapes → { calledName, callForm, receiverName? } (used from call-processor / parse-worker). */
|
|
2
|
+
import { SupportedLanguages } from '../../../config/supported-languages.js';
|
|
3
|
+
import { parseJavaMethodReference } from './java.js';
|
|
4
|
+
/** Non-null → seed replaces @call.name; null → use @call.name + inferCallForm / extractReceiverName. */
|
|
5
|
+
export function extractParsedCallSite(language, callNode) {
|
|
6
|
+
switch (language) {
|
|
7
|
+
case SupportedLanguages.Java:
|
|
8
|
+
if (callNode.type === 'method_reference') {
|
|
9
|
+
const parsed = parseJavaMethodReference(callNode);
|
|
10
|
+
if (!parsed)
|
|
11
|
+
return null;
|
|
12
|
+
return {
|
|
13
|
+
calledName: parsed.calledName,
|
|
14
|
+
callForm: parsed.callForm,
|
|
15
|
+
...(parsed.receiverName !== undefined ? { receiverName: parsed.receiverName } : {}),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
default:
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Java `method_reference` (`::`) nodes (tree-sitter-java). `super::` still lacks TypeEnv receiver typing. */
|
|
2
|
+
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
|
3
|
+
export type ParsedJavaMethodReference = {
|
|
4
|
+
calledName: string;
|
|
5
|
+
callForm: 'member' | 'constructor';
|
|
6
|
+
receiverName?: string;
|
|
7
|
+
};
|
|
8
|
+
/** Parse `expr::method`, `Type::new`, `this::m`, `super::m`. */
|
|
9
|
+
export declare const parseJavaMethodReference: (callNode: SyntaxNode) => ParsedJavaMethodReference | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Java `method_reference` (`::`) nodes (tree-sitter-java). `super::` still lacks TypeEnv receiver typing. */
|
|
2
|
+
/** Parse `expr::method`, `Type::new`, `this::m`, `super::m`. */
|
|
3
|
+
export const parseJavaMethodReference = (callNode) => {
|
|
4
|
+
if (callNode.type !== 'method_reference')
|
|
5
|
+
return null;
|
|
6
|
+
const recv = callNode.namedChild(0);
|
|
7
|
+
if (!recv)
|
|
8
|
+
return null;
|
|
9
|
+
for (const c of callNode.children) {
|
|
10
|
+
if (c.type === 'new') {
|
|
11
|
+
if (recv.type !== 'identifier')
|
|
12
|
+
return null;
|
|
13
|
+
return { calledName: recv.text, callForm: 'constructor' };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const rhs = callNode.child(callNode.childCount - 1);
|
|
17
|
+
if (!rhs || rhs.type !== 'identifier')
|
|
18
|
+
return null;
|
|
19
|
+
const methodName = rhs.text;
|
|
20
|
+
if (recv.type === 'identifier') {
|
|
21
|
+
return { calledName: methodName, callForm: 'member', receiverName: recv.text };
|
|
22
|
+
}
|
|
23
|
+
if (recv.type === 'this') {
|
|
24
|
+
return { calledName: methodName, callForm: 'member', receiverName: 'this' };
|
|
25
|
+
}
|
|
26
|
+
if (recv.type === 'super') {
|
|
27
|
+
return { calledName: methodName, callForm: 'member', receiverName: 'super' };
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
const buildEnrichmentPrompt = (members, heuristicLabel) => {
|
|
11
11
|
// Limit to first 20 members to control token usage
|
|
12
12
|
const limitedMembers = members.slice(0, 20);
|
|
13
|
-
const memberList = limitedMembers
|
|
14
|
-
.map(m => `${m.name} (${m.type})`)
|
|
15
|
-
.join(', ');
|
|
13
|
+
const memberList = limitedMembers.map((m) => `${m.name} (${m.type})`).join(', ');
|
|
16
14
|
return `Analyze this code cluster and provide a semantic name and short description.
|
|
17
15
|
|
|
18
16
|
Heuristic: "${heuristicLabel}"
|
|
@@ -109,16 +107,16 @@ export const enrichClustersBatch = async (communities, memberMap, llmClient, bat
|
|
|
109
107
|
// Report progress
|
|
110
108
|
onProgress?.(Math.min(i + batchSize, communities.length), communities.length);
|
|
111
109
|
const batch = communities.slice(i, i + batchSize);
|
|
112
|
-
const batchPrompt = batch
|
|
110
|
+
const batchPrompt = batch
|
|
111
|
+
.map((community, idx) => {
|
|
113
112
|
const members = memberMap.get(community.id) || [];
|
|
114
113
|
const limitedMembers = members.slice(0, 15);
|
|
115
|
-
const memberList = limitedMembers
|
|
116
|
-
.map(m => `${m.name} (${m.type})`)
|
|
117
|
-
.join(', ');
|
|
114
|
+
const memberList = limitedMembers.map((m) => `${m.name} (${m.type})`).join(', ');
|
|
118
115
|
return `Cluster ${idx + 1} (id: ${community.id}):
|
|
119
116
|
Heuristic: "${community.heuristicLabel}"
|
|
120
117
|
Members: ${memberList}`;
|
|
121
|
-
})
|
|
118
|
+
})
|
|
119
|
+
.join('\n\n');
|
|
122
120
|
const prompt = `Analyze these code clusters and generate semantic names, keywords, and descriptions.
|
|
123
121
|
|
|
124
122
|
${batchPrompt}
|
|
@@ -151,7 +151,12 @@ export function parseReplacingClause(text) {
|
|
|
151
151
|
break;
|
|
152
152
|
const toToken = tokens[i];
|
|
153
153
|
i++;
|
|
154
|
-
replacings.push({
|
|
154
|
+
replacings.push({
|
|
155
|
+
type,
|
|
156
|
+
from: fromToken.value,
|
|
157
|
+
to: toToken.value,
|
|
158
|
+
isPseudotext: fromToken.isPseudotext || undefined,
|
|
159
|
+
});
|
|
155
160
|
}
|
|
156
161
|
return replacings;
|
|
157
162
|
}
|
|
@@ -246,14 +251,16 @@ function applyReplacing(content, replacings) {
|
|
|
246
251
|
// characters (pseudotext). These cannot be handled by identifier-level matching.
|
|
247
252
|
let result = content;
|
|
248
253
|
for (const r of replacings) {
|
|
249
|
-
if (r.type === 'EXACT' &&
|
|
254
|
+
if (r.type === 'EXACT' &&
|
|
255
|
+
(r.isPseudotext || r.from.includes(' ') || !/^[A-Z][A-Z0-9-]*$/i.test(r.from))) {
|
|
250
256
|
const escaped = r.from.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
251
257
|
const re = new RegExp(escaped, 'gi');
|
|
252
258
|
result = result.replace(re, r.to);
|
|
253
259
|
}
|
|
254
260
|
}
|
|
255
261
|
// Second pass: identifier-level replacements (LEADING, TRAILING, single-word EXACT)
|
|
256
|
-
const identifierReplacings = replacings.filter(r => !(r.type === 'EXACT' &&
|
|
262
|
+
const identifierReplacings = replacings.filter((r) => !(r.type === 'EXACT' &&
|
|
263
|
+
(r.isPseudotext || r.from.includes(' ') || !/^[A-Z][A-Z0-9-]*$/i.test(r.from))));
|
|
257
264
|
if (identifierReplacings.length === 0)
|
|
258
265
|
return result;
|
|
259
266
|
return result.replace(RE_COBOL_IDENTIFIER, (match) => {
|