purecontext-mcp 1.2.0 → 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/AGENT_INSTRUCTIONS.md +110 -784
- package/AGENT_REFERENCE.md +561 -0
- package/CHANGELOG.md +177 -6
- package/FRAMEWORK-ADAPTERS.md +351 -0
- package/LANGUAGE-SUPPORT.md +144 -0
- package/README.md +92 -12
- package/USER-GUIDE.md +8 -0
- package/dist/cli/hooks.d.ts +28 -0
- package/dist/cli/hooks.d.ts.map +1 -0
- package/dist/cli/hooks.js +570 -0
- package/dist/cli/hooks.js.map +1 -0
- package/dist/cli/install-detect.d.ts +16 -0
- package/dist/cli/install-detect.d.ts.map +1 -0
- package/dist/cli/install-detect.js +70 -0
- package/dist/cli/install-detect.js.map +1 -0
- package/dist/cli/install-writers.d.ts +59 -0
- package/dist/cli/install-writers.d.ts.map +1 -0
- package/dist/cli/install-writers.js +292 -0
- package/dist/cli/install-writers.js.map +1 -0
- package/dist/cli/install.d.ts +14 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +150 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/config/config-loader.js +3 -0
- package/dist/config/config-loader.js.map +1 -1
- package/dist/config/config-schema.d.ts +11 -0
- package/dist/config/config-schema.d.ts.map +1 -1
- package/dist/config/config-schema.js +15 -0
- package/dist/config/config-schema.js.map +1 -1
- package/dist/core/db/symbol-store.d.ts +1 -0
- package/dist/core/db/symbol-store.d.ts.map +1 -1
- package/dist/core/db/symbol-store.js +120 -6
- package/dist/core/db/symbol-store.js.map +1 -1
- package/dist/core/file-discovery.d.ts +6 -0
- package/dist/core/file-discovery.d.ts.map +1 -1
- package/dist/core/file-discovery.js +20 -13
- package/dist/core/file-discovery.js.map +1 -1
- package/dist/core/file-processor.d.ts.map +1 -1
- package/dist/core/file-processor.js +26 -1
- package/dist/core/file-processor.js.map +1 -1
- package/dist/core/git-log-reader.d.ts.map +1 -1
- package/dist/core/git-log-reader.js +21 -0
- package/dist/core/git-log-reader.js.map +1 -1
- package/dist/core/index-manager.d.ts.map +1 -1
- package/dist/core/index-manager.js +21 -7
- package/dist/core/index-manager.js.map +1 -1
- package/dist/core/indexing-worker.d.ts.map +1 -1
- package/dist/core/indexing-worker.js +14 -0
- package/dist/core/indexing-worker.js.map +1 -1
- package/dist/core/parse-dispatcher.d.ts.map +1 -1
- package/dist/core/parse-dispatcher.js +20 -5
- package/dist/core/parse-dispatcher.js.map +1 -1
- package/dist/core/search/query-preprocessor.d.ts +69 -3
- package/dist/core/search/query-preprocessor.d.ts.map +1 -1
- package/dist/core/search/query-preprocessor.js +450 -17
- package/dist/core/search/query-preprocessor.js.map +1 -1
- package/dist/core/search/relevance-ranker.d.ts +60 -5
- package/dist/core/search/relevance-ranker.d.ts.map +1 -1
- package/dist/core/search/relevance-ranker.js +931 -33
- package/dist/core/search/relevance-ranker.js.map +1 -1
- package/dist/core/test-mapper.d.ts.map +1 -1
- package/dist/core/test-mapper.js +7 -1
- package/dist/core/test-mapper.js.map +1 -1
- package/dist/core/types.d.ts +28 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/handlers/angular-html.d.ts +3 -0
- package/dist/handlers/angular-html.d.ts.map +1 -0
- package/dist/handlers/angular-html.js +215 -0
- package/dist/handlers/angular-html.js.map +1 -0
- package/dist/handlers/c.d.ts.map +1 -1
- package/dist/handlers/c.js +19 -0
- package/dist/handlers/c.js.map +1 -1
- package/dist/handlers/cpp-macro-registry.d.ts +21 -0
- package/dist/handlers/cpp-macro-registry.d.ts.map +1 -0
- package/dist/handlers/cpp-macro-registry.js +44 -0
- package/dist/handlers/cpp-macro-registry.js.map +1 -0
- package/dist/handlers/cpp.d.ts.map +1 -1
- package/dist/handlers/cpp.js +579 -10
- package/dist/handlers/cpp.js.map +1 -1
- package/dist/handlers/csharp.d.ts.map +1 -1
- package/dist/handlers/csharp.js +39 -2
- package/dist/handlers/csharp.js.map +1 -1
- package/dist/handlers/css.d.ts +3 -0
- package/dist/handlers/css.d.ts.map +1 -0
- package/dist/handlers/css.js +154 -0
- package/dist/handlers/css.js.map +1 -0
- package/dist/handlers/erlang.d.ts.map +1 -1
- package/dist/handlers/erlang.js +8 -1
- package/dist/handlers/erlang.js.map +1 -1
- package/dist/handlers/fortran.js +1 -1
- package/dist/handlers/fortran.js.map +1 -1
- package/dist/handlers/go.d.ts.map +1 -1
- package/dist/handlers/go.js +87 -2
- package/dist/handlers/go.js.map +1 -1
- package/dist/handlers/handler-registry.d.ts.map +1 -1
- package/dist/handlers/handler-registry.js +4 -0
- package/dist/handlers/handler-registry.js.map +1 -1
- package/dist/handlers/hcl.d.ts +3 -0
- package/dist/handlers/hcl.d.ts.map +1 -0
- package/dist/handlers/hcl.js +193 -0
- package/dist/handlers/hcl.js.map +1 -0
- package/dist/handlers/java.d.ts.map +1 -1
- package/dist/handlers/java.js +33 -16
- package/dist/handlers/java.js.map +1 -1
- package/dist/handlers/kotlin.d.ts.map +1 -1
- package/dist/handlers/kotlin.js +48 -3
- package/dist/handlers/kotlin.js.map +1 -1
- package/dist/handlers/less.d.ts +3 -0
- package/dist/handlers/less.d.ts.map +1 -0
- package/dist/handlers/less.js +255 -0
- package/dist/handlers/less.js.map +1 -0
- package/dist/handlers/objective-c.d.ts.map +1 -1
- package/dist/handlers/objective-c.js +122 -64
- package/dist/handlers/objective-c.js.map +1 -1
- package/dist/handlers/openapi.d.ts.map +1 -1
- package/dist/handlers/openapi.js +30 -5
- package/dist/handlers/openapi.js.map +1 -1
- package/dist/handlers/php.d.ts.map +1 -1
- package/dist/handlers/php.js +287 -41
- package/dist/handlers/php.js.map +1 -1
- package/dist/handlers/protobuf.d.ts.map +1 -1
- package/dist/handlers/protobuf.js +1 -0
- package/dist/handlers/protobuf.js.map +1 -1
- package/dist/handlers/python.d.ts.map +1 -1
- package/dist/handlers/python.js +1 -3
- package/dist/handlers/python.js.map +1 -1
- package/dist/handlers/ruby-dsl.d.ts +23 -0
- package/dist/handlers/ruby-dsl.d.ts.map +1 -0
- package/dist/handlers/ruby-dsl.js +251 -0
- package/dist/handlers/ruby-dsl.js.map +1 -0
- package/dist/handlers/ruby.d.ts.map +1 -1
- package/dist/handlers/ruby.js +29 -4
- package/dist/handlers/ruby.js.map +1 -1
- package/dist/handlers/rust.d.ts.map +1 -1
- package/dist/handlers/rust.js +98 -2
- package/dist/handlers/rust.js.map +1 -1
- package/dist/handlers/scss.d.ts +3 -0
- package/dist/handlers/scss.d.ts.map +1 -0
- package/dist/handlers/scss.js +290 -0
- package/dist/handlers/scss.js.map +1 -0
- package/dist/handlers/sql.d.ts.map +1 -1
- package/dist/handlers/sql.js +37 -18
- package/dist/handlers/sql.js.map +1 -1
- package/dist/handlers/typescript.d.ts.map +1 -1
- package/dist/handlers/typescript.js +65 -17
- package/dist/handlers/typescript.js.map +1 -1
- package/dist/handlers/xml.d.ts.map +1 -1
- package/dist/handlers/xml.js +35 -2
- package/dist/handlers/xml.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -1
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +10 -0
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/detect-antipatterns.d.ts +1 -1
- package/dist/server/tools/get-architecture-snapshot.d.ts +1 -1
- package/dist/server/tools/get-entry-points.d.ts +1 -1
- package/dist/server/tools/get-lexical-scope-matches.d.ts +54 -0
- package/dist/server/tools/get-lexical-scope-matches.d.ts.map +1 -0
- package/dist/server/tools/get-lexical-scope-matches.js +470 -0
- package/dist/server/tools/get-lexical-scope-matches.js.map +1 -0
- package/dist/server/tools/search-symbols.d.ts +10 -0
- package/dist/server/tools/search-symbols.d.ts.map +1 -1
- package/dist/server/tools/search-symbols.js +353 -8
- package/dist/server/tools/search-symbols.js.map +1 -1
- package/dist/server/tools/trace-invocation-chain.d.ts +53 -0
- package/dist/server/tools/trace-invocation-chain.d.ts.map +1 -0
- package/dist/server/tools/trace-invocation-chain.js +280 -0
- package/dist/server/tools/trace-invocation-chain.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/02-installation.md +89 -17
- package/docs/05-cli-reference.md +89 -0
- package/docs/dev/benchmark-findings-eu-za-tebe.md +210 -0
- package/docs/dev/phase-35-coverage-audit.md +469 -0
- package/package.json +4 -1
|
@@ -3,13 +3,317 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pipeline:
|
|
5
5
|
* 1. Strip FTS5 special characters that would cause syntax errors.
|
|
6
|
-
* 2. If the input is a multi-word natural-language phrase,
|
|
7
|
-
*
|
|
6
|
+
* 2. If the input is a multi-word natural-language phrase, remove English
|
|
7
|
+
* stop words (articles, auxiliaries, prepositions) that never appear in
|
|
8
|
+
* code symbol names, then pass the remaining words through as an FTS5 AND
|
|
9
|
+
* query (whitespace = implicit AND).
|
|
8
10
|
* 3. If the input is a single snake_case or camelCase identifier, expand it
|
|
9
11
|
* with OR alternatives so partial-word queries still find the symbol.
|
|
10
12
|
* 4. Drop expanded tokens shorter than 2 characters.
|
|
13
|
+
* 5. Expand any known code-domain abbreviations in the OR term list so that
|
|
14
|
+
* searching "db" also finds "database" and vice-versa.
|
|
11
15
|
*/
|
|
16
|
+
// ─── Stop words ──────────────────────────────────────────────────────────────
|
|
17
|
+
/**
|
|
18
|
+
* English function words that never appear in code symbol names.
|
|
19
|
+
*
|
|
20
|
+
* Conservative list: only includes words where there is essentially zero risk
|
|
21
|
+
* of a developer using them as a meaningful code identifier search term.
|
|
22
|
+
* Words like "not", "or" are intentionally excluded because they do appear in
|
|
23
|
+
* code names (notFound, orElse).
|
|
24
|
+
*/
|
|
25
|
+
const STOP_WORDS = new Set([
|
|
26
|
+
// Articles
|
|
27
|
+
'a', 'an', 'the',
|
|
28
|
+
// Coordinating conjunctions (and/but/nor are never code identifiers)
|
|
29
|
+
'and', 'but', 'nor',
|
|
30
|
+
// Be-verbs / state auxiliaries
|
|
31
|
+
'is', 'are', 'was', 'were', 'be', 'been', 'being',
|
|
32
|
+
// Have-verbs
|
|
33
|
+
'have', 'has', 'had',
|
|
34
|
+
// Modal verbs
|
|
35
|
+
'will', 'would', 'shall', 'should', 'may', 'might',
|
|
36
|
+
// Relative + interrogative pronouns
|
|
37
|
+
'it', 'its', 'that', 'which', 'who', 'whom', 'what', 'when', 'where',
|
|
38
|
+
// Pure prepositions with no code-name meaning
|
|
39
|
+
'of', 'in', 'on', 'at', 'for', 'to', 'from', 'by', 'as', 'into',
|
|
40
|
+
// Common English connectives / modifiers safe to drop in code queries
|
|
41
|
+
'with', 'without', 'using', 'via',
|
|
42
|
+
// Common adjectives with near-zero identifier occurrence
|
|
43
|
+
'new', 'existing', 'all', 'any', 'some',
|
|
44
|
+
// Temporal / positional prepositions safe in code search context
|
|
45
|
+
'before', 'after', 'during', 'already', 'just',
|
|
46
|
+
// Relative clause words
|
|
47
|
+
'than', 'then',
|
|
48
|
+
]);
|
|
49
|
+
/**
|
|
50
|
+
* Return true when the token (case-insensitive) is an English stop word that
|
|
51
|
+
* should be excluded from code-domain FTS5 queries and relevance scoring.
|
|
52
|
+
*/
|
|
53
|
+
export function isStopWord(token) {
|
|
54
|
+
return STOP_WORDS.has(token.toLowerCase());
|
|
55
|
+
}
|
|
56
|
+
// ─── Verb / domain synonym dictionary ────────────────────────────────────────
|
|
57
|
+
/**
|
|
58
|
+
* Synonym map for code-domain verbs and domain nouns that are commonly paraphrased
|
|
59
|
+
* in natural-language queries but represented differently in code symbol names.
|
|
60
|
+
*
|
|
61
|
+
* Direction conventions (from the CLAUDE.md spec):
|
|
62
|
+
* ↔ bidirectional: both forms expand to each other.
|
|
63
|
+
* → source expands to target(s) but not vice-versa.
|
|
64
|
+
*
|
|
65
|
+
* Applied only to individual tokens inside multi-word queries so single-word
|
|
66
|
+
* OR-expansion is unaffected.
|
|
67
|
+
*/
|
|
68
|
+
const VERB_SYNONYMS = {
|
|
69
|
+
// ↔ bidirectional pairs
|
|
70
|
+
'remove': ['delete', 'clear'],
|
|
71
|
+
'delete': ['remove'],
|
|
72
|
+
'clear': ['remove', 'delete'],
|
|
73
|
+
'pagination': ['paging'],
|
|
74
|
+
'paging': ['pagination'],
|
|
75
|
+
'disable': ['deactivate'],
|
|
76
|
+
'deactivate': ['disable'],
|
|
77
|
+
'confirm': ['verify'],
|
|
78
|
+
'verify': ['confirm', 'check'],
|
|
79
|
+
'check': ['verify', 'confirm'],
|
|
80
|
+
'suspend': ['deactivate', 'disable'],
|
|
81
|
+
'revoke': ['delete', 'remove'],
|
|
82
|
+
'forgot': ['reset'], // "forgotPassword" ↔ "resetPassword" flow
|
|
83
|
+
'reset': ['forgot'],
|
|
84
|
+
'fetch': ['get', 'retrieve'],
|
|
85
|
+
'execute': ['run', 'perform'],
|
|
86
|
+
'run': ['execute'],
|
|
87
|
+
'perform': ['execute', 'run'],
|
|
88
|
+
'resolve': ['verify', 'check'],
|
|
89
|
+
// → one-directional expansions
|
|
90
|
+
'signin': ['login'], // "sign-in" has its hyphen stripped → "signin"
|
|
91
|
+
'sign': ['login'], // "sign in" after stop-word removal of "in" → "sign"
|
|
92
|
+
'authenticate': ['login'],
|
|
93
|
+
'log': ['insert', 'record'], // "log action" = "insert/record an entry"
|
|
94
|
+
'retrieve': ['get', 'fetch'],
|
|
95
|
+
'load': ['get', 'find', 'fetch'],
|
|
96
|
+
'lookup': ['find', 'get'],
|
|
97
|
+
'expose': ['register'],
|
|
98
|
+
'attach': ['add'],
|
|
99
|
+
'initiate': ['create', 'start'],
|
|
100
|
+
'submit': ['create', 'send'],
|
|
101
|
+
'save': ['create', 'store'],
|
|
102
|
+
'list': ['get', 'find'],
|
|
103
|
+
'show': ['get', 'find'],
|
|
104
|
+
'checkout': ['create', 'place'],
|
|
105
|
+
'place': ['create', 'checkout'],
|
|
106
|
+
// Python-specific synonyms
|
|
107
|
+
'index': ['store', 'catalog', 'register'], // "index a symbol" → finds store_symbol, catalog_file
|
|
108
|
+
'catalog': ['index', 'store'], // bidirectional with index
|
|
109
|
+
'parse': ['analyze', 'extract'], // "parse AST" → finds analyze_tree, extract_symbols
|
|
110
|
+
'analyze': ['parse', 'inspect'], // "analyze code" → finds parse_source
|
|
111
|
+
'inspect': ['analyze', 'scan'], // "inspect file" → finds scan_directory
|
|
112
|
+
// Rust-specific synonyms
|
|
113
|
+
'serializable': ['serialize', 'serde'], // "serializable type" → finds Serialize trait
|
|
114
|
+
'deserializable': ['deserialize', 'serde'], // "deserializable" → finds Deserialize trait
|
|
115
|
+
'serialize': ['serializable', 'serde'], // bidirectional with serializable
|
|
116
|
+
'deserialize': ['deserializable', 'serde'], // bidirectional with deserializable
|
|
117
|
+
'spawn': ['async', 'tokio', 'task'], // tokio queries about spawning async tasks
|
|
118
|
+
'concurrent': ['async', 'parallel'], // concurrency vocabulary
|
|
119
|
+
'future': ['async', 'poll'], // Rust Future trait queries
|
|
120
|
+
// C/C++ rendering & graphics synonyms
|
|
121
|
+
'render': ['draw', 'display', 'paint'], // "render scene" → findsDraw/display functions
|
|
122
|
+
'draw': ['render', 'display'], // bidirectional with render
|
|
123
|
+
'display': ['render', 'draw'], // bidirectional with render
|
|
124
|
+
'integrate': ['compute', 'evaluate', 'sample'], // numerical integration vocabulary
|
|
125
|
+
'sample': ['integrate', 'evaluate'], // bidirectional with integrate
|
|
126
|
+
'evaluate': ['compute', 'sample'], // numerical methods vocabulary
|
|
127
|
+
'trace': ['ray', 'intersect'], // ray-tracing vocabulary
|
|
128
|
+
'intersect': ['trace', 'collide'], // geometry/collision vocabulary
|
|
129
|
+
'collide': ['intersect'], // physics vocabulary
|
|
130
|
+
'emit': ['send', 'dispatch', 'fire'], // event/particle emission
|
|
131
|
+
'dispatch': ['emit', 'send', 'route'], // event dispatching (also Go channels)
|
|
132
|
+
// Symfony / Doctrine / event-driven PHP synonyms
|
|
133
|
+
'register': ['subscribe', 'listen'], // "register event handler" → finds EventSubscriber.onKernelRequest
|
|
134
|
+
'subscribe': ['register', 'listen'], // bidirectional with register
|
|
135
|
+
'listen': ['subscribe', 'handle'], // "listen for events" → subscriber methods
|
|
136
|
+
'validate': ['check', 'verify', 'assert'], // form validation queries
|
|
137
|
+
'persist': ['save', 'store', 'create'], // Doctrine persist calls
|
|
138
|
+
'flush': ['save', 'commit'], // "flush to database" → Doctrine flush
|
|
139
|
+
'hydrate': ['populate', 'fill', 'map'], // ORM hydration queries
|
|
140
|
+
// Rendering / physically-based rendering domain synonyms (mitsuba3)
|
|
141
|
+
'light': ['emitter'], // "light sources" → Emitter base class
|
|
142
|
+
'emitter': ['light'], // bidirectional with light
|
|
143
|
+
'camera': ['sensor'], // mitsuba3 names the camera base "Sensor"
|
|
144
|
+
'sensor': ['camera'], // bidirectional with camera
|
|
145
|
+
'material': ['bsdf', 'shader'], // "material" → BSDF in PBR renderers
|
|
146
|
+
'bsdf': ['material', 'shader'], // bidirectional with material
|
|
147
|
+
'glass': ['dielectric'], // "ideal glass" → Dielectric class
|
|
148
|
+
'dielectric': ['glass'], // bidirectional with glass
|
|
149
|
+
'metal': ['conductor'], // "metal material" → Conductor classes
|
|
150
|
+
'conductor': ['metal'], // bidirectional with metal
|
|
151
|
+
'film': ['buffer', 'image'], // render film = image accumulation buffer
|
|
152
|
+
'acceleration': ['kdtree', 'bvh'], // "acceleration structure" → KDTree/BVH
|
|
153
|
+
'bidirectional': ['bsdf'], // "bidirectional scattering distribution" → BSDF
|
|
154
|
+
'lambertian': ['diffuse', 'smooth'], // Lambertian reflectance → SmoothDiffuse
|
|
155
|
+
// Vue / Nuxt framework vocabulary
|
|
156
|
+
'initialise': ['initialize', 'create', 'setup', 'init'], // British spelling → American + create
|
|
157
|
+
'initialize': ['initialise', 'create', 'setup', 'init'], // American spelling → British + create
|
|
158
|
+
'trigger': ['run', 'start', 'build', 'execute'], // "trigger build pipeline" → buildNuxt
|
|
159
|
+
'append': ['add', 'push', 'register'], // "append plugin" → addVitePlugin
|
|
160
|
+
'composable': ['use'], // Vue composables all start with "use"
|
|
161
|
+
// Crypto / security vocabulary (Task 431)
|
|
162
|
+
'cipher': ['encrypt', 'encode'],
|
|
163
|
+
'encrypt': ['cipher', 'encode'],
|
|
164
|
+
'decrypt': ['decipher', 'decode'],
|
|
165
|
+
'decipher': ['decrypt', 'decode'],
|
|
166
|
+
'secret': ['key', 'credential'],
|
|
167
|
+
'credential': ['key', 'secret', 'token'],
|
|
168
|
+
'token': ['key', 'credential'],
|
|
169
|
+
};
|
|
170
|
+
// Synonyms that are only relevant in rendering/graphics/PBR codebases.
|
|
171
|
+
// Applying these globally causes false-positive matches in unrelated repos.
|
|
172
|
+
const RENDERING_ONLY_SYNONYMS = new Set([
|
|
173
|
+
'render', 'draw', 'display',
|
|
174
|
+
'integrate', 'sample', 'evaluate',
|
|
175
|
+
'trace', 'intersect', 'collide',
|
|
176
|
+
'emit', 'dispatch',
|
|
177
|
+
'light', 'emitter', 'camera', 'sensor',
|
|
178
|
+
'material', 'bsdf', 'glass', 'dielectric',
|
|
179
|
+
'metal', 'conductor', 'film',
|
|
180
|
+
'acceleration', 'bidirectional', 'lambertian',
|
|
181
|
+
]);
|
|
182
|
+
// Synonyms that are only relevant in Rust codebases (async runtime vocabulary).
|
|
183
|
+
// Applying 'future→poll' globally causes FutureBase::poll to outscore folly::Future
|
|
184
|
+
// in C++ repos like facebook-folly.
|
|
185
|
+
const RUST_ONLY_SYNONYMS = new Set([
|
|
186
|
+
'future', 'spawn', 'concurrent',
|
|
187
|
+
'serializable', 'deserializable', 'serialize', 'deserialize',
|
|
188
|
+
]);
|
|
189
|
+
/**
|
|
190
|
+
* Return synonym alternatives for a single lowercase token, or an empty array
|
|
191
|
+
* when no mapping is defined.
|
|
192
|
+
*
|
|
193
|
+
* Pass `domain: 'rendering'` to include rendering/graphics synonyms.
|
|
194
|
+
* Pass `domain: 'rust'` to include Rust async/serde synonyms.
|
|
195
|
+
* By default, domain-specific synonyms are suppressed to avoid false positives
|
|
196
|
+
* in unrelated codebases.
|
|
197
|
+
*
|
|
198
|
+
* Lookup is case-insensitive.
|
|
199
|
+
*
|
|
200
|
+
* Examples:
|
|
201
|
+
* expandVerbSynonyms('remove') → ['delete']
|
|
202
|
+
* expandVerbSynonyms('render') → [] (not a rendering domain)
|
|
203
|
+
* expandVerbSynonyms('render', 'rendering') → ['draw', 'display', 'paint']
|
|
204
|
+
* expandVerbSynonyms('future') → [] (not a rust domain)
|
|
205
|
+
* expandVerbSynonyms('future', 'rust') → ['async', 'poll']
|
|
206
|
+
* expandVerbSynonyms('unknown') → []
|
|
207
|
+
*/
|
|
208
|
+
export function expandVerbSynonyms(token, domain) {
|
|
209
|
+
const lower = token.toLowerCase();
|
|
210
|
+
if (RENDERING_ONLY_SYNONYMS.has(lower) && domain !== 'rendering')
|
|
211
|
+
return [];
|
|
212
|
+
if (RUST_ONLY_SYNONYMS.has(lower) && domain !== 'rust')
|
|
213
|
+
return [];
|
|
214
|
+
// Use hasOwnProperty to avoid prototype-chain collisions (e.g. "constructor"
|
|
215
|
+
// resolves to Object.prototype.constructor which has .length===1 but is not iterable).
|
|
216
|
+
const entry = Object.prototype.hasOwnProperty.call(VERB_SYNONYMS, lower)
|
|
217
|
+
? VERB_SYNONYMS[lower]
|
|
218
|
+
: undefined;
|
|
219
|
+
return entry ?? [];
|
|
220
|
+
}
|
|
221
|
+
// ─── Abbreviation dictionaries ────────────────────────────────────────────────
|
|
222
|
+
/**
|
|
223
|
+
* Common code-domain abbreviations mapped to one or more full forms.
|
|
224
|
+
* Lookup is bidirectional: searching an abbreviation also finds the full form(s)
|
|
225
|
+
* and vice-versa.
|
|
226
|
+
*
|
|
227
|
+
* Single-element arrays: one canonical expansion (e.g. db → database).
|
|
228
|
+
* Multi-element arrays: several semantically related full forms where a developer
|
|
229
|
+
* might use any of them (e.g. calc → calculate | calculator | calculation).
|
|
230
|
+
*/
|
|
231
|
+
const ABBREV_TO_FULL = {
|
|
232
|
+
// ── General programming abbreviations ────────────────────────────────────
|
|
233
|
+
db: ['database'],
|
|
234
|
+
auth: ['authentication'],
|
|
235
|
+
cfg: ['config', 'configuration'],
|
|
236
|
+
msg: ['message'],
|
|
237
|
+
req: ['request'],
|
|
238
|
+
res: ['response', 'result', 'resource'],
|
|
239
|
+
err: ['error'],
|
|
240
|
+
str: ['string'],
|
|
241
|
+
num: ['number', 'count'],
|
|
242
|
+
buf: ['buffer'],
|
|
243
|
+
dir: ['directory'],
|
|
244
|
+
env: ['environment'],
|
|
245
|
+
ctx: ['context'],
|
|
246
|
+
param: ['parameter'],
|
|
247
|
+
val: ['value'],
|
|
248
|
+
fn: ['function'],
|
|
249
|
+
obj: ['object'],
|
|
250
|
+
arr: ['array'],
|
|
251
|
+
// ── C/C++ naming conventions ──────────────────────────────────────────────
|
|
252
|
+
calc: ['calculate', 'calculator', 'calculation'],
|
|
253
|
+
mgr: ['manager'],
|
|
254
|
+
ctrl: ['controller'],
|
|
255
|
+
ctl: ['controller'],
|
|
256
|
+
ptr: ['pointer'],
|
|
257
|
+
init: ['initialize', 'initialization'],
|
|
258
|
+
proc: ['process', 'processor'],
|
|
259
|
+
alloc: ['allocate', 'allocation'],
|
|
260
|
+
dealloc: ['deallocate', 'deallocation'],
|
|
261
|
+
impl: ['implementation'],
|
|
262
|
+
iter: ['iterator', 'iterate'],
|
|
263
|
+
len: ['length'],
|
|
264
|
+
idx: ['index'],
|
|
265
|
+
pos: ['position'],
|
|
266
|
+
dim: ['dimension'],
|
|
267
|
+
vec: ['vector'],
|
|
268
|
+
mat: ['matrix'],
|
|
269
|
+
img: ['image'],
|
|
270
|
+
tex: ['texture'],
|
|
271
|
+
vert: ['vertex'],
|
|
272
|
+
frag: ['fragment'],
|
|
273
|
+
geom: ['geometry'],
|
|
274
|
+
cam: ['camera'],
|
|
275
|
+
cls: ['class'],
|
|
276
|
+
attr: ['attribute'],
|
|
277
|
+
args: ['arguments'],
|
|
278
|
+
ret: ['return', 'result'],
|
|
279
|
+
src: ['source'],
|
|
280
|
+
dst: ['destination'],
|
|
281
|
+
tmp: ['temporary'],
|
|
282
|
+
prev: ['previous'],
|
|
283
|
+
curr: ['current'],
|
|
284
|
+
max: ['maximum'],
|
|
285
|
+
min: ['minimum'],
|
|
286
|
+
// ── Rendering / PBR acronyms ──────────────────────────────────────────────
|
|
287
|
+
bsdf: ['bidirectional', 'scattering'], // Bidirectional Scattering Distribution Function
|
|
288
|
+
ggx: ['microfacet', 'roughness'], // GGX / Trowbridge-Reitz microfacet distribution
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Reverse map: each full form → its abbreviation.
|
|
292
|
+
* When a single abbreviation expands to multiple full forms, each form maps back
|
|
293
|
+
* to the same abbreviation (e.g. 'calculate' → 'calc', 'calculator' → 'calc').
|
|
294
|
+
*/
|
|
295
|
+
const FULL_TO_ABBREV = Object.fromEntries(Object.entries(ABBREV_TO_FULL).flatMap(([abbr, fulls]) => fulls.map((full) => [full, abbr])));
|
|
12
296
|
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
297
|
+
/**
|
|
298
|
+
* Return the expansion(s) for a token, if one is known.
|
|
299
|
+
* Lookup is case-insensitive and bidirectional:
|
|
300
|
+
* 'db' → ['database']
|
|
301
|
+
* 'database' → ['db']
|
|
302
|
+
* 'calc' → ['calculate', 'calculator', 'calculation']
|
|
303
|
+
* 'calculate' → ['calc']
|
|
304
|
+
* 'cfg' → ['config', 'configuration']
|
|
305
|
+
* 'auth' → ['authentication']
|
|
306
|
+
* 'parseFile' → null (no known mapping)
|
|
307
|
+
*
|
|
308
|
+
* Returns null when no expansion is known.
|
|
309
|
+
*/
|
|
310
|
+
export function expandToken(token) {
|
|
311
|
+
const lower = token.toLowerCase();
|
|
312
|
+
if (ABBREV_TO_FULL[lower])
|
|
313
|
+
return ABBREV_TO_FULL[lower];
|
|
314
|
+
const abbr = FULL_TO_ABBREV[lower];
|
|
315
|
+
return abbr ? [abbr] : null;
|
|
316
|
+
}
|
|
13
317
|
/**
|
|
14
318
|
* Convert a raw search query into an FTS5 MATCH-safe query string.
|
|
15
319
|
*
|
|
@@ -18,40 +322,169 @@
|
|
|
18
322
|
* preprocessQuery('get_symbol_source') → 'get_symbol_source OR get OR symbol OR source'
|
|
19
323
|
* preprocessQuery('orchestrate indexing') → 'orchestrate indexing'
|
|
20
324
|
* preprocessQuery('"bad chars"') → 'bad chars'
|
|
325
|
+
* preprocessQuery('db') → 'db OR database'
|
|
326
|
+
* preprocessQuery('database') → 'database OR db'
|
|
327
|
+
* preprocessQuery('getDbRow') → 'getDbRow OR get OR db OR row OR database'
|
|
21
328
|
*/
|
|
22
|
-
export function preprocessQuery(raw) {
|
|
329
|
+
export function preprocessQuery(raw, domain) {
|
|
23
330
|
// Step 1: strip/replace characters that have special meaning in FTS5 MATCH syntax.
|
|
24
331
|
// Hyphen is replaced with a space because FTS5 interprets "word-word" as a column
|
|
25
332
|
// filter ("column:token") which causes a syntax error for unknown column names.
|
|
26
|
-
|
|
333
|
+
// Single quote is stripped because FTS5 interprets it as a string-literal delimiter
|
|
334
|
+
// ("user's" → "users" after collapsing the resulting space).
|
|
335
|
+
const escaped = raw.replace(/["'()\^*+\-,:;!?.\/]/g, ' ').replace(/\s+/g, ' ').trim();
|
|
27
336
|
if (!escaped)
|
|
28
337
|
return '';
|
|
29
|
-
// Step 2: if the input contains spaces it is a natural-language phrase
|
|
30
|
-
//
|
|
338
|
+
// Step 2: if the input contains spaces it is a natural-language phrase.
|
|
339
|
+
// Strip stop words (articles, auxiliaries, prepositions) that never appear
|
|
340
|
+
// in code symbol names, then rejoin as FTS5 implicit AND.
|
|
341
|
+
// Fall back to the full word list if stripping removes everything.
|
|
31
342
|
const words = escaped.split(/\s+/).filter(Boolean);
|
|
32
343
|
if (words.length > 1) {
|
|
33
|
-
|
|
344
|
+
// Filter stop words and single-char tokens (e.g. "s" from stripped apostrophes like "user's")
|
|
345
|
+
const meaningful = words.filter((w) => w.length >= 2 && !isStopWord(w));
|
|
346
|
+
const active = meaningful.length > 0 ? meaningful : words;
|
|
347
|
+
// For each word, if synonyms exist, produce an FTS5 OR-group: (word OR syn1 OR syn2).
|
|
348
|
+
// This lets the AND query match even when the code uses a synonym of the query word.
|
|
349
|
+
const parts = active.map((w) => {
|
|
350
|
+
const syns = expandVerbSynonyms(w, domain);
|
|
351
|
+
if (syns.length === 0)
|
|
352
|
+
return w;
|
|
353
|
+
return `(${[w, ...syns].join(' OR ')})`;
|
|
354
|
+
});
|
|
355
|
+
// FTS5 does not support implicit AND (space) adjacent to a parenthesised
|
|
356
|
+
// OR group — e.g. "(remove OR delete) record" causes a syntax error.
|
|
357
|
+
// Use explicit " AND " whenever at least one part is a group; otherwise
|
|
358
|
+
// fall back to the original space-separated implicit AND so queries with
|
|
359
|
+
// no synonyms continue to produce the same output as before.
|
|
360
|
+
const hasGroup = parts.some((p) => p.startsWith('('));
|
|
361
|
+
return parts.join(hasGroup ? ' AND ' : ' ');
|
|
34
362
|
}
|
|
35
363
|
const token = words[0];
|
|
364
|
+
// Accumulate OR terms, starting with the original token.
|
|
365
|
+
const terms = [token];
|
|
36
366
|
// Step 3a: snake_case expansion — 'get_symbol_source' → parts joined with OR
|
|
37
367
|
if (token.includes('_')) {
|
|
38
368
|
const parts = token.split('_').filter((t) => t.length >= 2);
|
|
39
369
|
if (parts.length > 1) {
|
|
40
|
-
|
|
370
|
+
terms.push(...parts);
|
|
41
371
|
}
|
|
42
|
-
return token;
|
|
43
372
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
373
|
+
else {
|
|
374
|
+
// Step 3b: camelCase expansion — 'parseFile' → 'parseFile OR parse OR file'
|
|
375
|
+
const camelParts = splitCamelCase(token);
|
|
376
|
+
if (camelParts.length > 1) {
|
|
377
|
+
const expanded = camelParts
|
|
378
|
+
.map((t) => t.toLowerCase())
|
|
379
|
+
.filter((t) => t.length >= 2);
|
|
380
|
+
terms.push(...expanded);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// Step 4: abbreviation expansion — for every term already in the list, add
|
|
384
|
+
// its known counterpart(s) (abbrev↔full) so both forms are searched.
|
|
385
|
+
const seen = new Set(terms.map((t) => t.toLowerCase()));
|
|
386
|
+
const toAdd = [];
|
|
387
|
+
for (const t of terms) {
|
|
388
|
+
const expansions = expandToken(t);
|
|
389
|
+
if (expansions) {
|
|
390
|
+
for (const exp of expansions) {
|
|
391
|
+
if (!seen.has(exp.toLowerCase())) {
|
|
392
|
+
toAdd.push(exp);
|
|
393
|
+
seen.add(exp.toLowerCase());
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
terms.push(...toAdd);
|
|
399
|
+
if (terms.length === 1)
|
|
400
|
+
return terms[0];
|
|
401
|
+
return terms.join(' OR ');
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Convert an AND-mode FTS5 query to an OR-mode fallback.
|
|
405
|
+
*
|
|
406
|
+
* Call this when the primary AND query returns zero results. Joining all tokens
|
|
407
|
+
* with OR dramatically increases recall for multi-word natural-language queries
|
|
408
|
+
* where the symbol content contains only some — not all — of the query terms.
|
|
409
|
+
*
|
|
410
|
+
* Rules:
|
|
411
|
+
* - Already-OR queries (have " OR " at the top level, outside parens) are returned unchanged.
|
|
412
|
+
* - Single-token queries are returned unchanged (no AND semantics in play).
|
|
413
|
+
* - Multi-word AND queries are rewritten: all tokens (including those inside synonym
|
|
414
|
+
* OR groups such as "(remove OR delete)") are flattened and joined with " OR ".
|
|
415
|
+
*
|
|
416
|
+
* Examples:
|
|
417
|
+
* toOrFallbackQuery('orchestrate indexing pipeline') → 'orchestrate OR indexing OR pipeline'
|
|
418
|
+
* toOrFallbackQuery('parseFile OR parse OR file') → 'parseFile OR parse OR file' (unchanged)
|
|
419
|
+
* toOrFallbackQuery('parseFile') → 'parseFile' (unchanged)
|
|
420
|
+
* toOrFallbackQuery('(remove OR delete) AND record AND id') → 'remove OR delete OR record OR id'
|
|
421
|
+
*/
|
|
422
|
+
export function toOrFallbackQuery(query, domain) {
|
|
423
|
+
if (!query)
|
|
424
|
+
return query;
|
|
425
|
+
// Already in OR mode at the top level — nothing to change.
|
|
426
|
+
// Uses hasTopLevelOr rather than a simple includes(' OR ') check so that
|
|
427
|
+
// AND-mode queries containing synonym OR groups — e.g. "(remove OR delete) AND record" —
|
|
428
|
+
// are still eligible for OR-fallback conversion.
|
|
429
|
+
if (hasTopLevelOr(query))
|
|
430
|
+
return query;
|
|
431
|
+
// Single token — AND semantics never applied.
|
|
432
|
+
if (!query.includes(' '))
|
|
433
|
+
return query;
|
|
434
|
+
// Flatten the query: strip parentheses, replace explicit AND/OR connectives with spaces,
|
|
435
|
+
// then split into individual tokens. This handles both implicit-AND queries
|
|
436
|
+
// ("update existing record") and explicit-AND queries with synonym groups
|
|
437
|
+
// ("(remove OR delete) AND record AND table AND id").
|
|
438
|
+
const flat = query
|
|
439
|
+
.replace(/[()]/g, ' ')
|
|
440
|
+
.replace(/\bAND\b/g, ' ')
|
|
441
|
+
.replace(/\bOR\b/g, ' ')
|
|
442
|
+
.split(/\s+/)
|
|
443
|
+
.filter((w) => w.length >= 2);
|
|
444
|
+
// Strip stop words before OR-joining so the expanded result set is not
|
|
445
|
+
// polluted by English function words that match nothing in the symbol index.
|
|
446
|
+
// Fall back to the full word list when filtering removes everything.
|
|
447
|
+
const meaningful = flat.filter((w) => !isStopWord(w));
|
|
448
|
+
const active = meaningful.length > 0 ? meaningful : flat;
|
|
449
|
+
// Also include verb synonyms in the OR list to broaden recall further.
|
|
450
|
+
const seen = new Set(active.map((w) => w.toLowerCase()));
|
|
451
|
+
const withSyns = [...active];
|
|
452
|
+
for (const w of active) {
|
|
453
|
+
for (const syn of expandVerbSynonyms(w, domain)) {
|
|
454
|
+
if (!seen.has(syn.toLowerCase())) {
|
|
455
|
+
withSyns.push(syn);
|
|
456
|
+
seen.add(syn.toLowerCase());
|
|
457
|
+
}
|
|
458
|
+
}
|
|
51
459
|
}
|
|
52
|
-
return
|
|
460
|
+
return withSyns.join(' OR ');
|
|
53
461
|
}
|
|
54
462
|
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
463
|
+
/**
|
|
464
|
+
* Return true when the FTS5 query has at least one " OR " connective at the
|
|
465
|
+
* top level (outside any parenthesised group).
|
|
466
|
+
*
|
|
467
|
+
* Used by toOrFallbackQuery to distinguish between:
|
|
468
|
+
* - Queries that are already in OR mode: "a OR b OR c" → true
|
|
469
|
+
* - AND-mode queries with synonym OR groups: "(a OR b) AND c" → false
|
|
470
|
+
*/
|
|
471
|
+
function hasTopLevelOr(query) {
|
|
472
|
+
let depth = 0;
|
|
473
|
+
for (let i = 0; i < query.length; i++) {
|
|
474
|
+
const ch = query[i];
|
|
475
|
+
if (ch === '(') {
|
|
476
|
+
depth++;
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
if (ch === ')') {
|
|
480
|
+
depth--;
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
if (depth === 0 && query.startsWith(' OR ', i))
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
55
488
|
/**
|
|
56
489
|
* Split a camelCase or PascalCase identifier into its component words.
|
|
57
490
|
* All-caps tokens (acronyms: MCP, HTTP) are returned as a single element.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-preprocessor.js","sourceRoot":"","sources":["../../../src/core/search/query-preprocessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,iFAAiF;AAEjF;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,mFAAmF;IACnF,kFAAkF;IAClF,gFAAgF;IAChF,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAExD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,yEAAyE;IACzE,oEAAoE;IACpE,MA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AAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YAAC,KAAK,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QACtC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YAAC,KAAK,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QACtC,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IAC9D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,cAAc,CAAC,KAAa;IACnC,kCAAkC;IAClC,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAE7C,MAAM,MAAM,GAAG,KAAK;QAClB,uEAAuE;SACtE,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC;QACtC,+EAA+E;QAC/E,oCAAoC;SACnC,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAE7C,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -7,16 +7,38 @@
|
|
|
7
7
|
* scheme that promotes exact name matches to the top.
|
|
8
8
|
*
|
|
9
9
|
* Scoring (additive, higher = more relevant):
|
|
10
|
-
* 100 — exact name match (case-insensitive)
|
|
10
|
+
* 100 — exact name match (case-insensitive, entire query = entire name)
|
|
11
11
|
* 60 — name starts with query
|
|
12
12
|
* 40 — name contains query as substring
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* 60 — identity-exact: any single query word exactly equals the symbol name (10–40 for data kinds, scaled by 40/queryWords.length); 2× when matched word appears twice in raw query
|
|
14
|
+
* 30 — all query words match a word-boundary name part (exact or stem)
|
|
15
|
+
* 20 — any query word matches a word-boundary name part (exact or stem)
|
|
16
|
+
* 15 — method verb bonus: first part of method name matches a query word
|
|
17
|
+
* 30 — kindBoost: method on a *Service class
|
|
18
|
+
* 20 — kindBoost: Rust trait (interface kind) when ALL trait name parts match query words
|
|
19
|
+
* 15 — kindBoost: method on a *Repository / *Manager / *Store / *_model / *Handler / *DB / *Client / *Activity / *Fragment / *Adapter / *ViewModel / *Processor / *Indexer / *Parser / *EventSubscriber / *Listener / *FormType class
|
|
20
|
+
* 10 — each query word with an exact word-boundary name-part match
|
|
21
|
+
* 8 — each query word with a stem-only word-boundary name-part match
|
|
16
22
|
* 8 — query phrase in signature
|
|
17
23
|
* 2 — any query word in signature (per word)
|
|
18
24
|
* 5 — query phrase in summary
|
|
19
25
|
* 1 — any query word in summary (per word)
|
|
26
|
+
* +15 — core path boost: symbol in /core/src/main/java/ or /main/java/ (Java/Groovy repos)
|
|
27
|
+
* +20 — frontend path boost: symbol in /apps/dashboard/ etc. in mixed monorepos, on hook/component queries
|
|
28
|
+
* +20 — use/hook bonus: symbol name starts with useXxx and query has React hook vocabulary
|
|
29
|
+
* +5 — path proximity boost per overlapping query token (applies when >= 3 symbols share name)
|
|
30
|
+
* -35 — library path penalty (system/, vendor/, third_party/, node_modules/, engine/, erts/, contrib/)
|
|
31
|
+
* -35 — Java plugin path penalty: /plugins/ or /plugin/ in Java/Groovy repos
|
|
32
|
+
*
|
|
33
|
+
* Query word extraction:
|
|
34
|
+
* - Hyphenated tokens split ("front-end" → "front", "end")
|
|
35
|
+
* - camelCase and snake_case tokens split into components
|
|
36
|
+
* - English stop words removed
|
|
37
|
+
* - Inflectional suffixes stripped to add stem variants:
|
|
38
|
+
* -s (plural) "models" → "model"
|
|
39
|
+
* -ing (gerund) "building" → "build"
|
|
40
|
+
* -ed (past) "updated" → "update" and "updat"
|
|
41
|
+
* -tion (nominal) "pagination" → "paginat"
|
|
20
42
|
*/
|
|
21
43
|
import type { SymbolRecord } from '../types.js';
|
|
22
44
|
export interface DebugScore {
|
|
@@ -24,11 +46,35 @@ export interface DebugScore {
|
|
|
24
46
|
nameExact: number;
|
|
25
47
|
namePrefix: number;
|
|
26
48
|
nameFuzzy: number;
|
|
49
|
+
identityExact: number;
|
|
50
|
+
compoundUnderscoreBoost: number;
|
|
51
|
+
singleTokenExactBoost: number;
|
|
27
52
|
wordOverlap: number;
|
|
53
|
+
methodVerbBonus: number;
|
|
28
54
|
signatureMatch: number;
|
|
29
55
|
summaryMatch: number;
|
|
30
56
|
kindBoost: number;
|
|
57
|
+
kindHintBoost: number;
|
|
58
|
+
libraryPenalty: number;
|
|
59
|
+
corePathBoost: number;
|
|
60
|
+
frontendPathBoost: number;
|
|
61
|
+
useHookBonus: number;
|
|
62
|
+
groovySourceBoost: number;
|
|
63
|
+
angularLifecycleBoost: number;
|
|
64
|
+
renderingCompoundBoost: number;
|
|
65
|
+
reactQueryHookBoost: number;
|
|
66
|
+
interceptorBoost: number;
|
|
67
|
+
packageContextBoost: number;
|
|
68
|
+
trpcPrefixBoost: number;
|
|
69
|
+
pathProximityBoost: number;
|
|
31
70
|
recencyBoost: number;
|
|
71
|
+
ftsBm25Bonus: number;
|
|
72
|
+
}
|
|
73
|
+
export interface RankOptions {
|
|
74
|
+
isMixedMonorepo?: boolean;
|
|
75
|
+
hasReactHookQuery?: boolean;
|
|
76
|
+
isJavaGroovyMixed?: boolean;
|
|
77
|
+
isAngularRepo?: boolean;
|
|
32
78
|
}
|
|
33
79
|
export interface ScoredSymbol {
|
|
34
80
|
symbol: SymbolRecord;
|
|
@@ -36,6 +82,15 @@ export interface ScoredSymbol {
|
|
|
36
82
|
matchReason: 'exact_name' | 'prefix_name' | 'name_contains' | 'word_overlap' | 'content_match';
|
|
37
83
|
debugScore?: DebugScore;
|
|
38
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Return true when the symbol's file path contains a well-known library
|
|
87
|
+
* directory segment or multi-segment substring, indicating third-party /
|
|
88
|
+
* framework code.
|
|
89
|
+
*
|
|
90
|
+
* Uses forward-slash normalisation so paths work correctly on Windows and Unix.
|
|
91
|
+
* Checks are case-insensitive to handle /BLAS/, /Engine/, etc.
|
|
92
|
+
*/
|
|
93
|
+
export declare function isLibraryPath(filePath: string): boolean;
|
|
39
94
|
/**
|
|
40
95
|
* Score and sort a list of symbols by relevance to `query`.
|
|
41
96
|
*
|
|
@@ -44,5 +99,5 @@ export interface ScoredSymbol {
|
|
|
44
99
|
*
|
|
45
100
|
* When `debug` is true, each result includes a `debugScore` breakdown.
|
|
46
101
|
*/
|
|
47
|
-
export declare function rankSymbols(symbols: SymbolRecord[], query: string, debug?: boolean): ScoredSymbol[];
|
|
102
|
+
export declare function rankSymbols(symbols: SymbolRecord[], query: string, debug?: boolean, domain?: string, opts?: RankOptions): ScoredSymbol[];
|
|
48
103
|
//# sourceMappingURL=relevance-ranker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relevance-ranker.d.ts","sourceRoot":"","sources":["../../../src/core/search/relevance-ranker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"relevance-ranker.d.ts","sourceRoot":"","sources":["../../../src/core/search/relevance-ranker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAAE,MAAM,CAAC;IAChC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,WAAW,EA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