0xray 2.1.2 → 2.1.4

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 (250) 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 +2 -1
  5. package/README.md +12 -11
  6. package/dist/AGENTS.md +2 -1
  7. package/dist/CHANGELOG.md +38 -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 +13 -10
  168. package/scripts/node/universal-version-manager.js +11 -11
  169. package/src/mcps/architect-tools.server.ts +112 -215
  170. package/src/mcps/auto-format.server.ts +50 -110
  171. package/src/mcps/boot-orchestrator.server.ts +75 -121
  172. package/src/mcps/config/__tests__/server-config-registry.test.ts +21 -12
  173. package/src/mcps/config/server-config-registry.ts +3 -3
  174. package/src/mcps/enforcer-tools.server.ts +212 -310
  175. package/src/mcps/estimation.server.ts +62 -122
  176. package/src/mcps/framework-compliance-audit.server.ts +52 -97
  177. package/src/mcps/framework-help.server.ts +64 -114
  178. package/src/mcps/governance.server.ts +2 -2
  179. package/src/mcps/knowledge-skills/api-design.server.ts +32 -77
  180. package/src/mcps/knowledge-skills/architecture-patterns.server.ts +31 -87
  181. package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +165 -193
  182. package/src/mcps/knowledge-skills/code-analyzer.server.ts +20 -55
  183. package/src/mcps/knowledge-skills/code-review.server.ts +114 -161
  184. package/src/mcps/knowledge-skills/content-creator.server.ts +218 -255
  185. package/src/mcps/knowledge-skills/database-design.server.ts +118 -165
  186. package/src/mcps/knowledge-skills/devops-deployment.server.ts +67 -172
  187. package/src/mcps/knowledge-skills/git-workflow.server.ts +32 -77
  188. package/src/mcps/knowledge-skills/growth-strategist.server.ts +324 -361
  189. package/src/mcps/knowledge-skills/log-monitor.server.ts +160 -187
  190. package/src/mcps/knowledge-skills/mobile-development.server.ts +89 -223
  191. package/src/mcps/knowledge-skills/multimodal-looker.server.ts +128 -175
  192. package/src/mcps/knowledge-skills/performance-optimization.server.ts +156 -329
  193. package/src/mcps/knowledge-skills/project-analysis.server.ts +72 -248
  194. package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +59 -171
  195. package/src/mcps/knowledge-skills/security-audit.server.ts +104 -151
  196. package/src/mcps/knowledge-skills/seo-consultant.server.ts +80 -220
  197. package/src/mcps/knowledge-skills/session-management.server.ts +51 -232
  198. package/src/mcps/knowledge-skills/skill-invocation.server.ts +165 -372
  199. package/src/mcps/knowledge-skills/strategist.server.ts +72 -143
  200. package/src/mcps/knowledge-skills/tech-writer.server.ts +85 -350
  201. package/src/mcps/knowledge-skills/testing-best-practices.server.ts +146 -195
  202. package/src/mcps/knowledge-skills/testing-strategy.server.ts +75 -161
  203. package/src/mcps/knowledge-skills/ui-ux-design.server.ts +93 -487
  204. package/src/mcps/lint.server.ts +53 -107
  205. package/src/mcps/mcp-client.ts +2 -2
  206. package/src/mcps/model-health-check.server.ts +34 -71
  207. package/src/mcps/performance-analysis.server.ts +60 -104
  208. package/src/mcps/processor-pipeline.server.ts +72 -110
  209. package/src/mcps/registry.json +1 -1
  210. package/src/mcps/researcher.server.ts +88 -177
  211. package/src/mcps/security-scan.server.ts +55 -104
  212. package/src/mcps/shared/knowledge-skill-base.ts +62 -0
  213. package/src/mcps/shared/prompt-security-validator.ts +199 -0
  214. package/src/mcps/shared/security-scanner.ts +599 -0
  215. package/src/mcps/state-manager.server.ts +117 -175
  216. package/src/opencode/codex.codex +1 -1
  217. package/src/opencode/commands/dependency-audit.md +3 -3
  218. package/src/opencode/enforcer-config.json +2 -2
  219. package/src/skills/registry.json +1 -1
  220. package/xray/codex.json +1 -1
  221. package/xray/config.json +1 -1
  222. package/xray/features.json +1 -1
  223. package/xray/integrations.json +3 -3
  224. package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
  225. package/dist/integrations/hermes-agent/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
  226. package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
  227. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313-pytest-9.0.2.pyc +0 -0
  228. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313.pyc +0 -0
  229. package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
  230. package/dist/integrations/hermes-agent/conftest.py +0 -14
  231. package/dist/integrations/hermes-agent/test_plugin.py +0 -1103
  232. package/dist/processors/implementations/refactoring-logging-processor.d.ts +0 -31
  233. package/dist/processors/implementations/refactoring-logging-processor.js +0 -96
  234. package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
  235. package/dist/processors/implementations/session-capture-processor.js +0 -37
  236. package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
  237. package/dist/scripts/activate-kernel-pipeline.js +0 -101
  238. package/dist/security/index.d.ts +0 -13
  239. package/dist/security/index.js +0 -13
  240. package/dist/security/security-agent-coordinator.d.ts +0 -72
  241. package/dist/security/security-agent-coordinator.js +0 -204
  242. package/dist/security/security-auditor.d.ts +0 -56
  243. package/dist/security/security-auditor.js +0 -584
  244. package/dist/security/security-hardening-system.d.ts +0 -239
  245. package/dist/security/security-hardening-system.js +0 -727
  246. package/dist/security/security-orchestration-layer.d.ts +0 -119
  247. package/dist/security/security-orchestration-layer.js +0 -496
  248. /package/dist/{security → mcps/shared}/prompt-security-validator.d.ts +0 -0
  249. /package/dist/{security → mcps/shared}/prompt-security-validator.js +0 -0
  250. /package/dist/{security → mcps/shared}/security-scanner.d.ts +0 -0
