@iress-oss/ids-mcp-server 0.0.1-dev.3 → 0.0.1-dev.5
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/generated/docs/components-autocomplete-docs.md +4 -4
- package/generated/docs/components-checkboxgroup-docs.md +17 -17
- package/generated/docs/components-col-docs.md +1 -1
- package/generated/docs/components-combobox-docs.md +4 -4
- package/generated/docs/components-filter-docs.md +4 -4
- package/generated/docs/components-form-docs.md +4 -4
- package/generated/docs/components-form-recipes-docs.md +4 -10
- package/generated/docs/components-icon-docs.md +4 -4
- package/generated/docs/components-provider-docs.md +105 -0
- package/generated/docs/components-radiogroup-docs.md +21 -21
- package/generated/docs/components-row-docs.md +4 -4
- package/generated/docs/components-skiplink-docs.md +1 -1
- package/generated/docs/components-table-ag-grid-docs.md +100 -100
- package/generated/docs/components-table-docs.md +6 -6
- package/generated/docs/components-toaster-docs.md +51 -0
- package/generated/docs/extensions-editor-docs.md +4 -4
- package/generated/docs/get-started-develop-docs.md +177 -16
- package/generated/docs/introduction-docs.md +1 -1
- package/generated/docs/themes-available-themes-docs.md +29 -29
- package/package.json +3 -13
- package/dist/componentHandlers.js +0 -241
- package/dist/componentHandlers.test.js +0 -380
- package/dist/config.js +0 -16
- package/dist/index.js +0 -53
- package/dist/iressHandlers.js +0 -144
- package/dist/iressHandlers.test.js +0 -316
- package/dist/resourceHandlers.js +0 -67
- package/dist/resourceHandlers.test.js +0 -352
- package/dist/searchHandlers.js +0 -287
- package/dist/searchHandlers.test.js +0 -524
- package/dist/toolHandler.js +0 -31
- package/dist/toolHandler.test.js +0 -369
- package/dist/tools.js +0 -165
- package/dist/types.js +0 -4
- package/dist/utils.js +0 -59
- package/dist/utils.test.js +0 -286
|
@@ -12,10 +12,108 @@ Set up your environment to use the latest version of the Iress Design System (ID
|
|
|
12
12
|
[](#set-up-the-component-library)Set up the component library
|
|
13
13
|
-------------------------------------------------------------
|
|
14
14
|
|
|
15
|
-
1. Install using
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
1. Install using the command line:
|
|
16
|
+
|
|
17
|
+
\[data-radix-scroll-area-viewport\] {
|
|
18
|
+
scrollbar-width: none;
|
|
19
|
+
-ms-overflow-style: none;
|
|
20
|
+
-webkit-overflow-scrolling: touch;
|
|
21
|
+
}
|
|
22
|
+
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
:where(\[data-radix-scroll-area-viewport\]) {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
align-items: stretch;
|
|
29
|
+
}
|
|
30
|
+
:where(\[data-radix-scroll-area-content\]) {
|
|
31
|
+
flex-grow: 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
yarn add @iress-oss/ids-components
|
|
35
|
+
|
|
36
|
+
Copy
|
|
37
|
+
|
|
38
|
+
2. Import the styles:
|
|
39
|
+
|
|
40
|
+
\[data-radix-scroll-area-viewport\] {
|
|
41
|
+
scrollbar-width: none;
|
|
42
|
+
-ms-overflow-style: none;
|
|
43
|
+
-webkit-overflow-scrolling: touch;
|
|
44
|
+
}
|
|
45
|
+
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
46
|
+
display: none;
|
|
47
|
+
}
|
|
48
|
+
:where(\[data-radix-scroll-area-viewport\]) {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
align-items: stretch;
|
|
52
|
+
}
|
|
53
|
+
:where(\[data-radix-scroll-area-content\]) {
|
|
54
|
+
flex-grow: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
import '@iress-oss/ids-components/dist/style.css';
|
|
58
|
+
|
|
59
|
+
Copy
|
|
60
|
+
|
|
61
|
+
3. Import the components. The provider is optional, but recommended for most applications. It sets up the design system and provides a consistent container for components like modals, slideouts, and toasts.
|
|
62
|
+
|
|
63
|
+
\[data-radix-scroll-area-viewport\] {
|
|
64
|
+
scrollbar-width: none;
|
|
65
|
+
-ms-overflow-style: none;
|
|
66
|
+
-webkit-overflow-scrolling: touch;
|
|
67
|
+
}
|
|
68
|
+
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
:where(\[data-radix-scroll-area-viewport\]) {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
align-items: stretch;
|
|
75
|
+
}
|
|
76
|
+
:where(\[data-radix-scroll-area-content\]) {
|
|
77
|
+
flex-grow: 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
import { IressProvider, IressButton } from '@iress-oss/ids-components';
|
|
81
|
+
|
|
82
|
+
Copy
|
|
83
|
+
|
|
84
|
+
4. Use the components:
|
|
85
|
+
|
|
86
|
+
\[data-radix-scroll-area-viewport\] {
|
|
87
|
+
scrollbar-width: none;
|
|
88
|
+
-ms-overflow-style: none;
|
|
89
|
+
-webkit-overflow-scrolling: touch;
|
|
90
|
+
}
|
|
91
|
+
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
:where(\[data-radix-scroll-area-viewport\]) {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
align-items: stretch;
|
|
98
|
+
}
|
|
99
|
+
:where(\[data-radix-scroll-area-content\]) {
|
|
100
|
+
flex-grow: 1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const App \= () \=> (
|
|
104
|
+
<IressButton onClick\={() \=> success({ children: 'Toast triggered' })}\>
|
|
105
|
+
Trigger toast </IressButton\>
|
|
106
|
+
);
|
|
107
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
108
|
+
<IressProvider\>
|
|
109
|
+
<App />
|
|
110
|
+
</IressProvider\>,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
Copy
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
* * *
|
|
19
117
|
|
|
20
118
|
[](#set-up-the-theme)Set up the theme
|
|
21
119
|
-------------------------------------
|
|
@@ -27,22 +125,85 @@ Microfrontends
|
|
|
27
125
|
|
|
28
126
|
If you are building a React App that is intended to be used as a microfrontend, please skip this step. Microfrontends should inherit the parent application's theme, and not define a theme itself, as it may conflict with other microfrontends in the same parent application.
|
|
29
127
|
|
|
30
|
-
1. Install using
|
|
31
|
-
|
|
32
|
-
|
|
128
|
+
1. Install using the command line:
|
|
129
|
+
|
|
130
|
+
\[data-radix-scroll-area-viewport\] {
|
|
131
|
+
scrollbar-width: none;
|
|
132
|
+
-ms-overflow-style: none;
|
|
133
|
+
-webkit-overflow-scrolling: touch;
|
|
134
|
+
}
|
|
135
|
+
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
136
|
+
display: none;
|
|
137
|
+
}
|
|
138
|
+
:where(\[data-radix-scroll-area-viewport\]) {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
align-items: stretch;
|
|
142
|
+
}
|
|
143
|
+
:where(\[data-radix-scroll-area-content\]) {
|
|
144
|
+
flex-grow: 1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
yarn add @iress/ids-themes
|
|
148
|
+
|
|
149
|
+
Copy
|
|
150
|
+
|
|
151
|
+
2. Import the component:
|
|
152
|
+
|
|
153
|
+
\[data-radix-scroll-area-viewport\] {
|
|
154
|
+
scrollbar-width: none;
|
|
155
|
+
-ms-overflow-style: none;
|
|
156
|
+
-webkit-overflow-scrolling: touch;
|
|
157
|
+
}
|
|
158
|
+
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
159
|
+
display: none;
|
|
160
|
+
}
|
|
161
|
+
:where(\[data-radix-scroll-area-viewport\]) {
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
align-items: stretch;
|
|
165
|
+
}
|
|
166
|
+
:where(\[data-radix-scroll-area-content\]) {
|
|
167
|
+
flex-grow: 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
import { IressTheme } from '@iress-oss/ids-components';
|
|
171
|
+
|
|
172
|
+
Copy
|
|
173
|
+
|
|
174
|
+
3. Add the component to your application:
|
|
175
|
+
|
|
176
|
+
\[data-radix-scroll-area-viewport\] {
|
|
177
|
+
scrollbar-width: none;
|
|
178
|
+
-ms-overflow-style: none;
|
|
179
|
+
-webkit-overflow-scrolling: touch;
|
|
180
|
+
}
|
|
181
|
+
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
182
|
+
display: none;
|
|
183
|
+
}
|
|
184
|
+
:where(\[data-radix-scroll-area-viewport\]) {
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
align-items: stretch;
|
|
188
|
+
}
|
|
189
|
+
:where(\[data-radix-scroll-area-content\]) {
|
|
190
|
+
flex-grow: 1;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
194
|
+
<IressProvider\>
|
|
195
|
+
<IressTheme />
|
|
196
|
+
<App />
|
|
197
|
+
</IressProvider\>,
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
Copy
|
|
201
|
+
|
|
33
202
|
|
|
34
203
|
For alternative ways to import the theme, see the [Themes documentation](./?path=/docs/themes-introduction--docs).
|
|
35
204
|
|
|
36
|
-
[](#set-up-the-icons)Set up the icons
|
|
37
|
-
-------------------------------------
|
|
38
|
-
|
|
39
|
-
If you are planning to use the `<IressIcon />` component, you need to include the Font Awesome CSS in your application.
|
|
40
|
-
|
|
41
|
-
You can do this by including the Font Awesome CSS [via the Iress CDN](./?path=/docs/components-icon--docs#installation).
|
|
42
|
-
|
|
43
205
|
On this page
|
|
44
206
|
|
|
45
207
|
* [Requirements](#requirements)
|
|
46
208
|
* [Set up the component library](#set-up-the-component-library)
|
|
47
|
-
* [Set up the theme](#set-up-the-theme)
|
|
48
|
-
* [Set up the icons](#set-up-the-icons)
|
|
209
|
+
* [Set up the theme](#set-up-the-theme)
|
|
@@ -17,11 +17,11 @@ Themes are no longer connected to the version of IDS you are using. Instead they
|
|
|
17
17
|
[](#list)List
|
|
18
18
|
-------------
|
|
19
19
|
|
|
20
|
-
Version: 5.5.0-
|
|
20
|
+
Version: 5.5.0-30221
|
|
21
21
|
|
|
22
22
|
* * *
|
|
23
23
|
|
|
24
|
-
5.5.0-
|
|
24
|
+
5.5.0-30221Latest5.4.8-262445.4.7-261205.4.6-260525.4.5-260275.4.4-260225.4.3-259955.4.2-259585.4.1-259415.4.0-294265.3.2-290865.3.1-29028
|
|
25
25
|
|
|
26
26
|
None selected
|
|
27
27
|
|
|
@@ -29,36 +29,36 @@ Latest build only
|
|
|
29
29
|
|
|
30
30
|
* * *
|
|
31
31
|
|
|
32
|
-
### Version: 5.5.0-
|
|
33
|
-
|
|
34
|
-
* [css/demo-theme-1--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
35
|
-
* [css/demo-theme-1.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
36
|
-
* [css/demo-theme-2--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
37
|
-
* [css/demo-theme-2.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
38
|
-
* [css/demo-theme-3--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
39
|
-
* [css/demo-theme-3.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
40
|
-
* [css/demo-theme-4--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
41
|
-
* [css/demo-theme-4.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
42
|
-
* [css/demo-theme-5--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
43
|
-
* [css/demo-theme-5.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
44
|
-
* [css/demo-theme-6--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
45
|
-
* [css/demo-theme-6.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
46
|
-
* [css/hostplus-theme-light--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
47
|
-
* [css/hostplus-theme-light.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
48
|
-
* [css/iress-beta-theme-dark--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
49
|
-
* [css/iress-beta-theme-dark.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
50
|
-
* [css/iress-beta-theme-light--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
51
|
-
* [css/iress-beta-theme-light.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
52
|
-
* [css/iress-theme-dark--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
53
|
-
* [css/iress-theme-dark.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
54
|
-
* [css/iress-theme-light--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
55
|
-
* [css/iress-theme-light.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
56
|
-
* [css/iress-theme-wealth--touch.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
57
|
-
* [css/iress-theme-wealth.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
32
|
+
### Version: 5.5.0-30221
|
|
33
|
+
|
|
34
|
+
* [css/demo-theme-1--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-1--touch.css)
|
|
35
|
+
* [css/demo-theme-1.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-1.css)
|
|
36
|
+
* [css/demo-theme-2--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-2--touch.css)
|
|
37
|
+
* [css/demo-theme-2.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-2.css)
|
|
38
|
+
* [css/demo-theme-3--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-3--touch.css)
|
|
39
|
+
* [css/demo-theme-3.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-3.css)
|
|
40
|
+
* [css/demo-theme-4--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-4--touch.css)
|
|
41
|
+
* [css/demo-theme-4.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-4.css)
|
|
42
|
+
* [css/demo-theme-5--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-5--touch.css)
|
|
43
|
+
* [css/demo-theme-5.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-5.css)
|
|
44
|
+
* [css/demo-theme-6--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-6--touch.css)
|
|
45
|
+
* [css/demo-theme-6.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/demo-theme-6.css)
|
|
46
|
+
* [css/hostplus-theme-light--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/hostplus-theme-light--touch.css)
|
|
47
|
+
* [css/hostplus-theme-light.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/hostplus-theme-light.css)
|
|
48
|
+
* [css/iress-beta-theme-dark--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-beta-theme-dark--touch.css)
|
|
49
|
+
* [css/iress-beta-theme-dark.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-beta-theme-dark.css)
|
|
50
|
+
* [css/iress-beta-theme-light--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-beta-theme-light--touch.css)
|
|
51
|
+
* [css/iress-beta-theme-light.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-beta-theme-light.css)
|
|
52
|
+
* [css/iress-theme-dark--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-theme-dark--touch.css)
|
|
53
|
+
* [css/iress-theme-dark.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-theme-dark.css)
|
|
54
|
+
* [css/iress-theme-light--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-theme-light--touch.css)
|
|
55
|
+
* [css/iress-theme-light.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-theme-light.css)
|
|
56
|
+
* [css/iress-theme-wealth--touch.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-theme-wealth--touch.css)
|
|
57
|
+
* [css/iress-theme-wealth.css](https://cdn-staging.iress.com/ids/5.5.0-30221/themes/css/iress-theme-wealth.css)
|
|
58
58
|
|
|
59
59
|
#### Theme mappings
|
|
60
60
|
|
|
61
|
-
* [ag-theme-iress-lite.css](https://cdn-staging.iress.com/ids/5.5.0-
|
|
61
|
+
* [ag-theme-iress-lite.css](https://cdn-staging.iress.com/ids/5.5.0-30221/ag-theme-iress-lite.css)
|
|
62
62
|
|
|
63
63
|
On this page
|
|
64
64
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iress-oss/ids-mcp-server",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.5",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for Iress Design System (IDS) component library - provides AI assistants with contextual information about IDS components, design tokens, and usage patterns",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,17 +32,7 @@
|
|
|
32
32
|
"author": "Iress",
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"scripts": {
|
|
35
|
-
"
|
|
36
|
-
"clean": "rimraf dist coverage generated .nyc_output",
|
|
37
|
-
"dev": "tsc --watch",
|
|
38
|
-
"generate": "tsx scripts/generate.ts",
|
|
39
|
-
"lint": "eslint . --ext ts,tsx,mdx --report-unused-disable-directives --max-warnings 0",
|
|
40
|
-
"lint:fix": "eslint . --fix",
|
|
41
|
-
"start": "node dist/index.js",
|
|
42
|
-
"test": "vitest run --coverage",
|
|
43
|
-
"test:dev": "chmod +x ./scripts/test-dev-server.sh && ./scripts/test-dev-server.sh",
|
|
44
|
-
"test:watch": "vitest watch",
|
|
45
|
-
"typecheck": "tsc --noEmit"
|
|
35
|
+
"generate": "tsx scripts/generate.ts"
|
|
46
36
|
},
|
|
47
37
|
"files": [
|
|
48
38
|
"dist",
|
|
@@ -77,5 +67,5 @@
|
|
|
77
67
|
"typescript": "^5.8.3",
|
|
78
68
|
"vitest": "^3.2.4"
|
|
79
69
|
},
|
|
80
|
-
"stableVersion": "5.
|
|
70
|
+
"stableVersion": "5.15.0"
|
|
81
71
|
}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool handlers for component-related operations
|
|
3
|
-
*/
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
import { getMarkdownFiles, mapIressComponentToFile, extractIressComponents, readFileContent, } from './utils.js';
|
|
7
|
-
import { DOCS_DIR } from './config.js';
|
|
8
|
-
function checkIressComponentMatch(query) {
|
|
9
|
-
if (query.startsWith('Iress')) {
|
|
10
|
-
const componentFile = mapIressComponentToFile(query);
|
|
11
|
-
if (componentFile) {
|
|
12
|
-
return {
|
|
13
|
-
content: [
|
|
14
|
-
{
|
|
15
|
-
type: 'text',
|
|
16
|
-
text: `Found exact match for **${query}**:\n\n**${componentFile}**\n ${query} component documentation\n\n*Use \`get_iress_component_info\` with "${query}" for detailed information.*`,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
function calculateRelevanceScore(file, content, query, lines) {
|
|
25
|
-
let relevanceScore = 0;
|
|
26
|
-
const queryLower = query.toLowerCase();
|
|
27
|
-
const filenameLower = file.toLowerCase();
|
|
28
|
-
// Check for Iress component mentions in content
|
|
29
|
-
const iressComponents = extractIressComponents(content);
|
|
30
|
-
const hasMatchingIressComponent = iressComponents.some((comp) => comp.toLowerCase().includes(queryLower) ||
|
|
31
|
-
queryLower.includes(comp.toLowerCase().replace('iress', '')));
|
|
32
|
-
if (hasMatchingIressComponent) {
|
|
33
|
-
relevanceScore += 75;
|
|
34
|
-
}
|
|
35
|
-
// High relevance for filename matches
|
|
36
|
-
if (filenameLower.includes(queryLower)) {
|
|
37
|
-
relevanceScore += 100;
|
|
38
|
-
}
|
|
39
|
-
// Medium relevance for title matches
|
|
40
|
-
const title = lines.find((line) => line.startsWith('#'))?.replace(/^#+\s*/, '') ?? '';
|
|
41
|
-
if (title.toLowerCase().includes(queryLower)) {
|
|
42
|
-
relevanceScore += 50;
|
|
43
|
-
}
|
|
44
|
-
// Lower relevance for content matches
|
|
45
|
-
const contentMatches = content.toLowerCase().split(queryLower).length - 1;
|
|
46
|
-
relevanceScore += contentMatches * 2;
|
|
47
|
-
return relevanceScore;
|
|
48
|
-
}
|
|
49
|
-
function createSearchResult(file, relevanceScore, lines) {
|
|
50
|
-
const componentName = file
|
|
51
|
-
.replace(/^components-/, '')
|
|
52
|
-
.replace('-docs.md', '');
|
|
53
|
-
const description = lines
|
|
54
|
-
.slice(0, 10)
|
|
55
|
-
.find((line) => line.trim() && !line.startsWith('#') && !line.startsWith('<!--'))
|
|
56
|
-
?.trim() ?? 'IDS component documentation';
|
|
57
|
-
return {
|
|
58
|
-
file,
|
|
59
|
-
relevance: relevanceScore,
|
|
60
|
-
description: `${componentName}: ${description}`,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export function handleFindComponent(args) {
|
|
64
|
-
const schema = z.object({
|
|
65
|
-
query: z.string(),
|
|
66
|
-
category: z.enum(['components', 'foundations', 'resources']).optional(),
|
|
67
|
-
});
|
|
68
|
-
const { query, category } = schema.parse(args);
|
|
69
|
-
// Check if query is an Iress component name
|
|
70
|
-
const iressMatch = checkIressComponentMatch(query);
|
|
71
|
-
if (iressMatch) {
|
|
72
|
-
return iressMatch;
|
|
73
|
-
}
|
|
74
|
-
const markdownFiles = getMarkdownFiles();
|
|
75
|
-
// Filter files by category if specified
|
|
76
|
-
const filteredFiles = category
|
|
77
|
-
? markdownFiles.filter((file) => file.startsWith(`${category}-`))
|
|
78
|
-
: markdownFiles;
|
|
79
|
-
const results = [];
|
|
80
|
-
for (const file of filteredFiles) {
|
|
81
|
-
try {
|
|
82
|
-
const filePath = path.join(DOCS_DIR, file);
|
|
83
|
-
const content = readFileContent(filePath);
|
|
84
|
-
const lines = content.split('\n');
|
|
85
|
-
const relevanceScore = calculateRelevanceScore(file, content, query, lines);
|
|
86
|
-
if (relevanceScore > 0) {
|
|
87
|
-
results.push(createSearchResult(file, relevanceScore, lines));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
console.error(`Error reading file ${file}:`, error);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Sort by relevance
|
|
95
|
-
results.sort((a, b) => b.relevance - a.relevance);
|
|
96
|
-
return {
|
|
97
|
-
content: [
|
|
98
|
-
{
|
|
99
|
-
type: 'text',
|
|
100
|
-
text: results.length > 0
|
|
101
|
-
? `Found ${results.length} relevant IDS components:\n\n${results
|
|
102
|
-
.slice(0, 10) // Limit to top 10 results
|
|
103
|
-
.map((r, index) => `${index + 1}. **${r.file}**\n ${r.description}`)
|
|
104
|
-
.join('\n\n')}`
|
|
105
|
-
: `No IDS components found matching "${query}". Try searching for common component names like "button", "input", "table", or "modal".`,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function findComponentFile(component, markdownFiles) {
|
|
111
|
-
return markdownFiles.find((file) => file.includes(`components-${component.toLowerCase()}`) ||
|
|
112
|
-
file.toLowerCase().includes(component.toLowerCase()));
|
|
113
|
-
}
|
|
114
|
-
function formatAvailableComponents(markdownFiles) {
|
|
115
|
-
return markdownFiles
|
|
116
|
-
.filter((f) => f.startsWith('components-'))
|
|
117
|
-
.map((f) => `- ${f.replace('components-', '').replace('-docs.md', '')}`)
|
|
118
|
-
.join('\n');
|
|
119
|
-
}
|
|
120
|
-
function isPropsRelatedLine(line) {
|
|
121
|
-
return (line.includes('mode') ||
|
|
122
|
-
line.includes('prop') ||
|
|
123
|
-
line.includes('Properties') ||
|
|
124
|
-
line.includes('API') ||
|
|
125
|
-
line.includes('Examples'));
|
|
126
|
-
}
|
|
127
|
-
function extractPropSections(content) {
|
|
128
|
-
const lines = content.split('\n');
|
|
129
|
-
const propSections = [];
|
|
130
|
-
let inPropsSection = false;
|
|
131
|
-
let currentSection = '';
|
|
132
|
-
for (const line of lines) {
|
|
133
|
-
if (isPropsRelatedLine(line)) {
|
|
134
|
-
if (currentSection) {
|
|
135
|
-
propSections.push(currentSection);
|
|
136
|
-
}
|
|
137
|
-
currentSection = line + '\n';
|
|
138
|
-
inPropsSection = true;
|
|
139
|
-
}
|
|
140
|
-
else if (inPropsSection && line.trim()) {
|
|
141
|
-
currentSection += line + '\n';
|
|
142
|
-
}
|
|
143
|
-
else if (inPropsSection && !line.trim()) {
|
|
144
|
-
if (currentSection) {
|
|
145
|
-
propSections.push(currentSection);
|
|
146
|
-
currentSection = '';
|
|
147
|
-
}
|
|
148
|
-
inPropsSection = false;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (currentSection) {
|
|
152
|
-
propSections.push(currentSection);
|
|
153
|
-
}
|
|
154
|
-
return propSections;
|
|
155
|
-
}
|
|
156
|
-
function formatPropsResponse(propSections, content, componentFile) {
|
|
157
|
-
return propSections.length > 0
|
|
158
|
-
? propSections.join('\n---\n\n')
|
|
159
|
-
: `Props information extracted from ${componentFile}:\n\n${content.slice(0, 2000)}...`;
|
|
160
|
-
}
|
|
161
|
-
export function handleGetComponentProps(args) {
|
|
162
|
-
const schema = z.object({
|
|
163
|
-
component: z.string(),
|
|
164
|
-
});
|
|
165
|
-
const { component } = schema.parse(args);
|
|
166
|
-
const markdownFiles = getMarkdownFiles();
|
|
167
|
-
const componentFile = findComponentFile(component, markdownFiles);
|
|
168
|
-
if (!componentFile) {
|
|
169
|
-
return {
|
|
170
|
-
content: [
|
|
171
|
-
{
|
|
172
|
-
type: 'text',
|
|
173
|
-
text: `Component "${component}" not found. Available components:\n${formatAvailableComponents(markdownFiles)}`,
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
try {
|
|
179
|
-
const filePath = path.join(DOCS_DIR, componentFile);
|
|
180
|
-
const content = readFileContent(filePath);
|
|
181
|
-
const propSections = extractPropSections(content);
|
|
182
|
-
return {
|
|
183
|
-
content: [
|
|
184
|
-
{
|
|
185
|
-
type: 'text',
|
|
186
|
-
text: `**${component} Component Props & API**\n\n${formatPropsResponse(propSections, content, componentFile)}`,
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
catch (error) {
|
|
192
|
-
throw new Error(`Failed to read component file ${componentFile}: ${error instanceof Error ? error.message : String(error)}`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
export function handleListComponents(args) {
|
|
196
|
-
const schema = z.object({
|
|
197
|
-
category: z
|
|
198
|
-
.enum(['components', 'foundations', 'resources', 'all'])
|
|
199
|
-
.default('all'),
|
|
200
|
-
});
|
|
201
|
-
const { category } = schema.parse(args);
|
|
202
|
-
const markdownFiles = getMarkdownFiles();
|
|
203
|
-
const categorized = {
|
|
204
|
-
components: markdownFiles
|
|
205
|
-
.filter((f) => f.startsWith('components-'))
|
|
206
|
-
.map((f) => f.replace('components-', '').replace('-docs.md', '')),
|
|
207
|
-
foundations: markdownFiles
|
|
208
|
-
.filter((f) => f.startsWith('foundations-'))
|
|
209
|
-
.map((f) => f.replace('foundations-', '').replace('-docs.md', '')),
|
|
210
|
-
resources: markdownFiles
|
|
211
|
-
.filter((f) => f.startsWith('resources-'))
|
|
212
|
-
.map((f) => f.replace('resources-', '').replace('-docs.md', '')),
|
|
213
|
-
};
|
|
214
|
-
let output = '**IDS Component Library**\n\n';
|
|
215
|
-
if (category === 'all') {
|
|
216
|
-
const componentsList = categorized.components
|
|
217
|
-
.map((c) => `- ${c}`)
|
|
218
|
-
.join('\n');
|
|
219
|
-
const foundationsList = categorized.foundations
|
|
220
|
-
.map((c) => `- ${c}`)
|
|
221
|
-
.join('\n');
|
|
222
|
-
const resourcesList = categorized.resources.map((c) => `- ${c}`).join('\n');
|
|
223
|
-
output += `**Components (${categorized.components.length})**\n${componentsList}\n\n`;
|
|
224
|
-
output += `**Foundations (${categorized.foundations.length})**\n${foundationsList}\n\n`;
|
|
225
|
-
output += `**Resources (${categorized.resources.length})**\n${resourcesList}`;
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
const items = categorized[category];
|
|
229
|
-
const itemsList = items.map((c) => `- ${c}`).join('\n');
|
|
230
|
-
const categoryTitle = category.charAt(0).toUpperCase() + category.slice(1);
|
|
231
|
-
output += `**${categoryTitle} (${items.length})**\n${itemsList}`;
|
|
232
|
-
}
|
|
233
|
-
return {
|
|
234
|
-
content: [
|
|
235
|
-
{
|
|
236
|
-
type: 'text',
|
|
237
|
-
text: output,
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
};
|
|
241
|
-
}
|