0xray 2.1.1 → 2.1.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 (254) hide show
  1. package/.opencode/codex.codex +1 -1
  2. package/.opencode/commands/dependency-audit.md +3 -3
  3. package/.opencode/enforcer-config.json +2 -2
  4. package/AGENTS.md +3 -2
  5. package/README.md +12 -11
  6. package/dist/AGENTS.md +3 -2
  7. package/dist/CHANGELOG.md +26 -0
  8. package/dist/README.md +12 -11
  9. package/dist/agents/code-reviewer.js +1 -1
  10. package/dist/analytics/routing-refiner.js +1 -1
  11. package/dist/cli/index.js +11 -1
  12. package/dist/cli/server.js +3 -3
  13. package/dist/core/activity-logger.d.ts +2 -2
  14. package/dist/core/activity-logger.js +4 -4
  15. package/dist/core/boot-orchestrator.d.ts +1 -1
  16. package/dist/core/boot-orchestrator.js +13 -28
  17. package/dist/core/bridge.mjs +3 -3
  18. package/dist/core/codex-formatter.js +2 -2
  19. package/dist/core/codex-injector.d.ts +0 -1
  20. package/dist/core/codex-injector.js +2 -3
  21. package/dist/core/config-loader.d.ts +1 -1
  22. package/dist/core/config-loader.js +1 -1
  23. package/dist/core/config-paths.d.ts +0 -2
  24. package/dist/core/config-paths.js +7 -8
  25. package/dist/core/context-loader.d.ts +1 -1
  26. package/dist/core/context-loader.js +1 -1
  27. package/dist/core/errors.d.ts +3 -0
  28. package/dist/core/errors.js +10 -0
  29. package/dist/core/features-config.js +1 -1
  30. package/dist/core/framework-logger.d.ts +3 -3
  31. package/dist/core/framework-logger.js +17 -9
  32. package/dist/core/index.d.ts +2 -2
  33. package/dist/core/index.js +4 -2
  34. package/dist/core/logging-config.d.ts +2 -1
  35. package/dist/core/logging-config.js +7 -7
  36. package/dist/enforcement/loaders/codex-loader.js +1 -1
  37. package/dist/execution/opencode-cli-invoker.js +5 -5
  38. package/dist/governance/governance-service.js +1 -1
  39. package/dist/index.d.ts +3 -3
  40. package/dist/index.js +3 -3
  41. package/dist/inference/inference-cycle.d.ts +1 -1
  42. package/dist/inference/inference-cycle.js +10 -10
  43. package/dist/integrations/base/Integration.js +1 -1
  44. package/dist/integrations/base/registry.js +19 -19
  45. package/dist/integrations/grok/grok-cli.js +17 -17
  46. package/dist/integrations/grok/hooks/pre-tool-use.js +1 -1
  47. package/dist/integrations/hermes-agent/bridge.mjs +1 -1
  48. package/dist/integrations/openclaw/api-server.d.ts +0 -1
  49. package/dist/integrations/openclaw/api-server.js +7 -10
  50. package/dist/integrations/openclaw/client.d.ts +0 -1
  51. package/dist/integrations/openclaw/client.js +22 -24
  52. package/dist/integrations/openclaw/hooks/xray-hooks.d.ts +0 -1
  53. package/dist/integrations/openclaw/hooks/xray-hooks.js +17 -18
  54. package/dist/integrations/plugins/plugin-registry.js +5 -5
  55. package/dist/mcps/architect-tools.server.d.ts +2 -4
  56. package/dist/mcps/architect-tools.server.js +112 -195
  57. package/dist/mcps/auto-format.server.d.ts +2 -4
  58. package/dist/mcps/auto-format.server.js +49 -95
  59. package/dist/mcps/boot-orchestrator.server.d.ts +2 -4
  60. package/dist/mcps/boot-orchestrator.server.js +73 -105
  61. package/dist/mcps/config/server-config-registry.js +3 -3
  62. package/dist/mcps/enforcer-tools.server.d.ts +2 -4
  63. package/dist/mcps/enforcer-tools.server.js +202 -285
  64. package/dist/mcps/estimation.server.d.ts +2 -4
  65. package/dist/mcps/estimation.server.js +63 -107
  66. package/dist/mcps/framework-compliance-audit.server.d.ts +2 -4
  67. package/dist/mcps/framework-compliance-audit.server.js +53 -82
  68. package/dist/mcps/framework-help.server.d.ts +2 -4
  69. package/dist/mcps/framework-help.server.js +63 -101
  70. package/dist/mcps/governance.server.js +2 -2
  71. package/dist/mcps/knowledge-skills/api-design.server.d.ts +2 -4
  72. package/dist/mcps/knowledge-skills/api-design.server.js +35 -67
  73. package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +2 -10
  74. package/dist/mcps/knowledge-skills/architecture-patterns.server.js +35 -74
  75. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.d.ts +2 -4
  76. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +143 -162
  77. package/dist/mcps/knowledge-skills/code-analyzer.server.d.ts +3 -4
  78. package/dist/mcps/knowledge-skills/code-analyzer.server.js +20 -45
  79. package/dist/mcps/knowledge-skills/code-review.server.d.ts +2 -4
  80. package/dist/mcps/knowledge-skills/code-review.server.js +109 -143
  81. package/dist/mcps/knowledge-skills/content-creator.server.d.ts +2 -4
  82. package/dist/mcps/knowledge-skills/content-creator.server.js +205 -226
  83. package/dist/mcps/knowledge-skills/database-design.server.d.ts +2 -4
  84. package/dist/mcps/knowledge-skills/database-design.server.js +117 -151
  85. package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +2 -4
  86. package/dist/mcps/knowledge-skills/devops-deployment.server.js +71 -160
  87. package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +2 -4
  88. package/dist/mcps/knowledge-skills/git-workflow.server.js +36 -68
  89. package/dist/mcps/knowledge-skills/growth-strategist.server.d.ts +2 -4
  90. package/dist/mcps/knowledge-skills/growth-strategist.server.js +303 -324
  91. package/dist/mcps/knowledge-skills/log-monitor.server.d.ts +2 -4
  92. package/dist/mcps/knowledge-skills/log-monitor.server.js +141 -160
  93. package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +2 -4
  94. package/dist/mcps/knowledge-skills/mobile-development.server.js +92 -209
  95. package/dist/mcps/knowledge-skills/multimodal-looker.server.d.ts +2 -4
  96. package/dist/mcps/knowledge-skills/multimodal-looker.server.js +123 -159
  97. package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +2 -5
  98. package/dist/mcps/knowledge-skills/performance-optimization.server.js +155 -296
  99. package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +2 -4
  100. package/dist/mcps/knowledge-skills/project-analysis.server.js +75 -226
  101. package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +2 -4
  102. package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +63 -156
  103. package/dist/mcps/knowledge-skills/security-audit.server.d.ts +2 -4
  104. package/dist/mcps/knowledge-skills/security-audit.server.js +102 -136
  105. package/dist/mcps/knowledge-skills/seo-consultant.server.d.ts +2 -4
  106. package/dist/mcps/knowledge-skills/seo-consultant.server.js +80 -203
  107. package/dist/mcps/knowledge-skills/session-management.server.d.ts +2 -4
  108. package/dist/mcps/knowledge-skills/session-management.server.js +50 -203
  109. package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +2 -4
  110. package/dist/mcps/knowledge-skills/skill-invocation.server.js +168 -347
  111. package/dist/mcps/knowledge-skills/strategist.server.d.ts +2 -11
  112. package/dist/mcps/knowledge-skills/strategist.server.js +72 -122
  113. package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +2 -4
  114. package/dist/mcps/knowledge-skills/tech-writer.server.js +87 -300
  115. package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +2 -4
  116. package/dist/mcps/knowledge-skills/testing-best-practices.server.js +147 -182
  117. package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +2 -4
  118. package/dist/mcps/knowledge-skills/testing-strategy.server.js +78 -153
  119. package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +2 -5
  120. package/dist/mcps/knowledge-skills/ui-ux-design.server.js +90 -399
  121. package/dist/mcps/lint.server.d.ts +2 -4
  122. package/dist/mcps/lint.server.js +51 -92
  123. package/dist/mcps/mcp-client.js +2 -2
  124. package/dist/mcps/model-health-check.server.d.ts +2 -4
  125. package/dist/mcps/model-health-check.server.js +32 -60
  126. package/dist/mcps/performance-analysis.server.d.ts +2 -4
  127. package/dist/mcps/performance-analysis.server.js +57 -88
  128. package/dist/mcps/processor-pipeline.server.d.ts +2 -4
  129. package/dist/mcps/processor-pipeline.server.js +69 -100
  130. package/dist/mcps/registry.json +1 -1
  131. package/dist/mcps/researcher.server.d.ts +3 -5
  132. package/dist/mcps/researcher.server.js +81 -154
  133. package/dist/mcps/security-scan.server.d.ts +2 -4
  134. package/dist/mcps/security-scan.server.js +54 -96
  135. package/dist/mcps/shared/knowledge-skill-base.d.ts +14 -0
  136. package/dist/mcps/shared/knowledge-skill-base.js +45 -0
  137. package/dist/{security → mcps/shared}/security-scanner.js +1 -1
  138. package/dist/mcps/state-manager.server.d.ts +2 -4
  139. package/dist/mcps/state-manager.server.js +115 -160
  140. package/dist/orchestrator/orchestrator.d.ts +1 -1
  141. package/dist/orchestrator/orchestrator.js +1 -1
  142. package/dist/orchestrator/universal-registry-bridge.js +1 -1
  143. package/dist/plugin/xray-codex-injection.d.ts +1 -1
  144. package/dist/plugin/xray-codex-injection.js +1 -1
  145. package/dist/postprocessor/PostProcessor.d.ts +4 -44
  146. package/dist/postprocessor/PostProcessor.js +39 -553
  147. package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +11 -0
  148. package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
  149. package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.d.ts +11 -0
  150. package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.js +356 -0
  151. package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +44 -0
  152. package/dist/postprocessor/config/ProcessorConfigLoader.js +21 -0
  153. package/dist/postprocessor/reporting/PostProcessorReporter.d.ts +19 -0
  154. package/dist/postprocessor/reporting/PostProcessorReporter.js +96 -0
  155. package/dist/postprocessor/triggers/GitHookTrigger.js +11 -11
  156. package/dist/processors/implementations/refactoring-logging-processor-wrapper.d.ts +32 -0
  157. package/dist/processors/implementations/refactoring-logging-processor-wrapper.js +95 -1
  158. package/dist/processors/processor-manager.js +346 -314
  159. package/dist/reporting/report-formatter.js +1 -1
  160. package/dist/security/security-hardener.d.ts +69 -2
  161. package/dist/security/security-hardener.js +129 -1
  162. package/dist/skills/registry.json +1 -1
  163. package/dist/state/index.d.ts +3 -5
  164. package/dist/state/index.js +1 -7
  165. package/dist/state/state-manager.d.ts +1 -1
  166. package/dist/state/state-manager.js +2 -3
  167. package/package.json +14 -10
  168. package/scripts/node/setup.cjs +32 -0
  169. package/scripts/node/universal-version-manager.js +11 -11
  170. package/src/mcps/architect-tools.server.ts +112 -215
  171. package/src/mcps/auto-format.server.ts +50 -110
  172. package/src/mcps/boot-orchestrator.server.ts +75 -121
  173. package/src/mcps/config/__tests__/server-config-registry.test.ts +21 -12
  174. package/src/mcps/config/server-config-registry.ts +3 -3
  175. package/src/mcps/enforcer-tools.server.ts +212 -310
  176. package/src/mcps/estimation.server.ts +62 -122
  177. package/src/mcps/framework-compliance-audit.server.ts +52 -97
  178. package/src/mcps/framework-help.server.ts +64 -114
  179. package/src/mcps/governance.server.ts +2 -2
  180. package/src/mcps/knowledge-skills/api-design.server.ts +32 -77
  181. package/src/mcps/knowledge-skills/architecture-patterns.server.ts +31 -87
  182. package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +165 -193
  183. package/src/mcps/knowledge-skills/code-analyzer.server.ts +20 -55
  184. package/src/mcps/knowledge-skills/code-review.server.ts +114 -161
  185. package/src/mcps/knowledge-skills/content-creator.server.ts +218 -255
  186. package/src/mcps/knowledge-skills/database-design.server.ts +118 -165
  187. package/src/mcps/knowledge-skills/devops-deployment.server.ts +67 -172
  188. package/src/mcps/knowledge-skills/git-workflow.server.ts +32 -77
  189. package/src/mcps/knowledge-skills/growth-strategist.server.ts +324 -361
  190. package/src/mcps/knowledge-skills/log-monitor.server.ts +160 -187
  191. package/src/mcps/knowledge-skills/mobile-development.server.ts +89 -223
  192. package/src/mcps/knowledge-skills/multimodal-looker.server.ts +128 -175
  193. package/src/mcps/knowledge-skills/performance-optimization.server.ts +156 -329
  194. package/src/mcps/knowledge-skills/project-analysis.server.ts +72 -248
  195. package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +59 -171
  196. package/src/mcps/knowledge-skills/security-audit.server.ts +104 -151
  197. package/src/mcps/knowledge-skills/seo-consultant.server.ts +80 -220
  198. package/src/mcps/knowledge-skills/session-management.server.ts +51 -232
  199. package/src/mcps/knowledge-skills/skill-invocation.server.ts +165 -372
  200. package/src/mcps/knowledge-skills/strategist.server.ts +72 -143
  201. package/src/mcps/knowledge-skills/tech-writer.server.ts +85 -350
  202. package/src/mcps/knowledge-skills/testing-best-practices.server.ts +146 -195
  203. package/src/mcps/knowledge-skills/testing-strategy.server.ts +75 -161
  204. package/src/mcps/knowledge-skills/ui-ux-design.server.ts +93 -487
  205. package/src/mcps/lint.server.ts +53 -107
  206. package/src/mcps/mcp-client.ts +2 -2
  207. package/src/mcps/model-health-check.server.ts +34 -71
  208. package/src/mcps/performance-analysis.server.ts +60 -104
  209. package/src/mcps/processor-pipeline.server.ts +72 -110
  210. package/src/mcps/registry.json +1 -1
  211. package/src/mcps/researcher.server.ts +88 -177
  212. package/src/mcps/security-scan.server.ts +55 -104
  213. package/src/mcps/shared/knowledge-skill-base.ts +62 -0
  214. package/src/mcps/shared/prompt-security-validator.ts +199 -0
  215. package/src/mcps/shared/security-scanner.ts +599 -0
  216. package/src/mcps/state-manager.server.ts +117 -175
  217. package/src/opencode/codex.codex +1 -1
  218. package/src/opencode/commands/dependency-audit.md +3 -3
  219. package/src/opencode/enforcer-config.json +2 -2
  220. package/src/skills/registry.json +1 -1
  221. package/xray/agents_template.md +109 -0
  222. package/xray/codex.json +598 -0
  223. package/xray/config.json +26 -0
  224. package/xray/features.json +132 -0
  225. package/xray/integrations.json +23 -0
  226. package/xray/routing-mappings.json +752 -0
  227. package/xray/workflow_state.json +28 -0
  228. package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
  229. package/dist/integrations/hermes-agent/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
  230. package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
  231. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313-pytest-9.0.2.pyc +0 -0
  232. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313.pyc +0 -0
  233. package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
  234. package/dist/integrations/hermes-agent/conftest.py +0 -14
  235. package/dist/integrations/hermes-agent/test_plugin.py +0 -1103
  236. package/dist/processors/implementations/refactoring-logging-processor.d.ts +0 -31
  237. package/dist/processors/implementations/refactoring-logging-processor.js +0 -96
  238. package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
  239. package/dist/processors/implementations/session-capture-processor.js +0 -37
  240. package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
  241. package/dist/scripts/activate-kernel-pipeline.js +0 -101
  242. package/dist/security/index.d.ts +0 -13
  243. package/dist/security/index.js +0 -13
  244. package/dist/security/security-agent-coordinator.d.ts +0 -72
  245. package/dist/security/security-agent-coordinator.js +0 -204
  246. package/dist/security/security-auditor.d.ts +0 -56
  247. package/dist/security/security-auditor.js +0 -584
  248. package/dist/security/security-hardening-system.d.ts +0 -239
  249. package/dist/security/security-hardening-system.js +0 -727
  250. package/dist/security/security-orchestration-layer.d.ts +0 -119
  251. package/dist/security/security-orchestration-layer.js +0 -496
  252. /package/dist/{security → mcps/shared}/prompt-security-validator.d.ts +0 -0
  253. /package/dist/{security → mcps/shared}/prompt-security-validator.js +0 -0
  254. /package/dist/{security → mcps/shared}/security-scanner.d.ts +0 -0
