gitnexus 1.6.0 → 1.6.1
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/dist/cli/analyze.js +28 -3
- package/dist/core/group/extractors/fs-utils.d.ts +10 -0
- package/dist/core/group/extractors/fs-utils.js +24 -0
- package/dist/core/group/extractors/grpc-extractor.d.ts +17 -8
- package/dist/core/group/extractors/grpc-extractor.js +313 -191
- package/dist/core/group/extractors/grpc-patterns/go.d.ts +2 -0
- package/dist/core/group/extractors/grpc-patterns/go.js +97 -0
- package/dist/core/group/extractors/grpc-patterns/index.d.ts +19 -0
- package/dist/core/group/extractors/grpc-patterns/index.js +46 -0
- package/dist/core/group/extractors/grpc-patterns/java.d.ts +2 -0
- package/dist/core/group/extractors/grpc-patterns/java.js +173 -0
- package/dist/core/group/extractors/grpc-patterns/node.d.ts +4 -0
- package/dist/core/group/extractors/grpc-patterns/node.js +290 -0
- package/dist/core/group/extractors/grpc-patterns/proto.d.ts +9 -0
- package/dist/core/group/extractors/grpc-patterns/proto.js +134 -0
- package/dist/core/group/extractors/grpc-patterns/python.d.ts +2 -0
- package/dist/core/group/extractors/grpc-patterns/python.js +67 -0
- package/dist/core/group/extractors/grpc-patterns/types.d.ts +50 -0
- package/dist/core/group/extractors/grpc-patterns/types.js +1 -0
- package/dist/core/group/extractors/http-patterns/go.d.ts +2 -0
- package/dist/core/group/extractors/http-patterns/go.js +215 -0
- package/dist/core/group/extractors/http-patterns/index.d.ts +17 -0
- package/dist/core/group/extractors/http-patterns/index.js +44 -0
- package/dist/core/group/extractors/http-patterns/java.d.ts +2 -0
- package/dist/core/group/extractors/http-patterns/java.js +253 -0
- package/dist/core/group/extractors/http-patterns/node.d.ts +4 -0
- package/dist/core/group/extractors/http-patterns/node.js +354 -0
- package/dist/core/group/extractors/http-patterns/php.d.ts +2 -0
- package/dist/core/group/extractors/http-patterns/php.js +70 -0
- package/dist/core/group/extractors/http-patterns/python.d.ts +2 -0
- package/dist/core/group/extractors/http-patterns/python.js +133 -0
- package/dist/core/group/extractors/http-patterns/types.d.ts +61 -0
- package/dist/core/group/extractors/http-patterns/types.js +1 -0
- package/dist/core/group/extractors/http-route-extractor.d.ts +10 -13
- package/dist/core/group/extractors/http-route-extractor.js +201 -238
- package/dist/core/group/extractors/manifest-extractor.d.ts +54 -0
- package/dist/core/group/extractors/manifest-extractor.js +235 -0
- package/dist/core/group/extractors/topic-extractor.d.ts +0 -1
- package/dist/core/group/extractors/topic-extractor.js +55 -192
- package/dist/core/group/extractors/topic-patterns/go.d.ts +2 -0
- package/dist/core/group/extractors/topic-patterns/go.js +120 -0
- package/dist/core/group/extractors/topic-patterns/index.d.ts +14 -0
- package/dist/core/group/extractors/topic-patterns/index.js +38 -0
- package/dist/core/group/extractors/topic-patterns/java.d.ts +2 -0
- package/dist/core/group/extractors/topic-patterns/java.js +80 -0
- package/dist/core/group/extractors/topic-patterns/node.d.ts +4 -0
- package/dist/core/group/extractors/topic-patterns/node.js +155 -0
- package/dist/core/group/extractors/topic-patterns/python.d.ts +2 -0
- package/dist/core/group/extractors/topic-patterns/python.js +116 -0
- package/dist/core/group/extractors/topic-patterns/types.d.ts +25 -0
- package/dist/core/group/extractors/topic-patterns/types.js +10 -0
- package/dist/core/group/extractors/tree-sitter-scanner.d.ts +113 -0
- package/dist/core/group/extractors/tree-sitter-scanner.js +94 -0
- package/dist/core/ingestion/binding-accumulator.d.ts +22 -17
- package/dist/core/ingestion/binding-accumulator.js +29 -25
- package/dist/core/ingestion/cobol-processor.d.ts +1 -1
- package/dist/core/ingestion/import-processor.js +1 -1
- package/dist/core/ingestion/language-config.js +1 -1
- package/dist/core/ingestion/language-provider.d.ts +8 -0
- package/dist/core/ingestion/languages/ruby.js +15 -0
- package/dist/core/ingestion/markdown-processor.d.ts +1 -1
- package/dist/core/ingestion/method-extractors/configs/jvm.js +1 -0
- package/dist/core/ingestion/method-extractors/configs/ruby.js +1 -0
- package/dist/core/ingestion/method-extractors/generic.d.ts +6 -0
- package/dist/core/ingestion/method-extractors/generic.js +48 -4
- package/dist/core/ingestion/method-types.d.ts +4 -0
- package/dist/core/ingestion/model/resolve.js +103 -48
- package/dist/core/ingestion/model/semantic-model.d.ts +1 -1
- package/dist/core/ingestion/model/semantic-model.js +1 -1
- package/dist/core/ingestion/model/symbol-table.d.ts +7 -7
- package/dist/core/ingestion/model/symbol-table.js +7 -7
- package/dist/core/ingestion/mro-processor.d.ts +1 -1
- package/dist/core/ingestion/mro-processor.js +1 -1
- package/dist/core/ingestion/parsing-processor.js +54 -42
- package/dist/core/ingestion/pipeline-phases/cobol.d.ts +16 -0
- package/dist/core/ingestion/pipeline-phases/cobol.js +45 -0
- package/dist/core/ingestion/pipeline-phases/communities.d.ts +16 -0
- package/dist/core/ingestion/pipeline-phases/communities.js +62 -0
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.d.ts +17 -0
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +156 -0
- package/dist/core/ingestion/pipeline-phases/cross-file.d.ts +37 -0
- package/dist/core/ingestion/pipeline-phases/cross-file.js +63 -0
- package/dist/core/ingestion/pipeline-phases/index.d.ts +21 -0
- package/dist/core/ingestion/pipeline-phases/index.js +22 -0
- package/dist/core/ingestion/pipeline-phases/markdown.d.ts +17 -0
- package/dist/core/ingestion/pipeline-phases/markdown.js +33 -0
- package/dist/core/ingestion/pipeline-phases/mro.d.ts +18 -0
- package/dist/core/ingestion/pipeline-phases/mro.js +36 -0
- package/dist/core/ingestion/pipeline-phases/orm-extraction.d.ts +22 -0
- package/dist/core/ingestion/pipeline-phases/orm-extraction.js +92 -0
- package/dist/core/ingestion/pipeline-phases/orm.d.ts +15 -0
- package/dist/core/ingestion/pipeline-phases/orm.js +74 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +47 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +437 -0
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +49 -0
- package/dist/core/ingestion/pipeline-phases/parse.js +33 -0
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +16 -0
- package/dist/core/ingestion/pipeline-phases/processes.js +143 -0
- package/dist/core/ingestion/pipeline-phases/routes.d.ts +21 -0
- package/dist/core/ingestion/pipeline-phases/routes.js +243 -0
- package/dist/core/ingestion/pipeline-phases/runner.d.ts +22 -0
- package/dist/core/ingestion/pipeline-phases/runner.js +203 -0
- package/dist/core/ingestion/pipeline-phases/scan.d.ts +21 -0
- package/dist/core/ingestion/pipeline-phases/scan.js +46 -0
- package/dist/core/ingestion/pipeline-phases/structure.d.ts +27 -0
- package/dist/core/ingestion/pipeline-phases/structure.js +35 -0
- package/dist/core/ingestion/pipeline-phases/tools.d.ts +20 -0
- package/dist/core/ingestion/pipeline-phases/tools.js +79 -0
- package/dist/core/ingestion/pipeline-phases/types.d.ts +79 -0
- package/dist/core/ingestion/pipeline-phases/types.js +37 -0
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.d.ts +35 -0
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.js +174 -0
- package/dist/core/ingestion/pipeline.d.ts +16 -10
- package/dist/core/ingestion/pipeline.js +66 -1534
- package/dist/core/ingestion/process-processor.js +1 -1
- package/dist/core/ingestion/tree-sitter-queries.d.ts +2 -2
- package/dist/core/ingestion/tree-sitter-queries.js +69 -0
- package/dist/core/ingestion/utils/ast-helpers.d.ts +1 -3
- package/dist/core/ingestion/utils/ast-helpers.js +48 -21
- package/dist/core/ingestion/utils/env.d.ts +10 -0
- package/dist/core/ingestion/utils/env.js +10 -0
- package/dist/core/ingestion/utils/graph-sort.d.ts +58 -0
- package/dist/core/ingestion/utils/graph-sort.js +100 -0
- package/dist/core/ingestion/workers/parse-worker.js +12 -8
- package/dist/core/lbug/lbug-adapter.js +66 -24
- package/package.json +3 -3
- package/vendor/tree-sitter-proto/binding.gyp +30 -0
- package/vendor/tree-sitter-proto/bindings/node/binding.cc +20 -0
- package/vendor/tree-sitter-proto/bindings/node/index.d.ts +28 -0
- package/vendor/tree-sitter-proto/bindings/node/index.js +7 -0
- package/vendor/tree-sitter-proto/package.json +18 -0
- package/vendor/tree-sitter-proto/src/node-types.json +1145 -0
- package/vendor/tree-sitter-proto/src/parser.c +10149 -0
- package/vendor/tree-sitter-proto/src/tree_sitter/alloc.h +54 -0
- package/vendor/tree-sitter-proto/src/tree_sitter/array.h +291 -0
- package/vendor/tree-sitter-proto/src/tree_sitter/parser.h +266 -0
package/dist/cli/analyze.js
CHANGED
|
@@ -18,7 +18,10 @@ import { runFullAnalysis } from '../core/run-analyze.js';
|
|
|
18
18
|
import fs from 'fs/promises';
|
|
19
19
|
const HEAP_MB = 8192;
|
|
20
20
|
const HEAP_FLAG = `--max-old-space-size=${HEAP_MB}`;
|
|
21
|
-
/**
|
|
21
|
+
/** Increase default stack size (KB) to prevent stack overflow on deep class hierarchies. */
|
|
22
|
+
const STACK_KB = 4096;
|
|
23
|
+
const STACK_FLAG = `--stack-size=${STACK_KB}`;
|
|
24
|
+
/** Re-exec the process with an 8GB heap and larger stack if we're currently below that. */
|
|
22
25
|
function ensureHeap() {
|
|
23
26
|
const nodeOpts = process.env.NODE_OPTIONS || '';
|
|
24
27
|
if (nodeOpts.includes('--max-old-space-size'))
|
|
@@ -26,8 +29,13 @@ function ensureHeap() {
|
|
|
26
29
|
const v8Heap = v8.getHeapStatistics().heap_size_limit;
|
|
27
30
|
if (v8Heap >= HEAP_MB * 1024 * 1024 * 0.9)
|
|
28
31
|
return false;
|
|
32
|
+
// --stack-size is a V8 flag not allowed in NODE_OPTIONS on Node 24+,
|
|
33
|
+
// so pass it only as a direct CLI argument, not via the environment.
|
|
34
|
+
const cliFlags = [HEAP_FLAG];
|
|
35
|
+
if (!nodeOpts.includes('--stack-size'))
|
|
36
|
+
cliFlags.push(STACK_FLAG);
|
|
29
37
|
try {
|
|
30
|
-
execFileSync(process.execPath, [
|
|
38
|
+
execFileSync(process.execPath, [...cliFlags, ...process.argv.slice(1)], {
|
|
31
39
|
stdio: 'inherit',
|
|
32
40
|
env: { ...process.env, NODE_OPTIONS: `${nodeOpts} ${HEAP_FLAG}`.trim() },
|
|
33
41
|
});
|
|
@@ -222,7 +230,24 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
222
230
|
console.warn = origWarn;
|
|
223
231
|
console.error = origError;
|
|
224
232
|
bar.stop();
|
|
225
|
-
|
|
233
|
+
const msg = err.message || String(err);
|
|
234
|
+
console.error(`\n Analysis failed: ${msg}\n`);
|
|
235
|
+
// Provide helpful guidance for known large-repo failure modes
|
|
236
|
+
if (msg.includes('Maximum call stack size exceeded') ||
|
|
237
|
+
msg.includes('call stack') ||
|
|
238
|
+
msg.includes('Map maximum size') ||
|
|
239
|
+
msg.includes('Invalid array length') ||
|
|
240
|
+
msg.includes('Invalid string length') ||
|
|
241
|
+
msg.includes('allocation failed') ||
|
|
242
|
+
msg.includes('heap out of memory') ||
|
|
243
|
+
msg.includes('JavaScript heap')) {
|
|
244
|
+
console.error(' This error typically occurs on very large repositories.');
|
|
245
|
+
console.error(' Suggestions:');
|
|
246
|
+
console.error(' 1. Add large vendored/generated directories to .gitnexusignore');
|
|
247
|
+
console.error(' 2. Increase Node.js heap: NODE_OPTIONS="--max-old-space-size=16384"');
|
|
248
|
+
console.error(' 3. Increase stack size: NODE_OPTIONS="--stack-size=4096"');
|
|
249
|
+
console.error('');
|
|
250
|
+
}
|
|
226
251
|
process.exitCode = 1;
|
|
227
252
|
return;
|
|
228
253
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely read a file inside a repo, rejecting any path that escapes
|
|
3
|
+
* `repoPath` via `..` traversal or absolute segments. Returns `null` if
|
|
4
|
+
* the path is outside the repo or the file can't be read.
|
|
5
|
+
*
|
|
6
|
+
* Used by every source-scan extractor under this directory. Kept as a
|
|
7
|
+
* single shared implementation so the path-traversal guard (security-
|
|
8
|
+
* sensitive) lives in exactly one place.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readSafe(repoPath: string, rel: string): string | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Safely read a file inside a repo, rejecting any path that escapes
|
|
5
|
+
* `repoPath` via `..` traversal or absolute segments. Returns `null` if
|
|
6
|
+
* the path is outside the repo or the file can't be read.
|
|
7
|
+
*
|
|
8
|
+
* Used by every source-scan extractor under this directory. Kept as a
|
|
9
|
+
* single shared implementation so the path-traversal guard (security-
|
|
10
|
+
* sensitive) lives in exactly one place.
|
|
11
|
+
*/
|
|
12
|
+
export function readSafe(repoPath, rel) {
|
|
13
|
+
const abs = path.resolve(repoPath, rel);
|
|
14
|
+
const base = path.resolve(repoPath);
|
|
15
|
+
const relToBase = path.relative(base, abs);
|
|
16
|
+
if (relToBase.startsWith('..') || path.isAbsolute(relToBase))
|
|
17
|
+
return null;
|
|
18
|
+
try {
|
|
19
|
+
return fs.readFileSync(abs, 'utf-8');
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import type { ContractExtractor, CypherExecutor } from '../contract-extractor.js';
|
|
2
2
|
import type { ExtractedContract, RepoHandle } from '../types.js';
|
|
3
|
+
export interface ProtoServiceInfo {
|
|
4
|
+
package: string;
|
|
5
|
+
serviceName: string;
|
|
6
|
+
methods: string[];
|
|
7
|
+
protoPath: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function buildProtoMap(repoPath: string): Promise<Map<string, ProtoServiceInfo[]>>;
|
|
10
|
+
export declare function resolveProtoConflict(_serviceName: string, sourceFilePath: string, candidates: ProtoServiceInfo[]): ProtoServiceInfo | null;
|
|
11
|
+
export declare function serviceContractId(pkg: string, serviceName: string): string;
|
|
3
12
|
export declare class GrpcExtractor implements ContractExtractor {
|
|
4
13
|
type: "grpc";
|
|
5
14
|
canExtract(_repo: RepoHandle): Promise<boolean>;
|
|
6
15
|
extract(_dbExecutor: CypherExecutor | null, repoPath: string, _repo: RepoHandle): Promise<ExtractedContract[]>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
private
|
|
16
|
+
/**
|
|
17
|
+
* Convert a plugin `GrpcDetection` into a concrete `ExtractedContract`
|
|
18
|
+
* by resolving the short service name against the proto map, building
|
|
19
|
+
* either a service-level (`grpc::pkg.Svc/*`) or method-level
|
|
20
|
+
* (`grpc::pkg.Svc/Method`) contract id, and selecting confidence
|
|
21
|
+
* based on whether the proto map had an entry.
|
|
22
|
+
*/
|
|
23
|
+
private detectionToContract;
|
|
15
24
|
private dedupe;
|
|
16
25
|
}
|