@eui/mcp 1.0.3

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.
Files changed (191) hide show
  1. package/README.md +846 -0
  2. package/dist/config/index.d.ts +6 -0
  3. package/dist/config/index.d.ts.map +1 -0
  4. package/dist/config/index.js +6 -0
  5. package/dist/config/index.js.map +1 -0
  6. package/dist/config/loader.d.ts +27 -0
  7. package/dist/config/loader.d.ts.map +1 -0
  8. package/dist/config/loader.js +224 -0
  9. package/dist/config/loader.js.map +1 -0
  10. package/dist/config/schema.d.ts +171 -0
  11. package/dist/config/schema.d.ts.map +1 -0
  12. package/dist/config/schema.js +100 -0
  13. package/dist/config/schema.js.map +1 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +45 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/loader/cache-manager.d.ts +74 -0
  19. package/dist/loader/cache-manager.d.ts.map +1 -0
  20. package/dist/loader/cache-manager.js +107 -0
  21. package/dist/loader/cache-manager.js.map +1 -0
  22. package/dist/loader/documentation-loader.d.ts +57 -0
  23. package/dist/loader/documentation-loader.d.ts.map +1 -0
  24. package/dist/loader/documentation-loader.js +81 -0
  25. package/dist/loader/documentation-loader.js.map +1 -0
  26. package/dist/loader/documentation-source.d.ts +37 -0
  27. package/dist/loader/documentation-source.d.ts.map +1 -0
  28. package/dist/loader/documentation-source.js +2 -0
  29. package/dist/loader/documentation-source.js.map +1 -0
  30. package/dist/loader/errors.d.ts +34 -0
  31. package/dist/loader/errors.d.ts.map +1 -0
  32. package/dist/loader/errors.js +65 -0
  33. package/dist/loader/errors.js.map +1 -0
  34. package/dist/loader/http-client.d.ts +43 -0
  35. package/dist/loader/http-client.d.ts.map +1 -0
  36. package/dist/loader/http-client.js +144 -0
  37. package/dist/loader/http-client.js.map +1 -0
  38. package/dist/loader/index.d.ts +6 -0
  39. package/dist/loader/index.d.ts.map +1 -0
  40. package/dist/loader/index.js +5 -0
  41. package/dist/loader/index.js.map +1 -0
  42. package/dist/loader/local-documentation-source.d.ts +62 -0
  43. package/dist/loader/local-documentation-source.d.ts.map +1 -0
  44. package/dist/loader/local-documentation-source.js +190 -0
  45. package/dist/loader/local-documentation-source.js.map +1 -0
  46. package/dist/loader/path-type-detector.d.ts +34 -0
  47. package/dist/loader/path-type-detector.d.ts.map +1 -0
  48. package/dist/loader/path-type-detector.js +78 -0
  49. package/dist/loader/path-type-detector.js.map +1 -0
  50. package/dist/loader/remote-documentation-source.d.ts +112 -0
  51. package/dist/loader/remote-documentation-source.d.ts.map +1 -0
  52. package/dist/loader/remote-documentation-source.js +252 -0
  53. package/dist/loader/remote-documentation-source.js.map +1 -0
  54. package/dist/main.d.ts +3 -0
  55. package/dist/main.d.ts.map +1 -0
  56. package/dist/main.js +211 -0
  57. package/dist/main.js.map +1 -0
  58. package/dist/mcp/index.d.ts +5 -0
  59. package/dist/mcp/index.d.ts.map +1 -0
  60. package/dist/mcp/index.js +5 -0
  61. package/dist/mcp/index.js.map +1 -0
  62. package/dist/mcp/server.d.ts +65 -0
  63. package/dist/mcp/server.d.ts.map +1 -0
  64. package/dist/mcp/server.js +224 -0
  65. package/dist/mcp/server.js.map +1 -0
  66. package/dist/publish/index.d.ts +8 -0
  67. package/dist/publish/index.d.ts.map +1 -0
  68. package/dist/publish/index.js +8 -0
  69. package/dist/publish/index.js.map +1 -0
  70. package/dist/publish/publish-utils.d.ts +74 -0
  71. package/dist/publish/publish-utils.d.ts.map +1 -0
  72. package/dist/publish/publish-utils.js +170 -0
  73. package/dist/publish/publish-utils.js.map +1 -0
  74. package/dist/query/component-query.d.ts +33 -0
  75. package/dist/query/component-query.d.ts.map +1 -0
  76. package/dist/query/component-query.js +63 -0
  77. package/dist/query/component-query.js.map +1 -0
  78. package/dist/query/index-builder.d.ts +79 -0
  79. package/dist/query/index-builder.d.ts.map +1 -0
  80. package/dist/query/index-builder.js +217 -0
  81. package/dist/query/index-builder.js.map +1 -0
  82. package/dist/query/index.d.ts +5 -0
  83. package/dist/query/index.d.ts.map +1 -0
  84. package/dist/query/index.js +6 -0
  85. package/dist/query/index.js.map +1 -0
  86. package/dist/query/result-formatter.d.ts +108 -0
  87. package/dist/query/result-formatter.d.ts.map +1 -0
  88. package/dist/query/result-formatter.js +165 -0
  89. package/dist/query/result-formatter.js.map +1 -0
  90. package/dist/query/search-engine.d.ts +54 -0
  91. package/dist/query/search-engine.d.ts.map +1 -0
  92. package/dist/query/search-engine.js +178 -0
  93. package/dist/query/search-engine.js.map +1 -0
  94. package/dist/test-error.ts +1 -0
  95. package/dist/tools/get-component-docs.d.ts +43 -0
  96. package/dist/tools/get-component-docs.d.ts.map +1 -0
  97. package/dist/tools/get-component-docs.js +55 -0
  98. package/dist/tools/get-component-docs.js.map +1 -0
  99. package/dist/tools/get-component-examples.d.ts +45 -0
  100. package/dist/tools/get-component-examples.d.ts.map +1 -0
  101. package/dist/tools/get-component-examples.js +56 -0
  102. package/dist/tools/get-component-examples.js.map +1 -0
  103. package/dist/tools/get-component-inputs.d.ts +44 -0
  104. package/dist/tools/get-component-inputs.d.ts.map +1 -0
  105. package/dist/tools/get-component-inputs.js +55 -0
  106. package/dist/tools/get-component-inputs.js.map +1 -0
  107. package/dist/tools/get-component-outputs.d.ts +44 -0
  108. package/dist/tools/get-component-outputs.d.ts.map +1 -0
  109. package/dist/tools/get-component-outputs.js +55 -0
  110. package/dist/tools/get-component-outputs.js.map +1 -0
  111. package/dist/tools/index.d.ts +7 -0
  112. package/dist/tools/index.d.ts.map +1 -0
  113. package/dist/tools/index.js +8 -0
  114. package/dist/tools/index.js.map +1 -0
  115. package/dist/tools/list-components.d.ts +69 -0
  116. package/dist/tools/list-components.d.ts.map +1 -0
  117. package/dist/tools/list-components.js +84 -0
  118. package/dist/tools/list-components.js.map +1 -0
  119. package/dist/tools/search-components.d.ts +69 -0
  120. package/dist/tools/search-components.d.ts.map +1 -0
  121. package/dist/tools/search-components.js +98 -0
  122. package/dist/tools/search-components.js.map +1 -0
  123. package/dist/types/compodoc.d.ts +261 -0
  124. package/dist/types/compodoc.d.ts.map +1 -0
  125. package/dist/types/compodoc.js +5 -0
  126. package/dist/types/compodoc.js.map +1 -0
  127. package/dist/types/index.d.ts +5 -0
  128. package/dist/types/index.d.ts.map +1 -0
  129. package/dist/types/index.js +5 -0
  130. package/dist/types/index.js.map +1 -0
  131. package/dist/utils/circuit-breaker.d.ts +91 -0
  132. package/dist/utils/circuit-breaker.d.ts.map +1 -0
  133. package/dist/utils/circuit-breaker.js +186 -0
  134. package/dist/utils/circuit-breaker.js.map +1 -0
  135. package/dist/utils/credential-masking.d.ts +90 -0
  136. package/dist/utils/credential-masking.d.ts.map +1 -0
  137. package/dist/utils/credential-masking.js +202 -0
  138. package/dist/utils/credential-masking.js.map +1 -0
  139. package/dist/utils/error-handler.d.ts +68 -0
  140. package/dist/utils/error-handler.d.ts.map +1 -0
  141. package/dist/utils/error-handler.js +184 -0
  142. package/dist/utils/error-handler.js.map +1 -0
  143. package/dist/utils/errors.d.ts +156 -0
  144. package/dist/utils/errors.d.ts.map +1 -0
  145. package/dist/utils/errors.js +242 -0
  146. package/dist/utils/errors.js.map +1 -0
  147. package/dist/utils/index.d.ts +10 -0
  148. package/dist/utils/index.d.ts.map +1 -0
  149. package/dist/utils/index.js +16 -0
  150. package/dist/utils/index.js.map +1 -0
  151. package/dist/utils/logger.d.ts +76 -0
  152. package/dist/utils/logger.d.ts.map +1 -0
  153. package/dist/utils/logger.js +150 -0
  154. package/dist/utils/logger.js.map +1 -0
  155. package/dist/utils/retry.d.ts +19 -0
  156. package/dist/utils/retry.d.ts.map +1 -0
  157. package/dist/utils/retry.js +81 -0
  158. package/dist/utils/retry.js.map +1 -0
  159. package/dist/version/changelog-file-utils.d.ts +69 -0
  160. package/dist/version/changelog-file-utils.d.ts.map +1 -0
  161. package/dist/version/changelog-file-utils.js +161 -0
  162. package/dist/version/changelog-file-utils.js.map +1 -0
  163. package/dist/version/changelog-utils.d.ts +98 -0
  164. package/dist/version/changelog-utils.d.ts.map +1 -0
  165. package/dist/version/changelog-utils.js +198 -0
  166. package/dist/version/changelog-utils.js.map +1 -0
  167. package/dist/version/dry-run-utils.d.ts +108 -0
  168. package/dist/version/dry-run-utils.d.ts.map +1 -0
  169. package/dist/version/dry-run-utils.js +126 -0
  170. package/dist/version/dry-run-utils.js.map +1 -0
  171. package/dist/version/git-tag-utils.d.ts +50 -0
  172. package/dist/version/git-tag-utils.d.ts.map +1 -0
  173. package/dist/version/git-tag-utils.js +66 -0
  174. package/dist/version/git-tag-utils.js.map +1 -0
  175. package/dist/version/index.d.ts +11 -0
  176. package/dist/version/index.d.ts.map +1 -0
  177. package/dist/version/index.js +11 -0
  178. package/dist/version/index.js.map +1 -0
  179. package/dist/version/release-utils.d.ts +94 -0
  180. package/dist/version/release-utils.d.ts.map +1 -0
  181. package/dist/version/release-utils.js +170 -0
  182. package/dist/version/release-utils.js.map +1 -0
  183. package/dist/version/rollback-utils.d.ts +47 -0
  184. package/dist/version/rollback-utils.d.ts.map +1 -0
  185. package/dist/version/rollback-utils.js +73 -0
  186. package/dist/version/rollback-utils.js.map +1 -0
  187. package/dist/version/version-manager.d.ts +98 -0
  188. package/dist/version/version-manager.d.ts.map +1 -0
  189. package/dist/version/version-manager.js +158 -0
  190. package/dist/version/version-manager.js.map +1 -0
  191. package/package.json +61 -0
