@appium/mcp-documentation 1.0.7 → 1.0.9
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/CHANGELOG.md +12 -0
- package/dist/answer-appium.d.ts.map +1 -1
- package/dist/answer-appium.js +1 -3
- package/dist/answer-appium.js.map +1 -1
- package/dist/appium-skills.d.ts.map +1 -1
- package/dist/appium-skills.js +5 -17
- package/dist/appium-skills.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js.map +1 -1
- package/dist/markdown-header-splitter.d.ts.map +1 -1
- package/dist/markdown-header-splitter.js.map +1 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +1 -1
- package/dist/paths.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/reasoning-rag.d.ts.map +1 -1
- package/dist/reasoning-rag.js +14 -25
- package/dist/reasoning-rag.js.map +1 -1
- package/dist/scripts/eval-documentation-rag.js +8 -21
- package/dist/scripts/eval-documentation-rag.js.map +1 -1
- package/dist/scripts/generate-embeddings-cache.js.map +1 -1
- package/dist/scripts/rag-eval-dataset.json +33 -138
- package/dist/scripts/simple-index-documentation.js +1 -1
- package/dist/scripts/simple-index-documentation.js.map +1 -1
- package/dist/scripts/simple-query-documentation.js.map +1 -1
- package/dist/sentence-transformers-embeddings.d.ts.map +1 -1
- package/dist/sentence-transformers-embeddings.js +5 -6
- package/dist/sentence-transformers-embeddings.js.map +1 -1
- package/dist/simple-pdf-indexer.d.ts +1 -1
- package/dist/simple-pdf-indexer.d.ts.map +1 -1
- package/dist/simple-pdf-indexer.js +15 -23
- package/dist/simple-pdf-indexer.js.map +1 -1
- package/dist/tests/__mocks__/@appium/support.d.ts.map +1 -1
- package/dist/tests/__mocks__/@appium/support.js.map +1 -1
- package/dist/tests/appium-skills.test.js.map +1 -1
- package/dist/tests/plugin.test.js +1 -1
- package/dist/tests/plugin.test.js.map +1 -1
- package/dist/tests/simple-pdf-indexer.test.js +1 -1
- package/dist/tests/simple-pdf-indexer.test.js.map +1 -1
- package/dist/tool-response.d.ts.map +1 -1
- package/dist/tool-response.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js.map +1 -1
- package/dist/uploads/documents.json +6141 -1
- package/package.json +29 -33
- package/scripts/zip-assets.mjs +7 -27
|
@@ -11,34 +11,22 @@
|
|
|
11
11
|
"id": "q01",
|
|
12
12
|
"query": "How do I install Appium?",
|
|
13
13
|
"expectedSources": ["en/quickstart/install.md"],
|
|
14
|
-
"answerSpans": [
|
|
15
|
-
"Appium can be installed globally using `npm`",
|
|
16
|
-
"npm install -g appium"
|
|
17
|
-
],
|
|
14
|
+
"answerSpans": ["Appium can be installed globally using `npm`", "npm install -g appium"],
|
|
18
15
|
"difficulty": "easy",
|
|
19
16
|
"category": "setup"
|
|
20
17
|
},
|
|
21
18
|
{
|
|
22
19
|
"id": "q02",
|
|
23
20
|
"query": "What capabilities does the XCUITest driver support?",
|
|
24
|
-
"expectedSources": [
|
|
25
|
-
|
|
26
|
-
],
|
|
27
|
-
"answerSpans": [
|
|
28
|
-
"platformName",
|
|
29
|
-
"appium:automationName",
|
|
30
|
-
"appium:deviceName",
|
|
31
|
-
"appium:platformVersion"
|
|
32
|
-
],
|
|
21
|
+
"expectedSources": ["appium-xcuitest-driver/docs/reference/capabilities.md"],
|
|
22
|
+
"answerSpans": ["platformName", "appium:automationName", "appium:deviceName", "appium:platformVersion"],
|
|
33
23
|
"difficulty": "easy",
|
|
34
24
|
"category": "capabilities"
|
|
35
25
|
},
|
|
36
26
|
{
|
|
37
27
|
"id": "q03",
|
|
38
28
|
"query": "how to run iOS tests in parallel",
|
|
39
|
-
"expectedSources": [
|
|
40
|
-
"appium-xcuitest-driver/docs/guides/parallel-tests.md"
|
|
41
|
-
],
|
|
29
|
+
"expectedSources": ["appium-xcuitest-driver/docs/guides/parallel-tests.md"],
|
|
42
30
|
"answerSpans": [
|
|
43
31
|
"It is possible to execute tests in parallel using XCUITest driver",
|
|
44
32
|
"wdaLocalPort` must be a unique port number for each parallel session",
|
|
@@ -50,14 +38,8 @@
|
|
|
50
38
|
{
|
|
51
39
|
"id": "q04",
|
|
52
40
|
"query": "push and pull files from an iOS device",
|
|
53
|
-
"expectedSources": [
|
|
54
|
-
|
|
55
|
-
],
|
|
56
|
-
"answerSpans": [
|
|
57
|
-
"mobile: pullFile",
|
|
58
|
-
"mobile: pushFile",
|
|
59
|
-
"mobile: pullFolder"
|
|
60
|
-
],
|
|
41
|
+
"expectedSources": ["appium-xcuitest-driver/docs/guides/file-transfer.md"],
|
|
42
|
+
"answerSpans": ["mobile: pullFile", "mobile: pushFile", "mobile: pullFolder"],
|
|
61
43
|
"difficulty": "easy",
|
|
62
44
|
"category": "ios"
|
|
63
45
|
},
|
|
@@ -77,24 +59,15 @@
|
|
|
77
59
|
{
|
|
78
60
|
"id": "q06",
|
|
79
61
|
"query": "what locator strategies are supported by XCUITest",
|
|
80
|
-
"expectedSources": [
|
|
81
|
-
|
|
82
|
-
],
|
|
83
|
-
"answerSpans": [
|
|
84
|
-
"-ios predicate string",
|
|
85
|
-
"-ios class chain",
|
|
86
|
-
"accessibility id",
|
|
87
|
-
"className"
|
|
88
|
-
],
|
|
62
|
+
"expectedSources": ["appium-xcuitest-driver/docs/reference/locator-strategies.md"],
|
|
63
|
+
"answerSpans": ["-ios predicate string", "-ios class chain", "accessibility id", "className"],
|
|
89
64
|
"difficulty": "easy",
|
|
90
65
|
"category": "locators"
|
|
91
66
|
},
|
|
92
67
|
{
|
|
93
68
|
"id": "q07",
|
|
94
69
|
"query": "how do I use iOS predicate strings to find elements",
|
|
95
|
-
"expectedSources": [
|
|
96
|
-
"appium-xcuitest-driver/docs/reference/ios-predicate.md"
|
|
97
|
-
],
|
|
70
|
+
"expectedSources": ["appium-xcuitest-driver/docs/reference/ios-predicate.md"],
|
|
98
71
|
"answerSpans": [
|
|
99
72
|
"iOSNsPredicateString",
|
|
100
73
|
"BEGINSWITH",
|
|
@@ -123,25 +96,15 @@
|
|
|
123
96
|
{
|
|
124
97
|
"id": "q09",
|
|
125
98
|
"query": "Appium server command line arguments",
|
|
126
|
-
"expectedSources": [
|
|
127
|
-
|
|
128
|
-
"en/reference/cli/index.md"
|
|
129
|
-
],
|
|
130
|
-
"answerSpans": [
|
|
131
|
-
"--address",
|
|
132
|
-
"--allow-cors",
|
|
133
|
-
"--allow-insecure",
|
|
134
|
-
"--base-path"
|
|
135
|
-
],
|
|
99
|
+
"expectedSources": ["en/reference/cli/server.md", "en/reference/cli/index.md"],
|
|
100
|
+
"answerSpans": ["--address", "--allow-cors", "--allow-insecure", "--base-path"],
|
|
136
101
|
"difficulty": "easy",
|
|
137
102
|
"category": "cli"
|
|
138
103
|
},
|
|
139
104
|
{
|
|
140
105
|
"id": "q10",
|
|
141
106
|
"query": "install a root certificate on an iOS device",
|
|
142
|
-
"expectedSources": [
|
|
143
|
-
"appium-xcuitest-driver/docs/guides/install-certificate.md"
|
|
144
|
-
],
|
|
107
|
+
"expectedSources": ["appium-xcuitest-driver/docs/guides/install-certificate.md"],
|
|
145
108
|
"answerSpans": ["mobile: installCertificate", "over-the-air"],
|
|
146
109
|
"difficulty": "easy",
|
|
147
110
|
"category": "ios"
|
|
@@ -149,28 +112,15 @@
|
|
|
149
112
|
{
|
|
150
113
|
"id": "q11",
|
|
151
114
|
"query": "I'm new to Appium, where should I start?",
|
|
152
|
-
"expectedSources": [
|
|
153
|
-
|
|
154
|
-
"en/intro/index.md",
|
|
155
|
-
"en/quickstart/requirements.md"
|
|
156
|
-
],
|
|
157
|
-
"answerSpans": [
|
|
158
|
-
"Quickstart Intro",
|
|
159
|
-
"install Appium",
|
|
160
|
-
"install a driver",
|
|
161
|
-
"first test"
|
|
162
|
-
],
|
|
115
|
+
"expectedSources": ["en/quickstart/index.md", "en/intro/index.md", "en/quickstart/requirements.md"],
|
|
116
|
+
"answerSpans": ["Quickstart Intro", "install Appium", "install a driver", "first test"],
|
|
163
117
|
"difficulty": "medium",
|
|
164
118
|
"category": "intro"
|
|
165
119
|
},
|
|
166
120
|
{
|
|
167
121
|
"id": "q12",
|
|
168
122
|
"query": "which driver should I use to automate android",
|
|
169
|
-
"expectedSources": [
|
|
170
|
-
"en/quickstart/uiauto2-driver.md",
|
|
171
|
-
"en/intro/drivers.md",
|
|
172
|
-
"en/ecosystem/drivers.md"
|
|
173
|
-
],
|
|
123
|
+
"expectedSources": ["en/quickstart/uiauto2-driver.md", "en/intro/drivers.md", "en/ecosystem/drivers.md"],
|
|
174
124
|
"answerSpans": ["UiAutomator2", "appium driver install uiautomator2"],
|
|
175
125
|
"difficulty": "medium",
|
|
176
126
|
"category": "android"
|
|
@@ -178,10 +128,7 @@
|
|
|
178
128
|
{
|
|
179
129
|
"id": "q13",
|
|
180
130
|
"query": "how do I switch to a webview in an iOS hybrid app",
|
|
181
|
-
"expectedSources": [
|
|
182
|
-
"appium-xcuitest-driver/docs/guides/hybrid.md",
|
|
183
|
-
"en/guides/context.md"
|
|
184
|
-
],
|
|
131
|
+
"expectedSources": ["appium-xcuitest-driver/docs/guides/hybrid.md", "en/guides/context.md"],
|
|
185
132
|
"answerSpans": [
|
|
186
133
|
"WEBVIEW_",
|
|
187
134
|
"NATIVE_APP",
|
|
@@ -199,20 +146,14 @@
|
|
|
199
146
|
"appium-xcuitest-driver/docs/preparation/prov-profile-basic-auto.md",
|
|
200
147
|
"appium-xcuitest-driver/docs/preparation/prov-profile-basic-manual.md"
|
|
201
148
|
],
|
|
202
|
-
"answerSpans": [
|
|
203
|
-
"WDA application must have a valid provisioning profile",
|
|
204
|
-
"Apple ID",
|
|
205
|
-
"WebDriverAgent.xcodeproj"
|
|
206
|
-
],
|
|
149
|
+
"answerSpans": ["WDA application must have a valid provisioning profile", "Apple ID", "WebDriverAgent.xcodeproj"],
|
|
207
150
|
"difficulty": "medium",
|
|
208
151
|
"category": "ios-real-device"
|
|
209
152
|
},
|
|
210
153
|
{
|
|
211
154
|
"id": "q15",
|
|
212
155
|
"query": "swipe gesture on android",
|
|
213
|
-
"expectedSources": [
|
|
214
|
-
"appium-uiautomator2-driver/docs/android-mobile-gestures.md"
|
|
215
|
-
],
|
|
156
|
+
"expectedSources": ["appium-uiautomator2-driver/docs/android-mobile-gestures.md"],
|
|
216
157
|
"answerSpans": ["mobile: swipeGesture", "direction", "percent"],
|
|
217
158
|
"difficulty": "medium",
|
|
218
159
|
"category": "gestures"
|
|
@@ -220,9 +161,7 @@
|
|
|
220
161
|
{
|
|
221
162
|
"id": "q16",
|
|
222
163
|
"query": "running tests against an .aab Android App Bundle",
|
|
223
|
-
"expectedSources": [
|
|
224
|
-
"appium-uiautomator2-driver/docs/android-appbundle.md"
|
|
225
|
-
],
|
|
164
|
+
"expectedSources": ["appium-uiautomator2-driver/docs/android-appbundle.md"],
|
|
226
165
|
"answerSpans": ["bundletool", ".apks", ".aab"],
|
|
227
166
|
"difficulty": "medium",
|
|
228
167
|
"category": "android"
|
|
@@ -231,11 +170,7 @@
|
|
|
231
170
|
"id": "q17",
|
|
232
171
|
"query": "differences between Appium 1 and Appium 2",
|
|
233
172
|
"expectedSources": ["en/guides/migrating-1-to-2.md"],
|
|
234
|
-
"answerSpans": [
|
|
235
|
-
"Drivers Installed Separately",
|
|
236
|
-
"ecosystem",
|
|
237
|
-
"uninstall Appium 1 first"
|
|
238
|
-
],
|
|
173
|
+
"answerSpans": ["Drivers Installed Separately", "ecosystem", "uninstall Appium 1 first"],
|
|
239
174
|
"difficulty": "medium",
|
|
240
175
|
"category": "migration"
|
|
241
176
|
},
|
|
@@ -243,11 +178,7 @@
|
|
|
243
178
|
"id": "q18",
|
|
244
179
|
"query": "enable Touch ID in an iOS simulator test",
|
|
245
180
|
"expectedSources": ["appium-xcuitest-driver/docs/guides/touch-id.md"],
|
|
246
|
-
"answerSpans": [
|
|
247
|
-
"appium:allowTouchIdEnroll",
|
|
248
|
-
"mobile: enrollBiometric",
|
|
249
|
-
"only supported on simulators"
|
|
250
|
-
],
|
|
181
|
+
"answerSpans": ["appium:allowTouchIdEnroll", "mobile: enrollBiometric", "only supported on simulators"],
|
|
251
182
|
"difficulty": "medium",
|
|
252
183
|
"category": "ios"
|
|
253
184
|
},
|
|
@@ -279,12 +210,7 @@
|
|
|
279
210
|
"appium-xcuitest-driver/docs/guides/wda-slowness.md",
|
|
280
211
|
"appium-xcuitest-driver/docs/guides/troubleshooting.md"
|
|
281
212
|
],
|
|
282
|
-
"answerSpans": [
|
|
283
|
-
"WebDriverAgent",
|
|
284
|
-
"XCTest",
|
|
285
|
-
"Proxying [",
|
|
286
|
-
"snapshotMaxDepth"
|
|
287
|
-
],
|
|
213
|
+
"answerSpans": ["WebDriverAgent", "XCTest", "Proxying [", "snapshotMaxDepth"],
|
|
288
214
|
"difficulty": "vague",
|
|
289
215
|
"category": "troubleshooting"
|
|
290
216
|
},
|
|
@@ -302,9 +228,7 @@
|
|
|
302
228
|
{
|
|
303
229
|
"id": "q23",
|
|
304
230
|
"query": "I switched xcode versions and now nothing works",
|
|
305
|
-
"expectedSources": [
|
|
306
|
-
"appium-xcuitest-driver/docs/guides/multiple-xcode-versions.md"
|
|
307
|
-
],
|
|
231
|
+
"expectedSources": ["appium-xcuitest-driver/docs/guides/multiple-xcode-versions.md"],
|
|
308
232
|
"answerSpans": ["xcode-select", "DEVELOPER_DIR"],
|
|
309
233
|
"difficulty": "vague",
|
|
310
234
|
"category": "troubleshooting"
|
|
@@ -312,9 +236,7 @@
|
|
|
312
236
|
{
|
|
313
237
|
"id": "q24",
|
|
314
238
|
"query": "can I reuse a WebDriverAgent that's already running",
|
|
315
|
-
"expectedSources": [
|
|
316
|
-
"appium-xcuitest-driver/docs/guides/attach-to-running-wda.md"
|
|
317
|
-
],
|
|
239
|
+
"expectedSources": ["appium-xcuitest-driver/docs/guides/attach-to-running-wda.md"],
|
|
318
240
|
"answerSpans": ["appium:webDriverAgentUrl", "attach to a running"],
|
|
319
241
|
"difficulty": "vague",
|
|
320
242
|
"category": "wda"
|
|
@@ -323,19 +245,14 @@
|
|
|
323
245
|
"id": "q25",
|
|
324
246
|
"query": "show me how to write a test in python",
|
|
325
247
|
"expectedSources": ["en/quickstart/test-py.md"],
|
|
326
|
-
"answerSpans": [
|
|
327
|
-
"Appium-Python-Client",
|
|
328
|
-
"pip install Appium-Python-Client"
|
|
329
|
-
],
|
|
248
|
+
"answerSpans": ["Appium-Python-Client", "pip install Appium-Python-Client"],
|
|
330
249
|
"difficulty": "vague",
|
|
331
250
|
"category": "clients"
|
|
332
251
|
},
|
|
333
252
|
{
|
|
334
253
|
"id": "q26",
|
|
335
254
|
"query": "long press an element on Android",
|
|
336
|
-
"expectedSources": [
|
|
337
|
-
"appium-uiautomator2-driver/docs/android-mobile-gestures.md"
|
|
338
|
-
],
|
|
255
|
+
"expectedSources": ["appium-uiautomator2-driver/docs/android-mobile-gestures.md"],
|
|
339
256
|
"answerSpans": ["mobile: longClickGesture", "long click action"],
|
|
340
257
|
"difficulty": "easy",
|
|
341
258
|
"category": "gestures"
|
|
@@ -343,10 +260,7 @@
|
|
|
343
260
|
{
|
|
344
261
|
"id": "q27",
|
|
345
262
|
"query": "how do I list available drivers on my machine",
|
|
346
|
-
"expectedSources": [
|
|
347
|
-
"en/reference/cli/extensions.md",
|
|
348
|
-
"en/guides/managing-exts.md"
|
|
349
|
-
],
|
|
263
|
+
"expectedSources": ["en/reference/cli/extensions.md", "en/guides/managing-exts.md"],
|
|
350
264
|
"answerSpans": ["appium driver list", "driver install"],
|
|
351
265
|
"difficulty": "medium",
|
|
352
266
|
"category": "cli"
|
|
@@ -354,10 +268,7 @@
|
|
|
354
268
|
{
|
|
355
269
|
"id": "q28",
|
|
356
270
|
"query": "what's the difference between appium:app and appium:bundleId",
|
|
357
|
-
"expectedSources": [
|
|
358
|
-
"appium-xcuitest-driver/docs/reference/capabilities.md",
|
|
359
|
-
"en/guides/caps.md"
|
|
360
|
-
],
|
|
271
|
+
"expectedSources": ["appium-xcuitest-driver/docs/reference/capabilities.md", "en/guides/caps.md"],
|
|
361
272
|
"answerSpans": ["bundleId", "appium:app"],
|
|
362
273
|
"difficulty": "medium",
|
|
363
274
|
"category": "capabilities"
|
|
@@ -377,10 +288,7 @@
|
|
|
377
288
|
"appium-xcuitest-driver/docs/reference/execute-methods.md",
|
|
378
289
|
"appium-xcuitest-driver/docs/guides/audio-capture.md"
|
|
379
290
|
],
|
|
380
|
-
"answerSpans": [
|
|
381
|
-
"mobile: startRecordingScreen",
|
|
382
|
-
"mobile: stopRecordingScreen"
|
|
383
|
-
],
|
|
291
|
+
"answerSpans": ["mobile: startRecordingScreen", "mobile: stopRecordingScreen"],
|
|
384
292
|
"difficulty": "medium",
|
|
385
293
|
"category": "ios"
|
|
386
294
|
},
|
|
@@ -432,10 +340,7 @@
|
|
|
432
340
|
{
|
|
433
341
|
"id": "q35",
|
|
434
342
|
"query": "Appium 2 plugin installation",
|
|
435
|
-
"expectedSources": [
|
|
436
|
-
"en/guides/managing-exts.md",
|
|
437
|
-
"en/reference/cli/extensions.md"
|
|
438
|
-
],
|
|
343
|
+
"expectedSources": ["en/guides/managing-exts.md", "en/reference/cli/extensions.md"],
|
|
439
344
|
"answerSpans": ["appium plugin install", "plugin"],
|
|
440
345
|
"difficulty": "easy",
|
|
441
346
|
"category": "plugins"
|
|
@@ -481,10 +386,7 @@
|
|
|
481
386
|
{
|
|
482
387
|
"id": "q40",
|
|
483
388
|
"query": "Appium driver doctor command",
|
|
484
|
-
"expectedSources": [
|
|
485
|
-
"en/reference/cli/extensions.md",
|
|
486
|
-
"en/quickstart/uiauto2-driver.md"
|
|
487
|
-
],
|
|
389
|
+
"expectedSources": ["en/reference/cli/extensions.md", "en/quickstart/uiauto2-driver.md"],
|
|
488
390
|
"answerSpans": ["appium driver doctor", "required fixes"],
|
|
489
391
|
"difficulty": "easy",
|
|
490
392
|
"category": "cli"
|
|
@@ -492,10 +394,7 @@
|
|
|
492
394
|
{
|
|
493
395
|
"id": "q41",
|
|
494
396
|
"query": "how to install Appium server arguments documentation",
|
|
495
|
-
"expectedSources": [
|
|
496
|
-
"en/reference/cli/server.md",
|
|
497
|
-
"en/reference/cli/index.md"
|
|
498
|
-
],
|
|
397
|
+
"expectedSources": ["en/reference/cli/server.md", "en/reference/cli/index.md"],
|
|
499
398
|
"answerSpans": ["appium server", "--port"],
|
|
500
399
|
"difficulty": "medium",
|
|
501
400
|
"category": "cli"
|
|
@@ -503,11 +402,7 @@
|
|
|
503
402
|
{
|
|
504
403
|
"id": "q42",
|
|
505
404
|
"query": "what is an Appium plugin",
|
|
506
|
-
"expectedSources": [
|
|
507
|
-
"en/intro/index.md",
|
|
508
|
-
"en/ecosystem/plugins.md",
|
|
509
|
-
"en/guides/managing-exts.md"
|
|
510
|
-
],
|
|
405
|
+
"expectedSources": ["en/intro/index.md", "en/ecosystem/plugins.md", "en/guides/managing-exts.md"],
|
|
511
406
|
"answerSpans": ["plugin", "extend"],
|
|
512
407
|
"difficulty": "easy",
|
|
513
408
|
"category": "plugins"
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* If a file path is provided, it will index that specific file.
|
|
18
18
|
* If a directory path is provided, it will index all Markdown files in that directory.
|
|
19
19
|
*/
|
|
20
|
-
import * as path from 'node:path';
|
|
21
20
|
import * as fs from 'node:fs';
|
|
21
|
+
import * as path from 'node:path';
|
|
22
22
|
import { indexMarkdown, indexAllMarkdownFiles } from '../simple-pdf-indexer.js';
|
|
23
23
|
/**
|
|
24
24
|
* Main function to handle the documentation indexing process
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-index-documentation.js","sourceRoot":"","sources":["../../src/scripts/simple-index-documentation.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"simple-index-documentation.js","sourceRoot":"","sources":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C,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,KAAK,IAAI,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-query-documentation.js","sourceRoot":"","sources":["../../src/scripts/simple-query-documentation.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"simple-query-documentation.js","sourceRoot":"","sources":["../../src/scripts/simple-query-documentation.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAG,CAAC,0FAA0F,CAAC,CAAC;IAExG,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3B,IAAI,KAAa,CAAC;IAElB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,0BAA0B,KAAK,GAAG,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,KAAK,GAAG,0CAA0C,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,4CAA4C,KAAK,GAAG,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,0CAA0C,KAAK,GAAG,CAAC,CAAC;IAEhE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC;YACrC,KAAK;SACN,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE3B,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;gBACrC,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,KAAK,IAAI,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentence-transformers-embeddings.d.ts","sourceRoot":"","sources":["../src/sentence-transformers-embeddings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,qBAAa,8BAA8B;IACzC,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,YAAY,CAAa;gBAErB,OAAO,GAAE;
|
|
1
|
+
{"version":3,"file":"sentence-transformers-embeddings.d.ts","sourceRoot":"","sources":["../src/sentence-transformers-embeddings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,qBAAa,8BAA8B;IACzC,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,YAAY,CAAa;gBAErB,OAAO,GAAE;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAM;IAOzE,kFAAkF;IAClF,YAAY,IAAI,MAAM;IAItB;;;OAGG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAyBjD;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IA+B1D;;OAEG;YACW,sBAAsB;IAkBpC;;OAEG;YACW,eAAe;CAoB9B"}
|
|
@@ -34,9 +34,7 @@ export class SentenceTransformersEmbeddings {
|
|
|
34
34
|
throw new Error('Model not initialized');
|
|
35
35
|
}
|
|
36
36
|
try {
|
|
37
|
-
const input = this.queryInstruction
|
|
38
|
-
? `${this.queryInstruction}${text}`
|
|
39
|
-
: text;
|
|
37
|
+
const input = this.queryInstruction ? `${this.queryInstruction}${text}` : text;
|
|
40
38
|
const result = await this.model(input, {
|
|
41
39
|
pooling: 'mean',
|
|
42
40
|
normalize: true,
|
|
@@ -47,7 +45,9 @@ export class SentenceTransformersEmbeddings {
|
|
|
47
45
|
}
|
|
48
46
|
catch (error) {
|
|
49
47
|
log.error('Error generating embeddings:', error);
|
|
50
|
-
throw new Error(`Failed to generate embeddings: ${error instanceof Error ? error.message : String(error)}`, {
|
|
48
|
+
throw new Error(`Failed to generate embeddings: ${error instanceof Error ? error.message : String(error)}`, {
|
|
49
|
+
cause: error,
|
|
50
|
+
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -67,8 +67,7 @@ export class SentenceTransformersEmbeddings {
|
|
|
67
67
|
normalize: true,
|
|
68
68
|
});
|
|
69
69
|
embeddings.push(Array.from(result.data));
|
|
70
|
-
if (texts.length > logEvery &&
|
|
71
|
-
(i + 1 === texts.length || (i + 1) % logEvery === 0)) {
|
|
70
|
+
if (texts.length > logEvery && (i + 1 === texts.length || (i + 1) % logEvery === 0)) {
|
|
72
71
|
log.info(`Processed ${i + 1}/${texts.length} documents`);
|
|
73
72
|
}
|
|
74
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentence-transformers-embeddings.js","sourceRoot":"","sources":["../src/sentence-transformers-embeddings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B;;GAEG;AACH,MAAM,OAAO,8BAA8B;IACjC,KAAK,GAAQ,IAAI,CAAC;IAClB,SAAS,CAAS;IAClB,gBAAgB,CAAS;IACzB,aAAa,GAAY,KAAK,CAAC;IAC/B,YAAY,GAAQ,IAAI,CAAC;IAEjC,YAAY,
|
|
1
|
+
{"version":3,"file":"sentence-transformers-embeddings.js","sourceRoot":"","sources":["../src/sentence-transformers-embeddings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B;;GAEG;AACH,MAAM,OAAO,8BAA8B;IACjC,KAAK,GAAQ,IAAI,CAAC;IAClB,SAAS,CAAS;IAClB,gBAAgB,CAAS;IACzB,aAAa,GAAY,KAAK,CAAC;IAC/B,YAAY,GAAQ,IAAI,CAAC;IAEjC,YAAY,UAA2D,EAAE;QACvE,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,yBAAyB,CAAC;QAChE,6DAA6D;QAC7D,+DAA+D;QAC/D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;IACzD,CAAC;IAED,kFAAkF;IAClF,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IAC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document } from '@langchain/core/documents';
|
|
10
9
|
import { MemoryVectorStore } from '@langchain/classic/vectorstores/memory';
|
|
10
|
+
import { Document } from '@langchain/core/documents';
|
|
11
11
|
/**
|
|
12
12
|
* Initialize the vector store with Markdown content
|
|
13
13
|
* @param markdownPath Path to the Markdown file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-pdf-indexer.d.ts","sourceRoot":"","sources":["../src/simple-pdf-indexer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"simple-pdf-indexer.d.ts","sourceRoot":"","sources":["../src/simple-pdf-indexer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EAAC,iBAAiB,EAAC,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAC;AAuFnD;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,MAAa,EACxB,YAAY,GAAE,MAAY,GACzB,OAAO,CAAC,iBAAiB,CAAC,CA6C5B;AAED;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAyCpF;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,MAAa,EACxB,YAAY,GAAE,MAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAa,EACxB,YAAY,GAAE,MAAY,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAuFnB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAuC5F"}
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
* vector store is persisted to a file for use across different script
|
|
7
7
|
* executions.
|
|
8
8
|
*/
|
|
9
|
-
import { Document } from '@langchain/core/documents';
|
|
10
|
-
import { MemoryVectorStore } from '@langchain/classic/vectorstores/memory';
|
|
11
|
-
import { fs } from '@appium/support';
|
|
12
9
|
import * as crypto from 'node:crypto';
|
|
13
10
|
import * as path from 'node:path';
|
|
14
11
|
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import { fs } from '@appium/support';
|
|
13
|
+
import { MemoryVectorStore } from '@langchain/classic/vectorstores/memory';
|
|
14
|
+
import { Document } from '@langchain/core/documents';
|
|
15
|
+
import log from './logger.js';
|
|
15
16
|
import { splitMarkdownByHeaders } from './markdown-header-splitter.js';
|
|
16
17
|
// Initialize embeddings using sentence-transformers (no API key required)
|
|
17
18
|
import { SentenceTransformersEmbeddings } from './sentence-transformers-embeddings.js';
|
|
18
|
-
import log from './logger.js';
|
|
19
19
|
let embeddings = null;
|
|
20
20
|
/**
|
|
21
21
|
* Initialize embeddings lazily when needed
|
|
@@ -42,7 +42,9 @@ function getEmbeddings() {
|
|
|
42
42
|
log.info(`Using sentence-transformers model: ${modelName}`);
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
|
-
throw new Error(`Failed to initialize embeddings: ${error instanceof Error ? error.message : String(error)}`, {
|
|
45
|
+
throw new Error(`Failed to initialize embeddings: ${error instanceof Error ? error.message : String(error)}`, {
|
|
46
|
+
cause: error,
|
|
47
|
+
});
|
|
46
48
|
}
|
|
47
49
|
return embeddings;
|
|
48
50
|
}
|
|
@@ -55,13 +57,7 @@ let memoryVectorStore = null;
|
|
|
55
57
|
/**
|
|
56
58
|
* Exclude certain directories from being indexed to avoid irrelevant content and reduce noise in the vector store.
|
|
57
59
|
*/
|
|
58
|
-
const EXCLUDED_MARKDOWN_DIRECTORIES = new Set([
|
|
59
|
-
'appium-skills',
|
|
60
|
-
'ja',
|
|
61
|
-
'zh',
|
|
62
|
-
'.github',
|
|
63
|
-
'blog',
|
|
64
|
-
]);
|
|
60
|
+
const EXCLUDED_MARKDOWN_DIRECTORIES = new Set(['appium-skills', 'ja', 'zh', '.github', 'blog']);
|
|
65
61
|
/**
|
|
66
62
|
* Exclude specific filenames regardless of where they appear in the tree.
|
|
67
63
|
*
|
|
@@ -333,9 +329,7 @@ function makeFingerprint(documents, modelName) {
|
|
|
333
329
|
};
|
|
334
330
|
}
|
|
335
331
|
function fingerprintsMatch(a, b) {
|
|
336
|
-
return
|
|
337
|
-
a.chunkCount === b.chunkCount &&
|
|
338
|
-
a.contentHash === b.contentHash);
|
|
332
|
+
return a.modelName === b.modelName && a.chunkCount === b.chunkCount && a.contentHash === b.contentHash;
|
|
339
333
|
}
|
|
340
334
|
/**
|
|
341
335
|
* Try to load a valid embeddings cache for the given documents + model.
|
|
@@ -361,8 +355,7 @@ async function loadEmbeddingsCache(documents, modelName) {
|
|
|
361
355
|
`Cached: ${JSON.stringify(cache.fingerprint)}; expected: ${JSON.stringify(expected)}`);
|
|
362
356
|
return null;
|
|
363
357
|
}
|
|
364
|
-
if (!Array.isArray(cache.embeddings) ||
|
|
365
|
-
cache.embeddings.length !== documents.length) {
|
|
358
|
+
if (!Array.isArray(cache.embeddings) || cache.embeddings.length !== documents.length) {
|
|
366
359
|
log.warn(`Embeddings cache length (${cache.embeddings?.length}) does not match documents length (${documents.length}). Invalidating.`);
|
|
367
360
|
return null;
|
|
368
361
|
}
|
|
@@ -408,9 +401,7 @@ async function saveEmbeddingsCache(documents, vectors, modelName) {
|
|
|
408
401
|
await fs.unlink(tmpPath);
|
|
409
402
|
}
|
|
410
403
|
catch (cleanupErr) {
|
|
411
|
-
log.warn(`Failed to clean up tmp cache file ${tmpPath}: ${cleanupErr instanceof Error
|
|
412
|
-
? cleanupErr.message
|
|
413
|
-
: String(cleanupErr)}`);
|
|
404
|
+
log.warn(`Failed to clean up tmp cache file ${tmpPath}: ${cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr)}`);
|
|
414
405
|
}
|
|
415
406
|
}
|
|
416
407
|
}
|
|
@@ -505,7 +496,9 @@ async function extractTextFromMarkdown(markdownPath) {
|
|
|
505
496
|
}
|
|
506
497
|
catch (error) {
|
|
507
498
|
log.error('Error extracting text from Markdown:', error);
|
|
508
|
-
throw new Error(`Failed to extract text from Markdown: ${error instanceof Error ? error.message : String(error)}`, {
|
|
499
|
+
throw new Error(`Failed to extract text from Markdown: ${error instanceof Error ? error.message : String(error)}`, {
|
|
500
|
+
cause: error,
|
|
501
|
+
});
|
|
509
502
|
}
|
|
510
503
|
}
|
|
511
504
|
// This allows the script to be run directly from the command line
|
|
@@ -521,8 +514,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
|
|
|
521
514
|
// Use provided path
|
|
522
515
|
markdownPath = path.resolve(process.cwd(), args[0]);
|
|
523
516
|
// Check if the provided path is a file or directory
|
|
524
|
-
if ((await fs.exists(markdownPath)) &&
|
|
525
|
-
(await fs.stat(markdownPath)).isFile()) {
|
|
517
|
+
if ((await fs.exists(markdownPath)) && (await fs.stat(markdownPath)).isFile()) {
|
|
526
518
|
indexSingleFile = true;
|
|
527
519
|
}
|
|
528
520
|
}
|