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
@@ -6,15 +6,11 @@
6
6
  * and actionable debugging recommendations.
7
7
  */
8
8
 
9
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
10
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
11
- import {
12
- CallToolRequestSchema,
13
- ListToolsRequestSchema,
14
- } from "@modelcontextprotocol/sdk/types.js";
15
9
  import * as fs from "fs";
16
10
  import * as path from "path";
17
11
  import { fileURLToPath } from "url";
12
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
13
+ import { frameworkLogger } from "../../core/framework-logger.js";
18
14
 
19
15
  interface BugReport {
20
16
  id: string;
@@ -76,208 +72,188 @@ interface PrioritizedBug {
76
72
  [key: string]: unknown;
77
73
  }
78
74
 
79
- class BugTriageSpecialistServer {
80
- private server: Server;
81
-
75
+ class BugTriageSpecialistServer extends XrayKnowledgeSkillBase {
82
76
  constructor() {
83
- this.server = new Server(
84
- { name: "bug-triage-specialist", version: "2.0.1" },
85
- { capabilities: { tools: {} } },
86
- );
87
- this.setupToolHandlers();
88
- }
89
-
90
- private setupToolHandlers() {
91
- this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
92
- tools: [
93
- {
94
- name: "triage_bugs",
95
- description:
96
- "Analyze and triage bug reports, errors, or crash logs to identify root causes and prioritize fixes",
97
- inputSchema: {
98
- type: "object",
99
- properties: {
100
- errorLogs: {
101
- type: "array",
102
- items: { type: "string" },
103
- description:
104
- "Error messages, stack traces, or bug descriptions to analyze",
105
- },
106
- context: {
107
- type: "object",
108
- properties: {
109
- projectType: {
110
- type: "string",
111
- description: "Type of project (node, browser, etc.)",
112
- },
113
- framework: {
114
- type: "string",
115
- description: "Framework being used",
116
- },
117
- recentChanges: {
118
- type: "array",
119
- items: { type: "string" },
120
- description: "Recent code changes",
121
- },
77
+ super("bug-triage-specialist", "2.0.1");
78
+ this.tools = [
79
+ {
80
+ name: "triage_bugs",
81
+ description:
82
+ "Analyze and triage bug reports, errors, or crash logs to identify root causes and prioritize fixes",
83
+ inputSchema: {
84
+ type: "object",
85
+ properties: {
86
+ errorLogs: {
87
+ type: "array",
88
+ items: { type: "string" },
89
+ description:
90
+ "Error messages, stack traces, or bug descriptions to analyze",
91
+ },
92
+ context: {
93
+ type: "object",
94
+ properties: {
95
+ projectType: {
96
+ type: "string",
97
+ description: "Type of project (node, browser, etc.)",
98
+ },
99
+ framework: {
100
+ type: "string",
101
+ description: "Framework being used",
102
+ },
103
+ recentChanges: {
104
+ type: "array",
105
+ items: { type: "string" },
106
+ description: "Recent code changes",
122
107
  },
123
- description: "Additional context about the project",
124
108
  },
109
+ description: "Additional context about the project",
125
110
  },
126
- required: ["errorLogs"],
127
111
  },
112
+ required: ["errorLogs"],
128
113
  },
129
- {
130
- name: "analyze_stack_trace",
131
- description:
132
- "Parse and analyze stack traces to identify the exact location and cause of errors",
133
- inputSchema: {
134
- type: "object",
135
- properties: {
136
- stackTrace: {
137
- type: "string",
138
- description: "Stack trace to analyze",
139
- },
140
- sourceMap: {
141
- type: "object",
142
- description: "Optional source map for minified code",
143
- },
114
+ },
115
+ {
116
+ name: "analyze_stack_trace",
117
+ description:
118
+ "Parse and analyze stack traces to identify the exact location and cause of errors",
119
+ inputSchema: {
120
+ type: "object",
121
+ properties: {
122
+ stackTrace: {
123
+ type: "string",
124
+ description: "Stack trace to analyze",
125
+ },
126
+ sourceMap: {
127
+ type: "object",
128
+ description: "Optional source map for minified code",
144
129
  },
145
- required: ["stackTrace"],
146
130
  },
131
+ required: ["stackTrace"],
147
132
  },
148
- {
149
- name: "suggest_fixes",
150
- description:
151
- "Generate specific code fixes for identified bugs with explanations",
152
- inputSchema: {
153
- type: "object",
154
- properties: {
155
- bugId: { type: "string", description: "ID of the bug to fix" },
156
- language: {
157
- type: "string",
158
- description: "Programming language",
159
- default: "typescript",
160
- },
161
- existingCode: {
162
- type: "string",
163
- description: "The buggy code snippet",
164
- },
133
+ },
134
+ {
135
+ name: "suggest_fixes",
136
+ description:
137
+ "Generate specific code fixes for identified bugs with explanations",
138
+ inputSchema: {
139
+ type: "object",
140
+ properties: {
141
+ bugId: { type: "string", description: "ID of the bug to fix" },
142
+ language: {
143
+ type: "string",
144
+ description: "Programming language",
145
+ default: "typescript",
146
+ },
147
+ existingCode: {
148
+ type: "string",
149
+ description: "The buggy code snippet",
165
150
  },
166
- required: ["bugId", "existingCode"],
167
151
  },
152
+ required: ["bugId", "existingCode"],
168
153
  },
169
- {
170
- name: "prioritize_issues",
171
- description:
172
- "Prioritize bug fixes based on severity, impact, and effort",
173
- inputSchema: {
174
- type: "object",
175
- properties: {
176
- bugs: {
177
- type: "array",
178
- items: { type: "object" },
179
- description: "Array of bug objects to prioritize",
180
- },
181
- sprintVelocity: {
182
- type: "number",
183
- description: "Available story points",
184
- },
154
+ },
155
+ {
156
+ name: "prioritize_issues",
157
+ description:
158
+ "Prioritize bug fixes based on severity, impact, and effort",
159
+ inputSchema: {
160
+ type: "object",
161
+ properties: {
162
+ bugs: {
163
+ type: "array",
164
+ items: { type: "object" },
165
+ description: "Array of bug objects to prioritize",
166
+ },
167
+ sprintVelocity: {
168
+ type: "number",
169
+ description: "Available story points",
185
170
  },
186
- required: ["bugs"],
187
171
  },
172
+ required: ["bugs"],
188
173
  },
189
- {
190
- name: "find_related_issues",
191
- description:
192
- "Find related or duplicate bugs based on error patterns and symptoms",
193
- inputSchema: {
194
- type: "object",
195
- properties: {
196
- newBug: { type: "string", description: "Description of new bug" },
197
- existingBugs: {
198
- type: "array",
199
- items: { type: "string" },
200
- description: "List of existing bug IDs",
201
- },
174
+ },
175
+ {
176
+ name: "find_related_issues",
177
+ description:
178
+ "Find related or duplicate bugs based on error patterns and symptoms",
179
+ inputSchema: {
180
+ type: "object",
181
+ properties: {
182
+ newBug: { type: "string", description: "Description of new bug" },
183
+ existingBugs: {
184
+ type: "array",
185
+ items: { type: "string" },
186
+ description: "List of existing bug IDs",
202
187
  },
203
- required: ["newBug"],
204
188
  },
189
+ required: ["newBug"],
205
190
  },
206
- ],
207
- }));
208
-
209
- this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
210
- const { name, arguments: args = {} } = request.params;
211
- const params = args as Record<string, unknown>;
212
-
213
- try {
214
- switch (name) {
215
- case "triage_bugs": {
216
- const result = this.triageBugs(
217
- (params.errorLogs as string[]) || [],
218
- (params.context as Record<string, unknown>) || {},
219
- );
220
- return {
221
- content: [
222
- { type: "text", text: JSON.stringify(result, null, 2) },
223
- ],
224
- };
225
- }
226
- case "analyze_stack_trace": {
227
- const result = this.analyzeStackTrace(
228
- (params.stackTrace as string) || "",
229
- params.sourceMap as Record<string, unknown> | undefined,
230
- );
231
- return {
232
- content: [
233
- { type: "text", text: JSON.stringify(result, null, 2) },
234
- ],
235
- };
236
- }
237
- case "suggest_fixes": {
238
- const result = this.suggestFixes(
239
- (params.bugId as string) || "",
240
- (params.language as string) || "typescript",
241
- (params.existingCode as string) || "",
242
- );
243
- return {
244
- content: [
245
- { type: "text", text: JSON.stringify(result, null, 2) },
246
- ],
247
- };
248
- }
249
- case "prioritize_issues": {
250
- const result = this.prioritizeIssues(
251
- (params.bugs as Array<Record<string, unknown>>) || [],
252
- (params.sprintVelocity as number) || 20,
253
- );
254
- return {
255
- content: [
256
- { type: "text", text: JSON.stringify(result, null, 2) },
257
- ],
258
- };
259
- }
260
- case "find_related_issues": {
261
- const result = this.findRelatedIssues(
262
- (params.newBug as string) || "",
263
- (params.existingBugs as string[]) || [],
264
- );
265
- return {
266
- content: [
267
- { type: "text", text: JSON.stringify(result, null, 2) },
268
- ],
269
- };
270
- }
271
- default:
272
- throw new Error(`Unknown tool: ${name}`);
273
- }
274
- } catch (error) {
191
+ },
192
+ ];
193
+ this.handlers = {
194
+ "triage_bugs": async (args) => {
195
+ const params = args as Record<string, unknown>;
196
+ const result = this.triageBugs(
197
+ (params.errorLogs as string[]) || [],
198
+ (params.context as Record<string, unknown>) || {},
199
+ );
275
200
  return {
276
- content: [{ type: "text", text: `Error: ${error}` }],
277
- isError: true,
201
+ content: [
202
+ { type: "text", text: JSON.stringify(result, null, 2) },
203
+ ],
278
204
  };
279
- }
280
- });
205
+ },
206
+ "analyze_stack_trace": async (args) => {
207
+ const params = args as Record<string, unknown>;
208
+ const result = this.analyzeStackTrace(
209
+ (params.stackTrace as string) || "",
210
+ params.sourceMap as Record<string, unknown> | undefined,
211
+ );
212
+ return {
213
+ content: [
214
+ { type: "text", text: JSON.stringify(result, null, 2) },
215
+ ],
216
+ };
217
+ },
218
+ "suggest_fixes": async (args) => {
219
+ const params = args as Record<string, unknown>;
220
+ const result = this.suggestFixes(
221
+ (params.bugId as string) || "",
222
+ (params.language as string) || "typescript",
223
+ (params.existingCode as string) || "",
224
+ );
225
+ return {
226
+ content: [
227
+ { type: "text", text: JSON.stringify(result, null, 2) },
228
+ ],
229
+ };
230
+ },
231
+ "prioritize_issues": async (args) => {
232
+ const params = args as Record<string, unknown>;
233
+ const result = this.prioritizeIssues(
234
+ (params.bugs as Array<Record<string, unknown>>) || [],
235
+ (params.sprintVelocity as number) || 20,
236
+ );
237
+ return {
238
+ content: [
239
+ { type: "text", text: JSON.stringify(result, null, 2) },
240
+ ],
241
+ };
242
+ },
243
+ "find_related_issues": async (args) => {
244
+ const params = args as Record<string, unknown>;
245
+ const result = this.findRelatedIssues(
246
+ (params.newBug as string) || "",
247
+ (params.existingBugs as string[]) || [],
248
+ );
249
+ return {
250
+ content: [
251
+ { type: "text", text: JSON.stringify(result, null, 2) },
252
+ ],
253
+ };
254
+ },
255
+ };
256
+ this.setupToolHandlers();
281
257
  }
282
258
 
283
259
  private triageBugs(errorLogs: string[], context: Record<string, unknown>): TriageResult {
@@ -609,16 +585,12 @@ class BugTriageSpecialistServer {
609
585
  return effortMap[bug.fixComplexity as string] || 3;
610
586
  }
611
587
 
612
- async run() {
613
- const transport = new StdioServerTransport();
614
- await this.server.connect(transport);
615
- }
616
588
  }
617
589
 
618
590
  const entryPoint = path.resolve(process.argv[1] ?? "");
619
591
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
620
592
  const server = new BugTriageSpecialistServer();
621
- server.run();
593
+ server.run("bug-triage-specialist").catch((err) => { frameworkLogger.log("bug-triage-specialist", "run", "error", { error: err instanceof Error ? err.message : String(err) }); });
622
594
  }
623
595
 
624
596
  export { BugTriageSpecialistServer };
@@ -10,16 +10,10 @@
10
10
  * Use project-analysis for project-level (structure, health).
11
11
  */
12
12
 
13
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
14
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
15
- import {
16
- CallToolRequestSchema,
17
- ListToolsRequestSchema,
18
- } from "@modelcontextprotocol/sdk/types.js";
13
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
14
+ import { frameworkLogger } from "../../core/framework-logger.js";
19
15
  import * as fs from "fs";
20
16
  import * as path from "path";
21
- import { frameworkLogger } from "../../core/framework-logger.js";
22
- import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
23
17
 
24
18
  interface Tool {
25
19
  name: string;
@@ -64,9 +58,8 @@ interface FileTreeNode {
64
58
  size?: number;
65
59
  }
66
60
 
67
- class CodeAnalyzerServer {
68
- private server: Server;
69
- private tools: Tool[] = [
61
+ class CodeAnalyzerServer extends XrayKnowledgeSkillBase {
62
+ private toolDefinitions: Tool[] = [
70
63
  // ===== CODE ANALYSIS =====
71
64
  {
72
65
  name: "analyze_code",
@@ -302,39 +295,21 @@ class CodeAnalyzerServer {
302
295
  ];
303
296
 
304
297
  constructor() {
305
- this.server = new Server(
306
- { name: "code-analyzer", version: "2.0.1" },
307
- { capabilities: { tools: {} } },
308
- );
309
-
310
- this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
311
- tools: this.tools,
312
- }));
313
-
314
- this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
315
- const { name, arguments: args = {} } = request.params;
316
-
317
- try {
318
- switch (name) {
319
- case "analyze_code": return this.handleAnalyzeCode(args);
320
- case "calculate_complexity": return this.handleCalculateComplexity(args);
321
- case "detect_code_smells": return this.handleDetectCodeSmells(args);
322
- case "extract_metrics": return this.handleExtractMetrics(args);
323
- case "explore_codebase": return this.handleExploreCodebase(args);
324
- case "find_patterns": return this.handleFindPatterns(args);
325
- case "find_function": return this.handleFindFunction(args);
326
- case "get_file_structure": return this.handleGetFileStructure(args);
327
- case "analyze_dependencies": return this.handleAnalyzeDependencies(args);
328
- case "find_duplicates": return this.handleFindDuplicates(args);
329
- default: throw new Error(`Unknown tool: ${name}`);
330
- }
331
- } catch (error) {
332
- return {
333
- content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }],
334
- isError: true,
335
- };
336
- }
337
- });
298
+ super("code-analyzer", "2.0.1");
299
+ this.tools = this.toolDefinitions;
300
+ this.handlers = {
301
+ "analyze_code": async (args) => this.handleAnalyzeCode(args),
302
+ "calculate_complexity": async (args) => this.handleCalculateComplexity(args),
303
+ "detect_code_smells": async (args) => this.handleDetectCodeSmells(args),
304
+ "extract_metrics": async (args) => this.handleExtractMetrics(args),
305
+ "explore_codebase": async (args) => this.handleExploreCodebase(args),
306
+ "find_patterns": async (args) => this.handleFindPatterns(args),
307
+ "find_function": async (args) => this.handleFindFunction(args),
308
+ "get_file_structure": async (args) => this.handleGetFileStructure(args),
309
+ "analyze_dependencies": async (args) => this.handleAnalyzeDependencies(args),
310
+ "find_duplicates": async (args) => this.handleFindDuplicates(args),
311
+ };
312
+ this.setupToolHandlers();
338
313
  }
339
314
 
340
315
  private handleAnalyzeCode(args: unknown) {
@@ -575,17 +550,7 @@ class CodeAnalyzerServer {
575
550
  return { content: [{ type: "text", text: JSON.stringify({ totalDuplicates: duplicates.length, duplicates }, null, 2) }] };
576
551
  }
577
552
 
578
- async run(): Promise<void> {
579
- const transport = new StdioServerTransport();
580
- await this.server.connect(transport);
581
-
582
- // Use centralized shutdown handler
583
- createGracefulShutdown({
584
- serverName: "code-analyzer.server",
585
- server: this.server,
586
- });
587
- }
588
553
  }
589
554
 
590
- if (import.meta.url === `file://${process.argv[1]}`) { new CodeAnalyzerServer().run().catch(() => {}); }
555
+ if (import.meta.url === `file://${process.argv[1]}`) { new CodeAnalyzerServer().run("code-analyzer.server").catch((err) => { frameworkLogger.log("code-analyzer", "run", "error", { error: err instanceof Error ? err.message : String(err) }); }); }
591
556
  export default CodeAnalyzerServer;