@@ -0,0 +1,224 @@
1
+ /**
2
+ * CompodocMcpServer - Main MCP server implementation
3
+ * Handles tool registration, request routing, and error handling
4
+ */
5
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
8
+ import { ComponentQuery } from '../query/component-query.js';
9
+ import { SearchEngine } from '../query/search-engine.js';
10
+ import { ResultFormatter } from '../query/result-formatter.js';
11
+ import { ListComponentsTool, GetComponentDocsTool, SearchComponentsTool, GetComponentInputsTool, GetComponentOutputsTool, GetComponentExamplesTool, } from '../tools/index.js';
12
+ /**
13
+ * CompodocMcpServer class
14
+ * Manages the MCP server lifecycle and tool registration
15
+ */
16
+ export class CompodocMcpServer {
17
+ server;
18
+ index;
19
+ query;
20
+ searchEngine;
21
+ formatter;
22
+ tools;
23
+ isRunning = false;
24
+ constructor(config, index) {
25
+ this.index = index;
26
+ this.query = new ComponentQuery(index);
27
+ this.searchEngine = new SearchEngine(index);
28
+ this.formatter = new ResultFormatter();
29
+ this.tools = new Map();
30
+ // Initialize MCP server
31
+ this.server = new Server({
32
+ name: config.name,
33
+ version: config.version,
34
+ }, {
35
+ capabilities: {
36
+ tools: {},
37
+ },
38
+ });
39
+ // Register tools
40
+ this.registerTools();
41
+ // Set up request handlers
42
+ this.setupHandlers();
43
+ }
44
+ /**
45
+ * Register all available tools
46
+ */
47
+ registerTools() {
48
+ // Create tool instances
49
+ const listComponentsTool = new ListComponentsTool(this.query, this.formatter);
50
+ const getComponentDocsTool = new GetComponentDocsTool(this.query, this.formatter);
51
+ const searchComponentsTool = new SearchComponentsTool(this.searchEngine, this.formatter);
52
+ const getComponentInputsTool = new GetComponentInputsTool(this.query, this.formatter);
53
+ const getComponentOutputsTool = new GetComponentOutputsTool(this.query, this.formatter);
54
+ const getComponentExamplesTool = new GetComponentExamplesTool(this.query, this.formatter);
55
+ // Store tool instances
56
+ this.tools.set('list-components', listComponentsTool);
57
+ this.tools.set('get-component-docs', getComponentDocsTool);
58
+ this.tools.set('search-components', searchComponentsTool);
59
+ this.tools.set('get-component-inputs', getComponentInputsTool);
60
+ this.tools.set('get-component-outputs', getComponentOutputsTool);
61
+ this.tools.set('get-component-examples', getComponentExamplesTool);
62
+ }
63
+ /**
64
+ * Set up MCP request handlers
65
+ */
66
+ setupHandlers() {
67
+ // Handle list tools request
68
+ this.server.setRequestHandler(ListToolsRequestSchema, async () => {
69
+ const toolDefinitions = [
70
+ ListComponentsTool.getToolDefinition(),
71
+ GetComponentDocsTool.getToolDefinition(),
72
+ SearchComponentsTool.getToolDefinition(),
73
+ GetComponentInputsTool.getToolDefinition(),
74
+ GetComponentOutputsTool.getToolDefinition(),
75
+ GetComponentExamplesTool.getToolDefinition(),
76
+ ];
77
+ return {
78
+ tools: toolDefinitions,
79
+ };
80
+ });
81
+ // Handle call tool request
82
+ this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
83
+ const { name, arguments: args } = request.params;
84
+ try {
85
+ // Validate tool exists
86
+ const tool = this.tools.get(name);
87
+ if (!tool) {
88
+ return {
89
+ content: [
90
+ {
91
+ type: 'text',
92
+ text: JSON.stringify({
93
+ error: {
94
+ code: 'TOOL_NOT_FOUND',
95
+ message: `Tool '${name}' does not exist. Available tools: ${Array.from(this.tools.keys()).join(', ')}`,
96
+ },
97
+ }),
98
+ },
99
+ ],
100
+ isError: true,
101
+ };
102
+ }
103
+ // Validate parameters (basic check - tools will do detailed validation)
104
+ if (args === undefined || args === null) {
105
+ return {
106
+ content: [
107
+ {
108
+ type: 'text',
109
+ text: JSON.stringify({
110
+ error: {
111
+ code: 'INVALID_PARAMETERS',
112
+ message: 'Tool parameters are required',
113
+ },
114
+ }),
115
+ },
116
+ ],
117
+ isError: true,
118
+ };
119
+ }
120
+ // Execute tool
121
+ const result = tool.execute(args);
122
+ // Format response
123
+ return {
124
+ content: [
125
+ {
126
+ type: 'text',
127
+ text: JSON.stringify(result, null, 2),
128
+ },
129
+ ],
130
+ };
131
+ }
132
+ catch (error) {
133
+ // Handle errors gracefully
134
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
135
+ const errorCode = this.categorizeError(error);
136
+ return {
137
+ content: [
138
+ {
139
+ type: 'text',
140
+ text: JSON.stringify({
141
+ error: {
142
+ code: errorCode,
143
+ message: errorMessage,
144
+ },
145
+ }),
146
+ },
147
+ ],
148
+ isError: true,
149
+ };
150
+ }
151
+ });
152
+ }
153
+ /**
154
+ * Categorize errors for appropriate error codes
155
+ */
156
+ categorizeError(error) {
157
+ if (error instanceof Error) {
158
+ const message = error.message.toLowerCase();
159
+ if (message.includes('not found') || message.includes('does not exist')) {
160
+ return 'NOT_FOUND';
161
+ }
162
+ if (message.includes('invalid') ||
163
+ message.includes('must be') ||
164
+ message.includes('required')) {
165
+ return 'INVALID_PARAMETERS';
166
+ }
167
+ if (message.includes('limit') || message.includes('offset')) {
168
+ return 'INVALID_PARAMETERS';
169
+ }
170
+ }
171
+ return 'INTERNAL_ERROR';
172
+ }
173
+ /**
174
+ * Start the MCP server
175
+ */
176
+ async start() {
177
+ if (this.isRunning) {
178
+ throw new Error('Server is already running');
179
+ }
180
+ const transport = new StdioServerTransport();
181
+ await this.server.connect(transport);
182
+ this.isRunning = true;
183
+ }
184
+ /**
185
+ * Stop the MCP server
186
+ */
187
+ async stop() {
188
+ if (!this.isRunning) {
189
+ return;
190
+ }
191
+ await this.server.close();
192
+ this.isRunning = false;
193
+ }
194
+ /**
195
+ * Check if server is running
196
+ */
197
+ isHealthy() {
198
+ return this.isRunning;
199
+ }
200
+ /**
201
+ * Get server statistics
202
+ */
203
+ getStats() {
204
+ return {
205
+ isRunning: this.isRunning,
206
+ toolCount: this.tools.size,
207
+ indexStats: {
208
+ totalComponents: this.index.totalCount,
209
+ lastUpdated: this.index.lastUpdated,
210
+ },
211
+ };
212
+ }
213
+ /**
214
+ * Update the index (for hot reloading)
215
+ */
216
+ updateIndex(newIndex) {
217
+ this.index = newIndex;
218
+ this.query = new ComponentQuery(newIndex);
219
+ this.searchEngine = new SearchEngine(newIndex);
220
+ // Re-register tools with new index
221
+ this.registerTools();
222
+ }
223
+ }
224
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC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B;QAClC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;QAE/C,mCAAmC;QACnC,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Publishing module
3
+ *
4
+ * Provides utilities for npm package publishing, authentication validation,
5
+ * and error handling with credential sanitization.
6
+ */
7
+ export { validateNpmToken, sanitizeErrorMessage, isAuthenticationError, isVersionConflictError, extractVersionFromError, createAuthenticationErrorMessage, createVersionConflictErrorMessage, createPublishErrorMessage, } from './publish-utils';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publish/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Publishing module
3
+ *
4
+ * Provides utilities for npm package publishing, authentication validation,
5
+ * and error handling with credential sanitization.
6
+ */
7
+ export { validateNpmToken, sanitizeErrorMessage, isAuthenticationError, isVersionConflictError, extractVersionFromError, createAuthenticationErrorMessage, createVersionConflictErrorMessage, createPublishErrorMessage, } from './publish-utils';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/publish/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Publishing Utilities
3
+ *
4
+ * Provides functions for npm package publishing, authentication validation,
5
+ * and error handling with credential sanitization.
6
+ */
7
+ /**
8
+ * Validates that the NPM authentication token is set and non-empty.
9
+ *
10
+ * @param token - The NPM_TOKEN value from environment variables
11
+ * @returns true if token is valid, false otherwise
12
+ */
13
+ export declare function validateNpmToken(token: string | undefined): boolean;
14
+ /**
15
+ * Sanitizes error messages to remove any credential information.
16
+ *
17
+ * This function masks authentication tokens and other sensitive data
18
+ * that might appear in error messages or logs.
19
+ *
20
+ * @param message - The error message to sanitize
21
+ * @returns Sanitized error message with credentials masked
22
+ */
23
+ export declare function sanitizeErrorMessage(message: string): string;
24
+ /**
25
+ * Determines if an npm publish error is due to authentication failure.
26
+ *
27
+ * Checks error messages and status codes to identify authentication-related failures.
28
+ *
29
+ * @param error - The error object or message from npm publish
30
+ * @returns true if the error is authentication-related, false otherwise
31
+ */
32
+ export declare function isAuthenticationError(error: Error | string): boolean;
33
+ /**
34
+ * Determines if an npm publish error is due to a version conflict.
35
+ *
36
+ * Checks error messages and status codes to identify version conflict failures.
37
+ *
38
+ * @param error - The error object or message from npm publish
39
+ * @returns true if the error is a version conflict, false otherwise
40
+ */
41
+ export declare function isVersionConflictError(error: Error | string): boolean;
42
+ /**
43
+ * Creates a user-friendly error message for authentication failures.
44
+ *
45
+ * Provides actionable guidance without exposing credential values.
46
+ *
47
+ * @returns Formatted authentication error message
48
+ */
49
+ export declare function createAuthenticationErrorMessage(): string;
50
+ /**
51
+ * Extracts version number from a version conflict error message.
52
+ *
53
+ * Searches for semantic version patterns (MAJOR.MINOR.PATCH) in error messages
54
+ * to identify the conflicting version.
55
+ *
56
+ * @param error - The error object or message from npm publish
57
+ * @returns The extracted version string, or null if no version found
58
+ */
59
+ export declare function extractVersionFromError(error: Error | string): string | null;
60
+ /**
61
+ * Creates a user-friendly error message for version conflicts.
62
+ *
63
+ * @param version - The version that conflicts
64
+ * @returns Formatted version conflict error message
65
+ */
66
+ export declare function createVersionConflictErrorMessage(version: string): string;
67
+ /**
68
+ * Creates a generic error message for npm publish failures.
69
+ *
70
+ * @param error - The original error
71
+ * @returns Formatted error message with sanitized credentials
72
+ */
73
+ export declare function createPublishErrorMessage(error: Error | string): string;
74
+ //# sourceMappingURL=publish-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-utils.d.ts","sourceRoot":"","sources":["../../src/publish/publish-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAwBpE;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAerE;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,IAAI,MAAM,CAezD;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAc5E;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAazE;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAiBvE"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Publishing Utilities
3
+ *
4
+ * Provides functions for npm package publishing, authentication validation,
5
+ * and error handling with credential sanitization.
6
+ */
7
+ import { maskCredentials } from '../utils/credential-masking.js';
8
+ /**
9
+ * Validates that the NPM authentication token is set and non-empty.
10
+ *
11
+ * @param token - The NPM_TOKEN value from environment variables
12
+ * @returns true if token is valid, false otherwise
13
+ */
14
+ export function validateNpmToken(token) {
15
+ return typeof token === 'string' && token.trim().length > 0;
16
+ }
17
+ /**
18
+ * Sanitizes error messages to remove any credential information.
19
+ *
20
+ * This function masks authentication tokens and other sensitive data
21
+ * that might appear in error messages or logs.
22
+ *
23
+ * @param message - The error message to sanitize
24
+ * @returns Sanitized error message with credentials masked
25
+ */
26
+ export function sanitizeErrorMessage(message) {
27
+ // Use the centralized credential masking utility
28
+ return maskCredentials(message);
29
+ }
30
+ /**
31
+ * Determines if an npm publish error is due to authentication failure.
32
+ *
33
+ * Checks error messages and status codes to identify authentication-related failures.
34
+ *
35
+ * @param error - The error object or message from npm publish
36
+ * @returns true if the error is authentication-related, false otherwise
37
+ */
38
+ export function isAuthenticationError(error) {
39
+ const errorMessage = typeof error === 'string' ? error : error.message;
40
+ const lowerMessage = errorMessage.toLowerCase();
41
+ // Common authentication error patterns from npm
42
+ const authPatterns = [
43
+ 'authentication',
44
+ 'unauthorized',
45
+ '401',
46
+ 'forbidden',
47
+ '403',
48
+ 'token',
49
+ 'credentials',
50
+ 'login',
51
+ 'auth',
52
+ 'permission denied',
53
+ 'access denied',
54
+ 'not authorized',
55
+ 'authentication required',
56
+ 'invalid token',
57
+ 'expired token',
58
+ ];
59
+ return authPatterns.some(pattern => lowerMessage.includes(pattern));
60
+ }
61
+ /**
62
+ * Determines if an npm publish error is due to a version conflict.
63
+ *
64
+ * Checks error messages and status codes to identify version conflict failures.
65
+ *
66
+ * @param error - The error object or message from npm publish
67
+ * @returns true if the error is a version conflict, false otherwise
68
+ */
69
+ export function isVersionConflictError(error) {
70
+ const errorMessage = typeof error === 'string' ? error : error.message;
71
+ const lowerMessage = errorMessage.toLowerCase();
72
+ // Common version conflict error patterns from npm
73
+ const conflictPatterns = [
74
+ 'already exists',
75
+ 'cannot publish over',
76
+ 'already published',
77
+ 'version conflict',
78
+ 'duplicate version',
79
+ 'already in use',
80
+ ];
81
+ return conflictPatterns.some(pattern => lowerMessage.includes(pattern));
82
+ }
83
+ /**
84
+ * Creates a user-friendly error message for authentication failures.
85
+ *
86
+ * Provides actionable guidance without exposing credential values.
87
+ *
88
+ * @returns Formatted authentication error message
89
+ */
90
+ export function createAuthenticationErrorMessage() {
91
+ return [
92
+ 'ERROR: npm authentication failed',
93
+ '',
94
+ 'This could be due to:',
95
+ ' - Invalid or expired NPM_TOKEN',
96
+ ' - Insufficient permissions for the package',
97
+ ' - Token not configured in GitLab CI/CD variables',
98
+ '',
99
+ 'To resolve:',
100
+ ' 1. Verify NPM_TOKEN is set in GitLab CI/CD variables',
101
+ ' 2. Ensure the token has publish permissions',
102
+ ' 3. Check that the token has not expired',
103
+ ' 4. Verify you have ownership/maintainer access to the package',
104
+ ].join('\n');
105
+ }
106
+ /**
107
+ * Extracts version number from a version conflict error message.
108
+ *
109
+ * Searches for semantic version patterns (MAJOR.MINOR.PATCH) in error messages
110
+ * to identify the conflicting version.
111
+ *
112
+ * @param error - The error object or message from npm publish
113
+ * @returns The extracted version string, or null if no version found
114
+ */
115
+ export function extractVersionFromError(error) {
116
+ const errorMessage = typeof error === 'string' ? error : error.message;
117
+ // Match semantic version pattern: digits.digits.digits (with optional 'v' prefix)
118
+ // This regex matches versions like "1.2.3", "v1.2.3", "10.20.30", etc.
119
+ const versionPattern = /v?(\d+\.\d+\.\d+)/;
120
+ const match = errorMessage.match(versionPattern);
121
+ if (match) {
122
+ // Return the version without the 'v' prefix if present
123
+ return match[1];
124
+ }
125
+ return null;
126
+ }
127
+ /**
128
+ * Creates a user-friendly error message for version conflicts.
129
+ *
130
+ * @param version - The version that conflicts
131
+ * @returns Formatted version conflict error message
132
+ */
133
+ export function createVersionConflictErrorMessage(version) {
134
+ return [
135
+ `ERROR: Version ${version} has already been published to npm`,
136
+ '',
137
+ 'This could be due to:',
138
+ ' - The version was published in a previous release',
139
+ ' - Another pipeline published this version concurrently',
140
+ '',
141
+ 'To resolve:',
142
+ ' 1. Verify the current published version on npm',
143
+ ' 2. Bump to the next version using the appropriate release type',
144
+ ' 3. Ensure version tags are synchronized with npm',
145
+ ].join('\n');
146
+ }
147
+ /**
148
+ * Creates a generic error message for npm publish failures.
149
+ *
150
+ * @param error - The original error
151
+ * @returns Formatted error message with sanitized credentials
152
+ */
153
+ export function createPublishErrorMessage(error) {
154
+ const errorMessage = typeof error === 'string' ? error : error.message;
155
+ // Use centralized credential masking - no need to pass credentials explicitly
156
+ const sanitized = maskCredentials(errorMessage);
157
+ return [
158
+ 'ERROR: Failed to publish package to npm',
159
+ '',
160
+ 'Error details:',
161
+ ` ${sanitized}`,
162
+ '',
163
+ 'This could be due to:',
164
+ ' - Network connectivity issues',
165
+ ' - npm registry unavailable',
166
+ ' - Package validation errors',
167
+ ' - Insufficient permissions',
168
+ ].join('\n');
169
+ }
170
+ //# sourceMappingURL=publish-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-utils.js","sourceRoot":"","sources":["../../src/publish/publish-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAyB;IACxD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,iDAAiD;IACjD,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAqB;IACzD,MAAM,YAAY,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IACvE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MAAM,YAAY,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IAEvE,kFAAkF;IAClF,uEAAuE;IACvE,MAAM,cAAc,GAAG,mBAAmB,CAAC;IAC3C,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAEjD,IAAI,KAAK,EAAE,CAAC;QACV,uDAAuD;QACvD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAAC,OAAe;IAC/D,OAAO;QACL,kBAAkB,OAAO,oCAAoC;QAC7D,EAAE;QACF,uBAAuB;QACvB,qDAAqD;QACrD,0DAA0D;QAC1D,EAAE;QACF,aAAa;QACb,kDAAkD;QAClD,kEAAkE;QAClE,oDAAoD;KACrD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqB;IAC7D,MAAM,YAAY,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IACvE,8EAA8E;IAC9E,MAAM,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAEhD,OAAO;QACL,yCAAyC;QACzC,EAAE;QACF,gBAAgB;QAChB,KAAK,SAAS,EAAE;QAChB,EAAE;QACF,uBAAuB;QACvB,iCAAiC;QACjC,8BAA8B;QAC9B,+BAA+B;QAC/B,8BAA8B;KAC/B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * ComponentQuery - Handles component lookups by name and selector
3
+ */
4
+ import { ComponentIndex, IndexableDoc } from './index-builder.js';
5
+ /**
6
+ * ComponentQuery class
7
+ * Provides methods for querying components by name and selector
8
+ */
9
+ export declare class ComponentQuery {
10
+ private index;
11
+ constructor(index: ComponentIndex);
12
+ /**
13
+ * Get a component by name (case-sensitive)
14
+ */
15
+ getByName(name: string): IndexableDoc | undefined;
16
+ /**
17
+ * Get a component by selector (case-sensitive)
18
+ */
19
+ getBySelector(selector: string): IndexableDoc | undefined;
20
+ /**
21
+ * Get all components of a specific type
22
+ */
23
+ getByType(type: 'component' | 'directive' | 'pipe' | 'service' | 'all'): IndexableDoc[];
24
+ /**
25
+ * Get all components, optionally filtering deprecated ones
26
+ */
27
+ getAll(includeDeprecated?: boolean): IndexableDoc[];
28
+ /**
29
+ * Update the index
30
+ */
31
+ updateIndex(index: ComponentIndex): void;
32
+ }
33
+ //# sourceMappingURL=component-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-query.d.ts","sourceRoot":"","sources":["../../src/query/component-query.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElE;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAiB;gBAElB,KAAK,EAAE,cAAc;IAIjC;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIjD;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIzD;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,YAAY,EAAE;IAsBvF;;OAEG;IACH,MAAM,CAAC,iBAAiB,GAAE,OAAe,GAAG,YAAY,EAAE;IAQ1D;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;CAGzC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * ComponentQuery class
3
+ * Provides methods for querying components by name and selector
4
+ */
5
+ export class ComponentQuery {
6
+ index;
7
+ constructor(index) {
8
+ this.index = index;
9
+ }
10
+ /**
11
+ * Get a component by name (case-sensitive)
12
+ */
13
+ getByName(name) {
14
+ return this.index.byName.get(name);
15
+ }
16
+ /**
17
+ * Get a component by selector (case-sensitive)
18
+ */
19
+ getBySelector(selector) {
20
+ return this.index.bySelector.get(selector);
21
+ }
22
+ /**
23
+ * Get all components of a specific type
24
+ */
25
+ getByType(type) {
26
+ switch (type) {
27
+ case 'component':
28
+ return this.index.components;
29
+ case 'directive':
30
+ return this.index.directives;
31
+ case 'pipe':
32
+ return this.index.pipes;
33
+ case 'service':
34
+ return this.index.services;
35
+ case 'all':
36
+ return [
37
+ ...this.index.components,
38
+ ...this.index.directives,
39
+ ...this.index.pipes,
40
+ ...this.index.services,
41
+ ];
42
+ default:
43
+ return [];
44
+ }
45
+ }
46
+ /**
47
+ * Get all components, optionally filtering deprecated ones
48
+ */
49
+ getAll(includeDeprecated = false) {
50
+ const all = this.getByType('all');
51
+ if (includeDeprecated) {
52
+ return all;
53
+ }
54
+ return all.filter((doc) => !doc.deprecated);
55
+ }
56
+ /**
57
+ * Update the index
58
+ */
59
+ updateIndex(index) {
60
+ this.index = index;
61
+ }
62
+ }
63
+ //# sourceMappingURL=component-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-query.js","sourceRoot":"","sources":["../../src/query/component-query.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,OAAO,cAAc;IACjB,KAAK,CAAiB;IAE9B,YAAY,KAAqB;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,QAAgB;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,C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