0xray 2.1.2 → 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.
- package/.opencode/codex.codex +1 -1
- package/.opencode/commands/dependency-audit.md +3 -3
- package/.opencode/enforcer-config.json +2 -2
- package/AGENTS.md +2 -1
- package/README.md +12 -11
- package/dist/AGENTS.md +2 -1
- package/dist/CHANGELOG.md +26 -0
- package/dist/README.md +12 -11
- package/dist/agents/code-reviewer.js +1 -1
- package/dist/analytics/routing-refiner.js +1 -1
- package/dist/cli/index.js +11 -1
- package/dist/cli/server.js +3 -3
- package/dist/core/activity-logger.d.ts +2 -2
- package/dist/core/activity-logger.js +4 -4
- package/dist/core/boot-orchestrator.d.ts +1 -1
- package/dist/core/boot-orchestrator.js +13 -28
- package/dist/core/bridge.mjs +3 -3
- package/dist/core/codex-formatter.js +2 -2
- package/dist/core/codex-injector.d.ts +0 -1
- package/dist/core/codex-injector.js +2 -3
- package/dist/core/config-loader.d.ts +1 -1
- package/dist/core/config-loader.js +1 -1
- package/dist/core/config-paths.d.ts +0 -2
- package/dist/core/config-paths.js +7 -8
- package/dist/core/context-loader.d.ts +1 -1
- package/dist/core/context-loader.js +1 -1
- package/dist/core/errors.d.ts +3 -0
- package/dist/core/errors.js +10 -0
- package/dist/core/features-config.js +1 -1
- package/dist/core/framework-logger.d.ts +3 -3
- package/dist/core/framework-logger.js +17 -9
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +4 -2
- package/dist/core/logging-config.d.ts +2 -1
- package/dist/core/logging-config.js +7 -7
- package/dist/enforcement/loaders/codex-loader.js +1 -1
- package/dist/execution/opencode-cli-invoker.js +5 -5
- package/dist/governance/governance-service.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/inference/inference-cycle.d.ts +1 -1
- package/dist/inference/inference-cycle.js +10 -10
- package/dist/integrations/base/Integration.js +1 -1
- package/dist/integrations/base/registry.js +19 -19
- package/dist/integrations/grok/grok-cli.js +17 -17
- package/dist/integrations/grok/hooks/pre-tool-use.js +1 -1
- package/dist/integrations/hermes-agent/bridge.mjs +1 -1
- package/dist/integrations/openclaw/api-server.d.ts +0 -1
- package/dist/integrations/openclaw/api-server.js +7 -10
- package/dist/integrations/openclaw/client.d.ts +0 -1
- package/dist/integrations/openclaw/client.js +22 -24
- package/dist/integrations/openclaw/hooks/xray-hooks.d.ts +0 -1
- package/dist/integrations/openclaw/hooks/xray-hooks.js +17 -18
- package/dist/integrations/plugins/plugin-registry.js +5 -5
- package/dist/mcps/architect-tools.server.d.ts +2 -4
- package/dist/mcps/architect-tools.server.js +112 -195
- package/dist/mcps/auto-format.server.d.ts +2 -4
- package/dist/mcps/auto-format.server.js +49 -95
- package/dist/mcps/boot-orchestrator.server.d.ts +2 -4
- package/dist/mcps/boot-orchestrator.server.js +73 -105
- package/dist/mcps/config/server-config-registry.js +3 -3
- package/dist/mcps/enforcer-tools.server.d.ts +2 -4
- package/dist/mcps/enforcer-tools.server.js +202 -285
- package/dist/mcps/estimation.server.d.ts +2 -4
- package/dist/mcps/estimation.server.js +63 -107
- package/dist/mcps/framework-compliance-audit.server.d.ts +2 -4
- package/dist/mcps/framework-compliance-audit.server.js +53 -82
- package/dist/mcps/framework-help.server.d.ts +2 -4
- package/dist/mcps/framework-help.server.js +63 -101
- package/dist/mcps/governance.server.js +2 -2
- package/dist/mcps/knowledge-skills/api-design.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/api-design.server.js +35 -67
- package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +2 -10
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +35 -74
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +143 -162
- package/dist/mcps/knowledge-skills/code-analyzer.server.d.ts +3 -4
- package/dist/mcps/knowledge-skills/code-analyzer.server.js +20 -45
- package/dist/mcps/knowledge-skills/code-review.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/code-review.server.js +109 -143
- package/dist/mcps/knowledge-skills/content-creator.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/content-creator.server.js +205 -226
- package/dist/mcps/knowledge-skills/database-design.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/database-design.server.js +117 -151
- package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +71 -160
- package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/git-workflow.server.js +36 -68
- package/dist/mcps/knowledge-skills/growth-strategist.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/growth-strategist.server.js +303 -324
- package/dist/mcps/knowledge-skills/log-monitor.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/log-monitor.server.js +141 -160
- package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/mobile-development.server.js +92 -209
- package/dist/mcps/knowledge-skills/multimodal-looker.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/multimodal-looker.server.js +123 -159
- package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +2 -5
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +155 -296
- package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/project-analysis.server.js +75 -226
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +63 -156
- package/dist/mcps/knowledge-skills/security-audit.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/security-audit.server.js +102 -136
- package/dist/mcps/knowledge-skills/seo-consultant.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/seo-consultant.server.js +80 -203
- package/dist/mcps/knowledge-skills/session-management.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/session-management.server.js +50 -203
- package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +168 -347
- package/dist/mcps/knowledge-skills/strategist.server.d.ts +2 -11
- package/dist/mcps/knowledge-skills/strategist.server.js +72 -122
- package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/tech-writer.server.js +87 -300
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +147 -182
- package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +78 -153
- package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +2 -5
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +90 -399
- package/dist/mcps/lint.server.d.ts +2 -4
- package/dist/mcps/lint.server.js +51 -92
- package/dist/mcps/mcp-client.js +2 -2
- package/dist/mcps/model-health-check.server.d.ts +2 -4
- package/dist/mcps/model-health-check.server.js +32 -60
- package/dist/mcps/performance-analysis.server.d.ts +2 -4
- package/dist/mcps/performance-analysis.server.js +57 -88
- package/dist/mcps/processor-pipeline.server.d.ts +2 -4
- package/dist/mcps/processor-pipeline.server.js +69 -100
- package/dist/mcps/registry.json +1 -1
- package/dist/mcps/researcher.server.d.ts +3 -5
- package/dist/mcps/researcher.server.js +81 -154
- package/dist/mcps/security-scan.server.d.ts +2 -4
- package/dist/mcps/security-scan.server.js +54 -96
- package/dist/mcps/shared/knowledge-skill-base.d.ts +14 -0
- package/dist/mcps/shared/knowledge-skill-base.js +45 -0
- package/dist/{security → mcps/shared}/security-scanner.js +1 -1
- package/dist/mcps/state-manager.server.d.ts +2 -4
- package/dist/mcps/state-manager.server.js +115 -160
- package/dist/orchestrator/orchestrator.d.ts +1 -1
- package/dist/orchestrator/orchestrator.js +1 -1
- package/dist/orchestrator/universal-registry-bridge.js +1 -1
- package/dist/plugin/xray-codex-injection.d.ts +1 -1
- package/dist/plugin/xray-codex-injection.js +1 -1
- package/dist/postprocessor/PostProcessor.d.ts +4 -44
- package/dist/postprocessor/PostProcessor.js +39 -553
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +11 -0
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
- package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.d.ts +11 -0
- package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.js +356 -0
- package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +44 -0
- package/dist/postprocessor/config/ProcessorConfigLoader.js +21 -0
- package/dist/postprocessor/reporting/PostProcessorReporter.d.ts +19 -0
- package/dist/postprocessor/reporting/PostProcessorReporter.js +96 -0
- package/dist/postprocessor/triggers/GitHookTrigger.js +11 -11
- package/dist/processors/implementations/refactoring-logging-processor-wrapper.d.ts +32 -0
- package/dist/processors/implementations/refactoring-logging-processor-wrapper.js +95 -1
- package/dist/processors/processor-manager.js +346 -314
- package/dist/reporting/report-formatter.js +1 -1
- package/dist/security/security-hardener.d.ts +69 -2
- package/dist/security/security-hardener.js +129 -1
- package/dist/skills/registry.json +1 -1
- package/dist/state/index.d.ts +3 -5
- package/dist/state/index.js +1 -7
- package/dist/state/state-manager.d.ts +1 -1
- package/dist/state/state-manager.js +2 -3
- package/package.json +13 -10
- package/scripts/node/universal-version-manager.js +11 -11
- package/src/mcps/architect-tools.server.ts +112 -215
- package/src/mcps/auto-format.server.ts +50 -110
- package/src/mcps/boot-orchestrator.server.ts +75 -121
- package/src/mcps/config/__tests__/server-config-registry.test.ts +21 -12
- package/src/mcps/config/server-config-registry.ts +3 -3
- package/src/mcps/enforcer-tools.server.ts +212 -310
- package/src/mcps/estimation.server.ts +62 -122
- package/src/mcps/framework-compliance-audit.server.ts +52 -97
- package/src/mcps/framework-help.server.ts +64 -114
- package/src/mcps/governance.server.ts +2 -2
- package/src/mcps/knowledge-skills/api-design.server.ts +32 -77
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +31 -87
- package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +165 -193
- package/src/mcps/knowledge-skills/code-analyzer.server.ts +20 -55
- package/src/mcps/knowledge-skills/code-review.server.ts +114 -161
- package/src/mcps/knowledge-skills/content-creator.server.ts +218 -255
- package/src/mcps/knowledge-skills/database-design.server.ts +118 -165
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +67 -172
- package/src/mcps/knowledge-skills/git-workflow.server.ts +32 -77
- package/src/mcps/knowledge-skills/growth-strategist.server.ts +324 -361
- package/src/mcps/knowledge-skills/log-monitor.server.ts +160 -187
- package/src/mcps/knowledge-skills/mobile-development.server.ts +89 -223
- package/src/mcps/knowledge-skills/multimodal-looker.server.ts +128 -175
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +156 -329
- package/src/mcps/knowledge-skills/project-analysis.server.ts +72 -248
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +59 -171
- package/src/mcps/knowledge-skills/security-audit.server.ts +104 -151
- package/src/mcps/knowledge-skills/seo-consultant.server.ts +80 -220
- package/src/mcps/knowledge-skills/session-management.server.ts +51 -232
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +165 -372
- package/src/mcps/knowledge-skills/strategist.server.ts +72 -143
- package/src/mcps/knowledge-skills/tech-writer.server.ts +85 -350
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +146 -195
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +75 -161
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +93 -487
- package/src/mcps/lint.server.ts +53 -107
- package/src/mcps/mcp-client.ts +2 -2
- package/src/mcps/model-health-check.server.ts +34 -71
- package/src/mcps/performance-analysis.server.ts +60 -104
- package/src/mcps/processor-pipeline.server.ts +72 -110
- package/src/mcps/registry.json +1 -1
- package/src/mcps/researcher.server.ts +88 -177
- package/src/mcps/security-scan.server.ts +55 -104
- package/src/mcps/shared/knowledge-skill-base.ts +62 -0
- package/src/mcps/shared/prompt-security-validator.ts +199 -0
- package/src/mcps/shared/security-scanner.ts +599 -0
- package/src/mcps/state-manager.server.ts +117 -175
- package/src/opencode/codex.codex +1 -1
- package/src/opencode/commands/dependency-audit.md +3 -3
- package/src/opencode/enforcer-config.json +2 -2
- package/src/skills/registry.json +1 -1
- package/xray/codex.json +1 -1
- package/xray/config.json +1 -1
- package/xray/features.json +1 -1
- package/xray/integrations.json +3 -3
- package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313-pytest-9.0.2.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/conftest.py +0 -14
- package/dist/integrations/hermes-agent/test_plugin.py +0 -1103
- package/dist/processors/implementations/refactoring-logging-processor.d.ts +0 -31
- package/dist/processors/implementations/refactoring-logging-processor.js +0 -96
- package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
- package/dist/processors/implementations/session-capture-processor.js +0 -37
- package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
- package/dist/scripts/activate-kernel-pipeline.js +0 -101
- package/dist/security/index.d.ts +0 -13
- package/dist/security/index.js +0 -13
- package/dist/security/security-agent-coordinator.d.ts +0 -72
- package/dist/security/security-agent-coordinator.js +0 -204
- package/dist/security/security-auditor.d.ts +0 -56
- package/dist/security/security-auditor.js +0 -584
- package/dist/security/security-hardening-system.d.ts +0 -239
- package/dist/security/security-hardening-system.js +0 -727
- package/dist/security/security-orchestration-layer.d.ts +0 -119
- package/dist/security/security-orchestration-layer.js +0 -496
- /package/dist/{security → mcps/shared}/prompt-security-validator.d.ts +0 -0
- /package/dist/{security → mcps/shared}/prompt-security-validator.js +0 -0
- /package/dist/{security → mcps/shared}/security-scanner.d.ts +0 -0
|
@@ -5,16 +5,10 @@
|
|
|
5
5
|
* code documentation maintenance, and technical writing assistance
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
CallToolRequestSchema,
|
|
12
|
-
ListToolsRequestSchema,
|
|
13
|
-
type CallToolResult,
|
|
14
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
|
|
9
|
+
import { frameworkLogger } from "../../core/framework-logger.js";
|
|
15
10
|
import * as fs from "fs";
|
|
16
11
|
import * as path from "path";
|
|
17
|
-
import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
|
|
18
12
|
|
|
19
13
|
interface DocumentationAnalysis {
|
|
20
14
|
completeness: number; // 0-100
|
|
@@ -160,197 +154,73 @@ interface ProjectStructureAnalysis {
|
|
|
160
154
|
structure: Record<string, unknown>;
|
|
161
155
|
}
|
|
162
156
|
|
|
163
|
-
class XrayDocumentationGenerationServer {
|
|
164
|
-
private server: Server;
|
|
165
|
-
|
|
157
|
+
class XrayDocumentationGenerationServer extends XrayKnowledgeSkillBase {
|
|
166
158
|
constructor() {
|
|
167
|
-
|
|
159
|
+
super("documentation-generation", "2.0.1");
|
|
160
|
+
this.tools = [
|
|
168
161
|
{
|
|
169
|
-
name: "
|
|
162
|
+
name: "analyze_documentation",
|
|
163
|
+
description: "Analyze existing documentation for completeness, quality, and gaps",
|
|
164
|
+
inputSchema: {
|
|
165
|
+
type: "object",
|
|
166
|
+
properties: {
|
|
167
|
+
docsPath: { type: "string", description: "Path to documentation directory or files" },
|
|
168
|
+
codePath: { type: "string", description: "Path to corresponding code for comparison" },
|
|
169
|
+
docTypes: { type: "array", items: { type: "string", enum: ["readme", "api", "code", "architecture", "deployment", "user-guide"] }, description: "Types of documentation to analyze" },
|
|
170
|
+
},
|
|
171
|
+
required: ["docsPath"],
|
|
172
|
+
},
|
|
170
173
|
},
|
|
171
174
|
{
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
name: "generate_api_docs",
|
|
176
|
+
description: "Generate comprehensive API documentation from code analysis",
|
|
177
|
+
inputSchema: {
|
|
178
|
+
type: "object",
|
|
179
|
+
properties: {
|
|
180
|
+
codePath: { type: "string", description: "Path to API code files" },
|
|
181
|
+
framework: { type: "string", enum: ["express", "fastify", "koa", "nestjs", "spring", "django", "flask", "fastapi"], description: "API framework being used" },
|
|
182
|
+
format: { type: "string", enum: ["openapi", "markdown", "html", "postman"], description: "Output documentation format", default: "openapi" },
|
|
183
|
+
includeExamples: { type: "boolean", description: "Include request/response examples", default: true },
|
|
184
|
+
},
|
|
185
|
+
required: ["codePath", "framework"],
|
|
174
186
|
},
|
|
175
187
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
{
|
|
187
|
-
name: "analyze_documentation",
|
|
188
|
-
description:
|
|
189
|
-
"Analyze existing documentation for completeness, quality, and gaps",
|
|
190
|
-
inputSchema: {
|
|
191
|
-
type: "object",
|
|
192
|
-
properties: {
|
|
193
|
-
docsPath: {
|
|
194
|
-
type: "string",
|
|
195
|
-
description: "Path to documentation directory or files",
|
|
196
|
-
},
|
|
197
|
-
codePath: {
|
|
198
|
-
type: "string",
|
|
199
|
-
description: "Path to corresponding code for comparison",
|
|
200
|
-
},
|
|
201
|
-
docTypes: {
|
|
202
|
-
type: "array",
|
|
203
|
-
items: {
|
|
204
|
-
type: "string",
|
|
205
|
-
enum: [
|
|
206
|
-
"readme",
|
|
207
|
-
"api",
|
|
208
|
-
"code",
|
|
209
|
-
"architecture",
|
|
210
|
-
"deployment",
|
|
211
|
-
"user-guide",
|
|
212
|
-
],
|
|
213
|
-
},
|
|
214
|
-
description: "Types of documentation to analyze",
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
required: ["docsPath"],
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: "generate_api_docs",
|
|
222
|
-
description:
|
|
223
|
-
"Generate comprehensive API documentation from code analysis",
|
|
224
|
-
inputSchema: {
|
|
225
|
-
type: "object",
|
|
226
|
-
properties: {
|
|
227
|
-
codePath: {
|
|
228
|
-
type: "string",
|
|
229
|
-
description: "Path to API code files",
|
|
230
|
-
},
|
|
231
|
-
framework: {
|
|
232
|
-
type: "string",
|
|
233
|
-
enum: [
|
|
234
|
-
"express",
|
|
235
|
-
"fastify",
|
|
236
|
-
"koa",
|
|
237
|
-
"nestjs",
|
|
238
|
-
"spring",
|
|
239
|
-
"django",
|
|
240
|
-
"flask",
|
|
241
|
-
"fastapi",
|
|
242
|
-
],
|
|
243
|
-
description: "API framework being used",
|
|
244
|
-
},
|
|
245
|
-
format: {
|
|
246
|
-
type: "string",
|
|
247
|
-
enum: ["openapi", "markdown", "html", "postman"],
|
|
248
|
-
description: "Output documentation format",
|
|
249
|
-
default: "openapi",
|
|
250
|
-
},
|
|
251
|
-
includeExamples: {
|
|
252
|
-
type: "boolean",
|
|
253
|
-
description: "Include request/response examples",
|
|
254
|
-
default: true,
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
required: ["codePath", "framework"],
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
name: "generate_code_documentation",
|
|
262
|
-
description:
|
|
263
|
-
"Generate inline code documentation and improve existing docs",
|
|
264
|
-
inputSchema: {
|
|
265
|
-
type: "object",
|
|
266
|
-
properties: {
|
|
267
|
-
codePath: {
|
|
268
|
-
type: "string",
|
|
269
|
-
description: "Path to code files to document",
|
|
270
|
-
},
|
|
271
|
-
language: {
|
|
272
|
-
type: "string",
|
|
273
|
-
enum: [
|
|
274
|
-
"typescript",
|
|
275
|
-
"javascript",
|
|
276
|
-
"python",
|
|
277
|
-
"java",
|
|
278
|
-
"csharp",
|
|
279
|
-
"go",
|
|
280
|
-
"rust",
|
|
281
|
-
],
|
|
282
|
-
description: "Programming language",
|
|
283
|
-
},
|
|
284
|
-
style: {
|
|
285
|
-
type: "string",
|
|
286
|
-
enum: ["jsdoc", "docstring", "xml", "markdown"],
|
|
287
|
-
description: "Documentation comment style",
|
|
288
|
-
default: "jsdoc",
|
|
289
|
-
},
|
|
290
|
-
includePrivate: {
|
|
291
|
-
type: "boolean",
|
|
292
|
-
description: "Include documentation for private members",
|
|
293
|
-
default: false,
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
required: ["codePath", "language"],
|
|
297
|
-
},
|
|
188
|
+
{
|
|
189
|
+
name: "generate_code_documentation",
|
|
190
|
+
description: "Generate inline code documentation and improve existing docs",
|
|
191
|
+
inputSchema: {
|
|
192
|
+
type: "object",
|
|
193
|
+
properties: {
|
|
194
|
+
codePath: { type: "string", description: "Path to code files to document" },
|
|
195
|
+
language: { type: "string", enum: ["typescript", "javascript", "python", "java", "csharp", "go", "rust"], description: "Programming language" },
|
|
196
|
+
style: { type: "string", enum: ["jsdoc", "docstring", "xml", "markdown"], description: "Documentation comment style", default: "jsdoc" },
|
|
197
|
+
includePrivate: { type: "boolean", description: "Include documentation for private members", default: false },
|
|
298
198
|
},
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
description: "Type of project",
|
|
313
|
-
},
|
|
314
|
-
includeSections: {
|
|
315
|
-
type: "array",
|
|
316
|
-
items: { type: "string" },
|
|
317
|
-
description: "Specific sections to include",
|
|
318
|
-
default: [
|
|
319
|
-
"installation",
|
|
320
|
-
"usage",
|
|
321
|
-
"api",
|
|
322
|
-
"contributing",
|
|
323
|
-
"license",
|
|
324
|
-
],
|
|
325
|
-
},
|
|
326
|
-
existingReadme: {
|
|
327
|
-
type: "string",
|
|
328
|
-
description: "Path to existing README to improve",
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
required: ["projectPath", "projectType"],
|
|
332
|
-
},
|
|
199
|
+
required: ["codePath", "language"],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "generate_readme",
|
|
204
|
+
description: "Generate or improve project README documentation",
|
|
205
|
+
inputSchema: {
|
|
206
|
+
type: "object",
|
|
207
|
+
properties: {
|
|
208
|
+
projectPath: { type: "string", description: "Path to project root directory" },
|
|
209
|
+
projectType: { type: "string", enum: ["library", "application", "api", "cli", "framework"], description: "Type of project" },
|
|
210
|
+
includeSections: { type: "array", items: { type: "string" }, description: "Specific sections to include", default: ["installation", "usage", "api", "contributing", "license"] },
|
|
211
|
+
existingReadme: { type: "string", description: "Path to existing README to improve" },
|
|
333
212
|
},
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
this.
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return await this.generateAPIDocs(args as unknown as GenerateAPIDocsArgs) as CallToolResult;
|
|
346
|
-
case "generate_code_documentation":
|
|
347
|
-
return await this.generateCodeDocumentation(args as unknown as GenerateCodeDocumentationArgs) as CallToolResult;
|
|
348
|
-
case "generate_readme":
|
|
349
|
-
return await this.generateReadme(args as unknown as GenerateReadmeArgs) as CallToolResult;
|
|
350
|
-
default:
|
|
351
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
213
|
+
required: ["projectPath", "projectType"],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
];
|
|
217
|
+
this.handlers = {
|
|
218
|
+
"analyze_documentation": async (args) => this.analyzeDocumentation(args as unknown as AnalyzeDocumentationArgs),
|
|
219
|
+
"generate_api_docs": async (args) => this.generateAPIDocs(args as unknown as GenerateAPIDocsArgs),
|
|
220
|
+
"generate_code_documentation": async (args) => this.generateCodeDocumentation(args as unknown as GenerateCodeDocumentationArgs),
|
|
221
|
+
"generate_readme": async (args) => this.generateReadme(args as unknown as GenerateReadmeArgs),
|
|
222
|
+
};
|
|
223
|
+
this.setupToolHandlers();
|
|
354
224
|
}
|
|
355
225
|
|
|
356
226
|
private async analyzeDocumentation(args: AnalyzeDocumentationArgs) {
|
|
@@ -618,68 +488,24 @@ class XrayDocumentationGenerationServer {
|
|
|
618
488
|
docsPath: string,
|
|
619
489
|
docType: string,
|
|
620
490
|
): Promise<number> {
|
|
621
|
-
|
|
622
|
-
|
|
491
|
+
const keywordMap: Record<string, string[]> = {
|
|
492
|
+
readme: ["readme"],
|
|
493
|
+
api: ["api", "swagger", "openapi"],
|
|
494
|
+
code: ["code"],
|
|
495
|
+
architecture: ["arch", "design"],
|
|
496
|
+
deployment: ["deploy"],
|
|
497
|
+
"user-guide": ["guide", "tutorial"],
|
|
498
|
+
};
|
|
499
|
+
const keywords = keywordMap[docType];
|
|
500
|
+
if (!keywords) return 0;
|
|
623
501
|
try {
|
|
624
502
|
const files = fs.readdirSync(docsPath, { recursive: true });
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
coverage = files.some(
|
|
629
|
-
(f) => typeof f === "string" && f.toLowerCase().includes("readme"),
|
|
630
|
-
)
|
|
631
|
-
? 100
|
|
632
|
-
: 0;
|
|
633
|
-
break;
|
|
634
|
-
case "api":
|
|
635
|
-
coverage = files.some(
|
|
636
|
-
(f) =>
|
|
637
|
-
typeof f === "string" &&
|
|
638
|
-
(f.includes("api") ||
|
|
639
|
-
f.includes("swagger") ||
|
|
640
|
-
f.includes("openapi")),
|
|
641
|
-
)
|
|
642
|
-
? 100
|
|
643
|
-
: 0;
|
|
644
|
-
break;
|
|
645
|
-
case "code":
|
|
646
|
-
coverage = files.some(
|
|
647
|
-
(f) => typeof f === "string" && f.includes("code"),
|
|
648
|
-
)
|
|
649
|
-
? 100
|
|
650
|
-
: 0;
|
|
651
|
-
break;
|
|
652
|
-
case "architecture":
|
|
653
|
-
coverage = files.some(
|
|
654
|
-
(f) =>
|
|
655
|
-
typeof f === "string" &&
|
|
656
|
-
(f.includes("arch") || f.includes("design")),
|
|
657
|
-
)
|
|
658
|
-
? 100
|
|
659
|
-
: 0;
|
|
660
|
-
break;
|
|
661
|
-
case "deployment":
|
|
662
|
-
coverage = files.some(
|
|
663
|
-
(f) => typeof f === "string" && f.includes("deploy"),
|
|
664
|
-
)
|
|
665
|
-
? 100
|
|
666
|
-
: 0;
|
|
667
|
-
break;
|
|
668
|
-
case "user-guide":
|
|
669
|
-
coverage = files.some(
|
|
670
|
-
(f) =>
|
|
671
|
-
typeof f === "string" &&
|
|
672
|
-
(f.includes("guide") || f.includes("tutorial")),
|
|
673
|
-
)
|
|
674
|
-
? 100
|
|
675
|
-
: 0;
|
|
676
|
-
break;
|
|
677
|
-
}
|
|
503
|
+
return files.some(
|
|
504
|
+
(f) => typeof f === "string" && keywords.some((k) => f.toLowerCase().includes(k)),
|
|
505
|
+
) ? 100 : 0;
|
|
678
506
|
} catch {
|
|
679
|
-
|
|
507
|
+
return 0;
|
|
680
508
|
}
|
|
681
|
-
|
|
682
|
-
return coverage;
|
|
683
509
|
}
|
|
684
510
|
|
|
685
511
|
private async compareDocsWithCode(
|
|
@@ -1053,7 +879,7 @@ class XrayDocumentationGenerationServer {
|
|
|
1053
879
|
openapi: "3.0.0",
|
|
1054
880
|
info: {
|
|
1055
881
|
title: "API Documentation",
|
|
1056
|
-
version: "2.
|
|
882
|
+
version: "2.1.1",
|
|
1057
883
|
description: "Generated API documentation",
|
|
1058
884
|
},
|
|
1059
885
|
servers: [
|
|
@@ -1393,19 +1219,8 @@ class XrayDocumentationGenerationServer {
|
|
|
1393
1219
|
|
|
1394
1220
|
// This would generate actual documentation comments based on code analysis
|
|
1395
1221
|
// For now, return sample comments
|
|
1396
|
-
comments.push(
|
|
1397
|
-
|
|
1398
|
-
* @param {string} param1 - First parameter
|
|
1399
|
-
* @param {number} param2 - Second parameter
|
|
1400
|
-
* @returns {boolean} Result of operation
|
|
1401
|
-
*/`);
|
|
1402
|
-
|
|
1403
|
-
comments.push(`/**
|
|
1404
|
-
* Sample class documentation
|
|
1405
|
-
* @class
|
|
1406
|
-
* @description Represents a sample class
|
|
1407
|
-
*/`);
|
|
1408
|
-
|
|
1222
|
+
comments.push("/** Sample function documentation */");
|
|
1223
|
+
comments.push("/** Sample class documentation */");
|
|
1409
1224
|
return comments;
|
|
1410
1225
|
}
|
|
1411
1226
|
|
|
@@ -1514,97 +1329,27 @@ class XrayDocumentationGenerationServer {
|
|
|
1514
1329
|
}
|
|
1515
1330
|
|
|
1516
1331
|
private generateInstallationSection(projectAnalysis: ProjectStructureAnalysis): string {
|
|
1517
|
-
let content = "## Installation\n\n";
|
|
1518
|
-
|
|
1519
|
-
if (
|
|
1520
|
-
projectAnalysis.languages.includes("JavaScript") ||
|
|
1521
|
-
projectAnalysis.languages.includes("TypeScript")
|
|
1522
|
-
) {
|
|
1523
|
-
content += "```bash\n";
|
|
1524
|
-
content += "# Clone the repository\n";
|
|
1525
|
-
content += "git clone <repository-url>\n";
|
|
1526
|
-
content += "cd <project-directory>\n\n";
|
|
1527
|
-
content += "# Install dependencies\n";
|
|
1528
|
-
content += "npm install\n";
|
|
1529
|
-
content += "# or\n";
|
|
1530
|
-
content += "yarn install\n";
|
|
1531
|
-
content += "```\n\n";
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1332
|
+
let content = "## Installation\n\n```bash\n# Install dependencies\nnpm install\n```\n\n";
|
|
1534
1333
|
if (projectAnalysis.languages.includes("Python")) {
|
|
1535
|
-
content += "```bash\n";
|
|
1536
|
-
content += "# Install with pip\n";
|
|
1537
|
-
content += "pip install <package-name>\n\n";
|
|
1538
|
-
content += "# Or install from source\n";
|
|
1539
|
-
content += "git clone <repository-url>\n";
|
|
1540
|
-
content += "cd <project-directory>\n";
|
|
1541
|
-
content += "pip install -e .\n";
|
|
1542
|
-
content += "```\n\n";
|
|
1334
|
+
content += "```bash\npip install <package-name>\n```\n\n";
|
|
1543
1335
|
}
|
|
1544
|
-
|
|
1545
1336
|
return content;
|
|
1546
1337
|
}
|
|
1547
1338
|
|
|
1548
1339
|
private generateUsageSection(projectAnalysis: ProjectStructureAnalysis): string {
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
content += "```javascript\n";
|
|
1552
|
-
content += "// Basic usage example\n";
|
|
1553
|
-
content += "const result = await performOperation();\n";
|
|
1554
|
-
content += "console.log(result);\n";
|
|
1555
|
-
content += "```\n\n";
|
|
1556
|
-
|
|
1557
|
-
content += "### Advanced Usage\n\n";
|
|
1558
|
-
content +=
|
|
1559
|
-
"For more advanced features, see the [API documentation](./docs/api.md).\n\n";
|
|
1560
|
-
|
|
1561
|
-
return content;
|
|
1340
|
+
return "## Usage\n\n```javascript\n// Example usage\nconst result = await performOperation();\n```\n\nFor advanced usage, see [API docs](./docs/api.md).\n\n";
|
|
1562
1341
|
}
|
|
1563
1342
|
|
|
1564
1343
|
private generateAPISection(projectAnalysis: ProjectStructureAnalysis): string {
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
content += "### Core Functions\n\n";
|
|
1568
|
-
content += "- `performOperation()` - Performs the main operation\n";
|
|
1569
|
-
content += "- `configure(options)` - Configures the library\n";
|
|
1570
|
-
content += "- `validateInput(input)` - Validates input data\n\n";
|
|
1571
|
-
|
|
1572
|
-
content +=
|
|
1573
|
-
"For detailed API documentation, see [API Reference](./docs/api.md).\n\n";
|
|
1574
|
-
|
|
1575
|
-
return content;
|
|
1344
|
+
return "## API\n\nSee [API Reference](./docs/api.md) for complete documentation.\n\n";
|
|
1576
1345
|
}
|
|
1577
1346
|
|
|
1578
1347
|
private generateContributingSection(): string {
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
content +=
|
|
1582
|
-
"We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details.\n\n";
|
|
1583
|
-
|
|
1584
|
-
content += "### Development Setup\n\n";
|
|
1585
|
-
content += "```bash\n";
|
|
1586
|
-
content += "git clone <repository-url>\n";
|
|
1587
|
-
content += "cd <project-directory>\n";
|
|
1588
|
-
content += "npm install\n";
|
|
1589
|
-
content += "npm run dev\n";
|
|
1590
|
-
content += "```\n\n";
|
|
1591
|
-
|
|
1592
|
-
content += "### Testing\n\n";
|
|
1593
|
-
content += "```bash\n";
|
|
1594
|
-
content += "npm test\n";
|
|
1595
|
-
content += "npm run test:coverage\n";
|
|
1596
|
-
content += "```\n\n";
|
|
1597
|
-
|
|
1598
|
-
return content;
|
|
1348
|
+
return "## Contributing\n\nSee [Contributing Guide](./CONTRIBUTING.md).\n\n";
|
|
1599
1349
|
}
|
|
1600
1350
|
|
|
1601
1351
|
private generateLicenseSection(): string {
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
content +=
|
|
1605
|
-
"This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n";
|
|
1606
|
-
|
|
1607
|
-
return content;
|
|
1352
|
+
return "## License\n\nMIT License - see [LICENSE](LICENSE).\n\n";
|
|
1608
1353
|
}
|
|
1609
1354
|
|
|
1610
1355
|
private getSeverityIcon(severity: string): string {
|
|
@@ -1617,22 +1362,12 @@ class XrayDocumentationGenerationServer {
|
|
|
1617
1362
|
return icons[severity as keyof typeof icons] || "❓";
|
|
1618
1363
|
}
|
|
1619
1364
|
|
|
1620
|
-
async run(): Promise<void> {
|
|
1621
|
-
const transport = new StdioServerTransport();
|
|
1622
|
-
await this.server.connect(transport);
|
|
1623
|
-
|
|
1624
|
-
// Use centralized shutdown handler
|
|
1625
|
-
createGracefulShutdown({
|
|
1626
|
-
serverName: "tech-writer.server",
|
|
1627
|
-
server: this.server,
|
|
1628
|
-
});
|
|
1629
|
-
}
|
|
1630
1365
|
}
|
|
1631
1366
|
|
|
1632
1367
|
// Run the server if this file is executed directly
|
|
1633
1368
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
1634
1369
|
const server = new XrayDocumentationGenerationServer();
|
|
1635
|
-
server.run().catch(() => {});
|
|
1370
|
+
server.run("documentation-generation.server").catch((err) => { frameworkLogger.log("tech-writer", "run", "error", { error: err instanceof Error ? err.message : String(err) }); });
|
|
1636
1371
|
}
|
|
1637
1372
|
|
|
1638
1373
|
export { XrayDocumentationGenerationServer };
|