@@ -5,13 +5,7 @@
5
5
  * component patterns, accessibility compliance, and design system guidance
6
6
  */
7
7
 
8
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
10
- import {
11
- CallToolRequestSchema,
12
- ListToolsRequestSchema,
13
- type CallToolResult,
14
- } from "@modelcontextprotocol/sdk/types.js";
8
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
15
9
  import { frameworkLogger } from "../../core/framework-logger.js";
16
10
 
17
11
  interface UIDesignAnalysis {
@@ -131,12 +125,6 @@ interface AnalyzeVisualHierarchyArgs {
131
125
  pageType?: string;
132
126
  }
133
127
 
134
- interface RecommendImagesArgs {
135
- context: string;
136
- style?: string;
137
- budget?: string;
138
- }
139
-
140
128
  interface ComponentDesign {
141
129
  componentType: string;
142
130
  requirements: string;
@@ -168,279 +156,112 @@ interface HierarchyIssue {
168
156
  message: string;
169
157
  }
170
158
 
171
- interface ImageLibrary {
172
- name: string;
173
- url: string;
174
- description: string;
175
- }
176
-
177
- interface ImageRecommendations {
178
- libraries: ImageLibrary[];
179
- tips: string[];
180
- style: string;
181
- }
182
-
183
159
  interface ToolResponse {
184
160
  content: Array<{ type: "text"; text: string }>;
185
161
  data?: unknown;
186
162
  isError?: boolean;
187
163
  }
188
164
 
189
- class XrayUIUXDesignServer {
190
- private server: Server;
191
-
165
+ class XrayUIUXDesignServer extends XrayKnowledgeSkillBase {
192
166
  constructor() {
193
- this.server = new Server(
167
+ super("ui-ux-design", "2.0.1");
168
+ this.tools = [
194
169
  {
195
- name: "ui-ux-design", version: "2.0.1",
170
+ name: "analyze_ui_component",
171
+ description:
172
+ "Analyze UI component for accessibility, usability, and design best practices",
173
+ inputSchema: {
174
+ type: "object",
175
+ properties: {
176
+ componentCode: { type: "string", description: "React/Vue/Angular component code to analyze" },
177
+ framework: { type: "string", enum: ["react", "vue", "angular", "svelte"], description: "UI framework being used" },
178
+ checkAccessibility: { type: "boolean", description: "Include WCAG accessibility analysis", default: true },
179
+ checkResponsive: { type: "boolean", description: "Include responsive design analysis", default: true },
180
+ },
181
+ required: ["componentCode", "framework"],
182
+ },
196
183
  },
197
184
  {
198
- capabilities: {
199
- tools: {},
185
+ name: "design_component",
186
+ description:
187
+ "Design a UI component with proper accessibility and UX patterns",
188
+ inputSchema: {
189
+ type: "object",
190
+ properties: {
191
+ componentType: { type: "string", enum: ["button", "input", "modal", "navigation", "card", "form"], description: "Type of component to design" },
192
+ requirements: { type: "string", description: "Functional requirements and use cases" },
193
+ framework: { type: "string", enum: ["react", "vue", "angular", "svelte"], description: "Target UI framework" },
194
+ accessibility: { type: "boolean", description: "Include accessibility features", default: true },
195
+ },
196
+ required: ["componentType", "requirements", "framework"],
200
197
  },
201
198
  },
202
- );
203
-
204
- this.setupToolHandlers();
205
- // Server initialization - removed unnecessary startup logging
206
- }
207
-
208
- private setupToolHandlers() {
209
- this.server.setRequestHandler(ListToolsRequestSchema, async () => {
210
- return {
211
- tools: [
212
- {
213
- name: "analyze_ui_component",
214
- description:
215
- "Analyze UI component for accessibility, usability, and design best practices",
216
- inputSchema: {
217
- type: "object",
218
- properties: {
219
- componentCode: {
220
- type: "string",
221
- description: "React/Vue/Angular component code to analyze",
222
- },
223
- framework: {
224
- type: "string",
225
- enum: ["react", "vue", "angular", "svelte"],
226
- description: "UI framework being used",
227
- },
228
- checkAccessibility: {
229
- type: "boolean",
230
- description: "Include WCAG accessibility analysis",
231
- default: true,
232
- },
233
- checkResponsive: {
234
- type: "boolean",
235
- description: "Include responsive design analysis",
236
- default: true,
237
- },
238
- },
239
- required: ["componentCode", "framework"],
240
- },
241
- },
242
- {
243
- name: "design_component",
244
- description:
245
- "Design a UI component with proper accessibility and UX patterns",
246
- inputSchema: {
247
- type: "object",
248
- properties: {
249
- componentType: {
250
- type: "string",
251
- enum: [
252
- "button",
253
- "input",
254
- "modal",
255
- "navigation",
256
- "card",
257
- "form",
258
- ],
259
- description: "Type of component to design",
260
- },
261
- requirements: {
262
- type: "string",
263
- description: "Functional requirements and use cases",
264
- },
265
- framework: {
266
- type: "string",
267
- enum: ["react", "vue", "angular", "svelte"],
268
- description: "Target UI framework",
269
- },
270
- accessibility: {
271
- type: "boolean",
272
- description: "Include accessibility features",
273
- default: true,
274
- },
275
- },
276
- required: ["componentType", "requirements", "framework"],
277
- },
278
- },
279
- {
280
- name: "audit_accessibility",
281
- description:
282
- "Perform comprehensive accessibility audit using WCAG guidelines",
283
- inputSchema: {
284
- type: "object",
285
- properties: {
286
- htmlContent: {
287
- type: "string",
288
- description: "HTML content to audit for accessibility",
289
- },
290
- cssContent: {
291
- type: "string",
292
- description: "CSS styles to check for accessibility",
293
- },
294
- wcagLevel: {
295
- type: "string",
296
- enum: ["A", "AA", "AAA"],
297
- description: "WCAG conformance level to check",
298
- default: "AA",
299
- },
300
- },
301
- required: ["htmlContent"],
302
- },
303
- },
304
- {
305
- name: "generate_design_system",
306
- description:
307
- "Generate a comprehensive design system with colors, typography, and components",
308
- inputSchema: {
309
- type: "object",
310
- properties: {
311
- brandGuidelines: {
312
- type: "string",
313
- description: "Brand colors, fonts, and style guidelines",
314
- },
315
- targetAudience: {
316
- type: "string",
317
- description: "Target user demographics and preferences",
318
- },
319
- platform: {
320
- type: "string",
321
- enum: ["web", "mobile", "desktop"],
322
- description: "Target platform",
323
- },
324
- includeAccessibility: {
325
- type: "boolean",
326
- description: "Include accessibility-compliant design tokens",
327
- default: true,
328
- },
329
- },
330
- required: ["brandGuidelines", "platform"],
331
- },
199
+ {
200
+ name: "audit_accessibility",
201
+ description:
202
+ "Perform comprehensive accessibility audit using WCAG guidelines",
203
+ inputSchema: {
204
+ type: "object",
205
+ properties: {
206
+ htmlContent: { type: "string", description: "HTML content to audit for accessibility" },
207
+ cssContent: { type: "string", description: "CSS styles to check for accessibility" },
208
+ wcagLevel: { type: "string", enum: ["A", "AA", "AAA"], description: "WCAG conformance level to check", default: "AA" },
332
209
  },
333
- {
334
- name: "validate_mobile_design",
335
- description:
336
- "Validate mobile-first design principles including touch targets, responsive typography, and thumb zone optimization",
337
- inputSchema: {
338
- type: "object",
339
- properties: {
340
- componentCode: {
341
- type: "string",
342
- description: "Component code to validate for mobile",
343
- },
344
- viewportWidth: {
345
- type: "number",
346
- description:
347
- "Minimum viewport width to validate (default: 320)",
348
- default: 320,
349
- },
350
- framework: {
351
- type: "string",
352
- enum: ["react", "vue", "angular", "svelte", "css"],
353
- description: "UI framework or CSS",
354
- },
355
- },
356
- required: ["componentCode"],
357
- },
210
+ required: ["htmlContent"],
211
+ },
212
+ },
213
+ {
214
+ name: "generate_design_system",
215
+ description:
216
+ "Generate a comprehensive design system with colors, typography, and components",
217
+ inputSchema: {
218
+ type: "object",
219
+ properties: {
220
+ brandGuidelines: { type: "string", description: "Brand colors, fonts, and style guidelines" },
221
+ targetAudience: { type: "string", description: "Target user demographics and preferences" },
222
+ platform: { type: "string", enum: ["web", "mobile", "desktop"], description: "Target platform" },
223
+ includeAccessibility: { type: "boolean", description: "Include accessibility-compliant design tokens", default: true },
358
224
  },
359
- {
360
- name: "analyze_visual_hierarchy",
361
- description:
362
- "Analyze visual hierarchy and cognitive load following 'Don't Make Me Think' principles",
363
- inputSchema: {
364
- type: "object",
365
- properties: {
366
- designCode: {
367
- type: "string",
368
- description: "HTML/CSS/React code of the design to analyze",
369
- },
370
- pageType: {
371
- type: "string",
372
- enum: [
373
- "landing",
374
- "dashboard",
375
- "form",
376
- "content",
377
- "ecommerce",
378
- ],
379
- description: "Type of page being analyzed",
380
- },
381
- },
382
- required: ["designCode"],
383
- },
225
+ required: ["brandGuidelines", "platform"],
226
+ },
227
+ },
228
+ {
229
+ name: "validate_mobile_design",
230
+ description:
231
+ "Validate mobile-first design principles including touch targets, responsive typography, and thumb zone optimization",
232
+ inputSchema: {
233
+ type: "object",
234
+ properties: {
235
+ componentCode: { type: "string", description: "Component code to validate for mobile" },
236
+ viewportWidth: { type: "number", description: "Minimum viewport width to validate (default: 320)", default: 320 },
237
+ framework: { type: "string", enum: ["react", "vue", "angular", "svelte", "css"], description: "UI framework or CSS" },
384
238
  },
385
- {
386
- name: "recommend_images",
387
- description:
388
- "Recommend appropriate image libraries, styles, and optimization strategies for the design context",
389
- inputSchema: {
390
- type: "object",
391
- properties: {
392
- context: {
393
- type: "string",
394
- description:
395
- "Design context (e.g., 'hero section', 'product gallery', 'team portraits')",
396
- },
397
- style: {
398
- type: "string",
399
- enum: [
400
- "photography",
401
- "illustration",
402
- "3d",
403
- "abstract",
404
- "minimal",
405
- ],
406
- description: "Preferred visual style",
407
- },
408
- budget: {
409
- type: "string",
410
- enum: ["free", "low", "premium"],
411
- description: "Budget constraint",
412
- default: "free",
413
- },
414
- },
415
- required: ["context"],
416
- },
239
+ required: ["componentCode"],
240
+ },
241
+ },
242
+ {
243
+ name: "analyze_visual_hierarchy",
244
+ description:
245
+ "Analyze visual hierarchy and cognitive load following 'Don't Make Me Think' principles",
246
+ inputSchema: {
247
+ type: "object",
248
+ properties: {
249
+ designCode: { type: "string", description: "HTML/CSS/React code of the design to analyze" },
250
+ pageType: { type: "string", enum: ["landing", "dashboard", "form", "content", "ecommerce"], description: "Type of page being analyzed" },
417
251
  },
418
- ],
419
- };
420
- });
421
-
422
- this.server.setRequestHandler(CallToolRequestSchema, async (request): Promise<CallToolResult> => {
423
- const { name, arguments: args } = request.params;
424
-
425
- switch (name) {
426
- case "analyze_ui_component":
427
- return await this.analyzeUIComponent(args as unknown as AnalyzeUIComponentArgs) as CallToolResult;
428
- case "design_component":
429
- return await this.designComponent(args as unknown as DesignComponentArgs) as CallToolResult;
430
- case "audit_accessibility":
431
- return await this.auditAccessibility(args as unknown as AuditAccessibilityArgs) as CallToolResult;
432
- case "generate_design_system":
433
- return await this.generateDesignSystem(args as unknown as GenerateDesignSystemArgs) as CallToolResult;
434
- case "validate_mobile_design":
435
- return await this.validateMobileDesign(args as unknown as ValidateMobileDesignArgs) as CallToolResult;
436
- case "analyze_visual_hierarchy":
437
- return await this.analyzeVisualHierarchy(args as unknown as AnalyzeVisualHierarchyArgs) as CallToolResult;
438
- case "recommend_images":
439
- return await this.recommendImages(args as unknown as RecommendImagesArgs) as CallToolResult;
440
- default:
441
- throw new Error(`Unknown tool: ${name}`);
442
- }
443
- });
252
+ required: ["designCode"],
253
+ },
254
+ },
255
+ ];
256
+ this.handlers = {
257
+ "analyze_ui_component": async (args) => this.analyzeUIComponent(args as unknown as AnalyzeUIComponentArgs),
258
+ "design_component": async (args) => this.designComponent(args as unknown as DesignComponentArgs),
259
+ "audit_accessibility": async (args) => this.auditAccessibility(args as unknown as AuditAccessibilityArgs),
260
+ "generate_design_system": async (args) => this.generateDesignSystem(args as unknown as GenerateDesignSystemArgs),
261
+ "validate_mobile_design": async (args) => this.validateMobileDesign(args as unknown as ValidateMobileDesignArgs),
262
+ "analyze_visual_hierarchy": async (args) => this.analyzeVisualHierarchy(args as unknown as AnalyzeVisualHierarchyArgs),
263
+ };
264
+ this.setupToolHandlers();
444
265
  }
445
266
 
446
267
  private async analyzeUIComponent(args: AnalyzeUIComponentArgs): Promise<ToolResponse> {
@@ -1796,13 +1617,9 @@ Available: ${Object.keys(system.components).length} component types
1796
1617
  const { designCode, pageType = "landing" } = args;
1797
1618
 
1798
1619
  const issues: HierarchyIssue[] = [];
1799
- const cognitiveLoadScore = 100;
1800
- const recommendations: string[] = [];
1801
1620
 
1802
- // Check heading hierarchy
1803
1621
  const h1Count = (designCode.match(/<h1/gi) || []).length;
1804
1622
  const h2Count = (designCode.match(/<h2/gi) || []).length;
1805
- const h3Count = (designCode.match(/<h3/gi) || []).length;
1806
1623
 
1807
1624
  if (h1Count === 0) {
1808
1625
  issues.push({
@@ -1818,15 +1635,6 @@ Available: ${Object.keys(system.components).length} component types
1818
1635
  });
1819
1636
  }
1820
1637
 
1821
- if (h2Count > 7) {
1822
- recommendations.push(
1823
- "Consider reducing number of H2 sections (current: " +
1824
- h2Count +
1825
- ") - may overwhelm users",
1826
- );
1827
- }
1828
-
1829
- // Check for clear CTAs
1830
1638
  const ctaPatterns = [
1831
1639
  /class="[^"]*cta[^"]*"/i,
1832
1640
  /class="[^"]*button[^"]*"/i,
@@ -1842,18 +1650,6 @@ Available: ${Object.keys(system.components).length} component types
1842
1650
  });
1843
1651
  }
1844
1652
 
1845
- // Check for progressive disclosure (accordions, tabs, etc.)
1846
- const hasProgressiveDisclosure =
1847
- designCode.includes("accordion") ||
1848
- designCode.includes("tab") ||
1849
- designCode.includes("collapsible");
1850
- if (!hasProgressiveDisclosure && designCode.length > 5000) {
1851
- recommendations.push(
1852
- "Consider progressive disclosure (accordions/tabs) to reduce cognitive load",
1853
- );
1854
- }
1855
-
1856
- // Check for "Don't Make Me Think" violations
1857
1653
  const unclearLabels = [/click here/i, /read more/i, /learn more$/i];
1858
1654
  unclearLabels.forEach((pattern) => {
1859
1655
  if (pattern.test(designCode)) {
@@ -1869,208 +1665,18 @@ Available: ${Object.keys(system.components).length} component types
1869
1665
  content: [
1870
1666
  {
1871
1667
  type: "text",
1872
- text: `## Visual Hierarchy & Cognitive Load Analysis\n\n### "Don't Make Me Think" Score: ${Math.max(0, cognitiveLoadScore - issues.length * 10)}/100\n\n### Heading Structure:\n- H1: ${h1Count} ${h1Count === 1 ? "✅" : "❌"}\n- H2: ${h2Count}\n- H3: ${h3Count}\n\n### Issues (${issues.length}):\n${issues.map((i: HierarchyIssue) => `- ${i.severity.toUpperCase()}: ${i.message}`).join("\n") || "None"}\n\n### Cognitive Load Recommendations:\n${recommendations.map((r: string) => `- ${r}`).join("\n") || "None"}\n\n### 3-Second Rule Checklist:\n- [ ] Page purpose immediately clear\n- [ ] Primary action obvious\n- [ ] No ambiguous labels\n- [ ] Clear visual hierarchy\n- [ ] Progressive disclosure used`,
1873
- },
1874
- ],
1875
- };
1876
- }
1877
-
1878
- private async recommendImages(args: RecommendImagesArgs): Promise<ToolResponse> {
1879
- const { context, style = "photography", budget = "free" } = args;
1880
-
1881
- const recommendations: ImageRecommendations = {
1882
- libraries: [],
1883
- tips: [],
1884
- style: style,
1885
- };
1886
-
1887
- // Context-specific recommendations
1888
- if (context.toLowerCase().includes("hero")) {
1889
- recommendations.tips.push(
1890
- "Hero images should be high-impact but not compete with text",
1891
- );
1892
- recommendations.tips.push(
1893
- "Use overlay/gradient to ensure text readability",
1894
- );
1895
- recommendations.tips.push(
1896
- "Recommended size: 1920x1080px, optimized to < 200KB",
1897
- );
1898
- }
1899
-
1900
- if (
1901
- context.toLowerCase().includes("team") ||
1902
- context.toLowerCase().includes("portrait")
1903
- ) {
1904
- recommendations.tips.push(
1905
- "Use consistent lighting and background for team photos",
1906
- );
1907
- recommendations.tips.push("Square or 4:5 aspect ratio works best");
1908
- }
1909
-
1910
- if (context.toLowerCase().includes("product")) {
1911
- recommendations.tips.push(
1912
- "Use high-quality product photography with neutral background",
1913
- );
1914
- recommendations.tips.push("Include multiple angles and detail shots");
1915
- }
1916
-
1917
- // Library recommendations based on budget and style
1918
- if (budget === "free") {
1919
- if (style === "photography") {
1920
- recommendations.libraries.push({
1921
- name: "Unsplash",
1922
- url: "unsplash.com",
1923
- description: "Free, high-quality photography",
1924
- });
1925
- recommendations.libraries.push({
1926
- name: "Pexels",
1927
- url: "pexels.com",
1928
- description: "Free stock photos and videos",
1929
- });
1930
- } else if (style === "illustration") {
1931
- recommendations.libraries.push({
1932
- name: "unDraw",
1933
- url: "undraw.co",
1934
- description: "Customizable open-source illustrations",
1935
- });
1936
- recommendations.libraries.push({
1937
- name: "Humaaans",
1938
- url: "humaaans.com",
1939
- description: "Mix-and-match people illustrations",
1940
- });
1941
- } else if (style === "3d") {
1942
- recommendations.libraries.push({
1943
- name: "BlenderKit",
1944
- url: "blenderkit.com",
1945
- description: "Free 3D assets",
1946
- });
1947
- }
1948
- } else if (budget === "premium") {
1949
- recommendations.libraries.push({
1950
- name: "Shutterstock",
1951
- url: "shutterstock.com",
1952
- description: "Extensive premium catalog",
1953
- });
1954
- recommendations.libraries.push({
1955
- name: "Getty Images",
1956
- url: "gettyimages.com",
1957
- description: "Editorial and commercial quality",
1958
- });
1959
- }
1960
-
1961
- // Icon recommendations
1962
- recommendations.libraries.push({
1963
- name: "Lucide",
1964
- url: "lucide.dev",
1965
- description: "Clean, consistent icon library (Free)",
1966
- });
1967
- recommendations.libraries.push({
1968
- name: "Heroicons",
1969
- url: "heroicons.com",
1970
- description: "Beautiful SVG icons by Tailwind (Free)",
1971
- });
1972
-
1973
- return {
1974
- content: [
1975
- {
1976
- type: "text",
1977
- text: `## Image Recommendations for: ${context}\n\n### Style: ${style}\n### Budget: ${budget}\n\n### Recommended Libraries:\n${recommendations.libraries.map((lib: ImageLibrary) => `- **${lib.name}** (${lib.url})\n ${lib.description}`).join("\n")}\n\n### Context-Specific Tips:\n${recommendations.tips.map((tip: string) => `- ${tip}`).join("\n")}\n\n### Image Optimization Checklist:\n- [ ] WebP format with JPEG fallback\n- [ ] Responsive srcset for different sizes\n- [ ] Alt text describing purpose (not just "image")\n- [ ] Lazy loading for below-fold images\n- [ ] Compressed to < 200KB without quality loss\n- [ ] Consistent style across all images`,
1668
+ text: `## Visual Hierarchy & Cognitive Load Analysis\n\n### "Don't Make Me Think" Score: ${Math.max(0, 100 - issues.length * 10)}/100\n\n### Heading Structure:\n- H1: ${h1Count} ${h1Count === 1 ? "✅" : "❌"}\n- H2: ${h2Count}\n\n### Issues (${issues.length}):\n${issues.map((i: HierarchyIssue) => `- ${i.severity.toUpperCase()}: ${i.message}`).join("\n") || "None"}\n\n### 3-Second Rule Checklist:\n- [ ] Page purpose immediately clear\n- [ ] Primary action obvious\n- [ ] No ambiguous labels\n- [ ] Clear visual hierarchy\n- [ ] Progressive disclosure used`,
1978
1669
  },
1979
1670
  ],
1980
1671
  };
1981
1672
  }
1982
1673
 
1983
- async run(): Promise<void> {
1984
- const transport = new StdioServerTransport();
1985
- await this.server.connect(transport);
1986
- await frameworkLogger.log(
1987
- "ui-ux-design.server",
1988
- "-xray-ui-ux-design-mcp-server-running-",
1989
- "info",
1990
- { message: "xray UI/UX Design MCP Server running..." },
1991
- );
1992
-
1993
- const cleanup = async (signal: string) => {
1994
- await frameworkLogger.log(
1995
- "ui-ux-design.server",
1996
- "-received-signal-shutting-down-gracefully-",
1997
- "info",
1998
- { message: `Received ${signal}, shutting down gracefully...` },
1999
- );
2000
-
2001
- // Set a timeout to force exit if graceful shutdown fails
2002
- const timeout = setTimeout(() => {
2003
- frameworkLogger.log("mcps/ui-ux-design", "shutdown", "error", { message: "Graceful shutdown timeout, forcing exit..." });
2004
- process.exit(1);
2005
- }, 5000); // 5 second timeout
2006
-
2007
- try {
2008
- if (this.server && typeof this.server.close === "function") {
2009
- await this.server.close();
2010
- }
2011
- clearTimeout(timeout);
2012
- await frameworkLogger.log(
2013
- "ui-ux-design.server",
2014
- "-xray-mcp-server-shut-down-gracefully-",
2015
- "info",
2016
- { message: "xray MCP Server shut down gracefully" },
2017
- );
2018
- process.exit(0);
2019
- } catch (error) {
2020
- clearTimeout(timeout);
2021
- frameworkLogger.log("mcps/ui-ux-design", "shutdown", "error", { message: `Error during server shutdown: ${String(error)}` });
2022
- process.exit(1);
2023
- }
2024
- };
2025
-
2026
- // Handle multiple shutdown signals
2027
- process.on("SIGINT", () => cleanup("SIGINT"));
2028
- process.on("SIGTERM", () => cleanup("SIGTERM"));
2029
- process.on("SIGHUP", () => cleanup("SIGHUP"));
2030
-
2031
- // Monitor parent process (opencode) and shutdown if it dies
2032
- const checkParent = async () => {
2033
- try {
2034
- process.kill(process.ppid, 0); // Check if parent is alive
2035
- setTimeout(checkParent, 1000); // Check again in 1 second
2036
- } catch (error) {
2037
- // Parent process died, shut down gracefully
2038
- await frameworkLogger.log(
2039
- "ui-ux-design.server",
2040
- "-parent-process-opencode-died-shutting-down-mcp-se",
2041
- "info",
2042
- {
2043
- message:
2044
- "Parent process (opencode) died, shutting down MCP server...",
2045
- },
2046
- );
2047
- cleanup("parent-process-death");
2048
- }
2049
- };
2050
-
2051
- // Start monitoring parent process
2052
- setTimeout(checkParent, 2000); // Start checking after 2 seconds
2053
-
2054
- // Handle uncaught exceptions and unhandled rejections
2055
- process.on("uncaughtException", (error) => {
2056
- frameworkLogger.log("mcps/ui-ux-design", "uncaughtException", "error", { error: String(error) });
2057
- cleanup("uncaughtException");
2058
- });
2059
-
2060
- process.on("unhandledRejection", (reason, promise) => {
2061
- frameworkLogger.log("mcps/ui-ux-design", "unhandledRejection", "error", { error: String(reason) });
2062
- cleanup("unhandledRejection");
2063
- });
2064
-
2065
- process.on("SIGINT", cleanup);
2066
- process.on("SIGTERM", cleanup);
2067
- }
2068
1674
  }
2069
1675
 
2070
1676
  // Run the server if this file is executed directly
2071
1677
  if (import.meta.url === `file://${process.argv[1]}`) {
2072
1678
  const server = new XrayUIUXDesignServer();
2073
- server.run().catch((error) => frameworkLogger.log("mcps/ui-ux-design", "run", "error", { error: String(error) }));
1679
+ server.run("ui-ux-design.server").catch((error) => frameworkLogger.log("mcps/ui-ux-design", "run", "error", { error: String(error) }));
2074
1680
  }
2075
1681
 
2076
1682
  export { XrayUIUXDesignServer };