@@ -4,66 +4,43 @@
4
4
  * Knowledge skill for API design patterns, RESTful conventions,
5
5
  * GraphQL schema design, and API documentation standards
6
6
  */
7
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
- import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
- import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
11
- class XrayApiDesignServer {
12
- server;
7
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
8
+ import { frameworkLogger } from "../../core/framework-logger.js";
9
+ class XrayApiDesignServer extends XrayKnowledgeSkillBase {
13
10
  constructor() {
14
- this.server = new Server({
15
- name: "api-design", version: "2.0.1",
16
- }, {
17
- capabilities: {
18
- tools: {},
19
- },
20
- });
21
- this.setupToolHandlers();
22
- // Server initialization - removed unnecessary startup logging
23
- }
24
- setupToolHandlers() {
25
- this.server.setRequestHandler(ListToolsRequestSchema, async () => {
26
- return {
27
- tools: [
28
- {
29
- name: "design-api-endpoints",
30
- description: "Design RESTful API endpoints with proper resource modeling",
31
- inputSchema: {
32
- type: "object",
33
- properties: {
34
- resource: { type: "string" },
35
- operations: { type: "array", items: { type: "string" } },
36
- relationships: { type: "array", items: { type: "string" } },
37
- },
38
- required: ["resource"],
39
- },
11
+ super("api-design", "2.0.1");
12
+ this.tools = [
13
+ {
14
+ name: "design-api-endpoints",
15
+ description: "Design RESTful API endpoints with proper resource modeling",
16
+ inputSchema: {
17
+ type: "object",
18
+ properties: {
19
+ resource: { type: "string" },
20
+ operations: { type: "array", items: { type: "string" } },
21
+ relationships: { type: "array", items: { type: "string" } },
40
22
  },
41
- {
42
- name: "validate-api-design",
43
- description: "Validate API design against RESTful principles and best practices",
44
- inputSchema: {
45
- type: "object",
46
- properties: {
47
- endpoints: { type: "array", items: { type: "string" } },
48
- standards: { type: "array", items: { type: "string" } },
49
- },
50
- required: ["endpoints"],
51
- },
23
+ required: ["resource"],
24
+ },
25
+ },
26
+ {
27
+ name: "validate-api-design",
28
+ description: "Validate API design against RESTful principles and best practices",
29
+ inputSchema: {
30
+ type: "object",
31
+ properties: {
32
+ endpoints: { type: "array", items: { type: "string" } },
33
+ standards: { type: "array", items: { type: "string" } },
52
34
  },
53
- ],
54
- };
55
- });
56
- this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
57
- const { name, arguments: args } = request.params;
58
- switch (name) {
59
- case "design-api-endpoints":
60
- return await this.designApiEndpoints(args);
61
- case "validate-api-design":
62
- return await this.validateApiDesign(args);
63
- default:
64
- throw new Error(`Unknown tool: ${name}`);
65
- }
66
- });
35
+ required: ["endpoints"],
36
+ },
37
+ },
38
+ ];
39
+ this.handlers = {
40
+ "design-api-endpoints": async (args) => this.designApiEndpoints(args),
41
+ "validate-api-design": async (args) => this.validateApiDesign(args),
42
+ };
43
+ this.setupToolHandlers();
67
44
  }
68
45
  async designApiEndpoints(args) {
69
46
  const { resource, operations, relationships } = args;
@@ -106,18 +83,9 @@ class XrayApiDesignServer {
106
83
  ],
107
84
  };
108
85
  }
109
- async run() {
110
- const transport = new StdioServerTransport();
111
- await this.server.connect(transport);
112
- // Use centralized shutdown handler
113
- createGracefulShutdown({
114
- serverName: "api-design.server",
115
- server: this.server,
116
- });
117
- }
118
86
  }
