stringray-ai 1.0.0
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/.mcp.json +68 -0
- package/LICENSE +21 -0
- package/README.md +618 -0
- package/dist/agents/architect.d.ts +3 -0
- package/dist/agents/architect.d.ts.map +1 -0
- package/dist/agents/architect.js +84 -0
- package/dist/agents/architect.js.map +1 -0
- package/dist/agents/bug-triage-specialist.d.ts +3 -0
- package/dist/agents/bug-triage-specialist.d.ts.map +1 -0
- package/dist/agents/bug-triage-specialist.js +66 -0
- package/dist/agents/bug-triage-specialist.js.map +1 -0
- package/dist/agents/code-reviewer.d.ts +3 -0
- package/dist/agents/code-reviewer.d.ts.map +1 -0
- package/dist/agents/code-reviewer.js +66 -0
- package/dist/agents/code-reviewer.js.map +1 -0
- package/dist/agents/enforcer.d.ts +3 -0
- package/dist/agents/enforcer.d.ts.map +1 -0
- package/dist/agents/enforcer.js +109 -0
- package/dist/agents/enforcer.js.map +1 -0
- package/dist/agents/index.d.ts +15 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +26 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/librarian.d.ts +3 -0
- package/dist/agents/librarian.d.ts.map +1 -0
- package/dist/agents/librarian.js +70 -0
- package/dist/agents/librarian.js.map +1 -0
- package/dist/agents/log-monitor.d.ts +3 -0
- package/dist/agents/log-monitor.d.ts.map +1 -0
- package/dist/agents/log-monitor.js +102 -0
- package/dist/agents/log-monitor.js.map +1 -0
- package/dist/agents/orchestrator.d.ts +3 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/orchestrator.js +85 -0
- package/dist/agents/orchestrator.js.map +1 -0
- package/dist/agents/refactorer.d.ts +3 -0
- package/dist/agents/refactorer.d.ts.map +1 -0
- package/dist/agents/refactorer.js +67 -0
- package/dist/agents/refactorer.js.map +1 -0
- package/dist/agents/security-auditor.d.ts +3 -0
- package/dist/agents/security-auditor.d.ts.map +1 -0
- package/dist/agents/security-auditor.js +66 -0
- package/dist/agents/security-auditor.js.map +1 -0
- package/dist/agents/sisyphus.d.ts +3 -0
- package/dist/agents/sisyphus.d.ts.map +1 -0
- package/dist/agents/sisyphus.js +53 -0
- package/dist/agents/sisyphus.js.map +1 -0
- package/dist/agents/test-architect.d.ts +3 -0
- package/dist/agents/test-architect.d.ts.map +1 -0
- package/dist/agents/test-architect.js +81 -0
- package/dist/agents/test-architect.js.map +1 -0
- package/dist/agents/types.d.ts +29 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/mcps/architect-tools.server.d.ts +40 -0
- package/dist/mcps/architect-tools.server.d.ts.map +1 -0
- package/dist/mcps/architect-tools.server.js +563 -0
- package/dist/mcps/architect-tools.server.js.map +1 -0
- package/dist/mcps/auto-format.server.d.ts +20 -0
- package/dist/mcps/auto-format.server.d.ts.map +1 -0
- package/dist/mcps/auto-format.server.js +391 -0
- package/dist/mcps/auto-format.server.js.map +1 -0
- package/dist/mcps/boot-orchestrator.server.d.ts +50 -0
- package/dist/mcps/boot-orchestrator.server.d.ts.map +1 -0
- package/dist/mcps/boot-orchestrator.server.js +871 -0
- package/dist/mcps/boot-orchestrator.server.js.map +1 -0
- package/dist/mcps/enforcer-tools.server.d.ts +26 -0
- package/dist/mcps/enforcer-tools.server.d.ts.map +1 -0
- package/dist/mcps/enforcer-tools.server.js +627 -0
- package/dist/mcps/enforcer-tools.server.js.map +1 -0
- package/dist/mcps/enhanced-orchestrator.server.d.ts +14 -0
- package/dist/mcps/enhanced-orchestrator.server.d.ts.map +1 -0
- package/dist/mcps/enhanced-orchestrator.server.js +250 -0
- package/dist/mcps/enhanced-orchestrator.server.js.map +1 -0
- package/dist/mcps/framework-compliance-audit.server.d.ts +23 -0
- package/dist/mcps/framework-compliance-audit.server.d.ts.map +1 -0
- package/dist/mcps/framework-compliance-audit.server.js +511 -0
- package/dist/mcps/framework-compliance-audit.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/api-design.server.d.ts +16 -0
- package/dist/mcps/knowledge-skills/api-design.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/api-design.server.js +120 -0
- package/dist/mcps/knowledge-skills/api-design.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +16 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +110 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/code-review.server.d.ts +32 -0
- package/dist/mcps/knowledge-skills/code-review.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/code-review.server.js +777 -0
- package/dist/mcps/knowledge-skills/code-review.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/database-design.server.d.ts +44 -0
- package/dist/mcps/knowledge-skills/database-design.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/database-design.server.js +818 -0
- package/dist/mcps/knowledge-skills/database-design.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +44 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +1178 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/documentation-generation.server.d.ts +48 -0
- package/dist/mcps/knowledge-skills/documentation-generation.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/documentation-generation.server.js +1188 -0
- package/dist/mcps/knowledge-skills/documentation-generation.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +16 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.js +112 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +16 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +108 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +34 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.js +710 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +34 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +794 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/security-audit.server.d.ts +34 -0
- package/dist/mcps/knowledge-skills/security-audit.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/security-audit.server.js +769 -0
- package/dist/mcps/knowledge-skills/security-audit.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +37 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +865 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +47 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +672 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +42 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +1016 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js.map +1 -0
- package/dist/mcps/lint.server.d.ts +18 -0
- package/dist/mcps/lint.server.d.ts.map +1 -0
- package/dist/mcps/lint.server.js +334 -0
- package/dist/mcps/lint.server.js.map +1 -0
- package/dist/mcps/model-health-check.server.d.ts +17 -0
- package/dist/mcps/model-health-check.server.d.ts.map +1 -0
- package/dist/mcps/model-health-check.server.js +226 -0
- package/dist/mcps/model-health-check.server.js.map +1 -0
- package/dist/mcps/orchestrator.server.d.ts +39 -0
- package/dist/mcps/orchestrator.server.d.ts.map +1 -0
- package/dist/mcps/orchestrator.server.js +908 -0
- package/dist/mcps/orchestrator.server.js.map +1 -0
- package/dist/mcps/performance-analysis.server.d.ts +28 -0
- package/dist/mcps/performance-analysis.server.d.ts.map +1 -0
- package/dist/mcps/performance-analysis.server.js +514 -0
- package/dist/mcps/performance-analysis.server.js.map +1 -0
- package/dist/mcps/processor-pipeline.server.d.ts +29 -0
- package/dist/mcps/processor-pipeline.server.d.ts.map +1 -0
- package/dist/mcps/processor-pipeline.server.js +520 -0
- package/dist/mcps/processor-pipeline.server.js.map +1 -0
- package/dist/mcps/security-scan.server.d.ts +20 -0
- package/dist/mcps/security-scan.server.d.ts.map +1 -0
- package/dist/mcps/security-scan.server.js +404 -0
- package/dist/mcps/security-scan.server.js.map +1 -0
- package/dist/mcps/state-manager.server.d.ts +29 -0
- package/dist/mcps/state-manager.server.d.ts.map +1 -0
- package/dist/mcps/state-manager.server.js +620 -0
- package/dist/mcps/state-manager.server.js.map +1 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.d.ts +109 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.js +337 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.js.map +1 -0
- package/dist/orchestrator/intelligent-commit-batcher.d.ts +112 -0
- package/dist/orchestrator/intelligent-commit-batcher.d.ts.map +1 -0
- package/dist/orchestrator/intelligent-commit-batcher.js +330 -0
- package/dist/orchestrator/intelligent-commit-batcher.js.map +1 -0
- package/dist/plugin/agents/architect.d.ts +3 -0
- package/dist/plugin/agents/architect.d.ts.map +1 -0
- package/dist/plugin/agents/architect.js +84 -0
- package/dist/plugin/agents/architect.js.map +1 -0
- package/dist/plugin/agents/bug-triage-specialist.d.ts +3 -0
- package/dist/plugin/agents/bug-triage-specialist.d.ts.map +1 -0
- package/dist/plugin/agents/bug-triage-specialist.js +66 -0
- package/dist/plugin/agents/bug-triage-specialist.js.map +1 -0
- package/dist/plugin/agents/code-reviewer.d.ts +3 -0
- package/dist/plugin/agents/code-reviewer.d.ts.map +1 -0
- package/dist/plugin/agents/code-reviewer.js +66 -0
- package/dist/plugin/agents/code-reviewer.js.map +1 -0
- package/dist/plugin/agents/enforcer.d.ts +3 -0
- package/dist/plugin/agents/enforcer.d.ts.map +1 -0
- package/dist/plugin/agents/enforcer.js +109 -0
- package/dist/plugin/agents/enforcer.js.map +1 -0
- package/dist/plugin/agents/index.d.ts +15 -0
- package/dist/plugin/agents/index.d.ts.map +1 -0
- package/dist/plugin/agents/index.js +26 -0
- package/dist/plugin/agents/index.js.map +1 -0
- package/dist/plugin/agents/librarian.d.ts +3 -0
- package/dist/plugin/agents/librarian.d.ts.map +1 -0
- package/dist/plugin/agents/librarian.js +70 -0
- package/dist/plugin/agents/librarian.js.map +1 -0
- package/dist/plugin/agents/log-monitor.d.ts +3 -0
- package/dist/plugin/agents/log-monitor.d.ts.map +1 -0
- package/dist/plugin/agents/log-monitor.js +102 -0
- package/dist/plugin/agents/log-monitor.js.map +1 -0
- package/dist/plugin/agents/orchestrator.d.ts +3 -0
- package/dist/plugin/agents/orchestrator.d.ts.map +1 -0
- package/dist/plugin/agents/orchestrator.js +85 -0
- package/dist/plugin/agents/orchestrator.js.map +1 -0
- package/dist/plugin/agents/refactorer.d.ts +3 -0
- package/dist/plugin/agents/refactorer.d.ts.map +1 -0
- package/dist/plugin/agents/refactorer.js +67 -0
- package/dist/plugin/agents/refactorer.js.map +1 -0
- package/dist/plugin/agents/security-auditor.d.ts +3 -0
- package/dist/plugin/agents/security-auditor.d.ts.map +1 -0
- package/dist/plugin/agents/security-auditor.js +66 -0
- package/dist/plugin/agents/security-auditor.js.map +1 -0
- package/dist/plugin/agents/sisyphus.d.ts +3 -0
- package/dist/plugin/agents/sisyphus.d.ts.map +1 -0
- package/dist/plugin/agents/sisyphus.js +53 -0
- package/dist/plugin/agents/sisyphus.js.map +1 -0
- package/dist/plugin/agents/test-architect.d.ts +3 -0
- package/dist/plugin/agents/test-architect.d.ts.map +1 -0
- package/dist/plugin/agents/test-architect.js +81 -0
- package/dist/plugin/agents/test-architect.js.map +1 -0
- package/dist/plugin/agents/types.d.ts +29 -0
- package/dist/plugin/agents/types.d.ts.map +1 -0
- package/dist/plugin/agents/types.js +2 -0
- package/dist/plugin/agents/types.js.map +1 -0
- package/dist/plugin/config-loader.d.ts +67 -0
- package/dist/plugin/config-loader.d.ts.map +1 -0
- package/dist/plugin/config-loader.js +125 -0
- package/dist/plugin/config-loader.js.map +1 -0
- package/dist/plugin/context-loader.d.ts +122 -0
- package/dist/plugin/context-loader.d.ts.map +1 -0
- package/dist/plugin/context-loader.js +273 -0
- package/dist/plugin/context-loader.js.map +1 -0
- package/dist/plugin/delegation/agent-delegator.d.ts +217 -0
- package/dist/plugin/delegation/agent-delegator.d.ts.map +1 -0
- package/dist/plugin/delegation/agent-delegator.js +928 -0
- package/dist/plugin/delegation/agent-delegator.js.map +1 -0
- package/dist/plugin/delegation/codebase-context-analyzer.d.ts +157 -0
- package/dist/plugin/delegation/codebase-context-analyzer.d.ts.map +1 -0
- package/dist/plugin/delegation/codebase-context-analyzer.js +1029 -0
- package/dist/plugin/delegation/codebase-context-analyzer.js.map +1 -0
- package/dist/plugin/delegation/complexity-analyzer.d.ts +61 -0
- package/dist/plugin/delegation/complexity-analyzer.d.ts.map +1 -0
- package/dist/plugin/delegation/complexity-analyzer.js +253 -0
- package/dist/plugin/delegation/complexity-analyzer.js.map +1 -0
- package/dist/plugin/enforcement/enforcer-tools.d.ts +62 -0
- package/dist/plugin/enforcement/enforcer-tools.d.ts.map +1 -0
- package/dist/plugin/enforcement/enforcer-tools.js +407 -0
- package/dist/plugin/enforcement/enforcer-tools.js.map +1 -0
- package/dist/plugin/enforcement/rule-enforcer.d.ts +171 -0
- package/dist/plugin/enforcement/rule-enforcer.d.ts.map +1 -0
- package/dist/plugin/enforcement/rule-enforcer.js +1342 -0
- package/dist/plugin/enforcement/rule-enforcer.js.map +1 -0
- package/dist/plugin/enforcement/test-auto-healing.d.ts +78 -0
- package/dist/plugin/enforcement/test-auto-healing.d.ts.map +1 -0
- package/dist/plugin/enforcement/test-auto-healing.js +318 -0
- package/dist/plugin/enforcement/test-auto-healing.js.map +1 -0
- package/dist/plugin/framework-logger.d.ts +20 -0
- package/dist/plugin/framework-logger.d.ts.map +1 -0
- package/dist/plugin/framework-logger.js +79 -0
- package/dist/plugin/framework-logger.js.map +1 -0
- package/dist/plugin/logging-config.d.ts +11 -0
- package/dist/plugin/logging-config.d.ts.map +1 -0
- package/dist/plugin/logging-config.js +44 -0
- package/dist/plugin/logging-config.js.map +1 -0
- package/dist/plugin/mcps/architect-tools.server.d.ts +40 -0
- package/dist/plugin/mcps/architect-tools.server.d.ts.map +1 -0
- package/dist/plugin/mcps/architect-tools.server.js +563 -0
- package/dist/plugin/mcps/architect-tools.server.js.map +1 -0
- package/dist/plugin/mcps/auto-format.server.d.ts +20 -0
- package/dist/plugin/mcps/auto-format.server.d.ts.map +1 -0
- package/dist/plugin/mcps/auto-format.server.js +391 -0
- package/dist/plugin/mcps/auto-format.server.js.map +1 -0
- package/dist/plugin/mcps/boot-orchestrator.server.d.ts +50 -0
- package/dist/plugin/mcps/boot-orchestrator.server.d.ts.map +1 -0
- package/dist/plugin/mcps/boot-orchestrator.server.js +871 -0
- package/dist/plugin/mcps/boot-orchestrator.server.js.map +1 -0
- package/dist/plugin/mcps/enforcer-tools.server.d.ts +26 -0
- package/dist/plugin/mcps/enforcer-tools.server.d.ts.map +1 -0
- package/dist/plugin/mcps/enforcer-tools.server.js +627 -0
- package/dist/plugin/mcps/enforcer-tools.server.js.map +1 -0
- package/dist/plugin/mcps/enhanced-orchestrator.server.d.ts +14 -0
- package/dist/plugin/mcps/enhanced-orchestrator.server.d.ts.map +1 -0
- package/dist/plugin/mcps/enhanced-orchestrator.server.js +250 -0
- package/dist/plugin/mcps/enhanced-orchestrator.server.js.map +1 -0
- package/dist/plugin/mcps/framework-compliance-audit.server.d.ts +23 -0
- package/dist/plugin/mcps/framework-compliance-audit.server.d.ts.map +1 -0
- package/dist/plugin/mcps/framework-compliance-audit.server.js +511 -0
- package/dist/plugin/mcps/framework-compliance-audit.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/api-design.server.d.ts +16 -0
- package/dist/plugin/mcps/knowledge-skills/api-design.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/api-design.server.js +120 -0
- package/dist/plugin/mcps/knowledge-skills/api-design.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/architecture-patterns.server.d.ts +16 -0
- package/dist/plugin/mcps/knowledge-skills/architecture-patterns.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/architecture-patterns.server.js +110 -0
- package/dist/plugin/mcps/knowledge-skills/architecture-patterns.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/code-review.server.d.ts +32 -0
- package/dist/plugin/mcps/knowledge-skills/code-review.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/code-review.server.js +777 -0
- package/dist/plugin/mcps/knowledge-skills/code-review.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/database-design.server.d.ts +44 -0
- package/dist/plugin/mcps/knowledge-skills/database-design.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/database-design.server.js +818 -0
- package/dist/plugin/mcps/knowledge-skills/database-design.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/devops-deployment.server.d.ts +44 -0
- package/dist/plugin/mcps/knowledge-skills/devops-deployment.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/devops-deployment.server.js +1178 -0
- package/dist/plugin/mcps/knowledge-skills/devops-deployment.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/documentation-generation.server.d.ts +48 -0
- package/dist/plugin/mcps/knowledge-skills/documentation-generation.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/documentation-generation.server.js +1188 -0
- package/dist/plugin/mcps/knowledge-skills/documentation-generation.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/git-workflow.server.d.ts +16 -0
- package/dist/plugin/mcps/knowledge-skills/git-workflow.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/git-workflow.server.js +112 -0
- package/dist/plugin/mcps/knowledge-skills/git-workflow.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/performance-optimization.server.d.ts +16 -0
- package/dist/plugin/mcps/knowledge-skills/performance-optimization.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/performance-optimization.server.js +108 -0
- package/dist/plugin/mcps/knowledge-skills/performance-optimization.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/project-analysis.server.d.ts +34 -0
- package/dist/plugin/mcps/knowledge-skills/project-analysis.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/project-analysis.server.js +710 -0
- package/dist/plugin/mcps/knowledge-skills/project-analysis.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/refactoring-strategies.server.d.ts +34 -0
- package/dist/plugin/mcps/knowledge-skills/refactoring-strategies.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/refactoring-strategies.server.js +794 -0
- package/dist/plugin/mcps/knowledge-skills/refactoring-strategies.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/security-audit.server.d.ts +34 -0
- package/dist/plugin/mcps/knowledge-skills/security-audit.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/security-audit.server.js +769 -0
- package/dist/plugin/mcps/knowledge-skills/security-audit.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/testing-best-practices.server.d.ts +37 -0
- package/dist/plugin/mcps/knowledge-skills/testing-best-practices.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/testing-best-practices.server.js +865 -0
- package/dist/plugin/mcps/knowledge-skills/testing-best-practices.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/testing-strategy.server.d.ts +47 -0
- package/dist/plugin/mcps/knowledge-skills/testing-strategy.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/testing-strategy.server.js +672 -0
- package/dist/plugin/mcps/knowledge-skills/testing-strategy.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/ui-ux-design.server.d.ts +42 -0
- package/dist/plugin/mcps/knowledge-skills/ui-ux-design.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/ui-ux-design.server.js +1016 -0
- package/dist/plugin/mcps/knowledge-skills/ui-ux-design.server.js.map +1 -0
- package/dist/plugin/mcps/lint.server.d.ts +18 -0
- package/dist/plugin/mcps/lint.server.d.ts.map +1 -0
- package/dist/plugin/mcps/lint.server.js +334 -0
- package/dist/plugin/mcps/lint.server.js.map +1 -0
- package/dist/plugin/mcps/model-health-check.server.d.ts +17 -0
- package/dist/plugin/mcps/model-health-check.server.d.ts.map +1 -0
- package/dist/plugin/mcps/model-health-check.server.js +226 -0
- package/dist/plugin/mcps/model-health-check.server.js.map +1 -0
- package/dist/plugin/mcps/orchestrator.server.d.ts +39 -0
- package/dist/plugin/mcps/orchestrator.server.d.ts.map +1 -0
- package/dist/plugin/mcps/orchestrator.server.js +908 -0
- package/dist/plugin/mcps/orchestrator.server.js.map +1 -0
- package/dist/plugin/mcps/performance-analysis.server.d.ts +28 -0
- package/dist/plugin/mcps/performance-analysis.server.d.ts.map +1 -0
- package/dist/plugin/mcps/performance-analysis.server.js +514 -0
- package/dist/plugin/mcps/performance-analysis.server.js.map +1 -0
- package/dist/plugin/mcps/processor-pipeline.server.d.ts +29 -0
- package/dist/plugin/mcps/processor-pipeline.server.d.ts.map +1 -0
- package/dist/plugin/mcps/processor-pipeline.server.js +520 -0
- package/dist/plugin/mcps/processor-pipeline.server.js.map +1 -0
- package/dist/plugin/mcps/security-scan.server.d.ts +20 -0
- package/dist/plugin/mcps/security-scan.server.d.ts.map +1 -0
- package/dist/plugin/mcps/security-scan.server.js +404 -0
- package/dist/plugin/mcps/security-scan.server.js.map +1 -0
- package/dist/plugin/mcps/state-manager.server.d.ts +29 -0
- package/dist/plugin/mcps/state-manager.server.d.ts.map +1 -0
- package/dist/plugin/mcps/state-manager.server.js +620 -0
- package/dist/plugin/mcps/state-manager.server.js.map +1 -0
- package/dist/plugin/monitoring/advanced-profiler.d.ts +48 -0
- package/dist/plugin/monitoring/advanced-profiler.d.ts.map +1 -0
- package/dist/plugin/monitoring/advanced-profiler.js +216 -0
- package/dist/plugin/monitoring/advanced-profiler.js.map +1 -0
- package/dist/plugin/monitoring/enterprise-monitoring-system.d.ts +331 -0
- package/dist/plugin/monitoring/enterprise-monitoring-system.d.ts.map +1 -0
- package/dist/plugin/monitoring/enterprise-monitoring-system.js +797 -0
- package/dist/plugin/monitoring/enterprise-monitoring-system.js.map +1 -0
- package/dist/plugin/orchestrator/enhanced-multi-agent-orchestrator.d.ts +111 -0
- package/dist/plugin/orchestrator/enhanced-multi-agent-orchestrator.d.ts.map +1 -0
- package/dist/plugin/orchestrator/enhanced-multi-agent-orchestrator.js +339 -0
- package/dist/plugin/orchestrator/enhanced-multi-agent-orchestrator.js.map +1 -0
- package/dist/plugin/orchestrator/intelligent-commit-batcher.d.ts +112 -0
- package/dist/plugin/orchestrator/intelligent-commit-batcher.d.ts.map +1 -0
- package/dist/plugin/orchestrator/intelligent-commit-batcher.js +330 -0
- package/dist/plugin/orchestrator/intelligent-commit-batcher.js.map +1 -0
- package/dist/plugin/orchestrator.d.ts +91 -0
- package/dist/plugin/orchestrator.d.ts.map +1 -0
- package/dist/plugin/orchestrator.js +444 -0
- package/dist/plugin/orchestrator.js.map +1 -0
- package/dist/plugin/plugins/marketplace/marketplace-service.d.ts +108 -0
- package/dist/plugin/plugins/marketplace/marketplace-service.d.ts.map +1 -0
- package/dist/plugin/plugins/marketplace/marketplace-service.js +620 -0
- package/dist/plugin/plugins/marketplace/marketplace-service.js.map +1 -0
- package/dist/plugin/plugins/marketplace/marketplace-types.d.ts +468 -0
- package/dist/plugin/plugins/marketplace/marketplace-types.d.ts.map +1 -0
- package/dist/plugin/plugins/marketplace/marketplace-types.js +11 -0
- package/dist/plugin/plugins/marketplace/marketplace-types.js.map +1 -0
- package/dist/plugin/plugins/plugin-system.d.ts +152 -0
- package/dist/plugin/plugins/plugin-system.d.ts.map +1 -0
- package/dist/plugin/plugins/plugin-system.js +405 -0
- package/dist/plugin/plugins/plugin-system.js.map +1 -0
- package/dist/plugin/plugins/stringray-codex-injection.d.ts +68 -0
- package/dist/plugin/plugins/stringray-codex-injection.d.ts.map +1 -0
- package/dist/plugin/plugins/stringray-codex-injection.js +225 -0
- package/dist/plugin/plugins/stringray-codex-injection.js.map +1 -0
- package/dist/plugin/plugins/strray-codex-injection.d.ts +68 -0
- package/dist/plugin/plugins/strray-codex-injection.d.ts.map +1 -0
- package/dist/plugin/plugins/strray-codex-injection.js +225 -0
- package/dist/plugin/plugins/strray-codex-injection.js.map +1 -0
- package/dist/plugin/processors/index.d.ts +12 -0
- package/dist/plugin/processors/index.d.ts.map +1 -0
- package/dist/plugin/processors/index.js +12 -0
- package/dist/plugin/processors/index.js.map +1 -0
- package/dist/plugin/processors/processor-manager.d.ts +113 -0
- package/dist/plugin/processors/processor-manager.d.ts.map +1 -0
- package/dist/plugin/processors/processor-manager.js +498 -0
- package/dist/plugin/processors/processor-manager.js.map +1 -0
- package/dist/plugin/processors/processor-types.d.ts +50 -0
- package/dist/plugin/processors/processor-types.d.ts.map +1 -0
- package/dist/plugin/processors/processor-types.js +10 -0
- package/dist/plugin/processors/processor-types.js.map +1 -0
- package/dist/plugin/processors/refactoring-logging-processor.d.ts +61 -0
- package/dist/plugin/processors/refactoring-logging-processor.d.ts.map +1 -0
- package/dist/plugin/processors/refactoring-logging-processor.js +257 -0
- package/dist/plugin/processors/refactoring-logging-processor.js.map +1 -0
- package/dist/plugin/reporting/framework-reporting-system.d.ts +157 -0
- package/dist/plugin/reporting/framework-reporting-system.d.ts.map +1 -0
- package/dist/plugin/reporting/framework-reporting-system.js +783 -0
- package/dist/plugin/reporting/framework-reporting-system.js.map +1 -0
- package/dist/plugin/security/security-hardening-system.d.ts +220 -0
- package/dist/plugin/security/security-hardening-system.d.ts.map +1 -0
- package/dist/plugin/security/security-hardening-system.js +605 -0
- package/dist/plugin/security/security-hardening-system.js.map +1 -0
- package/dist/plugin/state/context-providers.d.ts +5 -0
- package/dist/plugin/state/context-providers.d.ts.map +1 -0
- package/dist/plugin/state/context-providers.js +2 -0
- package/dist/plugin/state/context-providers.js.map +1 -0
- package/dist/plugin/state/index.d.ts +5 -0
- package/dist/plugin/state/index.d.ts.map +1 -0
- package/dist/plugin/state/index.js +8 -0
- package/dist/plugin/state/index.js.map +1 -0
- package/dist/plugin/state/state-manager.d.ts +29 -0
- package/dist/plugin/state/state-manager.d.ts.map +1 -0
- package/dist/plugin/state/state-manager.js +153 -0
- package/dist/plugin/state/state-manager.js.map +1 -0
- package/dist/plugin/state/state-types.d.ts +6 -0
- package/dist/plugin/state/state-types.d.ts.map +1 -0
- package/dist/plugin/state/state-types.js +2 -0
- package/dist/plugin/state/state-types.js.map +1 -0
- package/dist/plugin/utils/codex-parser.d.ts +62 -0
- package/dist/plugin/utils/codex-parser.d.ts.map +1 -0
- package/dist/plugin/utils/codex-parser.js +396 -0
- package/dist/plugin/utils/codex-parser.js.map +1 -0
- package/dist/plugin/utils/command-runner.d.ts +24 -0
- package/dist/plugin/utils/command-runner.d.ts.map +1 -0
- package/dist/plugin/utils/command-runner.js +44 -0
- package/dist/plugin/utils/command-runner.js.map +1 -0
- package/dist/plugin/utils/import-resolver.d.ts +55 -0
- package/dist/plugin/utils/import-resolver.d.ts.map +1 -0
- package/dist/plugin/utils/import-resolver.js +198 -0
- package/dist/plugin/utils/import-resolver.js.map +1 -0
- package/dist/plugin/utils/memory-pool.d.ts +90 -0
- package/dist/plugin/utils/memory-pool.d.ts.map +1 -0
- package/dist/plugin/utils/memory-pool.js +245 -0
- package/dist/plugin/utils/memory-pool.js.map +1 -0
- package/dist/plugin/utils/path-resolver.d.ts +49 -0
- package/dist/plugin/utils/path-resolver.d.ts.map +1 -0
- package/dist/plugin/utils/path-resolver.js +126 -0
- package/dist/plugin/utils/path-resolver.js.map +1 -0
- package/dist/plugin/utils/test-template-generator.d.ts +26 -0
- package/dist/plugin/utils/test-template-generator.d.ts.map +1 -0
- package/dist/plugin/utils/test-template-generator.js +178 -0
- package/dist/plugin/utils/test-template-generator.js.map +1 -0
- package/dist/processors/index.d.ts +12 -0
- package/dist/processors/index.d.ts.map +1 -0
- package/dist/processors/index.js +12 -0
- package/dist/processors/index.js.map +1 -0
- package/dist/processors/processor-manager.d.ts +113 -0
- package/dist/processors/processor-manager.d.ts.map +1 -0
- package/dist/processors/processor-manager.js +498 -0
- package/dist/processors/processor-manager.js.map +1 -0
- package/dist/processors/processor-types.d.ts +50 -0
- package/dist/processors/processor-types.d.ts.map +1 -0
- package/dist/processors/processor-types.js +10 -0
- package/dist/processors/processor-types.js.map +1 -0
- package/dist/processors/refactoring-logging-processor.d.ts +61 -0
- package/dist/processors/refactoring-logging-processor.d.ts.map +1 -0
- package/dist/processors/refactoring-logging-processor.js +257 -0
- package/dist/processors/refactoring-logging-processor.js.map +1 -0
- package/dist/state/context-providers.d.ts +5 -0
- package/dist/state/context-providers.d.ts.map +1 -0
- package/dist/state/context-providers.js +2 -0
- package/dist/state/context-providers.js.map +1 -0
- package/dist/state/index.d.ts +5 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +8 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/state-manager.d.ts +29 -0
- package/dist/state/state-manager.d.ts.map +1 -0
- package/dist/state/state-manager.js +153 -0
- package/dist/state/state-manager.js.map +1 -0
- package/dist/state/state-types.d.ts +6 -0
- package/dist/state/state-types.d.ts.map +1 -0
- package/dist/state/state-types.js +2 -0
- package/dist/state/state-types.js.map +1 -0
- package/dist/utils/codex-parser.d.ts +62 -0
- package/dist/utils/codex-parser.d.ts.map +1 -0
- package/dist/utils/codex-parser.js +396 -0
- package/dist/utils/codex-parser.js.map +1 -0
- package/dist/utils/command-runner.d.ts +24 -0
- package/dist/utils/command-runner.d.ts.map +1 -0
- package/dist/utils/command-runner.js +44 -0
- package/dist/utils/command-runner.js.map +1 -0
- package/dist/utils/import-resolver.d.ts +55 -0
- package/dist/utils/import-resolver.d.ts.map +1 -0
- package/dist/utils/import-resolver.js +198 -0
- package/dist/utils/import-resolver.js.map +1 -0
- package/dist/utils/memory-pool.d.ts +90 -0
- package/dist/utils/memory-pool.d.ts.map +1 -0
- package/dist/utils/memory-pool.js +245 -0
- package/dist/utils/memory-pool.js.map +1 -0
- package/dist/utils/path-resolver.d.ts +49 -0
- package/dist/utils/path-resolver.d.ts.map +1 -0
- package/dist/utils/path-resolver.js +126 -0
- package/dist/utils/path-resolver.js.map +1 -0
- package/dist/utils/test-template-generator.d.ts +26 -0
- package/dist/utils/test-template-generator.d.ts.map +1 -0
- package/dist/utils/test-template-generator.js +178 -0
- package/dist/utils/test-template-generator.js.map +1 -0
- package/package.json +138 -0
- package/scripts/analysis/analyze-context-awareness.ts +219 -0
- package/scripts/analysis/analyze-framework-usage.ts +208 -0
- package/scripts/analysis/analyzer-agent-runner.js +328 -0
- package/scripts/analysis/context-awareness-report.ts +250 -0
- package/scripts/analyze-imports.mjs +147 -0
- package/scripts/basic-security-audit.cjs +261 -0
- package/scripts/boot-check.cjs +188 -0
- package/scripts/build/check-syntax.sh +1 -0
- package/scripts/build/check-tsc.sh +1 -0
- package/scripts/build/check-types.sh +1 -0
- package/scripts/build/compile-single.sh +1 -0
- package/scripts/build/copy-plugin.sh +1 -0
- package/scripts/build/manual-build.sh +1 -0
- package/scripts/build/run-build-after-copy.sh +1 -0
- package/scripts/build/run-build-attempt.sh +1 -0
- package/scripts/build/run-build-errors-grep.sh +1 -0
- package/scripts/build/run-build-errors.sh +1 -0
- package/scripts/build/run-build-limited.sh +1 -0
- package/scripts/build/run-build-list.sh +1 -0
- package/scripts/build/run-build.sh +1 -0
- package/scripts/build/run-limited.sh +1 -0
- package/scripts/build/run-tsc-direct.sh +1 -0
- package/scripts/build/run-type-check.sh +1 -0
- package/scripts/build/run-typecheck.sh +1 -0
- package/scripts/build/test-build.sh +1 -0
- package/scripts/check-logs.sh +62 -0
- package/scripts/debug/debug-context-enhancement.ts +116 -0
- package/scripts/debug/debug-rules.mjs +23 -0
- package/scripts/demo/demo-clickable-monitoring.mjs +116 -0
- package/scripts/demo/profiling-demo.js +108 -0
- package/scripts/demo/profiling-demo.ts +126 -0
- package/scripts/demo/reporting-demonstration.ts +184 -0
- package/scripts/demo/reporting-examples.ts +105 -0
- package/scripts/dependency-scan.cjs +111 -0
- package/scripts/deploy-stringray-plugin.sh +323 -0
- package/scripts/disable-logging.sh +20 -0
- package/scripts/extract-framework.sh +405 -0
- package/scripts/fix-mcp-capabilities.js +83 -0
- package/scripts/framework/advanced-profiling-integration.sh +384 -0
- package/scripts/framework/check-agent-orchestration-health.sh +113 -0
- package/scripts/framework/enterprise-analysis-test.sh +174 -0
- package/scripts/framework/implement-analyzer-agent.sh +393 -0
- package/scripts/framework/merge-mcp-configs.sh +201 -0
- package/scripts/framework/validate-multi-agent-orchestration.sh +195 -0
- package/scripts/framework/validate-profiling.sh +64 -0
- package/scripts/github-actions-monitor.cjs +289 -0
- package/scripts/init.ts +121 -0
- package/scripts/monitoring/initialize-monitoring-pipeline.sh +89 -0
- package/scripts/monitoring/memory-dashboard.sh +52 -0
- package/scripts/monitoring/monitoring-daemon.mjs +67 -0
- package/scripts/monitoring/monitoring-daemon.sh +190 -0
- package/scripts/monitoring/profiling-dashboard.sh +69 -0
- package/scripts/performance-report.js +56 -0
- package/scripts/postinstall.cjs +240 -0
- package/scripts/profile-performance.sh +263 -0
- package/scripts/register-mcp-servers-fixed.sh +74 -0
- package/scripts/register-mcp-servers.sh +96 -0
- package/scripts/reporting/generate-phase1-report.js +28 -0
- package/scripts/reporting/run-postprocessor.js +59 -0
- package/scripts/reporting/trigger-report.js +15 -0
- package/scripts/run-simulations.mjs +29 -0
- package/scripts/scenario-data-processor.py +122 -0
- package/scripts/scenarios/scenario-security-check.ts +60 -0
- package/scripts/scenarios/scenario-user-management.ts +123 -0
- package/scripts/setup.cjs +128 -0
- package/scripts/simulation/run-simulations.js +84 -0
- package/scripts/simulation/simulate-full-orchestrator.ts +239 -0
- package/scripts/strray-triage.sh +349 -0
- package/scripts/test/run-memory-regression.sh +45 -0
- package/scripts/test/run-test.sh +2 -0
- package/scripts/test/test-deployment.sh +552 -0
- package/scripts/test/test-enhanced-report.ts +24 -0
- package/scripts/test/test-graceful-shutdown.sh +35 -0
- package/scripts/test/test-integration.mjs +79 -0
- package/scripts/test/test-manual-orchestration.sh +168 -0
- package/scripts/test/test-max-agents.sh +70 -0
- package/scripts/test/test-memory-monitor.sh +40 -0
- package/scripts/test/test-memory-pools.sh +58 -0
- package/scripts/test/test-module.ts +1 -0
- package/scripts/test/test-multi-agent-trigger.sh +251 -0
- package/scripts/test/test-orchestrator.txt +1 -0
- package/scripts/test/test-postinstall.js +1 -0
- package/scripts/test/test-security-module.ts +27 -0
- package/scripts/test/test-session-management.js +135 -0
- package/scripts/test/test-simulation.mjs +14 -0
- package/scripts/test/test-user-service.ts +111 -0
- package/scripts/test-comprehensive-path-resolution.mjs +62 -0
- package/scripts/test-data-processor.py +51 -0
- package/scripts/test-enforcement-e2e.mjs +127 -0
- package/scripts/test-full-plugin-no-timeout.sh +30 -0
- package/scripts/test-path-resolver.mjs +32 -0
- package/scripts/test-rules.mjs +128 -0
- package/scripts/test-stringray-plugin.mjs +66 -0
- package/scripts/test-utils/smart-test-runner.mjs +609 -0
- package/scripts/test-utils/test-quarantine.mjs +246 -0
- package/scripts/validate-codex.js +60 -0
- package/scripts/validate-phase1.mjs +189 -0
- package/scripts/validation/run-validators.js +114 -0
- package/scripts/validation/validate-external-processes.js +240 -0
- package/scripts/validation/validate-mcp-connectivity.js +165 -0
- package/scripts/validation/validate-oh-my-opencode-integration.js +200 -0
- package/scripts/validation/validate-reports.ts +114 -0
- package/scripts/verify-phase1.js +144 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StrRay Code Review MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Knowledge skill for automated code review, quality assessment,
|
|
5
|
+
* and best practices validation - provides comprehensive code quality analysis
|
|
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 * as fs from "fs";
|
|
11
|
+
import * as path from "path";
|
|
12
|
+
class StrRayCodeReviewServer {
|
|
13
|
+
server;
|
|
14
|
+
constructor() {
|
|
15
|
+
this.server = new Server({
|
|
16
|
+
name: "strray-code-review",
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
}, {
|
|
19
|
+
capabilities: {
|
|
20
|
+
tools: {},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
this.setupToolHandlers();
|
|
24
|
+
console.log("StrRay Code Review MCP Server initialized");
|
|
25
|
+
}
|
|
26
|
+
setupToolHandlers() {
|
|
27
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
28
|
+
return {
|
|
29
|
+
tools: [
|
|
30
|
+
{
|
|
31
|
+
name: "analyze_code_quality",
|
|
32
|
+
description: "Analyze code quality metrics, identify issues, and provide improvement suggestions",
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
filePath: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Path to the file to analyze",
|
|
39
|
+
},
|
|
40
|
+
includeMetrics: {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
description: "Include detailed code metrics in the analysis",
|
|
43
|
+
default: true,
|
|
44
|
+
},
|
|
45
|
+
focusAreas: {
|
|
46
|
+
type: "array",
|
|
47
|
+
items: {
|
|
48
|
+
type: "string",
|
|
49
|
+
enum: [
|
|
50
|
+
"security",
|
|
51
|
+
"performance",
|
|
52
|
+
"maintainability",
|
|
53
|
+
"style",
|
|
54
|
+
"logic",
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
description: "Specific areas to focus the review on",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
required: ["filePath"],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "review_pull_request",
|
|
65
|
+
description: "Review a pull request by analyzing changed files and providing comprehensive feedback",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
properties: {
|
|
69
|
+
files: {
|
|
70
|
+
type: "array",
|
|
71
|
+
items: { type: "string" },
|
|
72
|
+
description: "List of file paths to review",
|
|
73
|
+
},
|
|
74
|
+
baseBranch: {
|
|
75
|
+
type: "string",
|
|
76
|
+
description: "Base branch for comparison",
|
|
77
|
+
default: "main",
|
|
78
|
+
},
|
|
79
|
+
focusAreas: {
|
|
80
|
+
type: "array",
|
|
81
|
+
items: {
|
|
82
|
+
type: "string",
|
|
83
|
+
enum: [
|
|
84
|
+
"security",
|
|
85
|
+
"performance",
|
|
86
|
+
"maintainability",
|
|
87
|
+
"style",
|
|
88
|
+
"logic",
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
description: "Specific areas to focus the review on",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
required: ["files"],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "check_best_practices",
|
|
99
|
+
description: "Check adherence to coding best practices and standards",
|
|
100
|
+
inputSchema: {
|
|
101
|
+
type: "object",
|
|
102
|
+
properties: {
|
|
103
|
+
filePath: {
|
|
104
|
+
type: "string",
|
|
105
|
+
description: "Path to the file to check",
|
|
106
|
+
},
|
|
107
|
+
language: {
|
|
108
|
+
type: "string",
|
|
109
|
+
description: "Programming language (typescript, javascript, python, etc.)",
|
|
110
|
+
},
|
|
111
|
+
standards: {
|
|
112
|
+
type: "array",
|
|
113
|
+
items: { type: "string" },
|
|
114
|
+
description: "Specific standards to check (airbnb, google, microsoft, etc.)",
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
required: ["filePath"],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
124
|
+
const { name, arguments: args } = request.params;
|
|
125
|
+
switch (name) {
|
|
126
|
+
case "analyze_code_quality":
|
|
127
|
+
return await this.analyzeCodeQuality(args);
|
|
128
|
+
case "review_pull_request":
|
|
129
|
+
return await this.reviewPullRequest(args);
|
|
130
|
+
case "check_best_practices":
|
|
131
|
+
return await this.checkBestPractices(args);
|
|
132
|
+
default:
|
|
133
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
async analyzeCodeQuality(args) {
|
|
138
|
+
const { filePath, includeMetrics = true, focusAreas } = args;
|
|
139
|
+
try {
|
|
140
|
+
if (!fs.existsSync(filePath)) {
|
|
141
|
+
throw new Error(`File not found: ${filePath}`);
|
|
142
|
+
}
|
|
143
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
144
|
+
const extension = path.extname(filePath).toLowerCase();
|
|
145
|
+
const language = this.detectLanguage(extension);
|
|
146
|
+
const issues = this.analyzeCode(content, language, focusAreas);
|
|
147
|
+
const metrics = includeMetrics
|
|
148
|
+
? this.calculateMetrics(content, language)
|
|
149
|
+
: null;
|
|
150
|
+
const suggestions = this.generateSuggestions(issues, metrics, language);
|
|
151
|
+
const overallScore = this.calculateOverallScore(issues, metrics);
|
|
152
|
+
const result = {
|
|
153
|
+
file: filePath,
|
|
154
|
+
issues,
|
|
155
|
+
metrics: metrics,
|
|
156
|
+
suggestions,
|
|
157
|
+
overallScore,
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
content: [
|
|
161
|
+
{
|
|
162
|
+
type: "text",
|
|
163
|
+
text: `Code Review Results for ${filePath}:\n\n` +
|
|
164
|
+
`Overall Score: ${overallScore}/100\n\n` +
|
|
165
|
+
`Issues Found: ${issues.length}\n` +
|
|
166
|
+
(metrics
|
|
167
|
+
? `Lines of Code: ${metrics.linesOfCode}\n` +
|
|
168
|
+
`Cyclomatic Complexity: ${metrics.cyclomaticComplexity}\n` +
|
|
169
|
+
`Comment Ratio: ${(metrics.commentRatio * 100).toFixed(1)}%\n\n`
|
|
170
|
+
: "") +
|
|
171
|
+
`Key Issues:\n${issues
|
|
172
|
+
.slice(0, 10)
|
|
173
|
+
.map((issue) => `• ${issue.severity.toUpperCase()}: ${issue.message} (${issue.category})`)
|
|
174
|
+
.join("\n")}\n\n` +
|
|
175
|
+
`Suggestions:\n${suggestions
|
|
176
|
+
.slice(0, 5)
|
|
177
|
+
.map((s) => `• ${s}`)
|
|
178
|
+
.join("\n")}`,
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
return {
|
|
185
|
+
content: [
|
|
186
|
+
{
|
|
187
|
+
type: "text",
|
|
188
|
+
text: `Error analyzing code quality: ${error instanceof Error ? error.message : String(error)}`,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async reviewPullRequest(args) {
|
|
195
|
+
const { files, baseBranch = "main", focusAreas } = args;
|
|
196
|
+
try {
|
|
197
|
+
const results = [];
|
|
198
|
+
for (const filePath of files) {
|
|
199
|
+
if (!fs.existsSync(filePath)) {
|
|
200
|
+
continue; // Skip files that don't exist
|
|
201
|
+
}
|
|
202
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
203
|
+
const extension = path.extname(filePath).toLowerCase();
|
|
204
|
+
const language = this.detectLanguage(extension);
|
|
205
|
+
const issues = this.analyzeCode(content, language, focusAreas);
|
|
206
|
+
const metrics = this.calculateMetrics(content, language);
|
|
207
|
+
const suggestions = this.generateSuggestions(issues, metrics, language);
|
|
208
|
+
const overallScore = this.calculateOverallScore(issues, metrics);
|
|
209
|
+
results.push({
|
|
210
|
+
file: filePath,
|
|
211
|
+
issues,
|
|
212
|
+
metrics,
|
|
213
|
+
suggestions,
|
|
214
|
+
overallScore,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const totalIssues = results.reduce((sum, r) => sum + r.issues.length, 0);
|
|
218
|
+
const avgScore = results.length > 0
|
|
219
|
+
? Math.round(results.reduce((sum, r) => sum + r.overallScore, 0) /
|
|
220
|
+
results.length)
|
|
221
|
+
: 0;
|
|
222
|
+
const criticalIssues = results.flatMap((r) => r.issues.filter((i) => i.severity === "critical"));
|
|
223
|
+
return {
|
|
224
|
+
content: [
|
|
225
|
+
{
|
|
226
|
+
type: "text",
|
|
227
|
+
text: `Pull Request Review Summary:\n\n` +
|
|
228
|
+
`Files Reviewed: ${results.length}\n` +
|
|
229
|
+
`Total Issues: ${totalIssues}\n` +
|
|
230
|
+
`Average Quality Score: ${avgScore}/100\n` +
|
|
231
|
+
`Critical Issues: ${criticalIssues.length}\n\n` +
|
|
232
|
+
`Quality Scores by File:\n${results
|
|
233
|
+
.map((r) => `${r.file}: ${r.overallScore}/100 (${r.issues.length} issues)`)
|
|
234
|
+
.join("\n")}\n\n` +
|
|
235
|
+
(criticalIssues.length > 0
|
|
236
|
+
? `🚨 Critical Issues:\n${criticalIssues
|
|
237
|
+
.map((issue) => `• ${issue.file}:${issue.line} - ${issue.message}`)
|
|
238
|
+
.join("\n")}\n\n`
|
|
239
|
+
: "") +
|
|
240
|
+
`Overall Assessment: ${this.assessOverallQuality(avgScore, totalIssues, criticalIssues.length)}`,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
return {
|
|
247
|
+
content: [
|
|
248
|
+
{
|
|
249
|
+
type: "text",
|
|
250
|
+
text: `Error reviewing pull request: ${error instanceof Error ? error.message : String(error)}`,
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
async checkBestPractices(args) {
|
|
257
|
+
const { filePath, language: specifiedLanguage, standards = [] } = args;
|
|
258
|
+
try {
|
|
259
|
+
if (!fs.existsSync(filePath)) {
|
|
260
|
+
throw new Error(`File not found: ${filePath}`);
|
|
261
|
+
}
|
|
262
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
263
|
+
const extension = path.extname(filePath).toLowerCase();
|
|
264
|
+
const detectedLanguage = this.detectLanguage(extension);
|
|
265
|
+
const language = specifiedLanguage || detectedLanguage;
|
|
266
|
+
const violations = this.checkStandardsCompliance(content, language, standards);
|
|
267
|
+
const recommendations = this.generateStandardsRecommendations(violations, language, standards);
|
|
268
|
+
return {
|
|
269
|
+
content: [
|
|
270
|
+
{
|
|
271
|
+
type: "text",
|
|
272
|
+
text: `Best Practices Check for ${filePath}:\n\n` +
|
|
273
|
+
`Language: ${language}\n` +
|
|
274
|
+
`Standards Checked: ${standards.length > 0 ? standards.join(", ") : "General best practices"}\n\n` +
|
|
275
|
+
`Violations Found: ${violations.length}\n\n` +
|
|
276
|
+
`Key Violations:\n${violations
|
|
277
|
+
.slice(0, 10)
|
|
278
|
+
.map((v) => `• ${v.severity.toUpperCase()}: ${v.rule} - ${v.description}`)
|
|
279
|
+
.join("\n")}\n\n` +
|
|
280
|
+
`Recommendations:\n${recommendations
|
|
281
|
+
.slice(0, 5)
|
|
282
|
+
.map((r) => `• ${r}`)
|
|
283
|
+
.join("\n")}\n\n` +
|
|
284
|
+
`Compliance Score: ${this.calculateComplianceScore(violations)}/100`,
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
return {
|
|
291
|
+
content: [
|
|
292
|
+
{
|
|
293
|
+
type: "text",
|
|
294
|
+
text: `Error checking best practices: ${error instanceof Error ? error.message : String(error)}`,
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
detectLanguage(extension) {
|
|
301
|
+
const languageMap = {
|
|
302
|
+
".ts": "typescript",
|
|
303
|
+
".tsx": "typescript",
|
|
304
|
+
".js": "javascript",
|
|
305
|
+
".jsx": "javascript",
|
|
306
|
+
".py": "python",
|
|
307
|
+
".java": "java",
|
|
308
|
+
".cpp": "cpp",
|
|
309
|
+
".c": "c",
|
|
310
|
+
".cs": "csharp",
|
|
311
|
+
".php": "php",
|
|
312
|
+
".rb": "ruby",
|
|
313
|
+
".go": "go",
|
|
314
|
+
".rs": "rust",
|
|
315
|
+
".swift": "swift",
|
|
316
|
+
".kt": "kotlin",
|
|
317
|
+
".scala": "scala",
|
|
318
|
+
};
|
|
319
|
+
return languageMap[extension] || "unknown";
|
|
320
|
+
}
|
|
321
|
+
analyzeCode(content, language, focusAreas) {
|
|
322
|
+
const issues = [];
|
|
323
|
+
const lines = content.split("\n");
|
|
324
|
+
// Security analysis
|
|
325
|
+
if (!focusAreas || focusAreas.includes("security")) {
|
|
326
|
+
issues.push(...this.analyzeSecurity(content, lines, language));
|
|
327
|
+
}
|
|
328
|
+
// Performance analysis
|
|
329
|
+
if (!focusAreas || focusAreas.includes("performance")) {
|
|
330
|
+
issues.push(...this.analyzePerformance(content, lines, language));
|
|
331
|
+
}
|
|
332
|
+
// Maintainability analysis
|
|
333
|
+
if (!focusAreas || focusAreas.includes("maintainability")) {
|
|
334
|
+
issues.push(...this.analyzeMaintainability(content, lines, language));
|
|
335
|
+
}
|
|
336
|
+
// Style analysis
|
|
337
|
+
if (!focusAreas || focusAreas.includes("style")) {
|
|
338
|
+
issues.push(...this.analyzeStyle(content, lines, language));
|
|
339
|
+
}
|
|
340
|
+
// Logic analysis
|
|
341
|
+
if (!focusAreas || focusAreas.includes("logic")) {
|
|
342
|
+
issues.push(...this.analyzeLogic(content, lines, language));
|
|
343
|
+
}
|
|
344
|
+
return issues;
|
|
345
|
+
}
|
|
346
|
+
analyzeSecurity(content, lines, language) {
|
|
347
|
+
const issues = [];
|
|
348
|
+
lines.forEach((line, index) => {
|
|
349
|
+
const lineNum = index + 1;
|
|
350
|
+
// SQL injection patterns
|
|
351
|
+
if (line.includes("query(") &&
|
|
352
|
+
(line.includes("${") || line.includes("+"))) {
|
|
353
|
+
issues.push({
|
|
354
|
+
type: "error",
|
|
355
|
+
category: "security",
|
|
356
|
+
line: lineNum,
|
|
357
|
+
message: "Potential SQL injection vulnerability",
|
|
358
|
+
suggestion: "Use parameterized queries or prepared statements",
|
|
359
|
+
severity: "critical",
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
// XSS patterns
|
|
363
|
+
if (line.includes("innerHTML") || line.includes("outerHTML")) {
|
|
364
|
+
issues.push({
|
|
365
|
+
type: "error",
|
|
366
|
+
category: "security",
|
|
367
|
+
line: lineNum,
|
|
368
|
+
message: "Direct HTML manipulation detected",
|
|
369
|
+
suggestion: "Use textContent or sanitize HTML input",
|
|
370
|
+
severity: "high",
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
// Hardcoded secrets
|
|
374
|
+
if (/(password|secret|key|token)\s*=\s*['"][^'"]*['"]/i.test(line)) {
|
|
375
|
+
issues.push({
|
|
376
|
+
type: "error",
|
|
377
|
+
category: "security",
|
|
378
|
+
line: lineNum,
|
|
379
|
+
message: "Hardcoded secret detected",
|
|
380
|
+
suggestion: "Move secrets to environment variables or secure vault",
|
|
381
|
+
severity: "critical",
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
// eval() usage
|
|
385
|
+
if (line.includes("eval(")) {
|
|
386
|
+
issues.push({
|
|
387
|
+
type: "error",
|
|
388
|
+
category: "security",
|
|
389
|
+
line: lineNum,
|
|
390
|
+
message: "Use of eval() detected",
|
|
391
|
+
suggestion: "Avoid eval() for security reasons",
|
|
392
|
+
severity: "high",
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
return issues;
|
|
397
|
+
}
|
|
398
|
+
analyzePerformance(content, lines, language) {
|
|
399
|
+
const issues = [];
|
|
400
|
+
lines.forEach((line, index) => {
|
|
401
|
+
const lineNum = index + 1;
|
|
402
|
+
// Inefficient loops
|
|
403
|
+
if (line.includes("for") &&
|
|
404
|
+
line.includes(".length") &&
|
|
405
|
+
!line.includes("let ")) {
|
|
406
|
+
issues.push({
|
|
407
|
+
type: "warning",
|
|
408
|
+
category: "performance",
|
|
409
|
+
line: lineNum,
|
|
410
|
+
message: "Array length accessed in loop condition",
|
|
411
|
+
suggestion: "Cache array length outside the loop",
|
|
412
|
+
severity: "medium",
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
// Memory leaks (event listeners)
|
|
416
|
+
if (line.includes("addEventListener") &&
|
|
417
|
+
!content.includes("removeEventListener")) {
|
|
418
|
+
issues.push({
|
|
419
|
+
type: "warning",
|
|
420
|
+
category: "performance",
|
|
421
|
+
line: lineNum,
|
|
422
|
+
message: "Event listener added without cleanup",
|
|
423
|
+
suggestion: "Ensure event listeners are removed when no longer needed",
|
|
424
|
+
severity: "medium",
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
// Inefficient string concatenation
|
|
428
|
+
if (language === "javascript" &&
|
|
429
|
+
line.includes("+") &&
|
|
430
|
+
line.includes("=")) {
|
|
431
|
+
issues.push({
|
|
432
|
+
type: "warning",
|
|
433
|
+
category: "performance",
|
|
434
|
+
line: lineNum,
|
|
435
|
+
message: "String concatenation in loop may be inefficient",
|
|
436
|
+
suggestion: "Consider using array.join() or template literals",
|
|
437
|
+
severity: "low",
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
return issues;
|
|
442
|
+
}
|
|
443
|
+
analyzeMaintainability(content, lines, language) {
|
|
444
|
+
const issues = [];
|
|
445
|
+
// Function length check
|
|
446
|
+
const functions = content.match(/(?:function|const|let)\s+\w+\s*[=(]\s*(?:\([^)]*\)\s*=>|function\s*\([^)]*\))/g);
|
|
447
|
+
if (functions) {
|
|
448
|
+
functions.forEach((func) => {
|
|
449
|
+
const funcStart = content.indexOf(func);
|
|
450
|
+
const funcBody = content.substring(funcStart, content.indexOf("}", funcStart) + 1);
|
|
451
|
+
const funcLines = funcBody.split("\n").length;
|
|
452
|
+
if (funcLines > 50) {
|
|
453
|
+
issues.push({
|
|
454
|
+
type: "warning",
|
|
455
|
+
category: "maintainability",
|
|
456
|
+
line: lines.findIndex((l) => l.includes(func.split(" ")[1] || func)) +
|
|
457
|
+
1,
|
|
458
|
+
message: `Function too long (${funcLines} lines)`,
|
|
459
|
+
suggestion: "Break down into smaller, focused functions",
|
|
460
|
+
severity: "medium",
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
// Deep nesting check
|
|
466
|
+
let maxNesting = 0;
|
|
467
|
+
let currentNesting = 0;
|
|
468
|
+
lines.forEach((line, index) => {
|
|
469
|
+
const openBraces = (line.match(/{/g) || []).length;
|
|
470
|
+
const closeBraces = (line.match(/}/g) || []).length;
|
|
471
|
+
currentNesting += openBraces - closeBraces;
|
|
472
|
+
maxNesting = Math.max(maxNesting, currentNesting);
|
|
473
|
+
if (currentNesting > 4) {
|
|
474
|
+
issues.push({
|
|
475
|
+
type: "warning",
|
|
476
|
+
category: "maintainability",
|
|
477
|
+
line: index + 1,
|
|
478
|
+
message: "Excessive nesting depth",
|
|
479
|
+
suggestion: "Extract nested logic into separate functions",
|
|
480
|
+
severity: "medium",
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
return issues;
|
|
485
|
+
}
|
|
486
|
+
analyzeStyle(content, lines, language) {
|
|
487
|
+
const issues = [];
|
|
488
|
+
lines.forEach((line, index) => {
|
|
489
|
+
const lineNum = index + 1;
|
|
490
|
+
// Line length check
|
|
491
|
+
if (line.length > 120) {
|
|
492
|
+
issues.push({
|
|
493
|
+
type: "info",
|
|
494
|
+
category: "style",
|
|
495
|
+
line: lineNum,
|
|
496
|
+
message: "Line too long (>120 characters)",
|
|
497
|
+
suggestion: "Break long lines for better readability",
|
|
498
|
+
severity: "low",
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
// Magic numbers
|
|
502
|
+
if (/\b\d{2,}\b/.test(line) &&
|
|
503
|
+
!line.includes("//") &&
|
|
504
|
+
!line.includes("/*")) {
|
|
505
|
+
const numbers = line.match(/\b\d{2,}\b/g);
|
|
506
|
+
if (numbers && numbers.some((n) => parseInt(n) > 1)) {
|
|
507
|
+
issues.push({
|
|
508
|
+
type: "info",
|
|
509
|
+
category: "style",
|
|
510
|
+
line: lineNum,
|
|
511
|
+
message: "Magic number detected",
|
|
512
|
+
suggestion: "Replace magic numbers with named constants",
|
|
513
|
+
severity: "low",
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
return issues;
|
|
519
|
+
}
|
|
520
|
+
analyzeLogic(content, lines, language) {
|
|
521
|
+
const issues = [];
|
|
522
|
+
// Check for console.log in production code
|
|
523
|
+
lines.forEach((line, index) => {
|
|
524
|
+
if (line.includes("console.log") && !line.includes("//")) {
|
|
525
|
+
issues.push({
|
|
526
|
+
type: "warning",
|
|
527
|
+
category: "logic",
|
|
528
|
+
line: index + 1,
|
|
529
|
+
message: "console.log statement found",
|
|
530
|
+
suggestion: "Remove console.log statements or replace with proper logging",
|
|
531
|
+
severity: "low",
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
// Check for TODO comments
|
|
536
|
+
lines.forEach((line, index) => {
|
|
537
|
+
if (line.includes("TODO") || line.includes("FIXME")) {
|
|
538
|
+
issues.push({
|
|
539
|
+
type: "info",
|
|
540
|
+
category: "logic",
|
|
541
|
+
line: index + 1,
|
|
542
|
+
message: "TODO/FIXME comment found",
|
|
543
|
+
suggestion: "Address TODO items or create proper issues",
|
|
544
|
+
severity: "low",
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
return issues;
|
|
549
|
+
}
|
|
550
|
+
calculateMetrics(content, language) {
|
|
551
|
+
const lines = content.split("\n");
|
|
552
|
+
const codeLines = lines.filter((line) => {
|
|
553
|
+
const trimmed = line.trim();
|
|
554
|
+
return (trimmed &&
|
|
555
|
+
!trimmed.startsWith("//") &&
|
|
556
|
+
!trimmed.startsWith("/*") &&
|
|
557
|
+
!trimmed.startsWith("*"));
|
|
558
|
+
});
|
|
559
|
+
const commentLines = lines.filter((line) => line.trim().startsWith("//") ||
|
|
560
|
+
line.trim().startsWith("/*") ||
|
|
561
|
+
line.trim().startsWith("*"));
|
|
562
|
+
// Simple cyclomatic complexity calculation
|
|
563
|
+
const complexityKeywords = [
|
|
564
|
+
"if",
|
|
565
|
+
"else",
|
|
566
|
+
"for",
|
|
567
|
+
"while",
|
|
568
|
+
"case",
|
|
569
|
+
"catch",
|
|
570
|
+
"&&",
|
|
571
|
+
"||",
|
|
572
|
+
];
|
|
573
|
+
let complexity = 1; // Base complexity
|
|
574
|
+
complexityKeywords.forEach((keyword) => {
|
|
575
|
+
const matches = (content.match(new RegExp(`\\b${keyword}\\b`, "g")) || [])
|
|
576
|
+
.length;
|
|
577
|
+
complexity += matches;
|
|
578
|
+
});
|
|
579
|
+
return {
|
|
580
|
+
cyclomaticComplexity: complexity,
|
|
581
|
+
linesOfCode: codeLines.length,
|
|
582
|
+
commentRatio: commentLines.length / lines.length,
|
|
583
|
+
duplicateLines: this.calculateDuplicateLines(lines),
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
calculateDuplicateLines(lines) {
|
|
587
|
+
const lineCount = new Map();
|
|
588
|
+
lines.forEach((line) => {
|
|
589
|
+
const trimmed = line.trim();
|
|
590
|
+
if (trimmed) {
|
|
591
|
+
lineCount.set(trimmed, (lineCount.get(trimmed) || 0) + 1);
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
let duplicates = 0;
|
|
595
|
+
lineCount.forEach((count) => {
|
|
596
|
+
if (count > 1) {
|
|
597
|
+
duplicates += count;
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
return duplicates;
|
|
601
|
+
}
|
|
602
|
+
generateSuggestions(issues, metrics, language) {
|
|
603
|
+
const suggestions = [];
|
|
604
|
+
if (issues.length === 0) {
|
|
605
|
+
suggestions.push("Code quality is excellent! Consider adding more comprehensive tests.");
|
|
606
|
+
}
|
|
607
|
+
// Group issues by category and severity
|
|
608
|
+
const criticalIssues = issues.filter((i) => i.severity === "critical");
|
|
609
|
+
const highIssues = issues.filter((i) => i.severity === "high");
|
|
610
|
+
if (criticalIssues.length > 0) {
|
|
611
|
+
suggestions.push("Address all critical security and error issues before committing.");
|
|
612
|
+
}
|
|
613
|
+
if (highIssues.length > 0) {
|
|
614
|
+
suggestions.push("Review and fix high-priority issues to improve code reliability.");
|
|
615
|
+
}
|
|
616
|
+
if (metrics) {
|
|
617
|
+
if (metrics.cyclomaticComplexity > 20) {
|
|
618
|
+
suggestions.push("Consider breaking down complex functions to reduce cyclomatic complexity.");
|
|
619
|
+
}
|
|
620
|
+
if (metrics.commentRatio < 0.1) {
|
|
621
|
+
suggestions.push("Add more comments to improve code documentation and maintainability.");
|
|
622
|
+
}
|
|
623
|
+
if (metrics.linesOfCode > 500) {
|
|
624
|
+
suggestions.push("Large files detected. Consider splitting into smaller, focused modules.");
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
// Language-specific suggestions
|
|
628
|
+
switch (language) {
|
|
629
|
+
case "typescript":
|
|
630
|
+
suggestions.push("Ensure proper TypeScript type annotations and avoid 'any' types.");
|
|
631
|
+
break;
|
|
632
|
+
case "javascript":
|
|
633
|
+
suggestions.push("Consider migrating to TypeScript for better type safety.");
|
|
634
|
+
break;
|
|
635
|
+
case "python":
|
|
636
|
+
suggestions.push("Follow PEP 8 style guidelines and add type hints.");
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
return suggestions;
|
|
640
|
+
}
|
|
641
|
+
calculateOverallScore(issues, metrics) {
|
|
642
|
+
let score = 100;
|
|
643
|
+
// Deduct points for issues
|
|
644
|
+
issues.forEach((issue) => {
|
|
645
|
+
switch (issue.severity) {
|
|
646
|
+
case "critical":
|
|
647
|
+
score -= 10;
|
|
648
|
+
break;
|
|
649
|
+
case "high":
|
|
650
|
+
score -= 5;
|
|
651
|
+
break;
|
|
652
|
+
case "medium":
|
|
653
|
+
score -= 2;
|
|
654
|
+
break;
|
|
655
|
+
case "low":
|
|
656
|
+
score -= 1;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
// Deduct points for poor metrics
|
|
661
|
+
if (metrics) {
|
|
662
|
+
if (metrics.cyclomaticComplexity > 20)
|
|
663
|
+
score -= 10;
|
|
664
|
+
if (metrics.commentRatio < 0.05)
|
|
665
|
+
score -= 5;
|
|
666
|
+
if (metrics.duplicateLines > 50)
|
|
667
|
+
score -= 5;
|
|
668
|
+
}
|
|
669
|
+
return Math.max(0, Math.min(100, score));
|
|
670
|
+
}
|
|
671
|
+
assessOverallQuality(avgScore, totalIssues, criticalIssues) {
|
|
672
|
+
if (avgScore >= 90 && criticalIssues === 0) {
|
|
673
|
+
return "✅ EXCELLENT: Code quality is outstanding. Ready for production.";
|
|
674
|
+
}
|
|
675
|
+
else if (avgScore >= 75 && criticalIssues === 0) {
|
|
676
|
+
return "👍 GOOD: Code quality is acceptable. Minor improvements recommended.";
|
|
677
|
+
}
|
|
678
|
+
else if (avgScore >= 60) {
|
|
679
|
+
return "⚠️ NEEDS ATTENTION: Address critical issues and major improvements needed.";
|
|
680
|
+
}
|
|
681
|
+
else {
|
|
682
|
+
return "🚨 CRITICAL: Major quality issues detected. Do not merge without fixes.";
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
checkStandardsCompliance(content, language, standards) {
|
|
686
|
+
const violations = [];
|
|
687
|
+
// TypeScript specific checks
|
|
688
|
+
if (language === "typescript") {
|
|
689
|
+
if (content.includes(": any")) {
|
|
690
|
+
violations.push({
|
|
691
|
+
rule: "no-any",
|
|
692
|
+
description: "Avoid using 'any' type",
|
|
693
|
+
severity: "medium",
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
if (!content.includes("interface") && !content.includes("type")) {
|
|
697
|
+
violations.push({
|
|
698
|
+
rule: "use-types",
|
|
699
|
+
description: "Consider using interfaces or types for better type safety",
|
|
700
|
+
severity: "low",
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
// JavaScript specific checks
|
|
705
|
+
if (language === "javascript") {
|
|
706
|
+
if (content.includes("var ")) {
|
|
707
|
+
violations.push({
|
|
708
|
+
rule: "no-var",
|
|
709
|
+
description: "Use 'const' or 'let' instead of 'var'",
|
|
710
|
+
severity: "medium",
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
// Python specific checks
|
|
715
|
+
if (language === "python") {
|
|
716
|
+
if (content.includes("print(") && !content.includes("#")) {
|
|
717
|
+
violations.push({
|
|
718
|
+
rule: "no-print",
|
|
719
|
+
description: "Avoid using print() in production code",
|
|
720
|
+
severity: "low",
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return violations;
|
|
725
|
+
}
|
|
726
|
+
generateStandardsRecommendations(violations, language, standards) {
|
|
727
|
+
const recommendations = [];
|
|
728
|
+
if (violations.length === 0) {
|
|
729
|
+
recommendations.push(`Code follows ${language} best practices.`);
|
|
730
|
+
return recommendations;
|
|
731
|
+
}
|
|
732
|
+
violations.forEach((violation) => {
|
|
733
|
+
recommendations.push(`Fix ${violation.rule}: ${violation.description}`);
|
|
734
|
+
});
|
|
735
|
+
// Language-specific recommendations
|
|
736
|
+
switch (language) {
|
|
737
|
+
case "typescript":
|
|
738
|
+
recommendations.push("Enable strict TypeScript settings for better type checking.");
|
|
739
|
+
break;
|
|
740
|
+
case "javascript":
|
|
741
|
+
recommendations.push("Consider using ESLint with a comprehensive ruleset.");
|
|
742
|
+
break;
|
|
743
|
+
case "python":
|
|
744
|
+
recommendations.push("Use black for code formatting and flake8 for linting.");
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
747
|
+
return recommendations;
|
|
748
|
+
}
|
|
749
|
+
calculateComplianceScore(violations) {
|
|
750
|
+
const baseScore = 100;
|
|
751
|
+
const deductions = violations.reduce((total, violation) => {
|
|
752
|
+
switch (violation.severity) {
|
|
753
|
+
case "high":
|
|
754
|
+
return total + 10;
|
|
755
|
+
case "medium":
|
|
756
|
+
return total + 5;
|
|
757
|
+
case "low":
|
|
758
|
+
return total + 2;
|
|
759
|
+
default:
|
|
760
|
+
return total + 1;
|
|
761
|
+
}
|
|
762
|
+
}, 0);
|
|
763
|
+
return Math.max(0, baseScore - deductions);
|
|
764
|
+
}
|
|
765
|
+
async run() {
|
|
766
|
+
const transport = new StdioServerTransport();
|
|
767
|
+
await this.server.connect(transport);
|
|
768
|
+
console.log("StrRay Code Review MCP Server running...");
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
// Run the server if this file is executed directly
|
|
772
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
773
|
+
const server = new StrRayCodeReviewServer();
|
|
774
|
+
server.run().catch(console.error);
|
|
775
|
+
}
|
|
776
|
+
export { StrRayCodeReviewServer };
|
|
777
|
+
//# sourceMappingURL=code-review.server.js.map
|