gitnexus 1.6.4-rc.46 → 1.6.4-rc.47
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/core/ingestion/entry-point-scoring.d.ts +0 -18
- package/dist/core/ingestion/entry-point-scoring.js +7 -188
- package/dist/core/ingestion/framework-detection.d.ts +0 -120
- package/dist/core/ingestion/framework-detection.js +7 -365
- package/dist/core/ingestion/language-provider.d.ts +15 -0
- package/dist/core/ingestion/languages/c-cpp.js +70 -0
- package/dist/core/ingestion/languages/cobol.js +2 -0
- package/dist/core/ingestion/languages/csharp.js +49 -0
- package/dist/core/ingestion/languages/dart.js +36 -0
- package/dist/core/ingestion/languages/go.js +39 -0
- package/dist/core/ingestion/languages/java.js +21 -0
- package/dist/core/ingestion/languages/kotlin.js +41 -0
- package/dist/core/ingestion/languages/php.js +35 -0
- package/dist/core/ingestion/languages/python.js +15 -0
- package/dist/core/ingestion/languages/ruby.js +25 -0
- package/dist/core/ingestion/languages/rust.js +35 -0
- package/dist/core/ingestion/languages/swift.js +54 -0
- package/dist/core/ingestion/languages/typescript.js +46 -0
- package/dist/core/ingestion/languages/vue.js +2 -0
- package/package.json +1 -1
|
@@ -10,24 +10,6 @@
|
|
|
10
10
|
* This module is language-agnostic - language-specific patterns are defined per language.
|
|
11
11
|
*/
|
|
12
12
|
import { SupportedLanguages } from '../../_shared/index.js';
|
|
13
|
-
export declare const ENTRY_POINT_PATTERNS: {
|
|
14
|
-
javascript: RegExp[];
|
|
15
|
-
typescript: RegExp[];
|
|
16
|
-
python: RegExp[];
|
|
17
|
-
java: RegExp[];
|
|
18
|
-
kotlin: RegExp[];
|
|
19
|
-
csharp: RegExp[];
|
|
20
|
-
go: RegExp[];
|
|
21
|
-
rust: RegExp[];
|
|
22
|
-
c: RegExp[];
|
|
23
|
-
cpp: RegExp[];
|
|
24
|
-
swift: RegExp[];
|
|
25
|
-
php: RegExp[];
|
|
26
|
-
ruby: RegExp[];
|
|
27
|
-
dart: RegExp[];
|
|
28
|
-
vue: any[];
|
|
29
|
-
cobol: any[];
|
|
30
|
-
};
|
|
31
13
|
export interface EntryPointScoreResult {
|
|
32
14
|
score: number;
|
|
33
15
|
reasons: string[];
|
|
@@ -10,17 +10,13 @@
|
|
|
10
10
|
* This module is language-agnostic - language-specific patterns are defined per language.
|
|
11
11
|
*/
|
|
12
12
|
import { detectFrameworkFromPath } from './framework-detection.js';
|
|
13
|
-
import {
|
|
13
|
+
import { providers } from './languages/index.js';
|
|
14
14
|
// ============================================================================
|
|
15
|
-
// NAME PATTERNS
|
|
15
|
+
// NAME PATTERNS
|
|
16
16
|
// ============================================================================
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Universal patterns are separated from per-language patterns so the per-language
|
|
22
|
-
* table can use `satisfies Record<SupportedLanguages, RegExp[]>` for compile-time
|
|
23
|
-
* exhaustiveness — the compiler catches any missing language entry.
|
|
18
|
+
* Universal entry point naming patterns shared across all languages.
|
|
19
|
+
* Per-language patterns live on each LanguageProvider.entryPointPatterns.
|
|
24
20
|
*/
|
|
25
21
|
const UNIVERSAL_ENTRY_POINT_PATTERNS = [
|
|
26
22
|
/^(main|init|bootstrap|start|run|setup|configure)$/i,
|
|
@@ -36,187 +32,10 @@ const UNIVERSAL_ENTRY_POINT_PATTERNS = [
|
|
|
36
32
|
/^fire[A-Z]/, // fireEvent
|
|
37
33
|
/^emit[A-Z]/, // emitEvent
|
|
38
34
|
];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
[SupportedLanguages.JavaScript]: [
|
|
42
|
-
/^use[A-Z]/, // React hooks (useEffect, etc.)
|
|
43
|
-
],
|
|
44
|
-
[SupportedLanguages.TypeScript]: [
|
|
45
|
-
/^use[A-Z]/, // React hooks
|
|
46
|
-
],
|
|
47
|
-
// Python
|
|
48
|
-
[SupportedLanguages.Python]: [
|
|
49
|
-
/^app$/, // Flask/FastAPI app
|
|
50
|
-
/^(get|post|put|delete|patch)_/i, // REST conventions
|
|
51
|
-
/^api_/, // API functions
|
|
52
|
-
/^view_/, // Django views
|
|
53
|
-
],
|
|
54
|
-
// Java
|
|
55
|
-
[SupportedLanguages.Java]: [
|
|
56
|
-
/^do[A-Z]/, // doGet, doPost (Servlets)
|
|
57
|
-
/^create[A-Z]/, // Factory patterns
|
|
58
|
-
/^build[A-Z]/, // Builder patterns
|
|
59
|
-
/Service$/, // UserService
|
|
60
|
-
],
|
|
61
|
-
// Kotlin
|
|
62
|
-
[SupportedLanguages.Kotlin]: [
|
|
63
|
-
/^on(Create|Start|Resume|Pause|Stop|Destroy)$/, // Android lifecycle
|
|
64
|
-
/^do[A-Z]/, // doGet, doPost (shared JVM Servlet pattern)
|
|
65
|
-
/^create[A-Z]/, // Factory patterns
|
|
66
|
-
/^build[A-Z]/, // Builder patterns
|
|
67
|
-
/ViewModel$/, // MVVM pattern (Android)
|
|
68
|
-
/^module$/, // Ktor module entry point
|
|
69
|
-
/Service$/, // Service classes
|
|
70
|
-
],
|
|
71
|
-
// C#
|
|
72
|
-
[SupportedLanguages.CSharp]: [
|
|
73
|
-
/^(Get|Post|Put|Delete|Patch)/, // ASP.NET action methods
|
|
74
|
-
/Action$/, // MVC actions
|
|
75
|
-
/^On[A-Z]/, // Event handlers / Blazor lifecycle
|
|
76
|
-
/Async$/, // Async entry points
|
|
77
|
-
/^Configure$/, // Startup.Configure
|
|
78
|
-
/^ConfigureServices$/, // Startup.ConfigureServices
|
|
79
|
-
/^Handle$/, // MediatR / generic handler
|
|
80
|
-
/^Execute$/, // Command pattern
|
|
81
|
-
/^Invoke$/, // Middleware Invoke
|
|
82
|
-
/^Map[A-Z]/, // Minimal API MapGet, MapPost
|
|
83
|
-
/Service$/, // Service classes
|
|
84
|
-
/^Seed/, // Database seeding
|
|
85
|
-
],
|
|
86
|
-
// Go
|
|
87
|
-
[SupportedLanguages.Go]: [
|
|
88
|
-
/Handler$/, // http.Handler pattern
|
|
89
|
-
/^Serve/, // ServeHTTP
|
|
90
|
-
/^New[A-Z]/, // Constructor pattern (returns new instance)
|
|
91
|
-
/^Make[A-Z]/, // Make functions
|
|
92
|
-
],
|
|
93
|
-
// Rust
|
|
94
|
-
[SupportedLanguages.Rust]: [
|
|
95
|
-
/^(get|post|put|delete)_handler$/i,
|
|
96
|
-
/^handle_/, // handle_request
|
|
97
|
-
/^new$/, // Constructor pattern
|
|
98
|
-
/^run$/, // run entry point
|
|
99
|
-
/^spawn/, // Async spawn
|
|
100
|
-
],
|
|
101
|
-
// C - explicit main() boost plus common C entry point conventions
|
|
102
|
-
[SupportedLanguages.C]: [
|
|
103
|
-
/^main$/, // THE entry point
|
|
104
|
-
/^init_/, // init_server, init_client
|
|
105
|
-
/_init$/, // module_init, server_init
|
|
106
|
-
/^start_/, // start_server
|
|
107
|
-
/_start$/, // thread_start
|
|
108
|
-
/^run_/, // run_loop
|
|
109
|
-
/_run$/, // event_run
|
|
110
|
-
/^stop_/, // stop_server
|
|
111
|
-
/_stop$/, // service_stop
|
|
112
|
-
/^open_/, // open_connection
|
|
113
|
-
/_open$/, // file_open
|
|
114
|
-
/^close_/, // close_connection
|
|
115
|
-
/_close$/, // socket_close
|
|
116
|
-
/^create_/, // create_session
|
|
117
|
-
/_create$/, // object_create
|
|
118
|
-
/^destroy_/, // destroy_session
|
|
119
|
-
/_destroy$/, // object_destroy
|
|
120
|
-
/^handle_/, // handle_request
|
|
121
|
-
/_handler$/, // signal_handler
|
|
122
|
-
/_callback$/, // event_callback
|
|
123
|
-
/^cmd_/, // tmux: cmd_new_window, cmd_attach_session
|
|
124
|
-
/^server_/, // server_start, server_loop
|
|
125
|
-
/^client_/, // client_connect
|
|
126
|
-
/^session_/, // session_create
|
|
127
|
-
/^window_/, // window_resize (tmux)
|
|
128
|
-
/^key_/, // key_press
|
|
129
|
-
/^input_/, // input_parse
|
|
130
|
-
/^output_/, // output_write
|
|
131
|
-
/^notify_/, // notify_client
|
|
132
|
-
/^control_/, // control_start
|
|
133
|
-
],
|
|
134
|
-
// C++ - same as C plus OOP/template patterns
|
|
135
|
-
[SupportedLanguages.CPlusPlus]: [
|
|
136
|
-
/^main$/, // THE entry point
|
|
137
|
-
/^init_/,
|
|
138
|
-
/_init$/,
|
|
139
|
-
/^Create[A-Z]/, // Factory patterns
|
|
140
|
-
/^create_/,
|
|
141
|
-
/^Run$/, // Run methods
|
|
142
|
-
/^run$/,
|
|
143
|
-
/^Start$/, // Start methods
|
|
144
|
-
/^start$/,
|
|
145
|
-
/^handle_/,
|
|
146
|
-
/_handler$/,
|
|
147
|
-
/_callback$/,
|
|
148
|
-
/^OnEvent/, // Event callbacks
|
|
149
|
-
/^on_/,
|
|
150
|
-
/::Run$/, // Class::Run
|
|
151
|
-
/::Start$/, // Class::Start
|
|
152
|
-
/::Init$/, // Class::Init
|
|
153
|
-
/::Execute$/, // Class::Execute
|
|
154
|
-
],
|
|
155
|
-
// Swift / iOS
|
|
156
|
-
[SupportedLanguages.Swift]: [
|
|
157
|
-
/^viewDidLoad$/, // UIKit lifecycle
|
|
158
|
-
/^viewWillAppear$/, // UIKit lifecycle
|
|
159
|
-
/^viewDidAppear$/, // UIKit lifecycle
|
|
160
|
-
/^viewWillDisappear$/, // UIKit lifecycle
|
|
161
|
-
/^viewDidDisappear$/, // UIKit lifecycle
|
|
162
|
-
/^application\(/, // AppDelegate methods
|
|
163
|
-
/^scene\(/, // SceneDelegate methods
|
|
164
|
-
/^body$/, // SwiftUI View.body
|
|
165
|
-
/Coordinator$/, // Coordinator pattern
|
|
166
|
-
/^sceneDidBecomeActive$/, // SceneDelegate lifecycle
|
|
167
|
-
/^sceneWillResignActive$/, // SceneDelegate lifecycle
|
|
168
|
-
/^didFinishLaunchingWithOptions$/, // AppDelegate
|
|
169
|
-
/ViewController$/, // ViewController classes
|
|
170
|
-
/^configure[A-Z]/, // Configuration methods
|
|
171
|
-
/^setup[A-Z]/, // Setup methods
|
|
172
|
-
/^makeBody$/, // SwiftUI ViewModifier
|
|
173
|
-
],
|
|
174
|
-
// PHP / Laravel
|
|
175
|
-
[SupportedLanguages.PHP]: [
|
|
176
|
-
/Controller$/, // UserController (class name convention)
|
|
177
|
-
/^handle$/, // Job::handle(), Listener::handle()
|
|
178
|
-
/^execute$/, // Command::execute()
|
|
179
|
-
/^boot$/, // ServiceProvider::boot()
|
|
180
|
-
/^register$/, // ServiceProvider::register()
|
|
181
|
-
/^__invoke$/, // Invokable controllers/actions
|
|
182
|
-
/^(index|show|store|update|destroy|create|edit)$/, // RESTful resource methods
|
|
183
|
-
/^(get|post|put|delete|patch)[A-Z]/, // Explicit HTTP method actions
|
|
184
|
-
/^run$/, // Command/Job run()
|
|
185
|
-
/^fire$/, // Event fire()
|
|
186
|
-
/^dispatch$/, // Dispatchable jobs
|
|
187
|
-
/Service$/, // UserService (Service layer)
|
|
188
|
-
/Repository$/, // UserRepository (Repository pattern)
|
|
189
|
-
/^find$/, // Repository::find()
|
|
190
|
-
/^findAll$/, // Repository::findAll()
|
|
191
|
-
/^save$/, // Repository::save()
|
|
192
|
-
/^delete$/, // Repository::delete()
|
|
193
|
-
],
|
|
194
|
-
// Ruby
|
|
195
|
-
[SupportedLanguages.Ruby]: [
|
|
196
|
-
/^call$/, // Service objects (MyService.call)
|
|
197
|
-
/^perform$/, // Background jobs (Sidekiq, ActiveJob)
|
|
198
|
-
/^execute$/, // Command pattern
|
|
199
|
-
],
|
|
200
|
-
// Dart / Flutter
|
|
201
|
-
[SupportedLanguages.Dart]: [
|
|
202
|
-
/^main$/, // App entry
|
|
203
|
-
/^build$/, // Widget.build — fundamental Flutter render entry point
|
|
204
|
-
/^createState$/, // StatefulWidget.createState
|
|
205
|
-
/^initState$/, // State lifecycle initialization
|
|
206
|
-
/^dispose$/, // State lifecycle teardown
|
|
207
|
-
/^didChangeDependencies$/, // State lifecycle — InheritedWidget changes
|
|
208
|
-
/^didUpdateWidget$/, // State lifecycle — widget rebuild with new config
|
|
209
|
-
/^runApp$/, // App entry point
|
|
210
|
-
/^onEvent$/, // BLoC event handler
|
|
211
|
-
/^mapEventToState$/, // Legacy BLoC pattern
|
|
212
|
-
],
|
|
213
|
-
[SupportedLanguages.Vue]: [], // Vue uses TypeScript queries — entry points handled via TS patterns
|
|
214
|
-
[SupportedLanguages.Cobol]: [], // Standalone regex processor — no tree-sitter entry points
|
|
215
|
-
};
|
|
216
|
-
/** Pre-computed merged patterns (universal + language-specific) to avoid per-call array allocation. */
|
|
217
|
-
const MERGED_ENTRY_POINT_PATTERNS = Object.fromEntries(Object.values(SupportedLanguages).map((lang) => [
|
|
35
|
+
/** Pre-computed merged patterns (universal + language-specific) from providers. */
|
|
36
|
+
const MERGED_ENTRY_POINT_PATTERNS = Object.fromEntries(Object.entries(providers).map(([lang, provider]) => [
|
|
218
37
|
lang,
|
|
219
|
-
[...UNIVERSAL_ENTRY_POINT_PATTERNS, ...(
|
|
38
|
+
[...UNIVERSAL_ENTRY_POINT_PATTERNS, ...(provider.entryPointPatterns ?? [])],
|
|
220
39
|
]));
|
|
221
40
|
// ============================================================================
|
|
222
41
|
// UTILITY PATTERNS - Functions that should be penalized
|
|
@@ -22,126 +22,6 @@ export interface FrameworkHint {
|
|
|
22
22
|
* Returns null if no framework pattern is detected (falls back to 1.0 multiplier).
|
|
23
23
|
*/
|
|
24
24
|
export declare function detectFrameworkFromPath(filePath: string): FrameworkHint | null;
|
|
25
|
-
/**
|
|
26
|
-
* Patterns that indicate framework entry points within code definitions.
|
|
27
|
-
* These are matched against AST node text (class/method/function declaration text).
|
|
28
|
-
*/
|
|
29
|
-
export declare const FRAMEWORK_AST_PATTERNS: {
|
|
30
|
-
nestjs: string[];
|
|
31
|
-
'expo-router': string[];
|
|
32
|
-
express: string[];
|
|
33
|
-
fastapi: string[];
|
|
34
|
-
flask: string[];
|
|
35
|
-
spring: string[];
|
|
36
|
-
jaxrs: string[];
|
|
37
|
-
aspnet: string[];
|
|
38
|
-
signalr: string[];
|
|
39
|
-
blazor: string[];
|
|
40
|
-
efcore: string[];
|
|
41
|
-
'go-http': string[];
|
|
42
|
-
gin: string[];
|
|
43
|
-
echo: string[];
|
|
44
|
-
fiber: string[];
|
|
45
|
-
'go-grpc': string[];
|
|
46
|
-
prisma: string[];
|
|
47
|
-
supabase: string[];
|
|
48
|
-
laravel: string[];
|
|
49
|
-
actix: string[];
|
|
50
|
-
axum: string[];
|
|
51
|
-
rocket: string[];
|
|
52
|
-
tokio: string[];
|
|
53
|
-
qt: string[];
|
|
54
|
-
uikit: string[];
|
|
55
|
-
swiftui: string[];
|
|
56
|
-
vapor: string[];
|
|
57
|
-
rails: string[];
|
|
58
|
-
sinatra: string[];
|
|
59
|
-
flutter: string[];
|
|
60
|
-
riverpod: string[];
|
|
61
|
-
};
|
|
62
|
-
export declare const AST_FRAMEWORK_PATTERNS_BY_LANGUAGE: {
|
|
63
|
-
javascript: {
|
|
64
|
-
framework: string;
|
|
65
|
-
entryPointMultiplier: number;
|
|
66
|
-
reason: string;
|
|
67
|
-
patterns: string[];
|
|
68
|
-
}[];
|
|
69
|
-
typescript: {
|
|
70
|
-
framework: string;
|
|
71
|
-
entryPointMultiplier: number;
|
|
72
|
-
reason: string;
|
|
73
|
-
patterns: string[];
|
|
74
|
-
}[];
|
|
75
|
-
python: {
|
|
76
|
-
framework: string;
|
|
77
|
-
entryPointMultiplier: number;
|
|
78
|
-
reason: string;
|
|
79
|
-
patterns: string[];
|
|
80
|
-
}[];
|
|
81
|
-
java: {
|
|
82
|
-
framework: string;
|
|
83
|
-
entryPointMultiplier: number;
|
|
84
|
-
reason: string;
|
|
85
|
-
patterns: string[];
|
|
86
|
-
}[];
|
|
87
|
-
kotlin: {
|
|
88
|
-
framework: string;
|
|
89
|
-
entryPointMultiplier: number;
|
|
90
|
-
reason: string;
|
|
91
|
-
patterns: string[];
|
|
92
|
-
}[];
|
|
93
|
-
csharp: {
|
|
94
|
-
framework: string;
|
|
95
|
-
entryPointMultiplier: number;
|
|
96
|
-
reason: string;
|
|
97
|
-
patterns: string[];
|
|
98
|
-
}[];
|
|
99
|
-
php: {
|
|
100
|
-
framework: string;
|
|
101
|
-
entryPointMultiplier: number;
|
|
102
|
-
reason: string;
|
|
103
|
-
patterns: string[];
|
|
104
|
-
}[];
|
|
105
|
-
go: {
|
|
106
|
-
framework: string;
|
|
107
|
-
entryPointMultiplier: number;
|
|
108
|
-
reason: string;
|
|
109
|
-
patterns: string[];
|
|
110
|
-
}[];
|
|
111
|
-
rust: {
|
|
112
|
-
framework: string;
|
|
113
|
-
entryPointMultiplier: number;
|
|
114
|
-
reason: string;
|
|
115
|
-
patterns: string[];
|
|
116
|
-
}[];
|
|
117
|
-
c: any[];
|
|
118
|
-
cpp: {
|
|
119
|
-
framework: string;
|
|
120
|
-
entryPointMultiplier: number;
|
|
121
|
-
reason: string;
|
|
122
|
-
patterns: string[];
|
|
123
|
-
}[];
|
|
124
|
-
swift: {
|
|
125
|
-
framework: string;
|
|
126
|
-
entryPointMultiplier: number;
|
|
127
|
-
reason: string;
|
|
128
|
-
patterns: string[];
|
|
129
|
-
}[];
|
|
130
|
-
ruby: {
|
|
131
|
-
framework: string;
|
|
132
|
-
entryPointMultiplier: number;
|
|
133
|
-
reason: string;
|
|
134
|
-
patterns: string[];
|
|
135
|
-
}[];
|
|
136
|
-
dart: {
|
|
137
|
-
framework: string;
|
|
138
|
-
entryPointMultiplier: number;
|
|
139
|
-
reason: string;
|
|
140
|
-
patterns: string[];
|
|
141
|
-
}[];
|
|
142
|
-
vue: any[];
|
|
143
|
-
cobol: any[];
|
|
144
|
-
};
|
|
145
25
|
/**
|
|
146
26
|
* Detect framework entry points from AST definition text (decorators/annotations/attributes).
|
|
147
27
|
* Returns null if no known pattern is found.
|