119
87
  if (import.meta.url === `file://${process.argv[1]}`) {
120
88
  const server = new XrayApiDesignServer();
121
- server.run().catch(() => { });
89
+ server.run("api-design").catch((err) => { frameworkLogger.log("api-design", "run", "error", { error: err instanceof Error ? err.message : String(err) }); });
122
90
  }
123
91
  export default XrayApiDesignServer;
@@ -1,15 +1,7 @@
1
- /**
2
- * xray Architecture Patterns MCP Server
3
- *
4
- * Knowledge skill for architectural pattern recognition,
5
- * design pattern recommendations, and system architecture guidance
6
- */
7
- declare class XrayArchitecturePatternsServer {
8
- private server;
1
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
2
+ declare class XrayArchitecturePatternsServer extends XrayKnowledgeSkillBase {
9
3
  constructor();
10
- private setupToolHandlers;
11
4
  private analyzeArchitecture;
12
5
  private recommendPatterns;
13
- run(): Promise<void>;
14
6
  }
15
7
  export default XrayArchitecturePatternsServer;
@@ -1,73 +1,43 @@
1
- /**
2
- * xray Architecture Patterns MCP Server
3
- *
4
- * Knowledge skill for architectural pattern recognition,
5
- * design pattern recommendations, and system architecture guidance
6
- */
7
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
- import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
- import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
11
- class XrayArchitecturePatternsServer {
12
- server;
1
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
2
+ import { frameworkLogger } from "../../core/framework-logger.js";
3
+ class XrayArchitecturePatternsServer extends XrayKnowledgeSkillBase {
13
4
  constructor() {
14
- this.server = new Server({
15
- name: "architecture-patterns", version: "2.0.1",
16
- }, {
17
- capabilities: {
18
- tools: {},
19
- },
20
- });
21
- this.setupToolHandlers();
22
- // Server initialization - removed unnecessary startup logging
23
- }
24
- setupToolHandlers() {
25
- this.server.setRequestHandler(ListToolsRequestSchema, async () => {
26
- return {
27
- tools: [
28
- {
29
- name: "analyze-architecture",
30
- description: "Analyze current system architecture and identify patterns",
31
- inputSchema: {
32
- type: "object",
33
- properties: {
34
- projectRoot: { type: "string" },
35
- focusPatterns: { type: "array", items: { type: "string" } },
36
- },
37
- required: ["projectRoot"],
38
- },
5
+ super("architecture-patterns", "2.0.1");
6
+ this.tools = [
7
+ {
8
+ name: "analyze-architecture",
9
+ description: "Analyze current system architecture and identify patterns",
10
+ inputSchema: {
11
+ type: "object",
12
+ properties: {
13
+ projectRoot: { type: "string" },
14
+ focusPatterns: { type: "array", items: { type: "string" } },
39
15
  },
40
- {
41
- name: "recommend-patterns",
42
- description: "Recommend architectural patterns for specific use cases",
43
- inputSchema: {
44
- type: "object",
45
- properties: {
46
- useCase: { type: "string" },
47
- constraints: { type: "array", items: { type: "string" } },
48
- scale: { type: "string", enum: ["small", "medium", "large"] },
49
- },
50
- required: ["useCase"],
51
- },
16
+ required: ["projectRoot"],
17
+ },
18
+ },
19
+ {
20
+ name: "recommend-patterns",
21
+ description: "Recommend architectural patterns for specific use cases",
22
+ inputSchema: {
23
+ type: "object",
24
+ properties: {
25
+ useCase: { type: "string" },
26
+ constraints: { type: "array", items: { type: "string" } },
27
+ scale: { type: "string", enum: ["small", "medium", "large"] },
52
28
  },
53
- ],
54
- };
55
- });
56
- this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
57
- const { name, arguments: args } = request.params;
58
- switch (name) {
59
- case "analyze-architecture":
60
- return await this.analyzeArchitecture(args);
61
- case "recommend-patterns":
62
- return await this.recommendPatterns(args);
63
- default:
64
- throw new Error(`Unknown tool: ${name}`);
65
- }
66
- });
29
+ required: ["useCase"],
30
+ },
31
+ },
32
+ ];
33
+ this.handlers = {
34
+ "analyze-architecture": async (args) => this.analyzeArchitecture(args),
35
+ "recommend-patterns": async (args) => this.recommendPatterns(args),
36
+ };
37
+ this.setupToolHandlers();
67
38
  }
68
39
  async analyzeArchitecture(args) {
69
40
  const { projectRoot, focusPatterns } = args;
70
- // Simplified architecture analysis
71
41
  const analysis = {
72
42
  patterns: ["MVC", "Repository"],
73
43
  recommendations: ["Consider microservices for scaling"],
@@ -96,18 +66,9 @@ class XrayArchitecturePatternsServer {
96
66
  ],
97
67
  };
98
68
  }
99
- async run() {
100
- const transport = new StdioServerTransport();
101
- await this.server.connect(transport);
102
- // Use centralized shutdown handler
103
- createGracefulShutdown({
104
- serverName: "architecture-patterns.server",
105
- server: this.server,
106
- });
107
- }
108
69
  }
109
70
  if (import.meta.url === `file://${process.argv[1]}`) {
110
71
  const server = new XrayArchitecturePatternsServer();
111
- server.run().catch(() => { });
72
+ server.run("architecture-patterns.server").catch((err) => { frameworkLogger.log("architecture-patterns", "run", "error", { error: err instanceof Error ? err.message : String(err) }); });
112
73
  }
113
74
  export default XrayArchitecturePatternsServer;
@@ -5,10 +5,9 @@
5
5
  * Provides automated root cause analysis, stack trace interpretation,
6
6
  * and actionable debugging recommendations.
7
7
  */
8
- declare class BugTriageSpecialistServer {
9
- private server;
8
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
9
+ declare class BugTriageSpecialistServer extends XrayKnowledgeSkillBase {
10
10
  constructor();
11
- private setupToolHandlers;
12
11
  private triageBugs;
13
12
  private analyzeStackTrace;
14
13
  private suggestFixes;
@@ -28,6 +27,5 @@ declare class BugTriageSpecialistServer {
28
27
  private suggestFixFromTrace;
29
28
  private calculatePriorityScore;
30
29
  private estimateEffort;
31
- run(): Promise<void>;
32
30
  }
33
31
  export { BugTriageSpecialistServer };
@@ -5,185 +5,170 @@
5
5
  * Provides automated root cause analysis, stack trace interpretation,
6
6
  * and actionable debugging recommendations.
7
7
  */
8
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
10
- import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
11
8
  import * as path from "path";
12
9
  import { fileURLToPath } from "url";
13
- class BugTriageSpecialistServer {
14
- server;
10
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
11
+ import { frameworkLogger } from "../../core/framework-logger.js";
12
+ class BugTriageSpecialistServer extends XrayKnowledgeSkillBase {
15
13
  constructor() {
16
- this.server = new Server({ name: "bug-triage-specialist", version: "2.0.1" }, { capabilities: { tools: {} } });
17
- this.setupToolHandlers();
18
- }
19
- setupToolHandlers() {
20
- this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
21
- tools: [
22
- {
23
- name: "triage_bugs",
24
- description: "Analyze and triage bug reports, errors, or crash logs to identify root causes and prioritize fixes",
25
- inputSchema: {
26
- type: "object",
27
- properties: {
28
- errorLogs: {
29
- type: "array",
30
- items: { type: "string" },
31
- description: "Error messages, stack traces, or bug descriptions to analyze",
32
- },
33
- context: {
34
- type: "object",
35
- properties: {
36
- projectType: {
37
- type: "string",
38
- description: "Type of project (node, browser, etc.)",
39
- },
40
- framework: {
41
- type: "string",
42
- description: "Framework being used",
43
- },
44
- recentChanges: {
45
- type: "array",
46
- items: { type: "string" },
47
- description: "Recent code changes",
48
- },
14
+ super("bug-triage-specialist", "2.0.1");
15
+ this.tools = [
16
+ {
17
+ name: "triage_bugs",
18
+ description: "Analyze and triage bug reports, errors, or crash logs to identify root causes and prioritize fixes",
19
+ inputSchema: {
20
+ type: "object",
21
+ properties: {
22
+ errorLogs: {
23
+ type: "array",
24
+ items: { type: "string" },
25
+ description: "Error messages, stack traces, or bug descriptions to analyze",
26
+ },
27
+ context: {
28
+ type: "object",
29
+ properties: {
30
+ projectType: {
31
+ type: "string",
32
+ description: "Type of project (node, browser, etc.)",
33
+ },
34
+ framework: {
35
+ type: "string",
36
+ description: "Framework being used",
37
+ },
38
+ recentChanges: {
39
+ type: "array",
40
+ items: { type: "string" },
41
+ description: "Recent code changes",
49
42
  },
50
- description: "Additional context about the project",
51
43
  },
44
+ description: "Additional context about the project",
52
45
  },
53
- required: ["errorLogs"],
54
46
  },
47
+ required: ["errorLogs"],
55
48
  },
56
- {
57
- name: "analyze_stack_trace",
58
- description: "Parse and analyze stack traces to identify the exact location and cause of errors",
59
- inputSchema: {
60
- type: "object",
61
- properties: {
62
- stackTrace: {
63
- type: "string",
64
- description: "Stack trace to analyze",
65
- },
66
- sourceMap: {
67
- type: "object",
68
- description: "Optional source map for minified code",
69
- },
49
+ },
50
+ {
51
+ name: "analyze_stack_trace",
52
+ description: "Parse and analyze stack traces to identify the exact location and cause of errors",
53
+ inputSchema: {
54
+ type: "object",
55
+ properties: {
56
+ stackTrace: {
57
+ type: "string",
58
+ description: "Stack trace to analyze",
59
+ },
60
+ sourceMap: {
61
+ type: "object",
62
+ description: "Optional source map for minified code",
70
63
  },
71
- required: ["stackTrace"],
72
64
  },
65
+ required: ["stackTrace"],
73
66
  },
74
- {
75
- name: "suggest_fixes",
76
- description: "Generate specific code fixes for identified bugs with explanations",
77
- inputSchema: {
78
- type: "object",
79
- properties: {
80
- bugId: { type: "string", description: "ID of the bug to fix" },
81
- language: {
82
- type: "string",
83
- description: "Programming language",
84
- default: "typescript",
85
- },
86
- existingCode: {
87
- type: "string",
88
- description: "The buggy code snippet",
89
- },
67
+ },
68
+ {
69
+ name: "suggest_fixes",
70
+ description: "Generate specific code fixes for identified bugs with explanations",
71
+ inputSchema: {
72
+ type: "object",
73
+ properties: {
74
+ bugId: { type: "string", description: "ID of the bug to fix" },
75
+ language: {
76
+ type: "string",
77
+ description: "Programming language",
78
+ default: "typescript",
79
+ },
80
+ existingCode: {
81
+ type: "string",
82
+ description: "The buggy code snippet",
90
83
  },
91
- required: ["bugId", "existingCode"],
92
84
  },
85
+ required: ["bugId", "existingCode"],
93
86
  },
94
- {
95
- name: "prioritize_issues",
96
- description: "Prioritize bug fixes based on severity, impact, and effort",
97
- inputSchema: {
98
- type: "object",
99
- properties: {
100
- bugs: {
101
- type: "array",
102
- items: { type: "object" },
103
- description: "Array of bug objects to prioritize",
104
- },
105
- sprintVelocity: {
106
- type: "number",
107
- description: "Available story points",
108
- },
87
+ },
88
+ {
89
+ name: "prioritize_issues",
90
+ description: "Prioritize bug fixes based on severity, impact, and effort",
91
+ inputSchema: {
92
+ type: "object",
93
+ properties: {
94
+ bugs: {
95
+ type: "array",
96
+ items: { type: "object" },
97
+ description: "Array of bug objects to prioritize",
98
+ },
99
+ sprintVelocity: {
100
+ type: "number",
101
+ description: "Available story points",
109
102
  },
110
- required: ["bugs"],
111
103
  },
104
+ required: ["bugs"],
112
105
  },
113
- {
114
- name: "find_related_issues",
115
- description: "Find related or duplicate bugs based on error patterns and symptoms",
116
- inputSchema: {
117
- type: "object",
118
- properties: {
119
- newBug: { type: "string", description: "Description of new bug" },
120
- existingBugs: {
121
- type: "array",
122
- items: { type: "string" },
123
- description: "List of existing bug IDs",
124
- },
106
+ },
107
+ {
108
+ name: "find_related_issues",
109
+ description: "Find related or duplicate bugs based on error patterns and symptoms",
110
+ inputSchema: {
111
+ type: "object",
112
+ properties: {
113
+ newBug: { type: "string", description: "Description of new bug" },
114
+ existingBugs: {
115
+ type: "array",
116
+ items: { type: "string" },
117
+ description: "List of existing bug IDs",
125
118
  },
126
- required: ["newBug"],
127
119
  },
120
+ required: ["newBug"],
128
121
  },
129
- ],
130
- }));
131
- this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
132
- const { name, arguments: args = {} } = request.params;
133
- const params = args;
134
- try {
135
- switch (name) {
136
- case "triage_bugs": {
137
- const result = this.triageBugs(params.errorLogs || [], params.context || {});
138
- return {
139
- content: [
140
- { type: "text", text: JSON.stringify(result, null, 2) },
141
- ],
142
- };
143
- }
144
- case "analyze_stack_trace": {
145
- const result = this.analyzeStackTrace(params.stackTrace || "", params.sourceMap);
146
- return {
147
- content: [
148
- { type: "text", text: JSON.stringify(result, null, 2) },
149
- ],
150
- };
151
- }
152
- case "suggest_fixes": {
153
- const result = this.suggestFixes(params.bugId || "", params.language || "typescript", params.existingCode || "");
154
- return {
155
- content: [
156
- { type: "text", text: JSON.stringify(result, null, 2) },
157
- ],
158
- };
159
- }
160
- case "prioritize_issues": {
161
- const result = this.prioritizeIssues(params.bugs || [], params.sprintVelocity || 20);
162
- return {
163
- content: [
164
- { type: "text", text: JSON.stringify(result, null, 2) },
165
- ],
166
- };
167
- }
168
- case "find_related_issues": {
169
- const result = this.findRelatedIssues(params.newBug || "", params.existingBugs || []);
170
- return {
171
- content: [
172
- { type: "text", text: JSON.stringify(result, null, 2) },
173
- ],
174
- };
175
- }
176
- default:
177
- throw new Error(`Unknown tool: ${name}`);
178
- }
179
- }
180
- catch (error) {
122
+ },
123
+ ];
124
+ this.handlers = {
125
+ "triage_bugs": async (args) => {
126
+ const params = args;
127
+ const result = this.triageBugs(params.errorLogs || [], params.context || {});
181
128
  return {
182
- content: [{ type: "text", text: `Error: ${error}` }],
183
- isError: true,
129
+ content: [
130
+ { type: "text", text: JSON.stringify(result, null, 2) },
131
+ ],
184
132
  };
185
- }
186
- });
133
+ },
134
+ "analyze_stack_trace": async (args) => {
135
+ const params = args;
136
+ const result = this.analyzeStackTrace(params.stackTrace || "", params.sourceMap);
137
+ return {
138
+ content: [
139
+ { type: "text", text: JSON.stringify(result, null, 2) },
140
+ ],
141
+ };
142
+ },
143
+ "suggest_fixes": async (args) => {
144
+ const params = args;
145
+ const result = this.suggestFixes(params.bugId || "", params.language || "typescript", params.existingCode || "");
146
+ return {
147
+ content: [
148
+ { type: "text", text: JSON.stringify(result, null, 2) },
149
+ ],
150
+ };
151
+ },
152
+ "prioritize_issues": async (args) => {
153
+ const params = args;
154
+ const result = this.prioritizeIssues(params.bugs || [], params.sprintVelocity || 20);
155
+ return {
156
+ content: [
157
+ { type: "text", text: JSON.stringify(result, null, 2) },
158
+ ],
159
+ };
160
+ },
161
+ "find_related_issues": async (args) => {
162
+ const params = args;
163
+ const result = this.findRelatedIssues(params.newBug || "", params.existingBugs || []);
164
+ return {
165
+ content: [
166
+ { type: "text", text: JSON.stringify(result, null, 2) },
167
+ ],
168
+ };
169
+ },
170
+ };
171
+ this.setupToolHandlers();
187
172
  }
188
173
  triageBugs(errorLogs, context) {
189
174
  const bugs = errorLogs.map((log, idx) => {
@@ -461,14 +446,10 @@ class BugTriageSpecialistServer {
461
446
  };
462
447
  return effortMap[bug.fixComplexity] || 3;
463
448
  }
464
- async run() {
465
- const transport = new StdioServerTransport();
466
- await this.server.connect(transport);
467
- }
468
449
  }
469
450
  const entryPoint = path.resolve(process.argv[1] ?? "");
470
451
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
471
452
  const server = new BugTriageSpecialistServer();
472
- server.run();
453
+ server.run("bug-triage-specialist").catch((err) => { frameworkLogger.log("bug-triage-specialist", "run", "error", { error: err instanceof Error ? err.message : String(err) }); });
473
454
  }
474
455
  export { BugTriageSpecialistServer };