@rio-cloud/uikit-mcp 1.1.10 → 1.1.12
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 +2 -1
- package/dist/doc-metadata.json +92 -92
- package/dist/docs/components/accentBar.md +1 -1
- package/dist/docs/components/activity.md +1 -1
- package/dist/docs/components/analyticsAnalysisOverlay.md +3 -1
- package/dist/docs/components/animatedNumber.md +2 -2
- package/dist/docs/components/animatedTextReveal.md +6 -6
- package/dist/docs/components/animations.md +22 -22
- package/dist/docs/components/appHeader.md +1 -1
- package/dist/docs/components/appLayout.md +31 -65
- package/dist/docs/components/appNavigationBar.md +1 -1
- package/dist/docs/components/areaCharts.md +7 -5
- package/dist/docs/components/aspectRatioPlaceholder.md +1 -1
- package/dist/docs/components/assetTree.md +160 -142
- package/dist/docs/components/autosuggests.md +1 -1
- package/dist/docs/components/avatar.md +1 -1
- package/dist/docs/components/banner.md +2 -2
- package/dist/docs/components/barCharts.md +16 -14
- package/dist/docs/components/barList.md +9 -9
- package/dist/docs/components/basicMap.md +45 -1
- package/dist/docs/components/bottomSheet.md +1 -1
- package/dist/docs/components/button.md +1 -1
- package/dist/docs/components/buttonToolbar.md +1 -1
- package/dist/docs/components/calendarStripe.md +56 -56
- package/dist/docs/components/card.md +1 -1
- package/dist/docs/components/carousel.md +1 -1
- package/dist/docs/components/chartColors.md +3 -1
- package/dist/docs/components/chartsGettingStarted.md +3 -1
- package/dist/docs/components/chat.md +1 -1
- package/dist/docs/components/checkbox.md +3 -1
- package/dist/docs/components/circularProgress.md +5 -5
- package/dist/docs/components/clearableInput.md +1 -1
- package/dist/docs/components/collapse.md +4 -2
- package/dist/docs/components/composedCharts.md +17 -15
- package/dist/docs/components/contentLoader.md +1 -1
- package/dist/docs/components/dataTabs.md +1 -1
- package/dist/docs/components/datepickers.md +662 -660
- package/dist/docs/components/dayPicker.md +55 -5
- package/dist/docs/components/dayPickerCalendar.md +488 -468
- package/dist/docs/components/dialogs.md +1 -1
- package/dist/docs/components/divider.md +1 -1
- package/dist/docs/components/dropdowns.md +3270 -3244
- package/dist/docs/components/editableContent.md +1 -1
- package/dist/docs/components/expander.md +1 -1
- package/dist/docs/components/fade.md +1 -1
- package/dist/docs/components/fadeExpander.md +1 -1
- package/dist/docs/components/fadeUp.md +2 -2
- package/dist/docs/components/feedback.md +1 -1
- package/dist/docs/components/filePickers.md +1 -1
- package/dist/docs/components/formLabel.md +1 -1
- package/dist/docs/components/groupedItemList.md +1 -1
- package/dist/docs/components/htmlTable.md +113 -115
- package/dist/docs/components/iconList.md +3 -3
- package/dist/docs/components/imagePreloader.md +1 -1
- package/dist/docs/components/labeledElement.md +1 -1
- package/dist/docs/components/licensePlate.md +1 -1
- package/dist/docs/components/lineCharts.md +6 -4
- package/dist/docs/components/listMenu.md +1 -1
- package/dist/docs/components/loadMore.md +1 -1
- package/dist/docs/components/mainNavigation.md +1 -1
- package/dist/docs/components/mapCircle.md +1 -1
- package/dist/docs/components/mapCluster.md +3 -1
- package/dist/docs/components/mapContext.md +1 -1
- package/dist/docs/components/mapDraggableMarker.md +1 -1
- package/dist/docs/components/mapGettingStarted.md +39 -1
- package/dist/docs/components/mapInfoBubble.md +1 -1
- package/dist/docs/components/mapLayerGroup.md +1 -1
- package/dist/docs/components/mapMarker.md +3 -1
- package/dist/docs/components/mapPolygon.md +1 -1
- package/dist/docs/components/mapRoute.md +1 -1
- package/dist/docs/components/mapSettings.md +36 -9
- package/dist/docs/components/mapUtils.md +65 -2
- package/dist/docs/components/mapViewportHistory.md +287 -0
- package/dist/docs/components/multiselects.md +171 -1
- package/dist/docs/components/noData.md +1 -1
- package/dist/docs/components/notifications.md +1 -1
- package/dist/docs/components/numbercontrol.md +1 -1
- package/dist/docs/components/onboarding.md +1 -1
- package/dist/docs/components/page.md +1 -1
- package/dist/docs/components/pager.md +1 -1
- package/dist/docs/components/pieCharts.md +38 -36
- package/dist/docs/components/popover.md +1 -1
- package/dist/docs/components/position.md +1 -1
- package/dist/docs/components/radialBarCharts.md +27 -25
- package/dist/docs/components/radioCardGroup.md +1 -1
- package/dist/docs/components/radiobutton.md +3 -1
- package/dist/docs/components/releaseNotes.md +1 -1
- package/dist/docs/components/resizer.md +3 -1
- package/dist/docs/components/responsiveColumnStripe.md +3 -1
- package/dist/docs/components/responsiveVideo.md +1 -1
- package/dist/docs/components/rioglyph.md +1 -1
- package/dist/docs/components/rules.md +1 -1
- package/dist/docs/components/saveableInput.md +247 -247
- package/dist/docs/components/selects.md +168 -51
- package/dist/docs/components/sidebar.md +1 -1
- package/dist/docs/components/sliders.md +1 -1
- package/dist/docs/components/smoothScrollbars.md +3 -1
- package/dist/docs/components/spinners.md +1 -1
- package/dist/docs/components/states.md +15 -1
- package/dist/docs/components/statsWidgets.md +1 -1
- package/dist/docs/components/statusBar.md +3 -1
- package/dist/docs/components/stepButton.md +1 -1
- package/dist/docs/components/steppedProgressBars.md +1 -1
- package/dist/docs/components/subNavigation.md +1 -1
- package/dist/docs/components/supportMarker.md +1 -1
- package/dist/docs/components/svgImage.md +1 -1
- package/dist/docs/components/switch.md +3 -1
- package/dist/docs/components/table.md +1998 -221
- package/dist/docs/components/tableControls.md +51 -51
- package/dist/docs/components/tagManager.md +1 -1
- package/dist/docs/components/tags.md +1 -1
- package/dist/docs/components/teaser.md +3 -1
- package/dist/docs/components/textTruncateMiddle.md +1 -1
- package/dist/docs/components/timeline.md +1 -1
- package/dist/docs/components/timepicker.md +3 -1
- package/dist/docs/components/toggleButton.md +1 -1
- package/dist/docs/components/tooltip.md +5 -1
- package/dist/docs/components/tracker.md +1 -1
- package/dist/docs/components/virtualList.md +58 -56
- package/dist/docs/foundations.md +271 -105
- package/dist/docs/start/changelog.md +44 -212
- package/dist/docs/start/goodtoknow.md +8 -2
- package/dist/docs/start/guidelines/color-combinations.md +5 -1
- package/dist/docs/start/guidelines/custom-css.md +26 -2
- package/dist/docs/start/guidelines/custom-rioglyph.md +20 -2
- package/dist/docs/start/guidelines/formatting.md +2256 -249
- package/dist/docs/start/guidelines/iframe.md +37 -1
- package/dist/docs/start/guidelines/obfuscate-data.md +26 -2
- package/dist/docs/start/guidelines/print-css.md +16 -2
- package/dist/docs/start/guidelines/spinner.md +1 -1
- package/dist/docs/start/guidelines/state-in-url.md +1138 -11
- package/dist/docs/start/guidelines/supported-browsers.md +9 -2
- package/dist/docs/start/guidelines/writing.md +228 -2
- package/dist/docs/start/howto.md +160 -10
- package/dist/docs/start/intro.md +40 -2
- package/dist/docs/start/responsiveness.md +29 -1
- package/dist/docs/templates/ai-assistant.md +1 -1
- package/dist/docs/templates/common-table.md +55 -55
- package/dist/docs/templates/detail-views.md +2 -2
- package/dist/docs/templates/expandable-details.md +1 -1
- package/dist/docs/templates/feature-cards.md +37 -37
- package/dist/docs/templates/form-summary.md +15 -15
- package/dist/docs/templates/form-toggle.md +1 -1
- package/dist/docs/templates/list-blocks.md +137 -137
- package/dist/docs/templates/loading-progress.md +1 -1
- package/dist/docs/templates/options-panel.md +1 -1
- package/dist/docs/templates/panel-variants.md +1 -1
- package/dist/docs/templates/progress-cards.md +1 -1
- package/dist/docs/templates/progress-success.md +1 -1
- package/dist/docs/templates/settings-form.md +18 -18
- package/dist/docs/templates/stats-blocks.md +10 -10
- package/dist/docs/templates/table-panel.md +1 -1
- package/dist/docs/templates/usage-cards.md +1 -1
- package/dist/docs/utilities/classNames.md +89 -1
- package/dist/docs/utilities/deviceUtils.md +1 -1
- package/dist/docs/utilities/featureToggles.md +182 -2
- package/dist/docs/utilities/fuelTypeUtils.md +1 -1
- package/dist/docs/utilities/getTrackingAttributes.md +46 -1
- package/dist/docs/utilities/routeUtils.md +210 -2
- package/dist/docs/utilities/useAfterMount.md +1 -1
- package/dist/docs/utilities/useAutoAnimate.md +1 -1
- package/dist/docs/utilities/useAverage.md +1 -1
- package/dist/docs/utilities/useClickOutside.md +1 -1
- package/dist/docs/utilities/useClipboard.md +2 -2
- package/dist/docs/utilities/useCookies.md +1 -1
- package/dist/docs/utilities/useCount.md +1 -1
- package/dist/docs/utilities/useDarkMode.md +1 -1
- package/dist/docs/utilities/useDebugInfo.md +3 -3
- package/dist/docs/utilities/useDraggableElement.md +1 -1
- package/dist/docs/utilities/useEffectOnce.md +1 -1
- package/dist/docs/utilities/useElapsedTime.md +1 -1
- package/dist/docs/utilities/useElementSize.md +1 -1
- package/dist/docs/utilities/useEsc.md +1 -1
- package/dist/docs/utilities/useEvent.md +1 -1
- package/dist/docs/utilities/useFocusTrap.md +1 -1
- package/dist/docs/utilities/useFullscreen.md +1 -1
- package/dist/docs/utilities/useHover.md +1 -1
- package/dist/docs/utilities/useIncomingPostMessages.md +1 -1
- package/dist/docs/utilities/useInterval.md +1 -1
- package/dist/docs/utilities/useIsFocusWithin.md +1 -1
- package/dist/docs/utilities/useKey.md +1 -1
- package/dist/docs/utilities/useLocalStorage.md +1 -1
- package/dist/docs/utilities/useLocationSuggestions.md +1 -1
- package/dist/docs/utilities/useMax.md +1 -1
- package/dist/docs/utilities/useMin.md +1 -1
- package/dist/docs/utilities/useMutationObserver.md +1 -1
- package/dist/docs/utilities/useOnScreen.md +1 -1
- package/dist/docs/utilities/useOnlineStatus.md +1 -1
- package/dist/docs/utilities/usePostMessage.md +1 -1
- package/dist/docs/utilities/usePostMessageSender.md +1 -1
- package/dist/docs/utilities/usePrevious.md +111 -1
- package/dist/docs/utilities/useResizeObserver.md +1 -1
- package/dist/docs/utilities/useRioCookieConsent.md +1 -1
- package/dist/docs/utilities/useScrollPosition.md +1 -1
- package/dist/docs/utilities/useSearch.md +1 -1
- package/dist/docs/utilities/useSearchHighlight.md +1 -1
- package/dist/docs/utilities/useSorting.md +1 -1
- package/dist/docs/utilities/useStateWithValidation.md +1 -1
- package/dist/docs/utilities/useSum.md +1 -1
- package/dist/docs/utilities/useTableExport.md +61 -61
- package/dist/docs/utilities/useTableSelection.md +72 -72
- package/dist/docs/utilities/useTimeout.md +1 -1
- package/dist/docs/utilities/useToggle.md +1 -1
- package/dist/docs/utilities/useUrlState.md +1 -1
- package/dist/docs/utilities/useWindowResize.md +1 -1
- package/dist/index.mjs +174 -70
- package/dist/search-synonyms.json +214 -76
- package/dist/version.json +2 -2
- package/package.json +8 -6
- package/dist/docs/components/mapRouteGenerator.md +0 -6
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import FlexSearch from "flexsearch";
|
|
8
|
-
//#region
|
|
8
|
+
//#region shared/content/doc-id.ts
|
|
9
9
|
var InvalidDocIdError = class extends Error {
|
|
10
10
|
constructor(id, reason) {
|
|
11
11
|
super(`Invalid doc id "${id}": ${reason}`);
|
|
@@ -132,7 +132,7 @@ function buildSearchIndex(entries) {
|
|
|
132
132
|
});
|
|
133
133
|
for (const entry of entries) index.add({
|
|
134
134
|
id: entry.id,
|
|
135
|
-
title: entry.title,
|
|
135
|
+
title: entry.indexTitle ?? entry.title,
|
|
136
136
|
lead: entry.lead ?? "",
|
|
137
137
|
summary: entry.summary,
|
|
138
138
|
searchText: entry.searchText,
|
|
@@ -149,14 +149,163 @@ function buildSearchIndex(entries) {
|
|
|
149
149
|
return { search };
|
|
150
150
|
}
|
|
151
151
|
//#endregion
|
|
152
|
+
//#region server/lib/search-docs.ts
|
|
153
|
+
function normaliseKey(value) {
|
|
154
|
+
return value.toLowerCase().trim();
|
|
155
|
+
}
|
|
156
|
+
function slugifyHeading(value) {
|
|
157
|
+
return normaliseKey(value).replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
158
|
+
}
|
|
159
|
+
function compactText(value) {
|
|
160
|
+
return value.replace(/\s+/g, " ").trim();
|
|
161
|
+
}
|
|
162
|
+
function stripMarkdownForSearch(markdown) {
|
|
163
|
+
return compactText(markdown.replace(/```[\s\S]*?```/g, " ").replace(/^#{1,6}\s+/gm, "").replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/__([^_]+)__|_([^_]+)_/g, (_, bold, italic) => bold ?? italic ?? "").replace(/<[^>]+>/g, " ").replace(/[[\]()*_>#|]/g, " "));
|
|
164
|
+
}
|
|
165
|
+
function excerpt(value, maxLength = 240) {
|
|
166
|
+
const text = compactText(value);
|
|
167
|
+
if (text.length <= maxLength) return text;
|
|
168
|
+
return `${text.slice(0, maxLength - 1).trimEnd()}…`;
|
|
169
|
+
}
|
|
170
|
+
function extractSecondLevelMarkdownSections(markdown) {
|
|
171
|
+
const sections = [];
|
|
172
|
+
const lines = markdown.split(/\r?\n/);
|
|
173
|
+
let current = null;
|
|
174
|
+
for (const line of lines) {
|
|
175
|
+
const match = /^##\s+(.+?)\s*$/.exec(line);
|
|
176
|
+
if (match) {
|
|
177
|
+
if (current) sections.push({
|
|
178
|
+
heading: current.heading,
|
|
179
|
+
body: current.bodyLines.join("\n").trim()
|
|
180
|
+
});
|
|
181
|
+
current = {
|
|
182
|
+
heading: match[1].trim(),
|
|
183
|
+
bodyLines: []
|
|
184
|
+
};
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (current) current.bodyLines.push(line);
|
|
188
|
+
}
|
|
189
|
+
if (current) sections.push({
|
|
190
|
+
heading: current.heading,
|
|
191
|
+
body: current.bodyLines.join("\n").trim()
|
|
192
|
+
});
|
|
193
|
+
return sections;
|
|
194
|
+
}
|
|
195
|
+
function expandDomainSynonyms(rawQuery, config) {
|
|
196
|
+
const query = normaliseKey(rawQuery);
|
|
197
|
+
const expansions = /* @__PURE__ */ new Set();
|
|
198
|
+
const preferred = /* @__PURE__ */ new Set();
|
|
199
|
+
const hints = /* @__PURE__ */ new Set();
|
|
200
|
+
const synonyms = config.synonyms ?? {};
|
|
201
|
+
const preferredDocIds = config.preferredDocIds ?? {};
|
|
202
|
+
const allKeys = new Set([
|
|
203
|
+
...Object.keys(synonyms),
|
|
204
|
+
...Object.keys(preferredDocIds),
|
|
205
|
+
...Object.keys(config.hints ?? {})
|
|
206
|
+
]);
|
|
207
|
+
for (const key of allKeys) {
|
|
208
|
+
if (!query.includes(normaliseKey(key))) continue;
|
|
209
|
+
for (const value of synonyms[key] ?? []) if (normaliseKey(value) !== query) expansions.add(value);
|
|
210
|
+
for (const id of preferredDocIds[key] ?? []) preferred.add(id);
|
|
211
|
+
if (config.hints?.[key]) hints.add(config.hints[key]);
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
expansions: Array.from(expansions),
|
|
215
|
+
preferredDocIds: Array.from(preferred),
|
|
216
|
+
hints: Array.from(hints)
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function buildFoundationSectionAliases(foundation, markdown) {
|
|
220
|
+
if (!foundation || !markdown) return [];
|
|
221
|
+
return extractSecondLevelMarkdownSections(markdown).map((section) => {
|
|
222
|
+
const slug = slugifyHeading(section.heading);
|
|
223
|
+
if (!slug) return null;
|
|
224
|
+
const plainText = stripMarkdownForSearch(section.body);
|
|
225
|
+
const guidance = `Matched section: "${section.heading}". After reading this resource, use the "## ${section.heading}" section; ignore unrelated Foundations sections unless they are needed for context.`;
|
|
226
|
+
const summary = plainText ? `${guidance} Section excerpt: ${excerpt(plainText)}` : guidance;
|
|
227
|
+
return {
|
|
228
|
+
id: `foundations#${slug}`,
|
|
229
|
+
resourceDocId: foundation.id,
|
|
230
|
+
title: `Foundations: ${section.heading}`,
|
|
231
|
+
indexTitle: section.heading,
|
|
232
|
+
lead: null,
|
|
233
|
+
summary,
|
|
234
|
+
searchText: [section.heading, plainText].filter(Boolean).join("\n"),
|
|
235
|
+
category: foundation.category,
|
|
236
|
+
section: foundation.section,
|
|
237
|
+
boost: [
|
|
238
|
+
section.heading,
|
|
239
|
+
`foundations ${section.heading}`,
|
|
240
|
+
`#foundations/${slug}`
|
|
241
|
+
].join(" "),
|
|
242
|
+
matchedHeading: section.heading
|
|
243
|
+
};
|
|
244
|
+
}).filter((entry) => Boolean(entry));
|
|
245
|
+
}
|
|
246
|
+
function buildSearchEntries(metadata, options = {}) {
|
|
247
|
+
const foundation = metadata.find((entry) => entry.id === "foundations");
|
|
248
|
+
return [...metadata, ...buildFoundationSectionAliases(foundation, options.foundationMarkdown ?? null)];
|
|
249
|
+
}
|
|
250
|
+
function resolveSearchDocs(options) {
|
|
251
|
+
const { query, limit, index, entriesById, synonymsConfig, resourceForDocId } = options;
|
|
252
|
+
const searchQueue = [query];
|
|
253
|
+
const domainSynonyms = expandDomainSynonyms(query, synonymsConfig);
|
|
254
|
+
for (const extra of domainSynonyms.expansions) searchQueue.push(extra);
|
|
255
|
+
const seen = /* @__PURE__ */ new Set();
|
|
256
|
+
const results = [];
|
|
257
|
+
const normalizedQuery = normaliseKey(query);
|
|
258
|
+
function addResult(id) {
|
|
259
|
+
if (seen.has(id)) return results.length >= limit;
|
|
260
|
+
const entry = entriesById.get(id);
|
|
261
|
+
if (!entry) return false;
|
|
262
|
+
seen.add(id);
|
|
263
|
+
const resourceDocId = entry.resourceDocId ?? entry.id;
|
|
264
|
+
results.push({
|
|
265
|
+
resource: resourceForDocId(resourceDocId),
|
|
266
|
+
title: entry.title,
|
|
267
|
+
summary: entry.summary,
|
|
268
|
+
category: entry.category,
|
|
269
|
+
section: entry.section,
|
|
270
|
+
matchedHeading: entry.matchedHeading
|
|
271
|
+
});
|
|
272
|
+
return results.length >= limit;
|
|
273
|
+
}
|
|
274
|
+
if (/\bfoundations?\b/.test(normalizedQuery)) for (const entry of entriesById.values()) {
|
|
275
|
+
if (!entry.matchedHeading) continue;
|
|
276
|
+
if (!normalizedQuery.includes(normaliseKey(entry.matchedHeading))) continue;
|
|
277
|
+
if (addResult(entry.id)) return {
|
|
278
|
+
results,
|
|
279
|
+
domainSynonyms
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
for (const id of domainSynonyms.preferredDocIds) if (addResult(id)) return {
|
|
283
|
+
results,
|
|
284
|
+
domainSynonyms
|
|
285
|
+
};
|
|
286
|
+
for (const searchQuery of searchQueue) {
|
|
287
|
+
const hits = index.search(searchQuery, {
|
|
288
|
+
limit: Math.max(limit * 2, 10),
|
|
289
|
+
suggest: true
|
|
290
|
+
});
|
|
291
|
+
for (const group of hits) for (const id of group.result ?? []) if (addResult(String(id))) return {
|
|
292
|
+
results,
|
|
293
|
+
domainSynonyms
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
results,
|
|
298
|
+
domainSynonyms
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
//#endregion
|
|
152
302
|
//#region package.json
|
|
153
|
-
var version = "1.1.
|
|
303
|
+
var version = "1.1.11";
|
|
154
304
|
//#endregion
|
|
155
305
|
//#region server/index.ts
|
|
156
306
|
const DIST_ROOT = import.meta.dirname;
|
|
157
307
|
const { metadata, synonyms, version: capturedVersionInfo } = loadCompiledData(DIST_ROOT);
|
|
158
308
|
const CAPTURED_UIKIT_VERSION = capturedVersionInfo?.version ?? null;
|
|
159
|
-
const metadataById = new Map(metadata.map((m) => [m.id, m]));
|
|
160
309
|
const server = new McpServer({
|
|
161
310
|
name: "uikit-mcp-server",
|
|
162
311
|
version
|
|
@@ -169,24 +318,6 @@ const server = new McpServer({
|
|
|
169
318
|
function buildResourceUri(docId) {
|
|
170
319
|
return new URL(`uikit-doc://${docId}`);
|
|
171
320
|
}
|
|
172
|
-
function expandDomainSynonyms(rawQuery, config) {
|
|
173
|
-
const query = rawQuery.toLowerCase();
|
|
174
|
-
const expansions = /* @__PURE__ */ new Set();
|
|
175
|
-
const preferred = /* @__PURE__ */ new Set();
|
|
176
|
-
const hints = /* @__PURE__ */ new Set();
|
|
177
|
-
for (const [key, values] of Object.entries(config.synonyms ?? {})) if (query.includes(key.toLowerCase())) {
|
|
178
|
-
(values ?? []).forEach((value) => {
|
|
179
|
-
if (value.toLowerCase() !== query) expansions.add(value);
|
|
180
|
-
});
|
|
181
|
-
(config.preferredDocIds?.[key] ?? []).forEach((id) => preferred.add(id));
|
|
182
|
-
if (config.hints?.[key]) hints.add(config.hints[key]);
|
|
183
|
-
}
|
|
184
|
-
return {
|
|
185
|
-
expansions: Array.from(expansions),
|
|
186
|
-
preferredDocIds: Array.from(preferred),
|
|
187
|
-
hints: Array.from(hints)
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
321
|
function registerDocResources(docs) {
|
|
191
322
|
for (const doc of docs) {
|
|
192
323
|
const safeId = assertSafeDocId(doc.id);
|
|
@@ -207,7 +338,7 @@ function registerDocResources(docs) {
|
|
|
207
338
|
}
|
|
208
339
|
console.error(`Registered ${docs.length} documentation resources.`);
|
|
209
340
|
}
|
|
210
|
-
function registerSearchTool(index,
|
|
341
|
+
function registerSearchTool(index, entriesMap, synonymsConfig) {
|
|
211
342
|
const inputSchema = {
|
|
212
343
|
query: z.string().min(1, "Query is required"),
|
|
213
344
|
limit: z.number().int().min(1).max(20).optional()
|
|
@@ -217,7 +348,8 @@ function registerSearchTool(index, metadataMap, synonymsConfig) {
|
|
|
217
348
|
title: z.string(),
|
|
218
349
|
summary: z.string().optional(),
|
|
219
350
|
category: z.string().nullish(),
|
|
220
|
-
section: z.string().nullish()
|
|
351
|
+
section: z.string().nullish(),
|
|
352
|
+
matchedHeading: z.string().optional()
|
|
221
353
|
})) };
|
|
222
354
|
server.registerTool("search_docs", {
|
|
223
355
|
title: "Search UI Kit docs",
|
|
@@ -231,50 +363,14 @@ function registerSearchTool(index, metadataMap, synonymsConfig) {
|
|
|
231
363
|
openWorldHint: false
|
|
232
364
|
}
|
|
233
365
|
}, async ({ query, limit = 5 }) => {
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (!doc) continue;
|
|
243
|
-
seen.add(id);
|
|
244
|
-
resolved.push({
|
|
245
|
-
resource: buildResourceUri(id).href,
|
|
246
|
-
title: doc.title,
|
|
247
|
-
summary: doc.summary,
|
|
248
|
-
category: doc.category,
|
|
249
|
-
section: doc.section
|
|
250
|
-
});
|
|
251
|
-
if (resolved.length >= limit) break;
|
|
252
|
-
}
|
|
253
|
-
for (const searchQuery of searchQueue) {
|
|
254
|
-
const hits = index.search(searchQuery, {
|
|
255
|
-
limit: Math.max(limit * 2, 10),
|
|
256
|
-
suggest: true
|
|
257
|
-
});
|
|
258
|
-
for (const group of hits) {
|
|
259
|
-
for (const id of group.result ?? []) {
|
|
260
|
-
const docId = String(id);
|
|
261
|
-
if (seen.has(docId)) continue;
|
|
262
|
-
seen.add(docId);
|
|
263
|
-
const doc = metadataMap.get(docId);
|
|
264
|
-
if (!doc) continue;
|
|
265
|
-
resolved.push({
|
|
266
|
-
resource: buildResourceUri(docId).href,
|
|
267
|
-
title: doc.title,
|
|
268
|
-
summary: doc.summary,
|
|
269
|
-
category: doc.category,
|
|
270
|
-
section: doc.section
|
|
271
|
-
});
|
|
272
|
-
if (resolved.length >= limit) break;
|
|
273
|
-
}
|
|
274
|
-
if (resolved.length >= limit) break;
|
|
275
|
-
}
|
|
276
|
-
if (resolved.length >= limit) break;
|
|
277
|
-
}
|
|
366
|
+
const { results: resolved, domainSynonyms } = resolveSearchDocs({
|
|
367
|
+
query,
|
|
368
|
+
limit,
|
|
369
|
+
index,
|
|
370
|
+
entriesById: entriesMap,
|
|
371
|
+
synonymsConfig,
|
|
372
|
+
resourceForDocId: (docId) => buildResourceUri(docId).href
|
|
373
|
+
});
|
|
278
374
|
let text = resolved.length > 0 ? resolved.map((entry, idx) => `${idx + 1}. ${entry.title} (${entry.resource})${entry.summary ? `\n ${entry.summary}` : ""}`).join("\n\n").concat("\n\nAlways call readResource on one of the URIs above instead of guessing component routes.") : `No matches for "${query}".`;
|
|
279
375
|
const uniqueHints = Array.from(new Set(domainSynonyms.hints.filter(Boolean)));
|
|
280
376
|
if (uniqueHints.length) text += `\n\n${uniqueHints.join("\n")}`;
|
|
@@ -289,9 +385,17 @@ function registerSearchTool(index, metadataMap, synonymsConfig) {
|
|
|
289
385
|
});
|
|
290
386
|
}
|
|
291
387
|
async function main() {
|
|
292
|
-
|
|
388
|
+
let foundationMarkdown = null;
|
|
389
|
+
try {
|
|
390
|
+
foundationMarkdown = loadMarkdown(DIST_ROOT, "foundations");
|
|
391
|
+
} catch {
|
|
392
|
+
foundationMarkdown = null;
|
|
393
|
+
}
|
|
394
|
+
const searchEntries = buildSearchEntries(metadata, { foundationMarkdown });
|
|
395
|
+
const searchEntriesById = new Map(searchEntries.map((entry) => [entry.id, entry]));
|
|
396
|
+
const index = buildSearchIndex(searchEntries);
|
|
293
397
|
registerDocResources(metadata);
|
|
294
|
-
registerSearchTool(index,
|
|
398
|
+
registerSearchTool(index, searchEntriesById, synonyms);
|
|
295
399
|
const docIds = new Set(metadata.map((m) => m.id));
|
|
296
400
|
const missingPreferred = /* @__PURE__ */ new Set();
|
|
297
401
|
for (const ids of Object.values(synonyms.preferredDocIds ?? {})) for (const id of ids ?? []) if (!docIds.has(id)) missingPreferred.add(id);
|
|
@@ -1,134 +1,272 @@
|
|
|
1
1
|
{
|
|
2
2
|
"synonyms": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"setup",
|
|
6
|
-
"how to",
|
|
7
|
-
"howto",
|
|
8
|
-
"getting started"
|
|
3
|
+
"accordion": [
|
|
4
|
+
"expander"
|
|
9
5
|
],
|
|
10
|
-
"
|
|
11
|
-
"
|
|
6
|
+
"alert": [
|
|
7
|
+
"notification",
|
|
8
|
+
"toast"
|
|
12
9
|
],
|
|
13
10
|
"button": [
|
|
14
11
|
"btn",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
12
|
+
"buttons",
|
|
13
|
+
"cta"
|
|
14
|
+
],
|
|
15
|
+
"chip": [
|
|
16
|
+
"tag",
|
|
17
|
+
"badge"
|
|
18
|
+
],
|
|
19
|
+
"csv export": [
|
|
20
|
+
"download",
|
|
21
|
+
"export",
|
|
22
|
+
"table export"
|
|
23
|
+
],
|
|
24
|
+
"datagrid": [
|
|
25
|
+
"grid",
|
|
26
|
+
"table"
|
|
27
|
+
],
|
|
28
|
+
"date picker": [
|
|
29
|
+
"calendar",
|
|
30
|
+
"datepicker"
|
|
31
|
+
],
|
|
32
|
+
"datepicker": [
|
|
33
|
+
"calendar",
|
|
34
|
+
"date picker"
|
|
35
|
+
],
|
|
36
|
+
"download": [
|
|
37
|
+
"export",
|
|
38
|
+
"csv export",
|
|
39
|
+
"table export"
|
|
17
40
|
],
|
|
18
41
|
"dropdown": [
|
|
19
|
-
"
|
|
20
|
-
"
|
|
42
|
+
"combobox",
|
|
43
|
+
"select"
|
|
21
44
|
],
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"combobox"
|
|
45
|
+
"expander": [
|
|
46
|
+
"accordion"
|
|
25
47
|
],
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
48
|
+
"export": [
|
|
49
|
+
"download",
|
|
50
|
+
"csv export",
|
|
51
|
+
"table export"
|
|
29
52
|
],
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
53
|
+
"file picker": [
|
|
54
|
+
"file upload",
|
|
55
|
+
"filepicker",
|
|
56
|
+
"upload"
|
|
57
|
+
],
|
|
58
|
+
"file upload": [
|
|
59
|
+
"file picker",
|
|
60
|
+
"filepicker",
|
|
61
|
+
"upload"
|
|
62
|
+
],
|
|
63
|
+
"filepicker": [
|
|
64
|
+
"file picker",
|
|
65
|
+
"file upload",
|
|
66
|
+
"upload"
|
|
33
67
|
],
|
|
34
68
|
"form": [
|
|
35
|
-
"
|
|
36
|
-
"
|
|
69
|
+
"field",
|
|
70
|
+
"input"
|
|
71
|
+
],
|
|
72
|
+
"getting started": [
|
|
73
|
+
"how to use",
|
|
74
|
+
"install",
|
|
75
|
+
"installation",
|
|
76
|
+
"setup"
|
|
77
|
+
],
|
|
78
|
+
"how to use": [
|
|
79
|
+
"getting started",
|
|
80
|
+
"install",
|
|
81
|
+
"installation",
|
|
82
|
+
"setup"
|
|
83
|
+
],
|
|
84
|
+
"install": [
|
|
85
|
+
"getting started",
|
|
86
|
+
"how to",
|
|
87
|
+
"howto",
|
|
88
|
+
"installation",
|
|
89
|
+
"setup"
|
|
90
|
+
],
|
|
91
|
+
"installation": [
|
|
92
|
+
"getting started",
|
|
93
|
+
"how to use",
|
|
94
|
+
"install",
|
|
95
|
+
"setup"
|
|
96
|
+
],
|
|
97
|
+
"license plate": [
|
|
98
|
+
"licenseplate",
|
|
99
|
+
"number plate"
|
|
100
|
+
],
|
|
101
|
+
"licenseplate": [
|
|
102
|
+
"license plate",
|
|
103
|
+
"number plate"
|
|
37
104
|
],
|
|
38
105
|
"modal": [
|
|
39
106
|
"dialog"
|
|
40
107
|
],
|
|
41
|
-
"
|
|
42
|
-
"
|
|
108
|
+
"notification": [
|
|
109
|
+
"alert",
|
|
110
|
+
"toast"
|
|
111
|
+
],
|
|
112
|
+
"number plate": [
|
|
113
|
+
"license plate",
|
|
114
|
+
"licenseplate"
|
|
115
|
+
],
|
|
116
|
+
"pager": [
|
|
117
|
+
"pages",
|
|
118
|
+
"pagination",
|
|
119
|
+
"paging"
|
|
120
|
+
],
|
|
121
|
+
"pagination": [
|
|
122
|
+
"pager",
|
|
123
|
+
"pages",
|
|
124
|
+
"paging"
|
|
125
|
+
],
|
|
126
|
+
"select": [
|
|
127
|
+
"combobox",
|
|
128
|
+
"dropdown"
|
|
129
|
+
],
|
|
130
|
+
"setup": [
|
|
131
|
+
"getting started",
|
|
132
|
+
"install",
|
|
133
|
+
"installation"
|
|
134
|
+
],
|
|
135
|
+
"table": [
|
|
136
|
+
"datagrid",
|
|
137
|
+
"grid"
|
|
138
|
+
],
|
|
139
|
+
"table export": [
|
|
140
|
+
"csv export",
|
|
141
|
+
"download",
|
|
142
|
+
"export"
|
|
143
|
+
],
|
|
144
|
+
"tag": [
|
|
145
|
+
"badge",
|
|
146
|
+
"chip"
|
|
43
147
|
],
|
|
44
148
|
"toast": [
|
|
45
149
|
"alert",
|
|
46
150
|
"notification"
|
|
47
151
|
],
|
|
152
|
+
"upload": [
|
|
153
|
+
"file picker",
|
|
154
|
+
"file upload",
|
|
155
|
+
"filepicker"
|
|
156
|
+
],
|
|
157
|
+
"version": [
|
|
158
|
+
"release"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"preferredDocIds": {
|
|
162
|
+
"accordion": [
|
|
163
|
+
"components/expander"
|
|
164
|
+
],
|
|
48
165
|
"alert": [
|
|
49
|
-
"
|
|
50
|
-
"notification"
|
|
166
|
+
"components/notifications"
|
|
51
167
|
],
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
168
|
+
"button": [
|
|
169
|
+
"components/button"
|
|
170
|
+
],
|
|
171
|
+
"chip": [
|
|
172
|
+
"components/tags"
|
|
173
|
+
],
|
|
174
|
+
"csv export": [
|
|
175
|
+
"utilities/useTableExport"
|
|
176
|
+
],
|
|
177
|
+
"datagrid": [
|
|
178
|
+
"components/table"
|
|
55
179
|
],
|
|
56
180
|
"date picker": [
|
|
57
|
-
"
|
|
58
|
-
"calendar"
|
|
181
|
+
"components/datepickers"
|
|
59
182
|
],
|
|
60
|
-
"
|
|
61
|
-
"
|
|
183
|
+
"datepicker": [
|
|
184
|
+
"components/datepickers"
|
|
185
|
+
],
|
|
186
|
+
"dialog": [
|
|
187
|
+
"components/dialogs"
|
|
188
|
+
],
|
|
189
|
+
"download": [
|
|
190
|
+
"utilities/useTableExport"
|
|
191
|
+
],
|
|
192
|
+
"dropdown": [
|
|
193
|
+
"components/dropdowns"
|
|
62
194
|
],
|
|
63
195
|
"expander": [
|
|
64
|
-
"
|
|
196
|
+
"components/expander"
|
|
65
197
|
],
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"badge"
|
|
198
|
+
"export": [
|
|
199
|
+
"utilities/useTableExport"
|
|
69
200
|
],
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
"
|
|
201
|
+
"file picker": [
|
|
202
|
+
"components/filePickers"
|
|
203
|
+
],
|
|
204
|
+
"file upload": [
|
|
205
|
+
"components/filePickers"
|
|
206
|
+
],
|
|
207
|
+
"filepicker": [
|
|
208
|
+
"components/filePickers"
|
|
78
209
|
],
|
|
79
210
|
"getting started": [
|
|
80
211
|
"start/howto"
|
|
81
212
|
],
|
|
82
|
-
"
|
|
213
|
+
"how to use": [
|
|
83
214
|
"start/howto"
|
|
84
215
|
],
|
|
85
|
-
"
|
|
216
|
+
"install": [
|
|
86
217
|
"start/howto"
|
|
87
218
|
],
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
],
|
|
91
|
-
"dropdown": [
|
|
92
|
-
"components/dropdowns"
|
|
93
|
-
],
|
|
94
|
-
"select": [
|
|
95
|
-
"components/dropdowns"
|
|
219
|
+
"installation": [
|
|
220
|
+
"start/howto"
|
|
96
221
|
],
|
|
97
|
-
"
|
|
98
|
-
"components/
|
|
222
|
+
"license plate": [
|
|
223
|
+
"components/licensePlate"
|
|
99
224
|
],
|
|
100
|
-
"
|
|
101
|
-
"components/
|
|
225
|
+
"licenseplate": [
|
|
226
|
+
"components/licensePlate"
|
|
102
227
|
],
|
|
103
228
|
"modal": [
|
|
104
229
|
"components/dialogs"
|
|
105
230
|
],
|
|
106
|
-
"
|
|
107
|
-
"components/dialogs"
|
|
108
|
-
],
|
|
109
|
-
"toast": [
|
|
231
|
+
"notification": [
|
|
110
232
|
"components/notifications"
|
|
111
233
|
],
|
|
112
|
-
"
|
|
113
|
-
"components/
|
|
234
|
+
"number plate": [
|
|
235
|
+
"components/licensePlate"
|
|
114
236
|
],
|
|
115
|
-
"
|
|
116
|
-
"components/
|
|
237
|
+
"pager": [
|
|
238
|
+
"components/pager"
|
|
117
239
|
],
|
|
118
|
-
"
|
|
119
|
-
"components/
|
|
240
|
+
"pagination": [
|
|
241
|
+
"components/pager"
|
|
120
242
|
],
|
|
121
|
-
"
|
|
122
|
-
"components/
|
|
243
|
+
"paging": [
|
|
244
|
+
"components/pager"
|
|
123
245
|
],
|
|
124
|
-
"
|
|
125
|
-
"components/
|
|
246
|
+
"select": [
|
|
247
|
+
"components/dropdowns",
|
|
248
|
+
"components/selects"
|
|
126
249
|
],
|
|
127
|
-
"
|
|
128
|
-
"
|
|
250
|
+
"setup": [
|
|
251
|
+
"start/howto"
|
|
252
|
+
],
|
|
253
|
+
"table": [
|
|
254
|
+
"components/table"
|
|
255
|
+
],
|
|
256
|
+
"table export": [
|
|
257
|
+
"utilities/useTableExport"
|
|
129
258
|
],
|
|
130
259
|
"tag": [
|
|
131
260
|
"components/tags"
|
|
261
|
+
],
|
|
262
|
+
"toast": [
|
|
263
|
+
"components/notifications"
|
|
264
|
+
],
|
|
265
|
+
"upload": [
|
|
266
|
+
"components/filePickers"
|
|
267
|
+
],
|
|
268
|
+
"version": [
|
|
269
|
+
"start/howto"
|
|
132
270
|
]
|
|
133
271
|
}
|
|
134
272
|
}
|
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rio-cloud/uikit-mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "MCP server that serves the captured RIO UI Kit documentation to Model Context Protocol clients.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,23 +26,25 @@
|
|
|
26
26
|
"crawl:full": "tsx tools/crawl-full.ts",
|
|
27
27
|
"crawl:navigation": "tsx crawler/cli/crawl-navigation.ts",
|
|
28
28
|
"capture:all": "tsx crawler/cli/capture-all.ts",
|
|
29
|
-
"mcp:demo-client": "npm run build:server && tsx tools/demo-client.ts",
|
|
30
29
|
"mcp:server": "npm run build:server && node dist/index.mjs"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
32
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
34
33
|
"flexsearch": "0.8.212",
|
|
35
|
-
"zod": "4.
|
|
34
|
+
"zod": "4.4.1"
|
|
36
35
|
},
|
|
37
36
|
"overrides": {
|
|
38
37
|
"@hono/node-server": "1.19.13",
|
|
39
|
-
"hono": "4.12.
|
|
38
|
+
"hono": "4.12.14",
|
|
39
|
+
"express-rate-limit": {
|
|
40
|
+
"ip-address": "10.1.1"
|
|
41
|
+
}
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"@types/node": "24.12.2",
|
|
43
45
|
"playwright": "1.59.1",
|
|
44
|
-
"tsdown": "0.21.
|
|
46
|
+
"tsdown": "0.21.10",
|
|
45
47
|
"tsx": "4.21.0",
|
|
46
|
-
"typescript": "6.0.
|
|
48
|
+
"typescript": "6.0.3"
|
|
47
49
|
}
|
|
48
50
|
}
|