akbo-cli 0.0.0-stage → 2.0.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 +786 -2
- package/dist/catalog_store.d.ts +131 -0
- package/dist/catalog_store.js +506 -0
- package/dist/cleaner.d.ts +11 -0
- package/dist/cleaner.js +92 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1961 -0
- package/dist/dream_engine.d.ts +61 -0
- package/dist/dream_engine.js +330 -0
- package/dist/extractors/base.d.ts +35 -0
- package/dist/extractors/base.js +17 -0
- package/dist/extractors/custom_extractor.d.ts +55 -0
- package/dist/extractors/custom_extractor.js +198 -0
- package/dist/extractors/dotnet_extractor.d.ts +11 -0
- package/dist/extractors/dotnet_extractor.js +579 -0
- package/dist/extractors/golang_extractor.d.ts +11 -0
- package/dist/extractors/golang_extractor.js +73 -0
- package/dist/extractors/index.d.ts +14 -0
- package/dist/extractors/index.js +30 -0
- package/dist/extractors/jvm_extractor.d.ts +11 -0
- package/dist/extractors/jvm_extractor.js +319 -0
- package/dist/extractors/node_extractor.d.ts +11 -0
- package/dist/extractors/node_extractor.js +306 -0
- package/dist/extractors/proto_graphql_extractor.d.ts +11 -0
- package/dist/extractors/proto_graphql_extractor.js +125 -0
- package/dist/extractors/python_extractor.d.ts +11 -0
- package/dist/extractors/python_extractor.js +298 -0
- package/dist/extractors/rust_extractor.d.ts +11 -0
- package/dist/extractors/rust_extractor.js +66 -0
- package/dist/graph_builder.d.ts +87 -0
- package/dist/graph_builder.js +1516 -0
- package/dist/guard_service.d.ts +33 -0
- package/dist/guard_service.js +167 -0
- package/dist/harvester.d.ts +38 -0
- package/dist/harvester.js +461 -0
- package/dist/hook_generator.d.ts +34 -0
- package/dist/hook_generator.js +269 -0
- package/dist/importers/skill_importer.d.ts +43 -0
- package/dist/importers/skill_importer.js +470 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/indexer.d.ts +19 -0
- package/dist/indexer.js +108 -0
- package/dist/init_service.d.ts +37 -0
- package/dist/init_service.js +246 -0
- package/dist/mcp_server.d.ts +10 -0
- package/dist/mcp_server.js +846 -0
- package/dist/pool_resolver.d.ts +40 -0
- package/dist/pool_resolver.js +84 -0
- package/dist/provider.d.ts +135 -0
- package/dist/provider.js +880 -0
- package/dist/query_service.d.ts +33 -0
- package/dist/query_service.js +161 -0
- package/dist/schema_generator.d.ts +236 -0
- package/dist/schema_generator.js +264 -0
- package/dist/standards_loader.d.ts +7 -0
- package/dist/standards_loader.js +33 -0
- package/dist/types.d.ts +323 -0
- package/dist/types.js +123 -0
- package/dist/unit_synthesizer.d.ts +22 -0
- package/dist/unit_synthesizer.js +196 -0
- package/dist/validator.d.ts +13 -0
- package/dist/validator.js +152 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.js +16 -0
- package/dist/watcher.d.ts +38 -0
- package/dist/watcher.js +132 -0
- package/package.json +56 -6
- package/schemas/index-schema.json +98 -0
- package/schemas/knowledge-unit.json +154 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CodebaseExtractor } from './base.js';
|
|
2
|
+
export * from './base.js';
|
|
3
|
+
export { DotnetExtractor } from './dotnet_extractor.js';
|
|
4
|
+
export { JvmExtractor } from './jvm_extractor.js';
|
|
5
|
+
export { NodeExtractor } from './node_extractor.js';
|
|
6
|
+
export { PythonExtractor } from './python_extractor.js';
|
|
7
|
+
export { GolangExtractor } from './golang_extractor.js';
|
|
8
|
+
export { RustExtractor } from './rust_extractor.js';
|
|
9
|
+
export { ProtoGraphqlExtractor } from './proto_graphql_extractor.js';
|
|
10
|
+
export { CustomRegexExtractor } from './custom_extractor.js';
|
|
11
|
+
/**
|
|
12
|
+
* Returns the default array of polyglot extractors registered for the Harvester pipeline.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createDefaultExtractors(): CodebaseExtractor[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DotnetExtractor } from './dotnet_extractor.js';
|
|
2
|
+
import { JvmExtractor } from './jvm_extractor.js';
|
|
3
|
+
import { NodeExtractor } from './node_extractor.js';
|
|
4
|
+
import { PythonExtractor } from './python_extractor.js';
|
|
5
|
+
import { GolangExtractor } from './golang_extractor.js';
|
|
6
|
+
import { RustExtractor } from './rust_extractor.js';
|
|
7
|
+
import { ProtoGraphqlExtractor } from './proto_graphql_extractor.js';
|
|
8
|
+
export * from './base.js';
|
|
9
|
+
export { DotnetExtractor } from './dotnet_extractor.js';
|
|
10
|
+
export { JvmExtractor } from './jvm_extractor.js';
|
|
11
|
+
export { NodeExtractor } from './node_extractor.js';
|
|
12
|
+
export { PythonExtractor } from './python_extractor.js';
|
|
13
|
+
export { GolangExtractor } from './golang_extractor.js';
|
|
14
|
+
export { RustExtractor } from './rust_extractor.js';
|
|
15
|
+
export { ProtoGraphqlExtractor } from './proto_graphql_extractor.js';
|
|
16
|
+
export { CustomRegexExtractor } from './custom_extractor.js';
|
|
17
|
+
/**
|
|
18
|
+
* Returns the default array of polyglot extractors registered for the Harvester pipeline.
|
|
19
|
+
*/
|
|
20
|
+
export function createDefaultExtractors() {
|
|
21
|
+
return [
|
|
22
|
+
new DotnetExtractor(),
|
|
23
|
+
new JvmExtractor(),
|
|
24
|
+
new NodeExtractor(),
|
|
25
|
+
new PythonExtractor(),
|
|
26
|
+
new GolangExtractor(),
|
|
27
|
+
new RustExtractor(),
|
|
28
|
+
new ProtoGraphqlExtractor()
|
|
29
|
+
];
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CodebaseExtractor } from './base.js';
|
|
2
|
+
import type { ManifestSummary, SchemaSummary, RouteOrSignature } from '../types.js';
|
|
3
|
+
export declare class JvmExtractor implements CodebaseExtractor {
|
|
4
|
+
readonly name = "jvm";
|
|
5
|
+
canExtractManifest(filePath: string): boolean;
|
|
6
|
+
extractManifest(filePath: string, content: string): ManifestSummary | null;
|
|
7
|
+
canExtractSchema(filePath: string): boolean;
|
|
8
|
+
extractSchemas(filePath: string, content: string): SchemaSummary[];
|
|
9
|
+
canExtractRoutes(filePath: string): boolean;
|
|
10
|
+
extractRoutesAndCommands(filePath: string, content: string): RouteOrSignature[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { cleanClientUrl } from './base.js';
|
|
3
|
+
export class JvmExtractor {
|
|
4
|
+
name = 'jvm';
|
|
5
|
+
canExtractManifest(filePath) {
|
|
6
|
+
const lower = path.basename(filePath).toLowerCase();
|
|
7
|
+
return (lower === 'pom.xml' ||
|
|
8
|
+
lower === 'build.gradle' ||
|
|
9
|
+
lower === 'build.gradle.kts' ||
|
|
10
|
+
lower === 'settings.gradle' ||
|
|
11
|
+
lower === 'settings.gradle.kts');
|
|
12
|
+
}
|
|
13
|
+
extractManifest(filePath, content) {
|
|
14
|
+
const filename = path.basename(filePath);
|
|
15
|
+
const lower = filename.toLowerCase();
|
|
16
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
17
|
+
if (lower === 'pom.xml') {
|
|
18
|
+
let parent;
|
|
19
|
+
const parentBlock = content.match(/<parent>([\s\S]*?)<\/parent>/);
|
|
20
|
+
if (parentBlock) {
|
|
21
|
+
const pGroup = parentBlock[1].match(/<groupId>(.*?)<\/groupId>/);
|
|
22
|
+
const pArtifact = parentBlock[1].match(/<artifactId>(.*?)<\/artifactId>/);
|
|
23
|
+
const pVersion = parentBlock[1].match(/<version>(.*?)<\/version>/);
|
|
24
|
+
parent = {
|
|
25
|
+
groupId: pGroup ? pGroup[1].trim() : undefined,
|
|
26
|
+
artifactId: pArtifact ? pArtifact[1].trim() : undefined,
|
|
27
|
+
version: pVersion ? pVersion[1].trim() : undefined
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const withoutParent = content.replace(/<parent>[\s\S]*?<\/parent>/, '');
|
|
31
|
+
const groupIdMatch = withoutParent.match(/<groupId>(.*?)<\/groupId>/) || (parent?.groupId ? [null, parent.groupId] : null);
|
|
32
|
+
const artifactIdMatch = withoutParent.match(/<artifactId>(.*?)<\/artifactId>/);
|
|
33
|
+
const versionMatch = withoutParent.match(/<version>(.*?)<\/version>/) || (parent?.version ? [null, parent.version] : null);
|
|
34
|
+
const nameMatch = withoutParent.match(/<name>(.*?)<\/name>/);
|
|
35
|
+
const modules = [];
|
|
36
|
+
const moduleMatches = Array.from(content.matchAll(/<module>(.*?)<\/module>/g));
|
|
37
|
+
for (const m of moduleMatches) {
|
|
38
|
+
modules.push(m[1].trim());
|
|
39
|
+
}
|
|
40
|
+
const dependencies = [];
|
|
41
|
+
const depMatches = Array.from(content.matchAll(/<dependency>([\s\S]*?)<\/dependency>/g));
|
|
42
|
+
for (const dep of depMatches) {
|
|
43
|
+
const art = dep[1].match(/<artifactId>(.*?)<\/artifactId>/);
|
|
44
|
+
const grp = dep[1].match(/<groupId>(.*?)<\/groupId>/);
|
|
45
|
+
if (art) {
|
|
46
|
+
dependencies.push(grp ? `${grp[1].trim()}:${art[1].trim()}` : art[1].trim());
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
path: normalized,
|
|
51
|
+
type: 'maven',
|
|
52
|
+
contentSummary: {
|
|
53
|
+
kind: 'maven',
|
|
54
|
+
groupId: groupIdMatch ? groupIdMatch[1].trim() : undefined,
|
|
55
|
+
artifactId: artifactIdMatch ? artifactIdMatch[1].trim() : undefined,
|
|
56
|
+
version: versionMatch ? versionMatch[1].trim() : undefined,
|
|
57
|
+
name: nameMatch ? nameMatch[1].trim() : undefined,
|
|
58
|
+
parent,
|
|
59
|
+
modules: modules.length > 0 ? modules : undefined,
|
|
60
|
+
dependencies: dependencies.slice(0, 30)
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// Gradle manifests
|
|
65
|
+
const isSettings = lower.startsWith('settings.gradle');
|
|
66
|
+
if (isSettings) {
|
|
67
|
+
const rootProjMatch = content.match(/rootProject\.name\s*=\s*['"]([^'"]+)['"]/);
|
|
68
|
+
const includes = Array.from(content.matchAll(/include(?:\s+|\s*\(\s*)['"]([^'"]+)['"]/g)).map(m => m[1]);
|
|
69
|
+
return {
|
|
70
|
+
path: normalized,
|
|
71
|
+
type: 'gradle',
|
|
72
|
+
contentSummary: {
|
|
73
|
+
kind: 'gradle_settings',
|
|
74
|
+
rootProjectName: rootProjMatch ? rootProjMatch[1] : undefined,
|
|
75
|
+
subprojects: includes
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const plugins = Array.from(content.matchAll(/id\s*(?:\(\s*['"]|['"])([^'"\)]+)/g)).map(m => m[1]);
|
|
80
|
+
const dependencies = [];
|
|
81
|
+
const depMatches = Array.from(content.matchAll(/(?:implementation|api|compileOnly|runtimeOnly|testImplementation)\s*(?:\(\s*['"]|['"])([^'"\)]+)/g));
|
|
82
|
+
for (const d of depMatches) {
|
|
83
|
+
dependencies.push(d[1]);
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
path: normalized,
|
|
87
|
+
type: 'gradle',
|
|
88
|
+
contentSummary: {
|
|
89
|
+
kind: 'gradle_build',
|
|
90
|
+
plugins: plugins.length > 0 ? plugins : undefined,
|
|
91
|
+
dependencies: dependencies.slice(0, 30)
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
canExtractSchema(filePath) {
|
|
96
|
+
const lower = filePath.toLowerCase();
|
|
97
|
+
return lower.endsWith('.java') || lower.endsWith('.kt');
|
|
98
|
+
}
|
|
99
|
+
extractSchemas(filePath, content) {
|
|
100
|
+
const schemas = [];
|
|
101
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
102
|
+
const jpaModels = [];
|
|
103
|
+
if (content.includes('@Entity') || content.includes('@Table')) {
|
|
104
|
+
const classMatch = content.match(/(?:public\s+)?(?:class|record)\s+([\p{L}\p{N}_]+)/u);
|
|
105
|
+
const tableMatch = content.match(/@Table\s*\(\s*(?:.*?\bname\s*=\s*)?["']([^"']+)["']/);
|
|
106
|
+
if (classMatch)
|
|
107
|
+
jpaModels.push(classMatch[1]);
|
|
108
|
+
if (tableMatch)
|
|
109
|
+
jpaModels.push(tableMatch[1]);
|
|
110
|
+
}
|
|
111
|
+
if (content.includes('Repository')) {
|
|
112
|
+
const repoMatches = Array.from(content.matchAll(/interface\s+([\p{L}\p{N}_]+Repository)\s*(?:<[^>]+>)?\s*extends\s+(?:[A-Za-z0-9_.]*Repository)<([\p{L}\p{N}_]+)/gu));
|
|
113
|
+
for (const rm of repoMatches) {
|
|
114
|
+
jpaModels.push(rm[1], rm[2]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (jpaModels.length > 0) {
|
|
118
|
+
schemas.push({
|
|
119
|
+
file: normalized,
|
|
120
|
+
type: 'jpa',
|
|
121
|
+
tablesOrModels: [...new Set(jpaModels)]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return schemas;
|
|
125
|
+
}
|
|
126
|
+
canExtractRoutes(filePath) {
|
|
127
|
+
const lower = filePath.toLowerCase();
|
|
128
|
+
return lower.endsWith('.java') || lower.endsWith('.kt');
|
|
129
|
+
}
|
|
130
|
+
extractRoutesAndCommands(filePath, content) {
|
|
131
|
+
const items = [];
|
|
132
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
133
|
+
// 1. Spring Boot Controllers
|
|
134
|
+
if (content.includes('@RestController') || content.includes('@Controller') || (content.includes('@RequestMapping') && !content.includes('@KafkaListener'))) {
|
|
135
|
+
const classReqMatch = content.match(/@RequestMapping\s*\(\s*(?:(?:value|path)\s*=\s*)?["']([^"']+)["']/);
|
|
136
|
+
const classPrefix = classReqMatch ? classReqMatch[1].replace(/^\//, '').replace(/\/$/, '') : '';
|
|
137
|
+
const classDeclMatch = content.match(/(?:public\s+)?(?:class|record)\s+[\p{L}\p{N}_]+[^{]*\{/u);
|
|
138
|
+
const classBody = classDeclMatch ? content.slice(classDeclMatch.index + classDeclMatch[0].length) : content;
|
|
139
|
+
const methodRegex = /@(GetMapping|PostMapping|PutMapping|DeleteMapping|PatchMapping|RequestMapping)(?:\s*\(([^)]*)\))?[\s\S]*?(?:public|protected|private|\s+)*(?:final|\s+)*(?:(?:ResponseEntity|Flux|Mono|List|Set|Collection|Page)<[^>]+>|[\p{L}\p{N}_<>\[\], ?]+)\s+([\p{L}\p{N}_]+)\s*\(([\s\S]*?)\)\s*(?:throws\s+[^{;]+)?(?=[{;])/gu;
|
|
140
|
+
for (const sm of classBody.matchAll(methodRegex)) {
|
|
141
|
+
let verb = 'GET';
|
|
142
|
+
if (sm[1] === 'PostMapping')
|
|
143
|
+
verb = 'POST';
|
|
144
|
+
else if (sm[1] === 'PutMapping')
|
|
145
|
+
verb = 'PUT';
|
|
146
|
+
else if (sm[1] === 'DeleteMapping')
|
|
147
|
+
verb = 'DELETE';
|
|
148
|
+
else if (sm[1] === 'PatchMapping')
|
|
149
|
+
verb = 'PATCH';
|
|
150
|
+
else if (sm[1] === 'RequestMapping') {
|
|
151
|
+
const verbMatch = sm[2] ? sm[2].match(/method\s*=\s*RequestMethod\.([A-Z]+)/) : null;
|
|
152
|
+
if (verbMatch)
|
|
153
|
+
verb = verbMatch[1];
|
|
154
|
+
}
|
|
155
|
+
let subPath = '';
|
|
156
|
+
if (sm[2]) {
|
|
157
|
+
const pathMatch = sm[2].match(/(?:(?:value|path)\s*=\s*)?["']([^"']*)["']/);
|
|
158
|
+
if (pathMatch)
|
|
159
|
+
subPath = pathMatch[1].replace(/^\//, '').replace(/\/$/, '');
|
|
160
|
+
}
|
|
161
|
+
const fullRoute = classPrefix && subPath
|
|
162
|
+
? `/${classPrefix}/${subPath}`
|
|
163
|
+
: classPrefix
|
|
164
|
+
? `/${classPrefix}`
|
|
165
|
+
: subPath
|
|
166
|
+
? `/${subPath}`
|
|
167
|
+
: '/';
|
|
168
|
+
const methodName = sm[3];
|
|
169
|
+
const params = sm[4].replace(/\s+/g, ' ').trim();
|
|
170
|
+
const javaPubs = [];
|
|
171
|
+
const kfRegex = /(?:kafkaTemplate|rabbitTemplate)\.(?:send|convertAndSend)\s*\(\s*["']([^"']+)["']/g;
|
|
172
|
+
for (const km of content.matchAll(kfRegex)) {
|
|
173
|
+
if (!javaPubs.includes(km[1]))
|
|
174
|
+
javaPubs.push(km[1]);
|
|
175
|
+
}
|
|
176
|
+
const javaPubSuffix = javaPubs.length > 0 ? ` [publishes: ${javaPubs.join(', ')}]` : '';
|
|
177
|
+
items.push({
|
|
178
|
+
file: normalized,
|
|
179
|
+
framework: 'SpringBoot',
|
|
180
|
+
method: verb,
|
|
181
|
+
identifier: methodName,
|
|
182
|
+
signature: `${verb} ${fullRoute} -> ${methodName}(${params})${javaPubSuffix}`
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// 2. Quarkus & JAX-RS: @Path
|
|
187
|
+
if (content.includes('@Path')) {
|
|
188
|
+
const classPathMatch = content.match(/@Path\s*\(\s*["']([^"']+)["']/);
|
|
189
|
+
const classPrefix = classPathMatch ? classPathMatch[1].replace(/^\//, '').replace(/\/$/, '') : '';
|
|
190
|
+
const classDeclMatch = content.match(/(?:public\s+)?(?:class|interface)\s+[\p{L}\p{N}_]+[^{]*\{/u);
|
|
191
|
+
const classBody = classDeclMatch ? content.slice(classDeclMatch.index + classDeclMatch[0].length) : content;
|
|
192
|
+
const jaxRegex = /@(GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD)(?:[\s\S]*?@Path\s*\(\s*["']([^"']+)["']\))?[\s\S]*?(?:public|protected|private|\s+)*(?:final|\s+)*(?:[\p{L}\p{N}_<>\[\], ?]+)\s+([\p{L}\p{N}_]+)\s*\(([\s\S]*?)\)\s*(?:throws\s+[^{;]+)?(?=[{;])/gu;
|
|
193
|
+
for (const jm of classBody.matchAll(jaxRegex)) {
|
|
194
|
+
const verb = jm[1].toUpperCase();
|
|
195
|
+
const subPath = jm[2] ? jm[2].replace(/^\//, '').replace(/\/$/, '') : '';
|
|
196
|
+
const fullRoute = classPrefix && subPath
|
|
197
|
+
? `/${classPrefix}/${subPath}`
|
|
198
|
+
: classPrefix
|
|
199
|
+
? `/${classPrefix}`
|
|
200
|
+
: subPath
|
|
201
|
+
? `/${subPath}`
|
|
202
|
+
: '/';
|
|
203
|
+
const methodName = jm[3];
|
|
204
|
+
const params = jm[4].replace(/\s+/g, ' ').trim();
|
|
205
|
+
items.push({
|
|
206
|
+
file: normalized,
|
|
207
|
+
framework: 'Quarkus/JAX-RS',
|
|
208
|
+
method: verb,
|
|
209
|
+
identifier: methodName,
|
|
210
|
+
signature: `${verb} ${fullRoute} -> ${methodName}(${params})`
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// 3. Spring Kafka Listeners
|
|
215
|
+
if (content.includes('@KafkaListener')) {
|
|
216
|
+
const kafkaMatches = Array.from(content.matchAll(/@KafkaListener\s*\(\s*(?:.*?\b(?:topics|topicPattern)\s*=\s*)?["']?([^"'),\s]+)["']?[\s\S]*?(?:public|protected|private)?\s+void\s+([\p{L}\p{N}_]+)\s*\(([^)]*)\)/gu));
|
|
217
|
+
for (const km of kafkaMatches) {
|
|
218
|
+
const topic = km[1];
|
|
219
|
+
const methodName = km[2];
|
|
220
|
+
const params = km[3].trim();
|
|
221
|
+
items.push({
|
|
222
|
+
file: normalized,
|
|
223
|
+
framework: 'Kafka',
|
|
224
|
+
identifier: methodName,
|
|
225
|
+
signature: `@KafkaListener topic: "${topic}" -> ${methodName}(${params})`
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// 4. Spring RabbitMQ Listeners
|
|
230
|
+
if (content.includes('@RabbitListener')) {
|
|
231
|
+
const rabbitMatches = Array.from(content.matchAll(/@RabbitListener\s*\(\s*(?:.*?\bqueues\s*=\s*)?["']?([^"'),\s]+)["']?[\s\S]*?(?:public|protected|private)?\s+void\s+([\p{L}\p{N}_]+)\s*\(([^)]*)\)/gu));
|
|
232
|
+
for (const rm of rabbitMatches) {
|
|
233
|
+
const queue = rm[1];
|
|
234
|
+
const methodName = rm[2];
|
|
235
|
+
const params = rm[3].trim();
|
|
236
|
+
items.push({
|
|
237
|
+
file: normalized,
|
|
238
|
+
framework: 'RabbitMQ',
|
|
239
|
+
identifier: methodName,
|
|
240
|
+
signature: `@RabbitListener queue: "${queue}" -> ${methodName}(${params})`
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// 5. Java & Kotlin HTTP Client calls: WebClient and RestTemplate
|
|
245
|
+
const webClientRegex = /(?:\bwebClient)\s*\.\s*(get|post|put|delete|patch)\s*\(\s*\)[\s\S]*?\.\s*uri\s*\(\s*["']([^"']+)["']/gu;
|
|
246
|
+
for (const match of content.matchAll(webClientRegex)) {
|
|
247
|
+
const verb = match[1].toUpperCase();
|
|
248
|
+
const cleanPath = cleanClientUrl(match[2]);
|
|
249
|
+
if (cleanPath) {
|
|
250
|
+
items.push({
|
|
251
|
+
file: normalized,
|
|
252
|
+
framework: 'HttpClient',
|
|
253
|
+
method: verb,
|
|
254
|
+
identifier: cleanPath,
|
|
255
|
+
signature: `${verb} ${cleanPath} [HTTP Client]`
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const restTemplateRegex = /(?:\brestTemplate)\s*\.\s*(getForObject|getForEntity|postForObject|postForEntity|put|delete|exchange)\s*\(\s*["']([^"']+)["']/gu;
|
|
260
|
+
for (const match of content.matchAll(restTemplateRegex)) {
|
|
261
|
+
const rawMethod = match[1];
|
|
262
|
+
let verb = 'GET';
|
|
263
|
+
if (rawMethod.startsWith('post'))
|
|
264
|
+
verb = 'POST';
|
|
265
|
+
else if (rawMethod.startsWith('put'))
|
|
266
|
+
verb = 'PUT';
|
|
267
|
+
else if (rawMethod.startsWith('delete'))
|
|
268
|
+
verb = 'DELETE';
|
|
269
|
+
else if (rawMethod === 'exchange')
|
|
270
|
+
verb = 'ANY';
|
|
271
|
+
const cleanPath = cleanClientUrl(match[2]);
|
|
272
|
+
if (cleanPath) {
|
|
273
|
+
items.push({
|
|
274
|
+
file: normalized,
|
|
275
|
+
framework: 'HttpClient',
|
|
276
|
+
method: verb,
|
|
277
|
+
identifier: cleanPath,
|
|
278
|
+
signature: `${verb} ${cleanPath} [HTTP Client]`
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// 6. Java & Kotlin gRPC Client calls
|
|
283
|
+
const javaGrpcRegex = /(?:\b(?:blockingStub|stub|futureStub|asyncStub|[A-Za-z0-9_]+Stub))\s*\.\s*([A-Za-z0-9_]+)\s*\(/gu;
|
|
284
|
+
for (const match of content.matchAll(javaGrpcRegex)) {
|
|
285
|
+
const method = match[1];
|
|
286
|
+
if (!['withDeadline', 'withDeadlineAfter', 'withInterceptors', 'withCompression', 'withCallCredentials', 'getChannel', 'equals', 'hashCode', 'toString'].includes(method)) {
|
|
287
|
+
items.push({
|
|
288
|
+
file: normalized,
|
|
289
|
+
framework: 'GrpcClient',
|
|
290
|
+
method: 'RPC',
|
|
291
|
+
identifier: method,
|
|
292
|
+
signature: `rpc client: ${method}`
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// 7. Java gRPC Service Implementations
|
|
297
|
+
if (content.includes('ImplBase') || content.includes('Grpc.')) {
|
|
298
|
+
const grpcClassMatch = content.match(/(?:public\s+)?class\s+([\p{L}\p{N}_]+)\s+extends\s+([\p{L}\p{N}_.]+ImplBase)/u);
|
|
299
|
+
if (grpcClassMatch) {
|
|
300
|
+
const className = grpcClassMatch[1];
|
|
301
|
+
const baseService = grpcClassMatch[2].split('.').pop()?.replace('ImplBase', '') || className;
|
|
302
|
+
const methodRegex = /public\s+void\s+([\p{L}\p{N}_]+)\s*\(\s*([\p{L}\p{N}_]+)\s+request,\s*StreamObserver<([\p{L}\p{N}_]+)>\s+responseObserver\s*\)/gu;
|
|
303
|
+
for (const m of content.matchAll(methodRegex)) {
|
|
304
|
+
const methodName = m[1];
|
|
305
|
+
const reqType = m[2];
|
|
306
|
+
const respType = m[3];
|
|
307
|
+
items.push({
|
|
308
|
+
file: normalized,
|
|
309
|
+
framework: 'gRPC/Java',
|
|
310
|
+
method: 'RPC',
|
|
311
|
+
identifier: methodName,
|
|
312
|
+
signature: `rpc ${baseService}.${methodName}(${reqType}) returns (${respType})`
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return items;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CodebaseExtractor } from './base.js';
|
|
2
|
+
import type { ManifestSummary, SchemaSummary, RouteOrSignature } from '../types.js';
|
|
3
|
+
export declare class NodeExtractor implements CodebaseExtractor {
|
|
4
|
+
readonly name = "node";
|
|
5
|
+
canExtractManifest(filePath: string): boolean;
|
|
6
|
+
extractManifest(filePath: string, content: string): ManifestSummary | null;
|
|
7
|
+
canExtractSchema(filePath: string): boolean;
|
|
8
|
+
extractSchemas(filePath: string, content: string): SchemaSummary[];
|
|
9
|
+
canExtractRoutes(filePath: string): boolean;
|
|
10
|
+
extractRoutesAndCommands(filePath: string, content: string): RouteOrSignature[];
|
|
11
|
+
}
|