@eui/mcp 1.5.10 → 21.2.4-snapshot-1776931045923
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/package.json +25 -63
- package/LICENSE +0 -291
- package/dist/main.js +0 -542
package/package.json
CHANGED
|
@@ -1,64 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"release:minor": "npm version minor -m 'chore(release): %s [skip ci]'",
|
|
28
|
-
"release:major": "npm version major -m 'chore(release): %s [skip ci]'"
|
|
29
|
-
},
|
|
30
|
-
"keywords": [
|
|
31
|
-
"mcp",
|
|
32
|
-
"model-context-protocol",
|
|
33
|
-
"angular",
|
|
34
|
-
"documentation",
|
|
35
|
-
"eui"
|
|
36
|
-
],
|
|
37
|
-
"author": "",
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"@modelcontextprotocol/sdk": "^1.7.0",
|
|
41
|
-
"chokidar": "^5.0.0",
|
|
42
|
-
"pino": "^10.3.1",
|
|
43
|
-
"pino-pretty": "^13.1.3",
|
|
44
|
-
"zod": "^3.22.4"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@types/jest": "^29.5.11",
|
|
48
|
-
"@types/node": "^20.10.6",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
50
|
-
"@typescript-eslint/parser": "^8.57.0",
|
|
51
|
-
"conventional-changelog-cli": "^4.1.0",
|
|
52
|
-
"eslint": "^8.56.0",
|
|
53
|
-
"esbuild": "^0.27.3",
|
|
54
|
-
"fast-check": "^3.15.0",
|
|
55
|
-
"jest": "^29.7.0",
|
|
56
|
-
"semver": "^7.7.3",
|
|
57
|
-
"ts-jest": "^29.1.1",
|
|
58
|
-
"ts-node": "^10.9.2",
|
|
59
|
-
"typescript": "^5.3.3"
|
|
60
|
-
},
|
|
61
|
-
"engines": {
|
|
62
|
-
"node": ">=18.0.0"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
2
|
+
"name": "@eui/mcp",
|
|
3
|
+
"version": "21.2.4-snapshot-1776931045923",
|
|
4
|
+
"description": "MCP server for EUI Angular component library using Compodoc documentation",
|
|
5
|
+
"main": "dist/main.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"eui-mcp": "./dist/main.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"mcp",
|
|
17
|
+
"model-context-protocol",
|
|
18
|
+
"angular",
|
|
19
|
+
"documentation",
|
|
20
|
+
"eui"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18.0.0"
|
|
24
|
+
},
|
|
25
|
+
"tag": "snapshot"
|
|
26
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
|
2
|
-
EUPL © the European Union 2007, 2016
|
|
3
|
-
|
|
4
|
-
This European Union Public Licence (the ‘EUPL’) applies to the Work (as
|
|
5
|
-
defined below) which is provided under the terms of this Licence. Any use of
|
|
6
|
-
the Work, other than as authorised under this Licence is prohibited (to the
|
|
7
|
-
extent such use is covered by a right of the copyright holder of the Work).
|
|
8
|
-
|
|
9
|
-
The Work is provided under the terms of this Licence when the Licensor (as
|
|
10
|
-
defined below) has placed the following notice immediately following the
|
|
11
|
-
copyright notice for the Work:
|
|
12
|
-
|
|
13
|
-
Licensed under the EUPL
|
|
14
|
-
|
|
15
|
-
or has expressed by any other means his willingness to license under the EUPL.
|
|
16
|
-
|
|
17
|
-
1. Definitions
|
|
18
|
-
|
|
19
|
-
In this Licence, the following terms have the following meaning:
|
|
20
|
-
|
|
21
|
-
- ‘The Licence’: this Licence.
|
|
22
|
-
|
|
23
|
-
- ‘The Original Work’: the work or software distributed or communicated by the
|
|
24
|
-
Licensor under this Licence, available as Source Code and also as Executable
|
|
25
|
-
Code as the case may be.
|
|
26
|
-
|
|
27
|
-
- ‘Derivative Works’: the works or software that could be created by the
|
|
28
|
-
Licensee, based upon the Original Work or modifications thereof. This
|
|
29
|
-
Licence does not define the extent of modification or dependence on the
|
|
30
|
-
Original Work required in order to classify a work as a Derivative Work;
|
|
31
|
-
this extent is determined by copyright law applicable in the country
|
|
32
|
-
mentioned in Article 15.
|
|
33
|
-
|
|
34
|
-
- ‘The Work’: the Original Work or its Derivative Works.
|
|
35
|
-
|
|
36
|
-
- ‘The Source Code’: the human-readable form of the Work which is the most
|
|
37
|
-
convenient for people to study and modify.
|
|
38
|
-
|
|
39
|
-
- ‘The Executable Code’: any code which has generally been compiled and which
|
|
40
|
-
is meant to be interpreted by a computer as a program.
|
|
41
|
-
|
|
42
|
-
- ‘The Licensor’: the natural or legal person that distributes or communicates
|
|
43
|
-
the Work under the Licence.
|
|
44
|
-
|
|
45
|
-
- ‘Contributor(s)’: any natural or legal person who modifies the Work under
|
|
46
|
-
the Licence, or otherwise contributes to the creation of a Derivative Work.
|
|
47
|
-
|
|
48
|
-
- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
|
|
49
|
-
the Work under the terms of the Licence.
|
|
50
|
-
|
|
51
|
-
- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
|
|
52
|
-
renting, distributing, communicating, transmitting, or otherwise making
|
|
53
|
-
available, online or offline, copies of the Work or providing access to its
|
|
54
|
-
essential functionalities at the disposal of any other natural or legal
|
|
55
|
-
person.
|
|
56
|
-
|
|
57
|
-
2. Scope of the rights granted by the Licence
|
|
58
|
-
|
|
59
|
-
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
|
60
|
-
sublicensable licence to do the following, for the duration of copyright
|
|
61
|
-
vested in the Original Work:
|
|
62
|
-
|
|
63
|
-
- use the Work in any circumstance and for all usage,
|
|
64
|
-
- reproduce the Work,
|
|
65
|
-
- modify the Work, and make Derivative Works based upon the Work,
|
|
66
|
-
- communicate to the public, including the right to make available or display
|
|
67
|
-
the Work or copies thereof to the public and perform publicly, as the case
|
|
68
|
-
may be, the Work,
|
|
69
|
-
- distribute the Work or copies thereof,
|
|
70
|
-
- lend and rent the Work or copies thereof,
|
|
71
|
-
- sublicense rights in the Work or copies thereof.
|
|
72
|
-
|
|
73
|
-
Those rights can be exercised on any media, supports and formats, whether now
|
|
74
|
-
known or later invented, as far as the applicable law permits so.
|
|
75
|
-
|
|
76
|
-
In the countries where moral rights apply, the Licensor waives his right to
|
|
77
|
-
exercise his moral right to the extent allowed by law in order to make
|
|
78
|
-
effective the licence of the economic rights here above listed.
|
|
79
|
-
|
|
80
|
-
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights
|
|
81
|
-
to any patents held by the Licensor, to the extent necessary to make use of
|
|
82
|
-
the rights granted on the Work under this Licence.
|
|
83
|
-
|
|
84
|
-
3. Communication of the Source Code
|
|
85
|
-
|
|
86
|
-
The Licensor may provide the Work either in its Source Code form, or as
|
|
87
|
-
Executable Code. If the Work is provided as Executable Code, the Licensor
|
|
88
|
-
provides in addition a machine-readable copy of the Source Code of the Work
|
|
89
|
-
along with each copy of the Work that the Licensor distributes or indicates,
|
|
90
|
-
in a notice following the copyright notice attached to the Work, a repository
|
|
91
|
-
where the Source Code is easily and freely accessible for as long as the
|
|
92
|
-
Licensor continues to distribute or communicate the Work.
|
|
93
|
-
|
|
94
|
-
4. Limitations on copyright
|
|
95
|
-
|
|
96
|
-
Nothing in this Licence is intended to deprive the Licensee of the benefits
|
|
97
|
-
from any exception or limitation to the exclusive rights of the rights owners
|
|
98
|
-
in the Work, of the exhaustion of those rights or of other applicable
|
|
99
|
-
limitations thereto.
|
|
100
|
-
|
|
101
|
-
5. Obligations of the Licensee
|
|
102
|
-
|
|
103
|
-
The grant of the rights mentioned above is subject to some restrictions and
|
|
104
|
-
obligations imposed on the Licensee. Those obligations are the following:
|
|
105
|
-
|
|
106
|
-
Attribution right: The Licensee shall keep intact all copyright, patent or
|
|
107
|
-
trademarks notices and all notices that refer to the Licence and to the
|
|
108
|
-
disclaimer of warranties. The Licensee must include a copy of such notices and
|
|
109
|
-
a copy of the Licence with every copy of the Work he/she distributes or
|
|
110
|
-
communicates. The Licensee must cause any Derivative Work to carry prominent
|
|
111
|
-
notices stating that the Work has been modified and the date of modification.
|
|
112
|
-
|
|
113
|
-
Copyleft clause: If the Licensee distributes or communicates copies of the
|
|
114
|
-
Original Works or Derivative Works, this Distribution or Communication will be
|
|
115
|
-
done under the terms of this Licence or of a later version of this Licence
|
|
116
|
-
unless the Original Work is expressly distributed only under this version of
|
|
117
|
-
the Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
|
|
118
|
-
(becoming Licensor) cannot offer or impose any additional terms or conditions
|
|
119
|
-
on the Work or Derivative Work that alter or restrict the terms of the
|
|
120
|
-
Licence.
|
|
121
|
-
|
|
122
|
-
Compatibility clause: If the Licensee Distributes or Communicates Derivative
|
|
123
|
-
Works or copies thereof based upon both the Work and another work licensed
|
|
124
|
-
under a Compatible Licence, this Distribution or Communication can be done
|
|
125
|
-
under the terms of this Compatible Licence. For the sake of this clause,
|
|
126
|
-
‘Compatible Licence’ refers to the licences listed in the appendix attached to
|
|
127
|
-
this Licence. Should the Licensee's obligations under the Compatible Licence
|
|
128
|
-
conflict with his/her obligations under this Licence, the obligations of the
|
|
129
|
-
Compatible Licence shall prevail.
|
|
130
|
-
|
|
131
|
-
Provision of Source Code: When distributing or communicating copies of the
|
|
132
|
-
Work, the Licensee will provide a machine-readable copy of the Source Code or
|
|
133
|
-
indicate a repository where this Source will be easily and freely available
|
|
134
|
-
for as long as the Licensee continues to distribute or communicate the Work.
|
|
135
|
-
|
|
136
|
-
Legal Protection: This Licence does not grant permission to use the trade
|
|
137
|
-
names, trademarks, service marks, or names of the Licensor, except as required
|
|
138
|
-
for reasonable and customary use in describing the origin of the Work and
|
|
139
|
-
reproducing the content of the copyright notice.
|
|
140
|
-
|
|
141
|
-
6. Chain of Authorship
|
|
142
|
-
|
|
143
|
-
The original Licensor warrants that the copyright in the Original Work granted
|
|
144
|
-
hereunder is owned by him/her or licensed to him/her and that he/she has the
|
|
145
|
-
power and authority to grant the Licence.
|
|
146
|
-
|
|
147
|
-
Each Contributor warrants that the copyright in the modifications he/she
|
|
148
|
-
brings to the Work are owned by him/her or licensed to him/her and that he/she
|
|
149
|
-
has the power and authority to grant the Licence.
|
|
150
|
-
|
|
151
|
-
Each time You accept the Licence, the original Licensor and subsequent
|
|
152
|
-
Contributors grant You a licence to their contributions to the Work, under the
|
|
153
|
-
terms of this Licence.
|
|
154
|
-
|
|
155
|
-
7. Disclaimer of Warranty
|
|
156
|
-
|
|
157
|
-
The Work is a work in progress, which is continuously improved by numerous
|
|
158
|
-
Contributors. It is not a finished work and may therefore contain defects or
|
|
159
|
-
‘bugs’ inherent to this type of development.
|
|
160
|
-
|
|
161
|
-
For the above reason, the Work is provided under the Licence on an ‘as is’
|
|
162
|
-
basis and without warranties of any kind concerning the Work, including
|
|
163
|
-
without limitation merchantability, fitness for a particular purpose, absence
|
|
164
|
-
of defects or errors, accuracy, non-infringement of intellectual property
|
|
165
|
-
rights other than copyright as stated in Article 6 of this Licence.
|
|
166
|
-
|
|
167
|
-
This disclaimer of warranty is an essential part of the Licence and a
|
|
168
|
-
condition for the grant of any rights to the Work.
|
|
169
|
-
|
|
170
|
-
8. Disclaimer of Liability
|
|
171
|
-
|
|
172
|
-
Except in the cases of wilful misconduct or damages directly caused to natural
|
|
173
|
-
persons, the Licensor will in no event be liable for any direct or indirect,
|
|
174
|
-
material or moral, damages of any kind, arising out of the Licence or of the
|
|
175
|
-
use of the Work, including without limitation, damages for loss of goodwill,
|
|
176
|
-
work stoppage, computer failure or malfunction, loss of data or any commercial
|
|
177
|
-
damage, even if the Licensor has been advised of the possibility of such
|
|
178
|
-
damage. However, the Licensor will be liable under statutory product liability
|
|
179
|
-
laws as far such laws apply to the Work.
|
|
180
|
-
|
|
181
|
-
9. Additional agreements
|
|
182
|
-
|
|
183
|
-
While distributing the Work, You may choose to conclude an additional
|
|
184
|
-
agreement, defining obligations or services consistent with this Licence.
|
|
185
|
-
However, if accepting obligations, You may act only on your own behalf and on
|
|
186
|
-
your sole responsibility, not on behalf of the original Licensor or any other
|
|
187
|
-
Contributor, and only if You agree to indemnify, defend, and hold each
|
|
188
|
-
Contributor harmless for any liability incurred by, or claims asserted against
|
|
189
|
-
such Contributor by the fact You have accepted any warranty or additional
|
|
190
|
-
liability.
|
|
191
|
-
|
|
192
|
-
10. Acceptance of the Licence
|
|
193
|
-
|
|
194
|
-
The provisions of this Licence can be accepted by clicking on an icon ‘I
|
|
195
|
-
agree’ placed under the bottom of a window displaying the text of this Licence
|
|
196
|
-
or by affirming consent in any other similar way, in accordance with the rules
|
|
197
|
-
of applicable law. Clicking on that icon indicates your clear and irrevocable
|
|
198
|
-
acceptance of this Licence and all of its terms and conditions.
|
|
199
|
-
|
|
200
|
-
Similarly, you irrevocably accept this Licence and all of its terms and
|
|
201
|
-
conditions by exercising any rights granted to You by Article 2 of this
|
|
202
|
-
Licence, such as the use of the Work, the creation by You of a Derivative Work
|
|
203
|
-
or the Distribution or Communication by You of the Work or copies thereof.
|
|
204
|
-
|
|
205
|
-
11. Information to the public
|
|
206
|
-
|
|
207
|
-
In case of any Distribution or Communication of the Work by means of
|
|
208
|
-
electronic communication by You (for example, by offering to download the Work
|
|
209
|
-
from a remote location) the distribution channel or media (for example, a
|
|
210
|
-
website) must at least provide to the public the information requested by the
|
|
211
|
-
applicable law regarding the Licensor, the Licence and the way it may be
|
|
212
|
-
accessible, concluded, stored and reproduced by the Licensee.
|
|
213
|
-
|
|
214
|
-
12. Termination of the Licence
|
|
215
|
-
|
|
216
|
-
The Licence and the rights granted hereunder will terminate automatically upon
|
|
217
|
-
any breach by the Licensee of the terms of the Licence.
|
|
218
|
-
|
|
219
|
-
Such a termination will not terminate the licences of any person who has
|
|
220
|
-
received the Work from the Licensee under the Licence, provided such persons
|
|
221
|
-
remain in full compliance with the Licence.
|
|
222
|
-
|
|
223
|
-
13. Miscellaneous
|
|
224
|
-
|
|
225
|
-
Without prejudice of Article 9 above, the Licence represents the complete
|
|
226
|
-
agreement between the Parties as to the Work.
|
|
227
|
-
|
|
228
|
-
If any provision of the Licence is invalid or unenforceable under applicable
|
|
229
|
-
law, this will not affect the validity or enforceability of the Licence as a
|
|
230
|
-
whole. Such provision will be construed or reformed so as necessary to make it
|
|
231
|
-
valid and enforceable.
|
|
232
|
-
|
|
233
|
-
The European Commission may publish other linguistic versions or new versions
|
|
234
|
-
of this Licence or updated versions of the Appendix, so far this is required
|
|
235
|
-
and reasonable, without reducing the scope of the rights granted by the
|
|
236
|
-
Licence. New versions of the Licence will be published with a unique version
|
|
237
|
-
number.
|
|
238
|
-
|
|
239
|
-
All linguistic versions of this Licence, approved by the European Commission,
|
|
240
|
-
have identical value. Parties can take advantage of the linguistic version of
|
|
241
|
-
their choice.
|
|
242
|
-
|
|
243
|
-
14. Jurisdiction
|
|
244
|
-
|
|
245
|
-
Without prejudice to specific agreement between parties,
|
|
246
|
-
|
|
247
|
-
- any litigation resulting from the interpretation of this License, arising
|
|
248
|
-
between the European Union institutions, bodies, offices or agencies, as a
|
|
249
|
-
Licensor, and any Licensee, will be subject to the jurisdiction of the Court
|
|
250
|
-
of Justice of the European Union, as laid down in article 272 of the Treaty
|
|
251
|
-
on the Functioning of the European Union,
|
|
252
|
-
|
|
253
|
-
- any litigation arising between other parties and resulting from the
|
|
254
|
-
interpretation of this License, will be subject to the exclusive
|
|
255
|
-
jurisdiction of the competent court where the Licensor resides or conducts
|
|
256
|
-
its primary business.
|
|
257
|
-
|
|
258
|
-
15. Applicable Law
|
|
259
|
-
|
|
260
|
-
Without prejudice to specific agreement between parties,
|
|
261
|
-
|
|
262
|
-
- this Licence shall be governed by the law of the European Union Member State
|
|
263
|
-
where the Licensor has his seat, resides or has his registered office,
|
|
264
|
-
|
|
265
|
-
- this licence shall be governed by Belgian law if the Licensor has no seat,
|
|
266
|
-
residence or registered office inside a European Union Member State.
|
|
267
|
-
|
|
268
|
-
Appendix
|
|
269
|
-
|
|
270
|
-
‘Compatible Licences’ according to Article 5 EUPL are:
|
|
271
|
-
|
|
272
|
-
- GNU General Public License (GPL) v. 2, v. 3
|
|
273
|
-
- GNU Affero General Public License (AGPL) v. 3
|
|
274
|
-
- Open Software License (OSL) v. 2.1, v. 3.0
|
|
275
|
-
- Eclipse Public License (EPL) v. 1.0
|
|
276
|
-
- CeCILL v. 2.0, v. 2.1
|
|
277
|
-
- Mozilla Public Licence (MPL) v. 2
|
|
278
|
-
- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
|
279
|
-
- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
|
|
280
|
-
works other than software
|
|
281
|
-
- European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
|
282
|
-
- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
|
|
283
|
-
Reciprocity (LiLiQ-R+).
|
|
284
|
-
|
|
285
|
-
The European Commission may update this Appendix to later versions of the
|
|
286
|
-
above licences without producing a new version of the EUPL, as long as they
|
|
287
|
-
provide the rights granted in Article 2 of this Licence and protect the
|
|
288
|
-
covered Source Code from exclusive appropriation.
|
|
289
|
-
|
|
290
|
-
All other changes or additions to this Appendix require the production of a
|
|
291
|
-
new EUPL version.
|
package/dist/main.js
DELETED
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{z as l}from"zod";var g=class{static detect(e){let t=e.trim();return this.isRemoteUrl(t)?{type:new URL(t).protocol==="https:"?"https_url":"http_url",originalPath:e,normalizedPath:t}:{type:"local",originalPath:e,normalizedPath:t}}static isValidUrl(e){try{return new URL(e.trim()).protocol.length>0}catch{return!1}}static isRemoteUrl(e){try{let t=e.trim();if(!t.startsWith("http://")&&!t.startsWith("https://"))return!1;let r=new URL(t);return!(r.protocol!=="http:"&&r.protocol!=="https:"||!r.hostname||r.hostname.length===0)}catch{return!1}}};var me=l.object({name:l.string().default("eui-compodoc-mcp"),version:l.string().default("1.0.0")}),de=l.object({path:l.string().min(1,"Documentation path cannot be empty").refine(i=>i.trim().length>0,{message:"Documentation path cannot be only whitespace"}).refine(i=>{let e=i.trim();return e.startsWith("http://")||e.startsWith("https://")?g.isRemoteUrl(e):!0},{message:"Path must be a valid local file path or HTTP/HTTPS URL"}),watchForChanges:l.boolean().default(!0),reloadDebounce:l.number().min(0).default(1e3),timeout:l.number().min(1e3).default(1e4),maxRetries:l.number().min(0).max(10).default(3),pollingInterval:l.number().min(5e3).default(6e4)}),fe=l.object({maxResults:l.number().min(1).max(1e3).default(50),minQueryLength:l.number().min(1).default(2)}),ge=l.object({level:l.enum(["debug","info","warn","error"]).default("info"),format:l.enum(["json","text"]).default("text")}),oe=l.object({server:me.default({}),documentation:de,search:fe.default({}),logging:ge.default({})}),X={server:{name:"eui-compodoc-mcp",version:"1.0.0"},documentation:{path:"./documentation.json",watchForChanges:!0,reloadDebounce:1e3,timeout:1e4,maxRetries:3,pollingInterval:6e4},search:{maxResults:50,minQueryLength:2},logging:{level:"info",format:"text"}};function ee(i){return oe.safeParse(i)}import*as $ from"fs";import*as ie from"path";function se(){let i={};return process.env.COMPODOC_MCP_DOC_PATH&&(i.documentation={path:process.env.COMPODOC_MCP_DOC_PATH}),process.env.COMPODOC_MCP_LOG_LEVEL&&(i.logging={level:process.env.COMPODOC_MCP_LOG_LEVEL}),process.env.COMPODOC_MCP_WATCH!==void 0&&(i.documentation||(i.documentation={path:""}),i.documentation.watchForChanges=process.env.COMPODOC_MCP_WATCH==="true"),i}function ae(i){let e={};for(let t=0;t<i.length;t++)switch(i[t]){case"--doc-path":case"--documentation-path":e.documentation||(e.documentation={path:""}),e.documentation.path=i[++t];break;case"--watch":e.documentation||(e.documentation={path:""}),e.documentation.watchForChanges=!0;break;case"--no-watch":e.documentation||(e.documentation={path:""}),e.documentation.watchForChanges=!1;break;case"--log-level":e.logging={level:i[++t]};break;case"--max-results":e.search={maxResults:parseInt(i[++t],10)};break;case"--help":case"-h":ye(),process.exit(0);break}return e}function ce(i){try{if(!$.existsSync(i))return process.stderr.write(`Configuration file not found: ${i}
|
|
3
|
-
`),{};let e=$.readFileSync(i,"utf-8"),t=ie.extname(i).toLowerCase();return t===".json"?JSON.parse(e):(process.stderr.write(`Unsupported configuration file format: ${t}
|
|
4
|
-
`),{})}catch(e){let t=e instanceof Error?e.message:"Unknown error occurred";return process.stderr.write(`Failed to load config file ${i}: ${t}
|
|
5
|
-
`),{}}}function _(i,e){let t={...i};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=e[r],o=t[r];n&&typeof n=="object"&&!Array.isArray(n)&&o&&typeof o=="object"&&!Array.isArray(o)?t[r]=_(o,n):n!==void 0&&(t[r]=n)}return t}function te(i=process.argv.slice(2)){try{let e=i.indexOf("--config"),t=e>=0?i[e+1]:void 0,r=t?ce(t):{},n=se(),o=ae(i),s={...X};s=_(s,r),s=_(s,n),s=_(s,o);let a=ee(s);if(!a.success){let p=he(a.error);return process.stderr.write(`Configuration validation failed:
|
|
6
|
-
`),p.forEach(u=>process.stderr.write(` - ${u}
|
|
7
|
-
`)),{success:!1,errors:p}}return{success:!0,config:a.data}}catch(e){return{success:!1,errors:[`Failed to load configuration: ${e instanceof Error?e.message:"Configuration error"}`]}}}function he(i){return i.errors.map(e=>`${e.path.join(".")}: ${e.message}`)}function ye(){process.stderr.write(`
|
|
8
|
-
EUI Compodoc MCP Server - Model Context Protocol server for Angular component documentation
|
|
9
|
-
|
|
10
|
-
Usage:
|
|
11
|
-
eui-compodoc-mcp [options]
|
|
12
|
-
|
|
13
|
-
Options:
|
|
14
|
-
--doc-path <path> Path to documentation.json file (required)
|
|
15
|
-
--watch Watch for changes to documentation.json (default: true)
|
|
16
|
-
--no-watch Disable file watching
|
|
17
|
-
--log-level <level> Logging level: debug, info, warn, error (default: info)
|
|
18
|
-
--max-results <number> Maximum search results (default: 50)
|
|
19
|
-
--config <file> Load configuration from JSON file
|
|
20
|
-
--help, -h Show this help message
|
|
21
|
-
|
|
22
|
-
Environment Variables:
|
|
23
|
-
COMPODOC_MCP_DOC_PATH Path to documentation.json file
|
|
24
|
-
COMPODOC_MCP_LOG_LEVEL Logging level
|
|
25
|
-
COMPODOC_MCP_WATCH Enable/disable file watching (true/false)
|
|
26
|
-
|
|
27
|
-
Configuration File Format (JSON):
|
|
28
|
-
{
|
|
29
|
-
"server": {
|
|
30
|
-
"name": "eui-compodoc-mcp",
|
|
31
|
-
"version": "1.0.0"
|
|
32
|
-
},
|
|
33
|
-
"documentation": {
|
|
34
|
-
"path": "./documentation.json",
|
|
35
|
-
"watchForChanges": true,
|
|
36
|
-
"reloadDebounce": 1000
|
|
37
|
-
},
|
|
38
|
-
"search": {
|
|
39
|
-
"maxResults": 50,
|
|
40
|
-
"minQueryLength": 2
|
|
41
|
-
},
|
|
42
|
-
"logging": {
|
|
43
|
-
"level": "info",
|
|
44
|
-
"format": "text"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
Examples:
|
|
49
|
-
eui-compodoc-mcp --doc-path ./documentation.json
|
|
50
|
-
eui-compodoc-mcp --doc-path ./docs/documentation.json --log-level debug
|
|
51
|
-
eui-compodoc-mcp --config ./config.json
|
|
52
|
-
COMPODOC_MCP_DOC_PATH=./documentation.json eui-compodoc-mcp
|
|
53
|
-
|
|
54
|
-
For more information, visit: https://github.com/your-org/eui-compodoc-mcp
|
|
55
|
-
`)}import*as V from"fs";import*as ue from"path";import{watch as we}from"chokidar";import pe from"pino";var O=class i{pino;context;constructor(e){this.context=e.context,this.pino=pe({level:e.level},pe.destination({dest:2,sync:!0}))}child(e){let t=new i({level:this.pino.level,format:"json",context:this.context?`${this.context}:${e}`:e});return t.pino=this.pino.child({context:e}),t}setLevel(e){this.pino.level=e}debug(e,t){this.pino.debug(t||{},e)}info(e,t){this.pino.info(t||{},e)}warn(e,t){this.pino.warn(t||{},e)}error(e,t,r){let n=r&&typeof r=="object"?r:{};this.pino.error({err:t,...n},e)}},P=null;function re(i){return P=new O(i),P}function c(){return P||(P=new O({level:"info",format:"text"})),P}var ve={failureThreshold:5,successThreshold:2,timeout:1e4,resetTimeout:6e4},G=class{state="CLOSED";failureCount=0;successCount=0;nextAttempt=Date.now();options;name;constructor(e,t={}){this.name=e,this.options={...ve,...t}}getState(){return this.state}getStats(){return{state:this.state,failureCount:this.failureCount,successCount:this.successCount,nextAttempt:this.nextAttempt}}async execute(e){let t=c();if(this.state==="OPEN"){if(Date.now()<this.nextAttempt){let r=new Error(`Circuit breaker '${this.name}' is OPEN. Next attempt at ${new Date(this.nextAttempt).toISOString()}`);throw t.warn("Circuit breaker is open",{name:this.name,nextAttempt:this.nextAttempt}),r}this.state="HALF_OPEN",this.successCount=0,t.info("Circuit breaker transitioning to HALF_OPEN",{name:this.name})}try{let r=await this.executeWithTimeout(e);return this.onSuccess(),r}catch(r){throw this.onFailure(),r}}async executeWithTimeout(e){return Promise.race([e(),new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${this.options.timeout}ms`)),this.options.timeout))])}onSuccess(){let e=c();this.failureCount=0,this.state==="HALF_OPEN"&&(this.successCount++,e.debug("Circuit breaker success in HALF_OPEN",{name:this.name,successCount:this.successCount,threshold:this.options.successThreshold}),this.successCount>=this.options.successThreshold&&(this.state="CLOSED",this.successCount=0,e.info("Circuit breaker closed",{name:this.name})))}onFailure(){let e=c();this.failureCount++,e.debug("Circuit breaker failure",{name:this.name,failureCount:this.failureCount,threshold:this.options.failureThreshold,state:this.state}),(this.state==="HALF_OPEN"||this.failureCount>=this.options.failureThreshold)&&(this.state="OPEN",this.nextAttempt=Date.now()+this.options.resetTimeout,e.warn("Circuit breaker opened",{name:this.name,failureCount:this.failureCount,nextAttempt:this.nextAttempt}))}reset(){let e=c();this.state="CLOSED",this.failureCount=0,this.successCount=0,this.nextAttempt=Date.now(),e.info("Circuit breaker manually reset",{name:this.name})}},H=class{breakers=new Map;get(e,t){return this.breakers.has(e)||this.breakers.set(e,new G(e,t)),this.breakers.get(e)}getAll(){return new Map(this.breakers)}resetAll(){this.breakers.forEach(e=>{e.reset()})}getAllStats(){let e={};return this.breakers.forEach((t,r)=>{e[r]=t.getStats()}),e}},Ce=new H;var q=class{filePath;watchForChanges;reloadDebounce;watcher;reloadTimer;onReloadCallback;onErrorCallback;currentData;constructor(e){this.filePath=ue.resolve(e.path),this.watchForChanges=e.watchForChanges,this.reloadDebounce=e.reloadDebounce,this.onReloadCallback=e.onReload,this.onErrorCallback=e.onError}async load(){try{if(!V.existsSync(this.filePath))return{success:!1,error:`Documentation file not found: ${this.filePath}`};let e=await V.promises.readFile(this.filePath,"utf-8"),t;try{t=JSON.parse(e)}catch(n){return{success:!1,error:`Failed to parse JSON: ${n instanceof Error?n.message:String(n)}`}}let r=this.validateStructure(t);return r?{success:!1,error:r}:(this.currentData=t,this.watchForChanges&&!this.watcher&&this.startMonitoring(),{success:!0,data:t})}catch(e){return{success:!1,error:`Failed to load documentation: ${e instanceof Error?e.message:String(e)}`}}}startMonitoring(){!this.watchForChanges||this.watcher||this.startWatching()}async stopMonitoring(){this.reloadTimer&&(clearTimeout(this.reloadTimer),this.reloadTimer=void 0),this.watcher&&(await this.watcher.close(),this.watcher=void 0,c().info("Stopped watching documentation file"))}getCurrentData(){return this.currentData}async dispose(){await this.stopMonitoring(),this.currentData=void 0,this.onReloadCallback=void 0,this.onErrorCallback=void 0}validateStructure(e){if(!e||typeof e!="object")return"Documentation must be an object";let t=e,r=["pipes","components","directives","injectables","interfaces","classes","modules"];for(let n of r){let o=t[n];if(o!==void 0&&!Array.isArray(o))return`${n} must be an array`}return null}startWatching(){this.watcher||(this.watcher=we(this.filePath,{persistent:!0,ignoreInitial:!0}),this.watcher.on("change",()=>{this.scheduleReload()}),this.watcher.on("error",e=>{let t=e instanceof Error?e:new Error(String(e));c().error("File watcher error",t),this.onErrorCallback&&this.onErrorCallback(t)}),c().info(`Watching for changes: ${this.filePath}`))}scheduleReload(){this.reloadTimer&&clearTimeout(this.reloadTimer),this.reloadTimer=setTimeout(()=>{this.reload()},this.reloadDebounce)}async reload(){c().info("Reloading documentation...");let e=await this.load();e.success&&e.data?(c().info("Documentation reloaded successfully"),this.onReloadCallback&&this.onReloadCallback(e.data)):(c().error("Failed to reload documentation",new Error(e.error)),this.onErrorCallback&&this.onErrorCallback(new Error(e.error)))}};var B=class{options;constructor(e){this.options=e}async fetch(e,t){let r;for(let n=0;n<=this.options.maxRetries;n++)try{let o=await this.fetchOnce(e,t);if(!this.isRetryableError(void 0,o.status)||n>=this.options.maxRetries)return o;let s=this.calculateBackoff(n);await this.sleep(s)}catch(o){if(r=o instanceof Error?o:new Error(String(o)),n<this.options.maxRetries&&this.isRetryableError(r)){let s=this.calculateBackoff(n);await this.sleep(s);continue}throw r}throw r||new Error("Unknown error during fetch")}async fetchOnce(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(),this.options.timeout);try{let o={Accept:"application/json","User-Agent":this.options.userAgent||"DocumentationLoader/1.0"};t&&t.forEach((u,m)=>{o[m]=u});let s=await fetch(e,{signal:r.signal,headers:o});clearTimeout(n);let a=new Map;s.headers.forEach((u,m)=>{a.set(m,u)});let p=await s.text();return{status:s.status,statusText:s.statusText,data:p,headers:a}}catch(o){throw clearTimeout(n),o instanceof Error&&o.name==="AbortError"?new Error(`Request timeout after ${this.options.timeout}ms`):o}}isRetryableError(e,t){if(t!==void 0){if(t>=200&&t<400)return!1;if(t>=500||t===408||t===429)return!0;if(t>=400&&t<500)return!1}if(e){let r=e.message.toLowerCase();if(r.includes("timeout")||r.includes("network")||r.includes("econnrefused")||r.includes("enotfound")||r.includes("econnreset"))return!0}return!0}calculateBackoff(e){return this.options.retryDelay*Math.pow(2,e)}sleep(e){return new Promise(t=>setTimeout(t,e))}};var z=class{cache;constructor(){this.cache=new Map}set(e,t,r){let n={data:t,timestamp:Date.now()},o=this.getHeaderCaseInsensitive(r,"etag");o&&(n.etag=o);let s=this.getHeaderCaseInsensitive(r,"last-modified");s&&(n.lastModified=s),this.cache.set(e,n)}get(e){return this.cache.get(e)}getConditionalHeaders(e){let t=new Map,r=this.cache.get(e);return r&&(r.etag&&t.set("If-None-Match",r.etag),r.lastModified&&t.set("If-Modified-Since",r.lastModified)),t}clear(e){this.cache.delete(e)}clearAll(){this.cache.clear()}getHeaderCaseInsensitive(e,t){let r=t.toLowerCase();for(let[n,o]of e.entries())if(n.toLowerCase()===r)return o}};var ne=class i extends Error{constructor(t,r,n){super(t);this.url=r;this.cause=n;this.name="NetworkError",Error.captureStackTrace&&Error.captureStackTrace(this,i)}};var k=class i extends ne{constructor(t,r,n,o){super(t,r);this.statusCode=n;this.statusText=o;this.name="HttpError",Error.captureStackTrace&&Error.captureStackTrace(this,i)}},L=class i extends Error{constructor(t,r){super(t);this.content=r;this.name="ParseError",Error.captureStackTrace&&Error.captureStackTrace(this,i)}};var W=class{url;httpClient;cacheManager;pollingTimer;currentData;pollingInterval;onReloadCallback;onErrorCallback;constructor(e){this.url=e.url,this.pollingInterval=e.pollingInterval,this.onReloadCallback=e.onReload,this.onErrorCallback=e.onError;let t={timeout:e.timeout,maxRetries:e.maxRetries,retryDelay:1e3,userAgent:"DocumentationLoader/1.0"};this.httpClient=new B(t),this.cacheManager=new z}async load(){return this.fetchDocumentation()}startMonitoring(){this.pollingTimer||(this.pollingTimer=setInterval(()=>{this.poll()},this.pollingInterval),c().info(`Started polling ${this.url} every ${this.pollingInterval}ms`))}async stopMonitoring(){this.pollingTimer&&(clearInterval(this.pollingTimer),this.pollingTimer=void 0,c().info(`Stopped polling ${this.url}`))}getCurrentData(){return this.currentData}async dispose(){await this.stopMonitoring(),this.cacheManager.clear(this.url),this.currentData=void 0,this.onReloadCallback=void 0,this.onErrorCallback=void 0}async poll(){try{c().debug(`Polling ${this.url} for updates...`);let e=this.cacheManager.getConditionalHeaders(this.url),t=await this.httpClient.fetch(this.url,e);if(t.status===304){c().debug("No changes detected (304 Not Modified)");return}if(t.status===200){let r=this.parseJson(t.data),n=this.validateStructure(r);if(n)throw new L(n,t.data);this.cacheManager.set(this.url,r,t.headers),this.currentData=r,c().info(`Documentation updated from ${this.url}`),this.onReloadCallback&&this.onReloadCallback(r);return}throw new k(`HTTP ${t.status}: ${t.statusText}`,this.url,t.status,t.statusText)}catch(e){let t=e instanceof Error?e.message:String(e);c().error(`Polling error for ${this.url}`,e instanceof Error?e:new Error(t)),this.onErrorCallback&&this.onErrorCallback(e instanceof Error?e:new Error(t))}}async fetchDocumentation(){try{let e=this.cacheManager.get(this.url),t=e?this.cacheManager.getConditionalHeaders(this.url):void 0,r=await this.httpClient.fetch(this.url,t);if(r.status===304&&e)return c().debug("Using cached documentation (304 Not Modified)"),this.currentData=e.data,{success:!0,data:e.data};if(r.status!==200)return{success:!1,error:`${new k(`HTTP ${r.status}: ${r.statusText}`,this.url,r.status,r.statusText).message} (URL: ${this.url})`};let n=this.parseJson(r.data),o=this.validateStructure(n);return o?{success:!1,error:o}:(this.cacheManager.set(this.url,n,r.headers),this.currentData=n,{success:!0,data:n})}catch(e){let t=e instanceof Error?e.message:String(e);return{success:!1,error:`Failed to fetch documentation from ${this.url}: ${t}`}}}parseJson(e){try{return JSON.parse(e)}catch(t){let r=t instanceof Error?t.message:String(t);throw new L(`Failed to parse JSON: ${r}`,e)}}validateStructure(e){if(!e||typeof e!="object")return"Documentation must be an object";let t=e,r=["pipes","components","directives","injectables","interfaces","classes","modules"];for(let n of r){let o=t[n];if(o!==void 0&&!Array.isArray(o))return`${n} must be an array`}return null}};var M=class{source;constructor(e){this.source=this.createSource(e)}async load(){let e=await this.source.load();return e.success&&this.source.startMonitoring(),e}getCurrentData(){return this.source.getCurrentData()}async stopWatching(){await this.source.stopMonitoring()}async dispose(){await this.source.dispose()}createSource(e){let t=g.detect(e.path);return t.type==="local"?new q({path:t.normalizedPath,watchForChanges:e.watchForChanges??!0,reloadDebounce:e.reloadDebounce??1e3,onReload:e.onReload,onError:e.onError}):new W({url:t.normalizedPath,timeout:e.timeout??1e4,maxRetries:e.maxRetries??3,pollingInterval:e.pollingInterval??6e4,onReload:e.onReload,onError:e.onError})}};var A=class{build(e){let t={byName:new Map,bySelector:new Map,searchIndex:new Map,components:[],directives:[],pipes:[],services:[],lastUpdated:new Date,totalCount:0},r=new Map;if(e.components)for(let n of e.components){if(r.has(n.name))throw new Error(`Duplicate name detected: "${n.name}" exists as both ${r.get(n.name)} and component. All component, directive, pipe, and service names must be unique across the entire documentation.`);r.set(n.name,"component"),this.indexComponent(n,t)}if(e.directives)for(let n of e.directives){if(r.has(n.name))throw new Error(`Duplicate name detected: "${n.name}" exists as both ${r.get(n.name)} and directive. All component, directive, pipe, and service names must be unique across the entire documentation.`);r.set(n.name,"directive"),this.indexDirective(n,t)}if(e.pipes)for(let n of e.pipes){if(r.has(n.name))throw new Error(`Duplicate name detected: "${n.name}" exists as both ${r.get(n.name)} and pipe. All component, directive, pipe, and service names must be unique across the entire documentation.`);r.set(n.name,"pipe"),this.indexPipe(n,t)}if(e.injectables)for(let n of e.injectables){if(r.has(n.name))throw new Error(`Duplicate name detected: "${n.name}" exists as both ${r.get(n.name)} and injectable. All component, directive, pipe, and service names must be unique across the entire documentation.`);r.set(n.name,"injectable"),this.indexInjectable(n,t)}return t.totalCount=t.components.length+t.directives.length+t.pipes.length+t.services.length,t}indexComponent(e,t){t.components.push(e),t.byName.set(e.name,e),e.selector&&t.bySelector.set(e.selector,e),this.addToSearchIndex(e,t)}indexDirective(e,t){t.directives.push(e),t.byName.set(e.name,e),e.selector&&t.bySelector.set(e.selector,e),this.addToSearchIndex(e,t)}indexPipe(e,t){t.pipes.push(e),t.byName.set(e.name,e),this.addToSearchIndex(e,t)}indexInjectable(e,t){t.services.push(e),t.byName.set(e.name,e),this.addToSearchIndex(e,t)}addToSearchIndex(e,t){let r=new Set;if(this.extractWords(e.name,r),"selector"in e&&e.selector&&this.extractWords(e.selector,r),e.description&&this.extractWords(e.description,r),"inputs"in e&&e.inputs)for(let n of e.inputs)this.extractWords(n.name,r),n.description&&this.extractWords(n.description,r);if("outputs"in e&&e.outputs)for(let n of e.outputs)this.extractWords(n.name,r),n.description&&this.extractWords(n.description,r);if("methods"in e&&e.methods)for(let n of e.methods)this.extractWords(n.name,r);for(let n of r)t.searchIndex.has(n)||t.searchIndex.set(n,new Set),t.searchIndex.get(n).add(e.name)}extractWords(e,t){let r=e.toLowerCase(),n=r.split(/[^a-z0-9]+/).filter(o=>o.length>0);for(let o of n)t.add(o);n.length===0&&e.trim().length>0&&t.add(r.trim())}getStatistics(e){return{totalCount:e.totalCount,componentCount:e.components.length,directiveCount:e.directives.length,pipeCount:e.pipes.length,serviceCount:e.services.length,lastUpdated:e.lastUpdated}}rebuild(e,t){return this.build(e)}};import{Server as Se}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as Ie}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as Re,ListToolsRequestSchema as Te}from"@modelcontextprotocol/sdk/types.js";var N=class{index;constructor(e){this.index=e}getByName(e){return this.index.byName.get(e)}getBySelector(e){return this.index.bySelector.get(e)}getByType(e){switch(e){case"component":return this.index.components;case"directive":return this.index.directives;case"pipe":return this.index.pipes;case"service":return this.index.services;case"all":return[...this.index.components,...this.index.directives,...this.index.pipes,...this.index.services];default:return[]}}getAll(e=!1){let t=this.getByType("all");return e?t:t.filter(r=>!r.deprecated)}updateIndex(e){this.index=e}};var F=class{index;constructor(e){this.index=e}search(e){let{query:t,types:r,includeDeprecated:n=!1,limit:o=50,offset:s=0}=e,a=t.toLowerCase().trim();if(a.length===0)return{items:[],total:0,hasMore:!1};let p=this.getCandidates(a,r),u=[];for(let T of p){if(!n&&T.deprecated)continue;let U=this.calculateRelevanceScore(T,a);U>0&&u.push({doc:T,relevanceScore:U})}u.sort((T,U)=>U.relevanceScore-T.relevanceScore);let m=u.length,f=u.slice(s,s+o),K=s+o<m;return{items:f,total:m,hasMore:K}}getCandidates(e,t){let r=e.split(/[^a-z0-9]+/).filter(s=>s.length>0),n=new Set;for(let s of r){if(this.index.searchIndex.has(s)){let a=this.index.searchIndex.get(s);for(let p of a)n.add(p)}for(let[a,p]of this.index.searchIndex.entries())if(a.startsWith(s))for(let u of p)n.add(u)}let o=[];for(let s of n){let a=this.index.byName.get(s);a&&(t&&t.length>0?t.includes(a.type)&&o.push(a):o.push(a))}return o}calculateRelevanceScore(e,t){let r=0,n=e.name.toLowerCase();if(n===t&&(r+=100),"selector"in e&&e.selector){let o=e.selector.toLowerCase();(o===t||o.includes(t))&&(r+=80)}if(n.startsWith(t)&&(r+=60),!n.startsWith(t)&&n.includes(t)&&(r+=30),e.description&&e.description.toLowerCase().includes(t)&&(r+=40),"inputs"in e&&e.inputs){for(let o of e.inputs)if(o.name.toLowerCase().includes(t)){r+=30;break}}if("outputs"in e&&e.outputs){for(let o of e.outputs)if(o.name.toLowerCase().includes(t)){r+=30;break}}if("methods"in e&&e.methods){for(let o of e.methods)if(o.name.toLowerCase().includes(t)){r+=20;break}}return e.deprecated&&(r=Math.floor(r*.5)),r}updateIndex(e){this.index=e}};var J=class{getPreferredDescription(e){return e.rawdescription??e.description??""}formatList(e,t=!1){return e.filter(r=>t||!r.deprecated).map(r=>this.formatSummary(r))}formatSummary(e){let t=e.type==="injectable"?"service":e.type,r="selector"in e?e.selector:void 0;return{name:e.name,type:t,selector:r,description:this.getPreferredDescription(e),deprecated:e.deprecated}}formatDetails(e){let t=this.formatInputs(e),r=this.formatOutputs(e),n=this.formatMethods(e),o=this.formatExamples(e),s=e.type==="injectable"?"service":e.type,a="selector"in e?e.selector:void 0,p="standalone"in e?e.standalone:void 0,u="imports"in e?e.imports:void 0;return{name:e.name,type:s,selector:a,description:this.getPreferredDescription(e),inputs:t,outputs:r,methods:n,examples:o,deprecated:e.deprecated,deprecationMessage:e.deprecationMessage,standalone:p,imports:u}}formatInputs(e){let t=[];return"inputs"in e&&e.inputs&&t.push(...e.inputs.map(r=>this.formatProperty(r))),"inputsClass"in e&&e.inputsClass&&t.push(...e.inputsClass.map(r=>this.formatProperty(r))),t}formatOutputs(e){let t=[];return"outputs"in e&&e.outputs&&t.push(...e.outputs.map(r=>this.formatProperty(r))),"outputsClass"in e&&e.outputsClass&&t.push(...e.outputsClass.map(r=>this.formatProperty(r))),t}formatProperty(e){return{name:e.name,type:e.type||"any",required:!e.optional,description:this.getPreferredDescription(e),defaultValue:e.defaultValue}}formatMethods(e){return!("methods"in e)||!e.methods?[]:e.methods.map(t=>this.formatMethod(t))}formatMethod(e){let t=(e.args||[]).map(o=>({name:o.name,type:o.type||"any",optional:o.optional||!1,defaultValue:o.defaultValue})),r=t.map(o=>{let s=o.optional?"?":"",a=o.defaultValue?` = ${o.defaultValue}`:"";return`${o.name}${s}: ${o.type}${a}`}).join(", "),n=`${e.name}(${r}): ${e.returnType||"void"}`;return{name:e.name,signature:n,description:this.getPreferredDescription(e),parameters:t,returnType:e.returnType||"void"}}formatExamples(e){return!("examples"in e)||!e.examples?[]:e.examples}formatSearchResults(e){return e.map(t=>{let r=t.doc.type==="injectable"?"service":t.doc.type,n="selector"in t.doc?t.doc.selector:void 0;return{name:t.doc.name,type:r,selector:n,description:this.getPreferredDescription(t.doc),deprecated:t.doc.deprecated,relevanceScore:t.relevanceScore}})}toJSON(e){return JSON.stringify(e,null,2)}formatDeprecatedList(e,t){if(e.length===0)return"No deprecated items found.";let r=e.reduce((o,s)=>(o[s.type]||(o[s.type]=[]),o[s.type].push(s),o),{}),n=`Found ${e.length} deprecated item(s):
|
|
56
|
-
|
|
57
|
-
`;for(let[o,s]of Object.entries(r)){n+=`## ${o.charAt(0).toUpperCase()+o.slice(1)}s
|
|
58
|
-
|
|
59
|
-
`;for(let a of s)n+=`### ${a.name}
|
|
60
|
-
`,n+=`- **Message**: ${a.deprecationMessage}
|
|
61
|
-
`,a.versionDeprecated&&(n+=`- **Deprecated in**: v${a.versionDeprecated}
|
|
62
|
-
`),t&&a.replacementSuggestion&&(n+=`- **Replacement**: ${a.replacementSuggestion}
|
|
63
|
-
`),n+=`
|
|
64
|
-
`}return n}formatDeprecationInfo(e){if(!e.isDeprecated)return`${e.name} (${e.type}) is not deprecated.`;let t=`# ${e.name} (${e.type})
|
|
65
|
-
|
|
66
|
-
`;return t+=`**Status**: DEPRECATED
|
|
67
|
-
|
|
68
|
-
`,e.deprecationMessage&&(t+=`**Message**: ${e.deprecationMessage}
|
|
69
|
-
|
|
70
|
-
`),e.versionDeprecated&&(t+=`**Deprecated in**: v${e.versionDeprecated}
|
|
71
|
-
|
|
72
|
-
`),e.replacementSuggestion&&(t+=`**Recommended replacement**: ${e.replacementSuggestion}
|
|
73
|
-
|
|
74
|
-
`),t}};var h=class{query;formatter;constructor(e,t){this.query=e,this.formatter=t}execute(e={}){let{includeDeprecated:t=!1,type:r="all",limit:n=50,offset:o=0}=e;if(n<1||n>1e3)throw new Error("Limit must be between 1 and 1000");if(o<0)throw new Error("Offset must be non-negative");let s=this.query.getByType(r),a=t?s:s.filter(K=>!K.deprecated),p=a.length,u=a.slice(o,o+n),m=o+n<p;return{items:this.formatter.formatList(u,!0),total:p,hasMore:m,offset:o,limit:n}}static getToolDefinition(){return{name:"list-components",description:"Lists all available components, directives, pipes, and services from the EUI component library. Supports filtering by type and deprecated status, with pagination for large result sets.",inputSchema:{type:"object",properties:{includeDeprecated:{type:"boolean",description:"Whether to include deprecated components in the results (default: false)",default:!1},type:{type:"string",enum:["component","directive","pipe","service","all"],description:"Filter by type (default: all)",default:"all"},limit:{type:"number",description:"Maximum number of results to return (default: 50, max: 1000)",default:50,minimum:1,maximum:1e3},offset:{type:"number",description:"Number of results to skip for pagination (default: 0)",default:0,minimum:0}}}}}};var y=class{query;formatter;constructor(e,t){this.query=e,this.formatter=t}execute(e){let{name:t}=e;if(!t||typeof t!="string"||t.trim().length===0)throw new Error("Component name is required and must be a non-empty string");let r=this.query.getByName(t.trim());if(!r)throw new Error(`Component "${t}" not found in documentation`);return{component:this.formatter.formatDetails(r)}}static getToolDefinition(){return{name:"get-component-docs",description:"Retrieves detailed documentation for a specific component, directive, pipe, or service by name. Returns complete metadata including inputs, outputs, methods, examples, selector information, standalone flag, and module import requirements.",inputSchema:{type:"object",properties:{name:{type:"string",description:"The name of the component, directive, pipe, or service to retrieve"}},required:["name"]}}}};var v=class{searchEngine;formatter;constructor(e,t){this.searchEngine=e,this.formatter=t}execute(e){let{query:t,types:r,includeDeprecated:n=!1,limit:o=50}=e;if(t==null||typeof t!="string")throw new Error("Query is required and must be a string");let s=t.trim();if(s.length===0)throw new Error("Query cannot be empty");if(o<1||o>1e3)throw new Error("Limit must be between 1 and 1000");if(r&&r.length>0){let m=["component","directive","pipe","service"];for(let f of r)if(!m.includes(f))throw new Error(`Invalid type "${f}". Must be one of: ${m.join(", ")}`)}let a={query:s,types:r,includeDeprecated:n,limit:o,offset:0},p=this.searchEngine.search(a);return{items:this.formatter.formatSearchResults(p.items),total:p.total,hasMore:p.hasMore,query:s}}static getToolDefinition(){return{name:"search-components",description:"Searches for components, directives, pipes, and services by keyword or functionality. Returns results ranked by relevance, matching against component names, selectors, descriptions, inputs, outputs, and methods. Supports filtering by type and deprecated status.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query to match against component metadata"},types:{type:"array",items:{type:"string",enum:["component","directive","pipe","service"]},description:"Filter results by type (optional). If not specified, searches all types."},includeDeprecated:{type:"boolean",description:"Whether to include deprecated components in results (default: false)",default:!1},limit:{type:"number",description:"Maximum number of results to return (default: 50, max: 1000)",default:50,minimum:1,maximum:1e3}},required:["query"]}}}};var C=class{query;formatter;constructor(e,t){this.query=e,this.formatter=t}execute(e){let{name:t}=e;if(!t||typeof t!="string"||t.trim().length===0)throw new Error("Component name is required and must be a non-empty string");let r=this.query.getByName(t.trim());if(!r)throw new Error(`Component "${t}" not found in documentation`);let n=this.formatter.formatInputs(r);return{componentName:r.name,inputs:n}}static getToolDefinition(){return{name:"get-component-inputs",description:"Retrieves all input properties for a specific component, directive, pipe, or service by name. Returns detailed information about each input including name, type, description, default value, and required flag.",inputSchema:{type:"object",properties:{name:{type:"string",description:"The name of the component, directive, pipe, or service"}},required:["name"]}}}};var x=class{query;formatter;constructor(e,t){this.query=e,this.formatter=t}execute(e){let{name:t}=e;if(!t||typeof t!="string"||t.trim().length===0)throw new Error("Component name is required and must be a non-empty string");let r=this.query.getByName(t.trim());if(!r)throw new Error(`Component "${t}" not found in documentation`);let n=this.formatter.formatOutputs(r);return{componentName:r.name,outputs:n}}static getToolDefinition(){return{name:"get-component-outputs",description:"Retrieves all output events for a specific component, directive, pipe, or service by name. Returns detailed information about each output including name, type, and description.",inputSchema:{type:"object",properties:{name:{type:"string",description:"The name of the component, directive, pipe, or service"}},required:["name"]}}}};var b=class{query;formatter;constructor(e,t){this.query=e,this.formatter=t}execute(e){let{name:t}=e;if(!t||typeof t!="string"||t.trim().length===0)throw new Error("Component name is required and must be a non-empty string");let r=this.query.getByName(t.trim());if(!r)throw new Error(`Component "${t}" not found in documentation`);let n=this.formatter.formatExamples(r);return{componentName:r.name,examples:n}}static getToolDefinition(){return{name:"get-component-examples",description:"Retrieves all usage examples for a specific component, directive, pipe, or service by name. Returns code examples with HTML templates and TypeScript code, preserving formatting. Returns an empty array if no examples are available.",inputSchema:{type:"object",properties:{name:{type:"string",description:"The name of the component, directive, pipe, or service"}},required:["name"]}}}};var w=class{async execute(e={}){try{let t=await fetch("https://registry.npmjs.org/@eui/components");if(!t.ok)throw t.status===404?new Error('Package "@eui/components" not found in npm registry'):new Error(`npm registry returned status ${t.status}`);let r=await t.json();if(!r["dist-tags"]||!r["dist-tags"].latest)throw new Error("Invalid response: missing dist-tags.latest");if(!r.time)throw new Error("Invalid response: missing time field");let n=r["dist-tags"].latest,o=r.time[n];if(!o)throw new Error(`Invalid response: no publish date for version ${n}`);return{packageName:"@eui/components",version:n,publishDate:o}}catch(t){throw t instanceof Error?t:new Error(`Unexpected error querying npm registry: ${String(t)}`)}}static getToolDefinition(){return{name:"get-library-version",description:"Queries the npm registry to retrieve the latest version information for the @eui/components package, including the version number and publish date.",inputSchema:{type:"object",properties:{}}}}};var Q=class{isDeprecated(e){return!!(e.deprecated===!0||e.decorators&&e.decorators.some(t=>t.name==="deprecated")||e.jsdoctags&&e.jsdoctags.some(t=>t.tagName?.text==="deprecated"))}extractDeprecationMessage(e){let t=e.jsdoctags?.find(r=>r.tagName?.text==="deprecated");return t?.comment?t.comment:e.deprecationMessage?e.deprecationMessage:"This item is deprecated."}extractVersion(e){let t=[/since\s+v?(\d+\.\d+\.\d+)/i,/deprecated\s+in\s+v?(\d+\.\d+\.\d+)/i,/v(\d+\.\d+\.\d+)/i];for(let r of t){let n=e.match(r);if(n)return n[1]}}extractReplacement(e){let t=[/use\s+([A-Za-z0-9_-]+)\s+instead/i,/replaced\s+by\s+([A-Za-z0-9_-]+)/i,/migrate\s+to\s+([A-Za-z0-9_-]+)/i,/see\s+([A-Za-z0-9_-]+)/i];for(let r of t){let n=e.match(r);if(n)return n[1]}}parseDeprecationInfo(e){let t=this.extractDeprecationMessage(e);return{deprecationMessage:t,versionDeprecated:this.extractVersion(t),replacementSuggestion:this.extractReplacement(t),filePath:e.file}}};var E=class{constructor(e){this.index=e;this.parser=new Q}parser;listDeprecated(e={}){let t=[],r=[{items:this.index.components,type:"component"},{items:this.index.directives,type:"directive"},{items:this.index.pipes,type:"pipe"},{items:this.index.services,type:"injectable"}];for(let{items:n,type:o}of r)if(!(e.type&&e.type!==o)){for(let s of n)if(this.parser.isDeprecated(s)){let a=this.parser.parseDeprecationInfo(s),p=e.includeReplacements?a.replacementSuggestion:void 0;t.push({name:s.name,type:o,deprecationMessage:a.deprecationMessage,versionDeprecated:a.versionDeprecated,replacementSuggestion:p,filePath:a.filePath})}}return t}getDeprecationInfo(e){let t=this.index.byName.get(e);if(!t)return null;if(!this.parser.isDeprecated(t))return{name:e,type:t.type,isDeprecated:!1};let n=this.parser.parseDeprecationInfo(t);return{name:e,type:t.type,isDeprecated:!0,deprecationMessage:n.deprecationMessage,versionDeprecated:n.versionDeprecated,replacementSuggestion:n.replacementSuggestion}}};var D=class{query;formatter;constructor(e,t){this.query=new E(e),this.formatter=t}execute(e={}){let{type:t,includeReplacements:r=!1}=e,n=this.query.listDeprecated({type:t,includeReplacements:r});return{content:[{type:"text",text:this.formatter.formatDeprecatedList(n,r)}]}}static getToolDefinition(){return{name:"list-deprecated",description:"Lists all deprecated items in the library (components, directives, pipes, services). Supports filtering by type and optionally includes replacement suggestions.",inputSchema:{type:"object",properties:{type:{type:"string",description:"Filter by type (component, directive, pipe, injectable)"},includeReplacements:{type:"boolean",description:"Include replacement suggestions in results (default: false)",default:!1}}}}}};var S=class{query;formatter;constructor(e,t){this.query=new E(e),this.formatter=t}execute(e){let{componentName:t}=e;if(!t||typeof t!="string"||t.trim().length===0)throw new Error("Component name is required and must be a non-empty string");let r=this.query.getDeprecationInfo(t.trim());if(!r)throw new Error(`Component "${t}" not found in documentation`);return{content:[{type:"text",text:this.formatter.formatDeprecationInfo(r)}]}}static getToolDefinition(){return{name:"get-deprecation-info",description:"Retrieves detailed deprecation information for a specific component, directive, pipe, or service. Returns deprecation status, message, version deprecated, and replacement suggestions.",inputSchema:{type:"object",properties:{componentName:{type:"string",description:"The name of the component or library element to check"}},required:["componentName"]}}}};var I=class{execute(e={}){return Promise.resolve({content:Ee,format:"markdown"})}static getToolDefinition(){return{name:"get-eui-cli-guide",description:"Returns a comprehensive markdown guide for getting started with EUI CLI, including installation, project creation, and basic usage instructions.",inputSchema:{type:"object",properties:{}}}}},Ee=`# Getting Started with EUI CLI
|
|
75
|
-
|
|
76
|
-
The EUI CLI is a command-line tool for scaffolding and managing EUI applications.
|
|
77
|
-
|
|
78
|
-
## Installation
|
|
79
|
-
|
|
80
|
-
Install the EUI CLI globally using npm:
|
|
81
|
-
|
|
82
|
-
\`\`\`bash
|
|
83
|
-
npm install -g @eui/cli
|
|
84
|
-
\`\`\`
|
|
85
|
-
|
|
86
|
-
Verify the installation:
|
|
87
|
-
|
|
88
|
-
\`\`\`bash
|
|
89
|
-
eui-cli --version
|
|
90
|
-
\`\`\`
|
|
91
|
-
|
|
92
|
-
## Creating a New Application
|
|
93
|
-
|
|
94
|
-
Generate a new EUI application using the \`new\` command:
|
|
95
|
-
|
|
96
|
-
\`\`\`bash
|
|
97
|
-
eui-cli new
|
|
98
|
-
\`\`\`
|
|
99
|
-
|
|
100
|
-
This will:
|
|
101
|
-
- Create a new directory called \`my-app\`
|
|
102
|
-
- Set up the project structure
|
|
103
|
-
- Install dependencies
|
|
104
|
-
- Configure build tools
|
|
105
|
-
|
|
106
|
-
### Interactive Setup
|
|
107
|
-
|
|
108
|
-
The CLI will prompt you for:
|
|
109
|
-
- **Application name**: Your app's display name
|
|
110
|
-
- **Description**: Brief description of your application
|
|
111
|
-
- **Framework**: Choose between Angular, React, or Vue
|
|
112
|
-
- **Styling**: Select CSS, SCSS, or styled-components
|
|
113
|
-
- **Features**: Optional features like routing, state management, etc.
|
|
114
|
-
|
|
115
|
-
### Non-Interactive Setup
|
|
116
|
-
|
|
117
|
-
Skip prompts by providing options:
|
|
118
|
-
|
|
119
|
-
eui-cli globally installed
|
|
120
|
-
\`\`\`bash
|
|
121
|
-
eui-cli new --config appType:angular,npmInstall:false --targetPath my-app
|
|
122
|
-
\`\`\`
|
|
123
|
-
or using npx
|
|
124
|
-
\`\`\`bash
|
|
125
|
-
npx @eui/cli new --config appType:angular,npmInstall:false --targetPath my-app
|
|
126
|
-
\`\`\`
|
|
127
|
-
|
|
128
|
-
## Project Structure
|
|
129
|
-
|
|
130
|
-
A generated EUI application has this structure:
|
|
131
|
-
|
|
132
|
-
\`\`\`
|
|
133
|
-
my-app/
|
|
134
|
-
\u251C\u2500\u2500 src/
|
|
135
|
-
\u2502 \u251C\u2500\u2500 app/
|
|
136
|
-
\u2502 \u2502 \u251C\u2500\u2500 features/
|
|
137
|
-
\u2502 \u2502 \u2502 \u251C\u2500\u2500 home/
|
|
138
|
-
\u2502 \u2502 \u2502 \u2502 \u251C\u2500\u2500 home.component.html
|
|
139
|
-
\u2502 \u2502 \u2502 \u2502 \u251C\u2500\u2500 home.component.ts
|
|
140
|
-
\u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 home.routes.ts
|
|
141
|
-
\u2502 \u2502 \u2502 \u251C\u2500\u2500 module1/
|
|
142
|
-
\u2502 \u2502 \u2502 \u2502 \u251C\u2500\u2500 components/
|
|
143
|
-
\u2502 \u2502 \u2502 \u2502 \u2502 \u251C\u2500\u2500 page1/
|
|
144
|
-
\u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u251C\u2500\u2500 page1.component.html
|
|
145
|
-
\u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 page1.component.ts
|
|
146
|
-
\u2502 \u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 page2/
|
|
147
|
-
\u2502 \u2502 \u2502 \u2502 \u2502 \u251C\u2500\u2500 page2.component.html
|
|
148
|
-
\u2502 \u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 page2.component.ts
|
|
149
|
-
\u2502 \u2502 \u2502 \u2502 \u251C\u2500\u2500 module1.component.html
|
|
150
|
-
\u2502 \u2502 \u2502 \u2502 \u251C\u2500\u2500 module1.component.ts
|
|
151
|
-
\u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 module1.routes.ts
|
|
152
|
-
\u2502 \u2502 \u2502 \u2514\u2500\u2500 module2/
|
|
153
|
-
\u2502 \u2502 \u2502 \u251C\u2500\u2500 module2.component.html
|
|
154
|
-
\u2502 \u2502 \u2502 \u251C\u2500\u2500 module2.component.ts
|
|
155
|
-
\u2502 \u2502 \u2502 \u2514\u2500\u2500 module2.routes.ts
|
|
156
|
-
\u2502 \u2502 \u251C\u2500\u2500 shared/
|
|
157
|
-
\u2502 \u2502 \u2502 \u2514\u2500\u2500 testing/
|
|
158
|
-
\u2502 \u2502 \u2502 \u2514\u2500\u2500 router.mock.ts
|
|
159
|
-
\u2502 \u2502 \u251C\u2500\u2500 app-starter.service.ts
|
|
160
|
-
\u2502 \u2502 \u251C\u2500\u2500 app-starter.service.spec.ts
|
|
161
|
-
\u2502 \u2502 \u251C\u2500\u2500 app.component.html
|
|
162
|
-
\u2502 \u2502 \u251C\u2500\u2500 app.component.ts
|
|
163
|
-
\u2502 \u2502 \u251C\u2500\u2500 app.component.spec.ts
|
|
164
|
-
\u2502 \u2502 \u251C\u2500\u2500 app.config.ts
|
|
165
|
-
\u2502 \u2502 \u2514\u2500\u2500 app.routes.ts
|
|
166
|
-
\u2502 \u251C\u2500\u2500 assets/
|
|
167
|
-
\u2502 \u2502 \u251C\u2500\u2500 config/
|
|
168
|
-
\u2502 \u2502 \u2502 \u251C\u2500\u2500 env-json-config-dev.json
|
|
169
|
-
\u2502 \u2502 \u2502 \u251C\u2500\u2500 env-json-config-prod.json
|
|
170
|
-
\u2502 \u2502 \u2502 \u2514\u2500\u2500 env-json-config.json
|
|
171
|
-
\u2502 \u2502 \u2514\u2500\u2500 i18n/
|
|
172
|
-
\u2502 \u2502 \u251C\u2500\u2500 en.json
|
|
173
|
-
\u2502 \u2502 \u2514\u2500\u2500 fr.json
|
|
174
|
-
\u2502 \u251C\u2500\u2500 config/
|
|
175
|
-
\u2502 \u2502 \u251C\u2500\u2500 global.ts
|
|
176
|
-
\u2502 \u2502 \u251C\u2500\u2500 index.ts
|
|
177
|
-
\u2502 \u2502 \u2514\u2500\u2500 modules.ts
|
|
178
|
-
\u2502 \u251C\u2500\u2500 environments/
|
|
179
|
-
\u2502 \u2502 \u251C\u2500\u2500 environment.ts
|
|
180
|
-
\u2502 \u2502 \u2514\u2500\u2500 environment.prod.ts
|
|
181
|
-
\u2502 \u251C\u2500\u2500 index.html
|
|
182
|
-
\u2502 \u251C\u2500\u2500 main.ts
|
|
183
|
-
\u2502 \u251C\u2500\u2500 styles.scss
|
|
184
|
-
\u2502 \u251C\u2500\u2500 favicon.ico
|
|
185
|
-
\u2502 \u251C\u2500\u2500 dummy.spec.ts
|
|
186
|
-
\u2502 \u251C\u2500\u2500 tsconfig.app.json
|
|
187
|
-
\u2502 \u2514\u2500\u2500 tsconfig.spec.json
|
|
188
|
-
\u251C\u2500\u2500 mock/
|
|
189
|
-
\u2502 \u251C\u2500\u2500 app/
|
|
190
|
-
\u2502 \u2502 \u251C\u2500\u2500 models/
|
|
191
|
-
\u2502 \u2502 \u2502 \u2514\u2500\u2500 user.js
|
|
192
|
-
\u2502 \u2502 \u2514\u2500\u2500 routes/
|
|
193
|
-
\u2502 \u251C\u2500\u2500 db/
|
|
194
|
-
\u2502 \u2502 \u2514\u2500\u2500 db.json
|
|
195
|
-
\u2502 \u2514\u2500\u2500 server.js
|
|
196
|
-
\`\`\`
|
|
197
|
-
|
|
198
|
-
The application will be available at \`http://localhost:4200\`
|
|
199
|
-
`;var R=class{execute(e={}){return Promise.resolve({content:De,format:"markdown"})}static getToolDefinition(){return{name:"get-eui-cli-instructions",description:"Returns complete EUI CLI instructions including all commands, options, headless mode configuration, CI/CD usage, and best practices for automated scaffolding and building.",inputSchema:{type:"object",properties:{}}}}},De=`# eUI CLI - Complete Options Report
|
|
200
|
-
|
|
201
|
-
## Overview
|
|
202
|
-
|
|
203
|
-
The @eui/cli is a command-line tool for scaffolding and managing eUI Angular applications. It supports both interactive and headless (automated) modes for CI/CD pipelines and scripting.
|
|
204
|
-
|
|
205
|
-
## Installation
|
|
206
|
-
|
|
207
|
-
\`\`\`bash
|
|
208
|
-
npm install -g @eui/cli@latest
|
|
209
|
-
\`\`\`
|
|
210
|
-
|
|
211
|
-
## Available Commands
|
|
212
|
-
|
|
213
|
-
### 1. new (default command)
|
|
214
|
-
|
|
215
|
-
Generates a new eUI application with interactive prompts or automated configuration.
|
|
216
|
-
|
|
217
|
-
**Usage:**
|
|
218
|
-
|
|
219
|
-
\`\`\`bash
|
|
220
|
-
eui-cli new [options]
|
|
221
|
-
eui-cli [options] # 'new' is default
|
|
222
|
-
\`\`\`
|
|
223
|
-
|
|
224
|
-
**Interactive Options:**
|
|
225
|
-
|
|
226
|
-
**Application Type:**
|
|
227
|
-
- \`angular\` - eUI Angular Desktop
|
|
228
|
-
- \`mobile\` - eUI Angular Mobile (Ionic)
|
|
229
|
-
- \`web-spring-boot\` - eUI Angular + Spring Boot (requires JDK + Maven)
|
|
230
|
-
- \`web-maven\` - eUI Angular + Maven web module (requires JDK + Maven)
|
|
231
|
-
|
|
232
|
-
**Additional Configuration:**
|
|
233
|
-
- \`ecl\` - ECL app-shell template for ec.europa.eu apps
|
|
234
|
-
- ECL Theme: \`ecl-ec\` or \`ecl-eu\`
|
|
235
|
-
|
|
236
|
-
**Package Manager:**
|
|
237
|
-
- \`yarn\` (default)
|
|
238
|
-
- \`pnpm\` (experimental)
|
|
239
|
-
|
|
240
|
-
**Maven Options (for web-spring-boot):**
|
|
241
|
-
- \`groupId\` - Default: ec.europa.digit
|
|
242
|
-
- \`artifactId\` - Default: myapp
|
|
243
|
-
|
|
244
|
-
### 2. build-app
|
|
245
|
-
|
|
246
|
-
Builds the Angular application with linting, testing, and compilation.
|
|
247
|
-
|
|
248
|
-
**Usage:**
|
|
249
|
-
|
|
250
|
-
\`\`\`bash
|
|
251
|
-
eui-cli build-app [options]
|
|
252
|
-
\`\`\`
|
|
253
|
-
|
|
254
|
-
**Options:**
|
|
255
|
-
|
|
256
|
-
| Option | Type | Description |
|
|
257
|
-
|--------|------|-------------|
|
|
258
|
-
| \`--skipLint\` | boolean | Skip linting phase |
|
|
259
|
-
| \`--skipTest\` | boolean | Skip unit testing phase |
|
|
260
|
-
| \`--skipCompile\` | boolean | Skip compilation phase |
|
|
261
|
-
| \`--configuration\` | string | Build configuration (e.g., production, development) |
|
|
262
|
-
| \`--baseHref\` | string | Base URL for the application |
|
|
263
|
-
| \`--servePath\` | string | Path where files are served |
|
|
264
|
-
| \`--deployUrl\` | string | URL where files will be deployed |
|
|
265
|
-
| \`--watch\` | boolean | Enable watch mode for tests |
|
|
266
|
-
| \`--dryRun\` | boolean | Run without executing build |
|
|
267
|
-
| \`--maxSpaceSize\` | boolean | Increase Node memory (8096MB) |
|
|
268
|
-
| \`--statsJson\` | boolean | Generate stats.json for bundle analysis |
|
|
269
|
-
| \`--ci\` | boolean | CI mode (disables progress output) |
|
|
270
|
-
| \`--sourceMap\` | boolean | Generate source maps |
|
|
271
|
-
| \`--configEnvTarget\` | string | Inject environment-specific config |
|
|
272
|
-
| \`--project\` | string | Project name (default: 'app') |
|
|
273
|
-
|
|
274
|
-
**Example:**
|
|
275
|
-
|
|
276
|
-
\`\`\`bash
|
|
277
|
-
eui-cli build-app --configuration=production --baseHref=/myapp/ --skipTest
|
|
278
|
-
\`\`\`
|
|
279
|
-
|
|
280
|
-
### 3. serve-app
|
|
281
|
-
|
|
282
|
-
Serves the Angular application locally with development server.
|
|
283
|
-
|
|
284
|
-
**Usage:**
|
|
285
|
-
|
|
286
|
-
\`\`\`bash
|
|
287
|
-
eui-cli serve-app [options]
|
|
288
|
-
\`\`\`
|
|
289
|
-
|
|
290
|
-
**Options:**
|
|
291
|
-
|
|
292
|
-
| Option | Type | Description |
|
|
293
|
-
|--------|------|-------------|
|
|
294
|
-
| \`--configuration\` | string | Serve configuration |
|
|
295
|
-
| \`--baseHref\` | string | Base URL for the application |
|
|
296
|
-
| \`--servePath\` | string | Path where files are served |
|
|
297
|
-
| \`--host\` | string | Host to listen on (default: localhost) |
|
|
298
|
-
| \`--port\` | number | Port to listen on (default: 4200) |
|
|
299
|
-
| \`--proxyConfig\` | string | Proxy configuration file |
|
|
300
|
-
| \`--disableHostCheck\` | boolean | Disable host check |
|
|
301
|
-
| \`--open\` | string | Open browser (default: true, use 'false' to disable) |
|
|
302
|
-
| \`--maxSpaceSize\` | boolean | Increase Node memory (8192MB) |
|
|
303
|
-
| \`--noLiveReload\` | boolean | Disable live reload |
|
|
304
|
-
| \`--configEnvTarget\` | string | Inject environment-specific config |
|
|
305
|
-
| \`--project\` | string | Project name (default: 'app') |
|
|
306
|
-
| \`--debug\` | boolean | Enable debug logging |
|
|
307
|
-
|
|
308
|
-
**Example:**
|
|
309
|
-
|
|
310
|
-
\`\`\`bash
|
|
311
|
-
eui-cli serve-app --port=4300 --host=0.0.0.0 --proxyConfig=proxy.conf.json
|
|
312
|
-
\`\`\`
|
|
313
|
-
|
|
314
|
-
### 4. lint-app
|
|
315
|
-
|
|
316
|
-
Runs linting on the application.
|
|
317
|
-
|
|
318
|
-
**Usage:**
|
|
319
|
-
|
|
320
|
-
\`\`\`bash
|
|
321
|
-
eui-cli lint-app
|
|
322
|
-
\`\`\`
|
|
323
|
-
|
|
324
|
-
### 5. inject-config-app
|
|
325
|
-
|
|
326
|
-
Injects environment-specific configuration into the application.
|
|
327
|
-
|
|
328
|
-
**Usage:**
|
|
329
|
-
|
|
330
|
-
\`\`\`bash
|
|
331
|
-
eui-cli inject-config-app --configEnvTarget=<env>
|
|
332
|
-
\`\`\`
|
|
333
|
-
|
|
334
|
-
**Options:**
|
|
335
|
-
|
|
336
|
-
| Option | Type | Description |
|
|
337
|
-
|--------|------|-------------|
|
|
338
|
-
| \`--configEnvTarget\` | string | Target environment (dev, tst, acc, prd) |
|
|
339
|
-
|
|
340
|
-
**How it works:**
|
|
341
|
-
- Copies \`src/assets/config/env-json-config-<env>.json\` to \`src/assets/env-json-config.json\`
|
|
342
|
-
- Used for environment-specific OpenID/configuration injection
|
|
343
|
-
|
|
344
|
-
**Example:**
|
|
345
|
-
|
|
346
|
-
\`\`\`bash
|
|
347
|
-
eui-cli inject-config-app --configEnvTarget=production
|
|
348
|
-
\`\`\`
|
|
349
|
-
|
|
350
|
-
### 6. generate-sprite
|
|
351
|
-
|
|
352
|
-
Generates SVG sprite from individual SVG files.
|
|
353
|
-
|
|
354
|
-
**Usage:**
|
|
355
|
-
|
|
356
|
-
\`\`\`bash
|
|
357
|
-
eui-cli generate-sprite --inFolder=<path> --outFile=<filename.svg>
|
|
358
|
-
\`\`\`
|
|
359
|
-
|
|
360
|
-
**Options:**
|
|
361
|
-
|
|
362
|
-
| Option | Type | Description |
|
|
363
|
-
|--------|------|-------------|
|
|
364
|
-
| \`--inFolder\` | string | Input folder containing SVG files (required) |
|
|
365
|
-
| \`--outFile\` | string | Output sprite filename (required, must end with .svg) |
|
|
366
|
-
|
|
367
|
-
**Features:**
|
|
368
|
-
- Optimizes SVG files using imagemin-svgo
|
|
369
|
-
- Generates sprite file and JSON list of icons
|
|
370
|
-
- Cleans up IDs, removes styles and titles
|
|
371
|
-
|
|
372
|
-
**Example:**
|
|
373
|
-
|
|
374
|
-
\`\`\`bash
|
|
375
|
-
eui-cli generate-sprite --inFolder=src/assets/icons --outFile=sprite.svg
|
|
376
|
-
\`\`\`
|
|
377
|
-
|
|
378
|
-
## Headless Mode (Automated/CI Usage)
|
|
379
|
-
|
|
380
|
-
### Using --config Parameter
|
|
381
|
-
|
|
382
|
-
The CLI supports headless operation via the \`--config\` parameter for automated scaffolding without interactive prompts.
|
|
383
|
-
|
|
384
|
-
**Syntax:**
|
|
385
|
-
|
|
386
|
-
\`\`\`bash
|
|
387
|
-
eui-cli --config <key1>:<value1>,<key2>:<value2> --targetPath <path>
|
|
388
|
-
\`\`\`
|
|
389
|
-
|
|
390
|
-
### Configuration Options
|
|
391
|
-
|
|
392
|
-
| Key | Type | Values | Description |
|
|
393
|
-
|-----|------|--------|-------------|
|
|
394
|
-
| \`appType\` | string | angular, mobile, web-maven, web-spring-boot | Application type |
|
|
395
|
-
| \`appName\` | string | any | Application name (default: 'my-app') |
|
|
396
|
-
| \`appScope\` | string | any | NPM scope (default: '@app') |
|
|
397
|
-
| \`appOptions\` | array | ecl | Additional options (use underscore for multiple: ecl_option2) |
|
|
398
|
-
| \`appOptionsEclTheme\` | string | ecl-ec, ecl-eu | ECL theme flavor |
|
|
399
|
-
| \`groupId\` | string | any | Maven groupId (default: 'ec.europa.digit') |
|
|
400
|
-
| \`artifactId\` | string | any | Maven artifactId (default: 'myapp') |
|
|
401
|
-
| \`packageManager\` | string | yarn, pnpm | Package manager |
|
|
402
|
-
| \`npmInstall\` | boolean | true, false | Install dependencies |
|
|
403
|
-
| \`appStart\` | boolean | true, false | Start app after generation |
|
|
404
|
-
|
|
405
|
-
### Headless Examples
|
|
406
|
-
|
|
407
|
-
**1. Basic Angular App (no installation):**
|
|
408
|
-
|
|
409
|
-
\`\`\`bash
|
|
410
|
-
eui-cli --config appType:angular,npmInstall:false --targetPath my-angular-app
|
|
411
|
-
\`\`\`
|
|
412
|
-
|
|
413
|
-
**2. Angular App with ECL EC Theme:**
|
|
414
|
-
|
|
415
|
-
\`\`\`bash
|
|
416
|
-
eui-cli --config appType:angular,appOptions:ecl,appOptionsEclTheme:ecl-ec,npmInstall:true,packageManager:yarn --targetPath my-ecl-app
|
|
417
|
-
\`\`\`
|
|
418
|
-
|
|
419
|
-
**3. Mobile Ionic App:**
|
|
420
|
-
|
|
421
|
-
\`\`\`bash
|
|
422
|
-
eui-cli --config appType:mobile,npmInstall:true --targetPath my-mobile-app
|
|
423
|
-
\`\`\`
|
|
424
|
-
|
|
425
|
-
**4. Spring Boot Web App:**
|
|
426
|
-
|
|
427
|
-
\`\`\`bash
|
|
428
|
-
eui-cli --config appType:web-spring-boot,groupId:com.mycompany,artifactId:myproject,npmInstall:false --targetPath my-spring-app
|
|
429
|
-
\`\`\`
|
|
430
|
-
|
|
431
|
-
**5. CI/CD Pipeline Example:**
|
|
432
|
-
|
|
433
|
-
\`\`\`bash
|
|
434
|
-
# Generate app without installation
|
|
435
|
-
eui-cli --config appType:angular,appOptions:ecl,npmInstall:false --targetPath ./build/app
|
|
436
|
-
|
|
437
|
-
# Build for production
|
|
438
|
-
cd ./build/app
|
|
439
|
-
eui-cli build-app --configuration=production --ci --skipTest --baseHref=/app/
|
|
440
|
-
\`\`\`
|
|
441
|
-
|
|
442
|
-
## Environment Variables
|
|
443
|
-
|
|
444
|
-
### _CSDR_ARGS
|
|
445
|
-
|
|
446
|
-
Alternative method for passing arguments (used in CSDR pipelines).
|
|
447
|
-
|
|
448
|
-
**Format:**
|
|
449
|
-
|
|
450
|
-
\`\`\`bash
|
|
451
|
-
export _CSDR_ARGS="key1:value1,key2:value2"
|
|
452
|
-
eui-cli
|
|
453
|
-
\`\`\`
|
|
454
|
-
|
|
455
|
-
**Array Format:**
|
|
456
|
-
|
|
457
|
-
\`\`\`bash
|
|
458
|
-
export _CSDR_ARGS="itemsArray:key1=value1|key2=value2"
|
|
459
|
-
\`\`\`
|
|
460
|
-
|
|
461
|
-
## Advanced Usage
|
|
462
|
-
|
|
463
|
-
### Version Check
|
|
464
|
-
|
|
465
|
-
\`\`\`bash
|
|
466
|
-
eui-cli -v
|
|
467
|
-
eui-cli --version
|
|
468
|
-
\`\`\`
|
|
469
|
-
|
|
470
|
-
### Debug Mode
|
|
471
|
-
|
|
472
|
-
Enable verbose logging for troubleshooting:
|
|
473
|
-
|
|
474
|
-
\`\`\`bash
|
|
475
|
-
eui-cli serve-app --debug
|
|
476
|
-
eui-cli build-app --debug
|
|
477
|
-
\`\`\`
|
|
478
|
-
|
|
479
|
-
### CI/CD Build Pipeline
|
|
480
|
-
|
|
481
|
-
\`\`\`bash
|
|
482
|
-
# 1. Inject environment config
|
|
483
|
-
eui-cli inject-config-app --configEnvTarget=production
|
|
484
|
-
|
|
485
|
-
# 2. Build with optimizations
|
|
486
|
-
eui-cli build-app \\
|
|
487
|
-
--configuration=production \\
|
|
488
|
-
--baseHref=/myapp/ \\
|
|
489
|
-
--deployUrl=https://cdn.example.com/ \\
|
|
490
|
-
--ci \\
|
|
491
|
-
--statsJson \\
|
|
492
|
-
--skipTest
|
|
493
|
-
|
|
494
|
-
# 3. Output in dist/ folder
|
|
495
|
-
\`\`\`
|
|
496
|
-
|
|
497
|
-
### Memory-Intensive Builds
|
|
498
|
-
|
|
499
|
-
\`\`\`bash
|
|
500
|
-
eui-cli build-app --maxSpaceSize --configuration=production
|
|
501
|
-
eui-cli serve-app --maxSpaceSize
|
|
502
|
-
\`\`\`
|
|
503
|
-
|
|
504
|
-
## Default Configuration Values
|
|
505
|
-
|
|
506
|
-
\`\`\`javascript
|
|
507
|
-
{
|
|
508
|
-
appName: 'my-app',
|
|
509
|
-
appScope: '@app',
|
|
510
|
-
appType: 'angular',
|
|
511
|
-
appOptions: [],
|
|
512
|
-
appOptionsEclTheme: 'ecl-ec',
|
|
513
|
-
appFeatures: [],
|
|
514
|
-
groupId: 'ec.europa.digit',
|
|
515
|
-
artifactId: 'myapp',
|
|
516
|
-
packageManager: 'yarn',
|
|
517
|
-
npmInstall: true,
|
|
518
|
-
appStart: true
|
|
519
|
-
}
|
|
520
|
-
\`\`\`
|
|
521
|
-
|
|
522
|
-
## Exit Codes
|
|
523
|
-
|
|
524
|
-
- \`0\` - Success
|
|
525
|
-
- \`1\` - Error (build failure, missing arguments, etc.)
|
|
526
|
-
|
|
527
|
-
## Best Practices
|
|
528
|
-
|
|
529
|
-
1. **Headless Generation**: Always use \`--config\` with \`npmInstall:false\` in CI, then install separately
|
|
530
|
-
2. **Build Optimization**: Use \`--ci\` flag in pipelines to disable progress output
|
|
531
|
-
3. **Memory Management**: Use \`--maxSpaceSize\` for large applications
|
|
532
|
-
4. **Environment Config**: Use \`inject-config-app\` before builds for environment-specific settings
|
|
533
|
-
5. **Testing**: Skip tests in CI with \`--skipTest\` if running separately
|
|
534
|
-
|
|
535
|
-
## Supported Node Versions
|
|
536
|
-
|
|
537
|
-
- **Node.js**: >=24.0.0
|
|
538
|
-
- **Yarn**: >=1.22.4 <2
|
|
539
|
-
`;var j=class{server;index;query;searchEngine;formatter;tools;isRunning=!1;constructor(e,t){this.index=t,this.query=new N(t),this.searchEngine=new F(t),this.formatter=new J,this.tools=new Map,this.server=new Se({name:e.name,version:e.version},{capabilities:{tools:{}}}),this.registerTools(),this.setupHandlers()}registerTools(){let e=new h(this.query,this.formatter),t=new y(this.query,this.formatter),r=new v(this.searchEngine,this.formatter),n=new C(this.query,this.formatter),o=new x(this.query,this.formatter),s=new b(this.query,this.formatter),a=new w,p=new D(this.index,this.formatter),u=new S(this.index,this.formatter),m=new I,f=new R;this.tools.set("list-components",e),this.tools.set("get-component-docs",t),this.tools.set("search-components",r),this.tools.set("get-component-inputs",n),this.tools.set("get-component-outputs",o),this.tools.set("get-component-examples",s),this.tools.set("get-library-version",a),this.tools.set("list-deprecated",p),this.tools.set("get-deprecation-info",u),this.tools.set("get-eui-cli-guide",m),this.tools.set("get-eui-cli-instructions",f)}setupHandlers(){this.server.setRequestHandler(Te,()=>({tools:[h.getToolDefinition(),y.getToolDefinition(),v.getToolDefinition(),C.getToolDefinition(),x.getToolDefinition(),b.getToolDefinition(),w.getToolDefinition(),D.getToolDefinition(),S.getToolDefinition(),I.getToolDefinition(),R.getToolDefinition()]})),this.server.setRequestHandler(Re,async e=>{let{name:t,arguments:r}=e.params;try{let n=this.tools.get(t);if(!n)return{content:[{type:"text",text:JSON.stringify({error:{code:"TOOL_NOT_FOUND",message:`Tool '${t}' does not exist. Available tools: ${Array.from(this.tools.keys()).join(", ")}`}})}],isError:!0};if(r==null)return{content:[{type:"text",text:JSON.stringify({error:{code:"INVALID_PARAMETERS",message:"Tool parameters are required"}})}],isError:!0};let o=await n.execute(r??{});return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(n){let o=n instanceof Error?n.message:"Unknown error occurred",s=this.categorizeError(n);return{content:[{type:"text",text:JSON.stringify({error:{code:s,message:o}})}],isError:!0}}})}categorizeError(e){if(e instanceof Error){let t=e.message.toLowerCase();if(t.includes("not found")||t.includes("does not exist"))return"NOT_FOUND";if(t.includes("invalid")||t.includes("must be")||t.includes("required")||t.includes("limit")||t.includes("offset"))return"INVALID_PARAMETERS"}return"INTERNAL_ERROR"}async start(){if(this.isRunning)throw new Error("Server is already running");let e=new Ie;await this.server.connect(e),this.isRunning=!0}async stop(){this.isRunning&&(await this.server.close(),this.isRunning=!1)}isHealthy(){return this.isRunning}getStats(){return{isRunning:this.isRunning,toolCount:this.tools.size,indexStats:{totalComponents:this.index.totalCount,lastUpdated:this.index.lastUpdated}}}updateIndex(e){this.index=e,this.query=new N(e),this.searchEngine=new F(e),this.registerTools()}};var d=null,Y=null,le=!1;async function Pe(){try{let i=te();(!i.success||!i.config)&&(process.stderr.write(`Failed to load configuration
|
|
540
|
-
`),i.errors&&i.errors.forEach(a=>process.stderr.write(` - ${a}
|
|
541
|
-
`)),process.exit(1));let e=i.config,t=re({level:e.logging.level,format:e.logging.format});t.info("Starting EUI Compodoc MCP Server",{version:e.server.version,documentationPath:e.documentation.path}),t.info("Loading documentation...",{path:e.documentation.path}),Y=new M({path:e.documentation.path,watchForChanges:e.documentation.watchForChanges,reloadDebounce:e.documentation.reloadDebounce,onReload:Oe,onError:ke});let r=await Y.load();(!r.success||!r.data)&&(t.error("Failed to load documentation",void 0,{error:r.error}),process.exit(1)),t.info("Documentation loaded successfully",{path:e.documentation.path}),t.info("Building component index...");let n=new A,o;try{o=n.build(r.data);let a=n.getStatistics(o);t.info("Index built successfully",{totalCount:a.totalCount,components:a.componentCount,directives:a.directiveCount,pipes:a.pipeCount,services:a.serviceCount})}catch(a){t.error("Failed to build index",a instanceof Error?a:new Error(String(a))),process.exit(1)}t.info("Initializing MCP server..."),d=new j({name:e.server.name,version:e.server.version},o),t.info("Starting MCP server..."),await d.start(),t.info("MCP server started successfully",{name:e.server.name,version:e.server.version,watchForChanges:e.documentation.watchForChanges}),d.isHealthy()?t.info("Health check passed"):t.warn("Health check failed - server may not be fully operational");let s=d.getStats();t.debug("Server statistics",s),t.info("Server is ready to accept requests")}catch(i){c().error("Fatal error during startup",i instanceof Error?i:new Error(String(i))),process.exit(1)}}function Oe(i){let e=c();e.info("Documentation file changed, reloading...");try{let t=new A,r=t.build(i);if(d){d.updateIndex(r);let n=t.getStatistics(r);e.info("Index updated successfully",{totalCount:n.totalCount,components:n.componentCount,directives:n.directiveCount,pipes:n.pipeCount,services:n.serviceCount})}}catch(t){e.error("Failed to reload documentation",t instanceof Error?t:new Error(String(t)))}}function ke(i){c().error("Documentation loader error",i)}async function Z(i){if(le)return;le=!0;let e=c();e.info(`Received ${i}, shutting down gracefully...`);try{d&&(e.info("Stopping MCP server..."),await d.stop(),e.info("MCP server stopped")),Y&&(e.info("Stopping documentation loader..."),await Y.dispose(),e.info("Documentation loader stopped")),e.info("Shutdown complete"),process.exit(0)}catch(t){e.error("Error during shutdown",t instanceof Error?t:new Error(String(t))),process.exit(1)}}function Le(){process.on("SIGINT",()=>{Z("SIGINT")}),process.on("SIGTERM",()=>{Z("SIGTERM")}),process.on("uncaughtException",i=>{c().error("Uncaught exception",i),Z("uncaughtException")}),process.on("unhandledRejection",i=>{c().error("Unhandled promise rejection",i instanceof Error?i:new Error(String(i))),Z("unhandledRejection")})}Le();Pe().catch(i=>{process.stderr.write(`Fatal error: ${i}
|
|
542
|
-
`),process.exit(1)});
|