0xray 2.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/.opencode/agents/api-design.yml +31 -0
- package/.opencode/agents/architect.yml +15 -0
- package/.opencode/agents/architecture-patterns.yml +14 -0
- package/.opencode/agents/auto-format.yml +14 -0
- package/.opencode/agents/backend-engineer.yml +12 -0
- package/.opencode/agents/boot-orchestrator.yml +14 -0
- package/.opencode/agents/bug-triage-specialist.yml +15 -0
- package/.opencode/agents/code-analyzer.yml +12 -0
- package/.opencode/agents/code-reviewer.yml +14 -0
- package/.opencode/agents/content-creator.yml +12 -0
- package/.opencode/agents/database-engineer.yml +12 -0
- package/.opencode/agents/devops-engineer.yml +12 -0
- package/.opencode/agents/framework-compliance-audit.yml +14 -0
- package/.opencode/agents/frontend-engineer.yml +12 -0
- package/.opencode/agents/frontend-ui-ux-engineer.yml +12 -0
- package/.opencode/agents/git-workflow.yml +15 -0
- package/.opencode/agents/growth-strategist.yml +12 -0
- package/.opencode/agents/hermes-agent.yml +12 -0
- package/.opencode/agents/inference-improve.yml +12 -0
- package/.opencode/agents/lint.yml +14 -0
- package/.opencode/agents/log-monitor.yml +12 -0
- package/.opencode/agents/mobile-developer.yml +12 -0
- package/.opencode/agents/model-health-check.yml +12 -0
- package/.opencode/agents/multimodal-looker.yml +12 -0
- package/.opencode/agents/performance-analysis.yml +12 -0
- package/.opencode/agents/performance-engineer.yml +12 -0
- package/.opencode/agents/performance-optimization.yml +12 -0
- package/.opencode/agents/processor-pipeline.yml +14 -0
- package/.opencode/agents/project-analysis.yml +12 -0
- package/.opencode/agents/refactorer.yml +12 -0
- package/.opencode/agents/researcher.yml +12 -0
- package/.opencode/agents/security-auditor.yml +12 -0
- package/.opencode/agents/security-scan.yml +12 -0
- package/.opencode/agents/seo-consultant.yml +12 -0
- package/.opencode/agents/session-management.yml +12 -0
- package/.opencode/agents/state-manager.yml +12 -0
- package/.opencode/agents/storyteller.yml +12 -0
- package/.opencode/agents/strategist.yml +12 -0
- package/.opencode/agents/tech-writer.yml +12 -0
- package/.opencode/agents/testing-best-practices.yml +12 -0
- package/.opencode/agents/testing-lead.yml +12 -0
- package/.opencode/agents/ui-ux-design.yml +12 -0
- package/.opencode/codex.codex +8 -0
- package/.opencode/commands/auto-format.md +99 -0
- package/.opencode/commands/auto-summary-capture.md +90 -0
- package/.opencode/commands/dependency-audit.md +184 -0
- package/.opencode/commands/enforcer-daily-scan.md +137 -0
- package/.opencode/commands/framework-compliance-audit.md +205 -0
- package/.opencode/commands/interactive-validator.md +75 -0
- package/.opencode/commands/job-summary-logger.md +68 -0
- package/.opencode/commands/lint.md +11 -0
- package/.opencode/commands/mode-switch.md +95 -0
- package/.opencode/commands/model-health-check.md +186 -0
- package/.opencode/commands/performance-analysis.md +144 -0
- package/.opencode/commands/pre-commit-introspection.md +185 -0
- package/.opencode/commands/pre-commit-introspection.sh +133 -0
- package/.opencode/commands/security-scan.md +157 -0
- package/.opencode/commands/sisyphus-validation.md +128 -0
- package/.opencode/commands/summary-logger.md +83 -0
- package/.opencode/enforcer-config.json +285 -0
- package/.opencode/hooks/hook-metrics.json +380 -0
- package/.opencode/hooks/post-commit +114 -0
- package/.opencode/hooks/post-push +34 -0
- package/.opencode/init.sh +151 -0
- package/.opencode/skills/api-design/SKILL.md +37 -0
- package/.opencode/skills/architect-tools/SKILL.md +37 -0
- package/.opencode/skills/architecture-patterns/SKILL.md +37 -0
- package/.opencode/skills/auto-format/SKILL.md +37 -0
- package/.opencode/skills/backend-engineer/SKILL.md +49 -0
- package/.opencode/skills/boot-orchestrator/SKILL.md +37 -0
- package/.opencode/skills/bug-triage/SKILL.md +43 -0
- package/.opencode/skills/code-analyzer/SKILL.md +45 -0
- package/.opencode/skills/code-review/SKILL.md +52 -0
- package/.opencode/skills/content-creator/SKILL.md +38 -0
- package/.opencode/skills/database-engineer/SKILL.md +46 -0
- package/.opencode/skills/devops-engineer/SKILL.md +49 -0
- package/.opencode/skills/enforcer/SKILL.md +37 -0
- package/.opencode/skills/framework-compliance-audit/SKILL.md +37 -0
- package/.opencode/skills/frontend-engineer/SKILL.md +49 -0
- package/.opencode/skills/frontend-ui-ux-engineer/SKILL.md +41 -0
- package/.opencode/skills/git-workflow/SKILL.md +37 -0
- package/.opencode/skills/growth-strategist/SKILL.md +48 -0
- package/.opencode/skills/hermes-agent/SKILL.md +212 -0
- package/.opencode/skills/inference-improve/SKILL.md +97 -0
- package/.opencode/skills/lint/SKILL.md +37 -0
- package/.opencode/skills/log-monitor/SKILL.md +44 -0
- package/.opencode/skills/mobile-developer/SKILL.md +42 -0
- package/.opencode/skills/model-health-check/SKILL.md +37 -0
- package/.opencode/skills/multimodal-looker/SKILL.md +45 -0
- package/.opencode/skills/orchestrator/SKILL.md +37 -0
- package/.opencode/skills/performance-analysis/SKILL.md +37 -0
- package/.opencode/skills/performance-engineer/SKILL.md +41 -0
- package/.opencode/skills/performance-optimization/SKILL.md +37 -0
- package/.opencode/skills/processor-pipeline/SKILL.md +37 -0
- package/.opencode/skills/project-analysis/SKILL.md +42 -0
- package/.opencode/skills/refactoring-strategies/SKILL.md +37 -0
- package/.opencode/skills/registry.json +66 -0
- package/.opencode/skills/researcher/SKILL.md +37 -0
- package/.opencode/skills/security-audit/SKILL.md +47 -0
- package/.opencode/skills/security-scan/SKILL.md +37 -0
- package/.opencode/skills/seo-consultant/SKILL.md +43 -0
- package/.opencode/skills/session-management/SKILL.md +36 -0
- package/.opencode/skills/state-manager/SKILL.md +37 -0
- package/.opencode/skills/storyteller/SKILL.md +130 -0
- package/.opencode/skills/strategist/SKILL.md +32 -0
- package/.opencode/skills/tech-writer/SKILL.md +37 -0
- package/.opencode/skills/testing-best-practices/SKILL.md +37 -0
- package/.opencode/skills/testing-strategy/SKILL.md +43 -0
- package/.opencode/skills/ui-ux-design/SKILL.md +603 -0
- package/.opencode/workflows/post-deployment-audit.yml +123 -0
- package/AGENTS.md +110 -0
- package/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/AGENTS.md +110 -0
- package/dist/CHANGELOG.md +2182 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +131 -0
- package/dist/agents/architect.js +56 -0
- package/dist/agents/backend-engineer.js +81 -0
- package/dist/agents/bug-triage-specialist.js +74 -0
- package/dist/agents/code-analyzer.js +150 -0
- package/dist/agents/code-reviewer.js +69 -0
- package/dist/agents/content-creator.js +72 -0
- package/dist/agents/database-engineer.js +76 -0
- package/dist/agents/devops-engineer.js +84 -0
- package/dist/agents/frontend-engineer.js +78 -0
- package/dist/agents/frontend-ui-ux-engineer.js +64 -0
- package/dist/agents/growth-strategist.js +111 -0
- package/dist/agents/index.js +45 -0
- package/dist/agents/librarian-agents-updater.js +333 -0
- package/dist/agents/log-monitor.js +109 -0
- package/dist/agents/mobile-developer.js +102 -0
- package/dist/agents/multimodal-looker.js +93 -0
- package/dist/agents/performance-engineer.js +86 -0
- package/dist/agents/refactorer.js +80 -0
- package/dist/agents/registry.js +340 -0
- package/dist/agents/researcher.js +83 -0
- package/dist/agents/security-auditor.js +158 -0
- package/dist/agents/seo-consultant.js +53 -0
- package/dist/agents/strategist.js +47 -0
- package/dist/agents/tech-writer.js +84 -0
- package/dist/agents/testing-lead.js +95 -0
- package/dist/agents/types.js +1 -0
- package/dist/analytics/consent-manager.js +258 -0
- package/dist/analytics/emerging-pattern-detector.js +260 -0
- package/dist/analytics/pattern-learning-engine.js +278 -0
- package/dist/analytics/pattern-performance-tracker.js +336 -0
- package/dist/analytics/predictive-analytics.js +248 -0
- package/dist/analytics/prompt-pattern-analyzer.js +371 -0
- package/dist/analytics/routing-performance-analyzer.js +356 -0
- package/dist/analytics/routing-refiner.js +380 -0
- package/dist/analytics/simple-pattern-analyzer.js +297 -0
- package/dist/architect/architect-tools.js +437 -0
- package/dist/architect/architectural-integrity.js +78 -0
- package/dist/benchmark/performance-benchmark.js +372 -0
- package/dist/cli/commands/analytics-disable.js +72 -0
- package/dist/cli/commands/analytics-enable-action.js +82 -0
- package/dist/cli/commands/analytics-preview.js +106 -0
- package/dist/cli/commands/analytics-status.js +68 -0
- package/dist/cli/commands/antigravity-status.js +106 -0
- package/dist/cli/commands/archive-logs.js +161 -0
- package/dist/cli/commands/credible-init.js +82 -0
- package/dist/cli/commands/grok-install.js +16 -0
- package/dist/cli/commands/hermes-install.js +66 -0
- package/dist/cli/commands/mcp-install.js +253 -0
- package/dist/cli/commands/openclaw-install.js +44 -0
- package/dist/cli/commands/opencode-install.js +99 -0
- package/dist/cli/commands/plugin-commands.js +246 -0
- package/dist/cli/commands/publish-agent.js +184 -0
- package/dist/cli/commands/security-audit.js +219 -0
- package/dist/cli/commands/skill-install.js +481 -0
- package/dist/cli/commands/status.js +196 -0
- package/dist/cli/commands/storyteller.js +230 -0
- package/dist/cli/index.js +986 -0
- package/dist/cli/server.js +147 -0
- package/dist/config/default-agents.js +16 -0
- package/dist/core/activity-logger.js +260 -0
- package/dist/core/adaptive-kernel.js +192 -0
- package/dist/core/agent-spawn-gate.js +120 -0
- package/dist/core/boot-orchestrator.js +812 -0
- package/dist/core/bridge.mjs +945 -0
- package/dist/core/codex-formatter.js +220 -0
- package/dist/core/codex-injector.js +424 -0
- package/dist/core/config-loader.js +148 -0
- package/dist/core/config-paths.js +162 -0
- package/dist/core/context-loader.js +269 -0
- package/dist/core/context-validator.js +212 -0
- package/dist/core/features-config.js +457 -0
- package/dist/core/framework-logger.js +275 -0
- package/dist/core/index.js +6 -0
- package/dist/core/kernel-patterns.js +302 -0
- package/dist/core/logging-config.js +43 -0
- package/dist/core/model-router.js +175 -0
- package/dist/core/orchestrator.js +408 -0
- package/dist/core/system-prompt-generator.js +265 -0
- package/dist/core/trace-context.js +33 -0
- package/dist/core/xray-activation.js +134 -0
- package/dist/delegation/agent-delegator.js +769 -0
- package/dist/delegation/agent-expertise.js +156 -0
- package/dist/delegation/analytics/index.js +12 -0
- package/dist/delegation/analytics/learning-engine.js +277 -0
- package/dist/delegation/analytics/outcome-tracker.js +279 -0
- package/dist/delegation/analytics/routing-analytics.js +193 -0
- package/dist/delegation/ast-code-parser.js +878 -0
- package/dist/delegation/codebase-context-analyzer.js +1040 -0
- package/dist/delegation/complexity-analyzer.js +282 -0
- package/dist/delegation/complexity-core.js +219 -0
- package/dist/delegation/config/types.js +6 -0
- package/dist/delegation/dependency-graph-builder.js +409 -0
- package/dist/delegation/index.js +20 -0
- package/dist/delegation/metrics-aggregator.js +335 -0
- package/dist/delegation/session-coordinator.js +352 -0
- package/dist/delegation/strategy-selector.js +108 -0
- package/dist/delegation/voting-coordinator.js +375 -0
- package/dist/delegation/voting-types.js +10 -0
- package/dist/delegation/weighted-voting-aggregator.js +194 -0
- package/dist/enforcement/core/index.js +19 -0
- package/dist/enforcement/core/rule-executor.js +365 -0
- package/dist/enforcement/core/rule-hierarchy.js +259 -0
- package/dist/enforcement/core/rule-registry.js +240 -0
- package/dist/enforcement/core/violation-fixer.js +651 -0
- package/dist/enforcement/enforcer-tools.js +909 -0
- package/dist/enforcement/index.js +41 -0
- package/dist/enforcement/loaders/agent-triage-loader.js +222 -0
- package/dist/enforcement/loaders/agents-md-validation-loader.js +252 -0
- package/dist/enforcement/loaders/base-loader.js +86 -0
- package/dist/enforcement/loaders/codex-loader.js +396 -0
- package/dist/enforcement/loaders/index.js +40 -0
- package/dist/enforcement/loaders/loader-orchestrator.js +168 -0
- package/dist/enforcement/loaders/processor-loader.js +113 -0
- package/dist/enforcement/rule-enforcer.js +298 -0
- package/dist/enforcement/test-auto-healing.js +325 -0
- package/dist/enforcement/types.js +30 -0
- package/dist/enforcement/validators/architecture-validators.js +600 -0
- package/dist/enforcement/validators/base-validator.js +108 -0
- package/dist/enforcement/validators/code-quality-validators.js +336 -0
- package/dist/enforcement/validators/index.js +21 -0
- package/dist/enforcement/validators/security-validators.js +220 -0
- package/dist/enforcement/validators/testing-validators.js +253 -0
- package/dist/enforcement/validators/validator-registry.js +150 -0
- package/dist/execution/opencode-cli-invoker.js +173 -0
- package/dist/execution/proposal-applier.js +254 -0
- package/dist/governance/codex-policy.service.js +167 -0
- package/dist/governance/governance-core.js +152 -0
- package/dist/governance/governance-service.js +274 -0
- package/dist/governance/governance-types.js +6 -0
- package/dist/index.js +24 -0
- package/dist/inference/deploy-verifier.js +161 -0
- package/dist/inference/index.js +5 -0
- package/dist/inference/inference-accumulator.js +126 -0
- package/dist/inference/inference-cycle.js +1168 -0
- package/dist/inference/semantic-patterns.js +310 -0
- package/dist/inference/session-capture.js +308 -0
- package/dist/integrations/base/ExampleIntegration.js +181 -0
- package/dist/integrations/base/Integration.js +395 -0
- package/dist/integrations/base/README.md +446 -0
- package/dist/integrations/base/index.js +16 -0
- package/dist/integrations/base/registry.js +606 -0
- package/dist/integrations/base/types.js +118 -0
- package/dist/integrations/governance/governance-client.js +316 -0
- package/dist/integrations/governance/index.js +373 -0
- package/dist/integrations/governance/types.js +97 -0
- package/dist/integrations/grok/grok-cli.js +83 -0
- package/dist/integrations/grok/hooks/pre-tool-use.js +134 -0
- package/dist/integrations/grok/plugin/0xray/.mcp.json +15 -0
- package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +30 -0
- package/dist/integrations/hermes-agent/__init__.py +718 -0
- package/dist/integrations/hermes-agent/after-install.md +71 -0
- package/dist/integrations/hermes-agent/bridge.mjs +861 -0
- package/dist/integrations/hermes-agent/conftest.py +14 -0
- package/dist/integrations/hermes-agent/plugin.yaml +12 -0
- package/dist/integrations/hermes-agent/schemas.py +100 -0
- package/dist/integrations/hermes-agent/test_plugin.py +1100 -0
- package/dist/integrations/hermes-agent/tools.py +253 -0
- package/dist/integrations/openclaw/README.md +134 -0
- package/dist/integrations/openclaw/api-server.js +389 -0
- package/dist/integrations/openclaw/client.js +492 -0
- package/dist/integrations/openclaw/config.js +374 -0
- package/dist/integrations/openclaw/hooks/strray-hooks.js +280 -0
- package/dist/integrations/openclaw/index.js +351 -0
- package/dist/integrations/openclaw/types.js +153 -0
- package/dist/integrations/plugins/index.js +10 -0
- package/dist/integrations/plugins/plugin-integration.js +606 -0
- package/dist/integrations/plugins/plugin-registry.js +580 -0
- package/dist/mcps/agent-resolver.js +106 -0
- package/dist/mcps/architect-tools.server.js +277 -0
- package/dist/mcps/auto-format.server.js +413 -0
- package/dist/mcps/boot-orchestrator.server.js +853 -0
- package/dist/mcps/config/config-loader.js +103 -0
- package/dist/mcps/config/config-validator.js +101 -0
- package/dist/mcps/config/index.js +30 -0
- package/dist/mcps/config/plugin-server-registry.js +223 -0
- package/dist/mcps/config/server-config-registry.js +348 -0
- package/dist/mcps/connection/connection-manager.js +79 -0
- package/dist/mcps/connection/connection-pool.js +164 -0
- package/dist/mcps/connection/mcp-connection.js +233 -0
- package/dist/mcps/connection/process-spawner.js +34 -0
- package/dist/mcps/enforcer-tools.server.js +778 -0
- package/dist/mcps/estimation.server.js +192 -0
- package/dist/mcps/framework-compliance-audit.server.js +500 -0
- package/dist/mcps/framework-help.server.js +400 -0
- package/dist/mcps/governance.server.js +464 -0
- package/dist/mcps/in-process-skill-registry.js +48 -0
- package/dist/mcps/knowledge-skills/api-design.server.js +123 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +113 -0
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +474 -0
- package/dist/mcps/knowledge-skills/code-analyzer.server.js +605 -0
- package/dist/mcps/knowledge-skills/code-review.server.js +847 -0
- package/dist/mcps/knowledge-skills/content-creator.server.js +256 -0
- package/dist/mcps/knowledge-skills/database-design.server.js +822 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +1180 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.js +115 -0
- package/dist/mcps/knowledge-skills/growth-strategist.server.js +361 -0
- package/dist/mcps/knowledge-skills/log-monitor.server.js +451 -0
- package/dist/mcps/knowledge-skills/mobile-development.server.js +525 -0
- package/dist/mcps/knowledge-skills/multimodal-looker.server.js +1063 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +1587 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.js +811 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +796 -0
- package/dist/mcps/knowledge-skills/security-audit.server.js +846 -0
- package/dist/mcps/knowledge-skills/seo-consultant.server.js +937 -0
- package/dist/mcps/knowledge-skills/session-management.server.js +470 -0
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +729 -0
- package/dist/mcps/knowledge-skills/strategist.server.js +217 -0
- package/dist/mcps/knowledge-skills/tech-writer.server.js +1191 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +866 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +827 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +1538 -0
- package/dist/mcps/lint.server.js +381 -0
- package/dist/mcps/mcp-client.js +574 -0
- package/dist/mcps/model-health-check.server.js +228 -0
- package/dist/mcps/orchestrator/config/agent-capabilities.js +87 -0
- package/dist/mcps/orchestrator/execution/execution-planner.js +279 -0
- package/dist/mcps/orchestrator/handlers/complexity-handler.js +94 -0
- package/dist/mcps/orchestrator/handlers/status-handler.js +232 -0
- package/dist/mcps/orchestrator/handlers/task-handler.js +197 -0
- package/dist/mcps/orchestrator/server.js +305 -0
- package/dist/mcps/orchestrator/types.js +6 -0
- package/dist/mcps/orchestrator.server.js +19 -0
- package/dist/mcps/performance-analysis.server.js +519 -0
- package/dist/mcps/processor-pipeline.server.js +561 -0
- package/dist/mcps/protocol/protocol-constants.js +46 -0
- package/dist/mcps/registry.json +110 -0
- package/dist/mcps/researcher.server.js +504 -0
- package/dist/mcps/security-scan.server.js +531 -0
- package/dist/mcps/simulation/index.js +12 -0
- package/dist/mcps/simulation/server-simulations.js +219 -0
- package/dist/mcps/simulation/simulation-engine.js +96 -0
- package/dist/mcps/state-manager.server.js +637 -0
- package/dist/mcps/tools/index.js +14 -0
- package/dist/mcps/tools/tool-cache.js +112 -0
- package/dist/mcps/tools/tool-discovery.js +65 -0
- package/dist/mcps/tools/tool-executor.js +75 -0
- package/dist/mcps/tools/tool-registry.js +67 -0
- package/dist/mcps/types/index.js +15 -0
- package/dist/mcps/types/json-rpc.types.js +7 -0
- package/dist/mcps/types/mcp.types.js +7 -0
- package/dist/metrics/agent-metrics.js +574 -0
- package/dist/metrics/index.js +6 -0
- package/dist/monitoring/advanced-profiler.js +232 -0
- package/dist/monitoring/memory-monitor.js +315 -0
- package/dist/monitoring/nudge-watchdog.js +356 -0
- package/dist/monitoring/test-auto-generation-monitor.js +157 -0
- package/dist/orchestrator/agent-spawn-governor.js +559 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.js +399 -0
- package/dist/orchestrator/intelligent-commit-batcher.js +353 -0
- package/dist/orchestrator/multi-agent-orchestration-coordinator.js +456 -0
- package/dist/orchestrator/orchestrator.js +657 -0
- package/dist/orchestrator/self-direction-activation.js +245 -0
- package/dist/orchestrator/universal-librarian-consultation.js +216 -0
- package/dist/orchestrator/universal-registry-bridge.js +247 -0
- package/dist/performance/performance-budget-enforcer.js +434 -0
- package/dist/performance/performance-regression-tester.js +342 -0
- package/dist/plugin/xray-codex-injection.js +857 -0
- package/dist/postprocessor/PostProcessor.js +1048 -0
- package/dist/postprocessor/analysis/FailureAnalysisEngine.js +245 -0
- package/dist/postprocessor/autofix/AutoFixEngine.js +254 -0
- package/dist/postprocessor/autofix/FixValidator.js +56 -0
- package/dist/postprocessor/config.js +65 -0
- package/dist/postprocessor/escalation/EscalationEngine.js +492 -0
- package/dist/postprocessor/monitoring/MonitoringEngine.js +125 -0
- package/dist/postprocessor/redeploy/RedeployCoordinator.js +342 -0
- package/dist/postprocessor/services/RegressionAnalysisService.js +131 -0
- package/dist/postprocessor/success/SuccessHandler.js +134 -0
- package/dist/postprocessor/triggers/APITrigger.js +115 -0
- package/dist/postprocessor/triggers/GitHookTrigger.js +551 -0
- package/dist/postprocessor/triggers/WebhookTrigger.js +211 -0
- package/dist/postprocessor/types.js +4 -0
- package/dist/processors/doc-write-guard.js +46 -0
- package/dist/processors/implementations/agents-md-validation-processor.js +286 -0
- package/dist/processors/implementations/async-pattern-processor.js +158 -0
- package/dist/processors/implementations/codex-compliance-processor.js +57 -0
- package/dist/processors/implementations/commit-batcher-processor.js +71 -0
- package/dist/processors/implementations/console-log-guard-processor.js +163 -0
- package/dist/processors/implementations/coverage-analysis-processor.js +138 -0
- package/dist/processors/implementations/error-boundary-processor.js +44 -0
- package/dist/processors/implementations/inference-improvement-processor.js +270 -0
- package/dist/processors/implementations/log-protection-processor.js +118 -0
- package/dist/processors/implementations/nudge-processor.js +130 -0
- package/dist/processors/implementations/performance-budget-processor.js +217 -0
- package/dist/processors/implementations/postprocessor-chain-validator.js +149 -0
- package/dist/processors/implementations/pre-validate-processor.js +18 -0
- package/dist/processors/implementations/publish-preflight-processor.js +249 -0
- package/dist/processors/implementations/refactoring-logging-processor-wrapper.js +33 -0
- package/dist/processors/implementations/refactoring-logging-processor.js +96 -0
- package/dist/processors/implementations/regression-testing-processor.js +59 -0
- package/dist/processors/implementations/session-capture-processor.js +37 -0
- package/dist/processors/implementations/session-summary-processor.js +130 -0
- package/dist/processors/implementations/spawn-governance-processor.js +219 -0
- package/dist/processors/implementations/state-validation-processor.js +15 -0
- package/dist/processors/implementations/storytelling-trigger-processor.js +589 -0
- package/dist/processors/implementations/test-auto-creation-processor.js +484 -0
- package/dist/processors/implementations/test-execution-processor.js +132 -0
- package/dist/processors/implementations/typescript-compilation-processor.js +87 -0
- package/dist/processors/implementations/version-compliance-processor.js +350 -0
- package/dist/processors/processor-interfaces.js +126 -0
- package/dist/processors/processor-manager.js +826 -0
- package/dist/processors/processor-types.js +12 -0
- package/dist/public/about.html +228 -0
- package/dist/public/enterprise.html +27 -0
- package/dist/public/features.html +102 -0
- package/dist/public/index.html +145 -0
- package/dist/reporting/framework-reporting-system.js +187 -0
- package/dist/reporting/log-parser.js +281 -0
- package/dist/reporting/metrics.js +202 -0
- package/dist/reporting/report-formatter.js +146 -0
- package/dist/reporting/types.js +1 -0
- package/dist/scripts/activate-kernel-pipeline.js +101 -0
- package/dist/scripts/integration.js +234 -0
- package/dist/scripts/pre-command +26 -0
- package/dist/scripts/pre-command.mjs +358 -0
- package/dist/security/comprehensive-security-audit.js +1005 -0
- package/dist/security/index.js +13 -0
- package/dist/security/prompt-security-validator.js +148 -0
- package/dist/security/security-agent-coordinator.js +204 -0
- package/dist/security/security-auditor.js +584 -0
- package/dist/security/security-hardener.js +170 -0
- package/dist/security/security-hardening-system.js +727 -0
- package/dist/security/security-headers.js +118 -0
- package/dist/security/security-orchestration-layer.js +496 -0
- package/dist/security/security-scanner.js +429 -0
- package/dist/services/inference-tuner.js +301 -0
- package/dist/session/index.js +3 -0
- package/dist/session/session-cleanup-manager.js +366 -0
- package/dist/session/session-monitor.js +503 -0
- package/dist/session/session-state-manager.js +522 -0
- package/dist/skills/api-design/SKILL.md +37 -0
- package/dist/skills/architect-tools/SKILL.md +37 -0
- package/dist/skills/architecture-patterns/SKILL.md +37 -0
- package/dist/skills/auto-format/SKILL.md +37 -0
- package/dist/skills/backend-engineer/SKILL.md +49 -0
- package/dist/skills/boot-orchestrator/SKILL.md +37 -0
- package/dist/skills/bug-triage/SKILL.md +43 -0
- package/dist/skills/code-analyzer/SKILL.md +45 -0
- package/dist/skills/code-review/SKILL.md +52 -0
- package/dist/skills/content-creator/SKILL.md +38 -0
- package/dist/skills/database-engineer/SKILL.md +46 -0
- package/dist/skills/devops-engineer/SKILL.md +49 -0
- package/dist/skills/enforcer/SKILL.md +37 -0
- package/dist/skills/framework-compliance-audit/SKILL.md +37 -0
- package/dist/skills/frontend-engineer/SKILL.md +49 -0
- package/dist/skills/frontend-ui-ux-engineer/SKILL.md +41 -0
- package/dist/skills/git-workflow/SKILL.md +37 -0
- package/dist/skills/growth-strategist/SKILL.md +48 -0
- package/dist/skills/hermes-agent/SKILL.md +212 -0
- package/dist/skills/inference-improve/SKILL.md +97 -0
- package/dist/skills/lint/SKILL.md +37 -0
- package/dist/skills/log-monitor/SKILL.md +44 -0
- package/dist/skills/mobile-developer/SKILL.md +42 -0
- package/dist/skills/model-health-check/SKILL.md +37 -0
- package/dist/skills/multimodal-looker/SKILL.md +45 -0
- package/dist/skills/orchestrator/SKILL.md +37 -0
- package/dist/skills/performance-analysis/SKILL.md +37 -0
- package/dist/skills/performance-engineer/SKILL.md +41 -0
- package/dist/skills/performance-optimization/SKILL.md +37 -0
- package/dist/skills/processor-pipeline/SKILL.md +37 -0
- package/dist/skills/project-analysis/SKILL.md +42 -0
- package/dist/skills/refactoring-strategies/SKILL.md +37 -0
- package/dist/skills/registry.json +66 -0
- package/dist/skills/researcher/SKILL.md +37 -0
- package/dist/skills/security-audit/SKILL.md +48 -0
- package/dist/skills/security-scan/SKILL.md +37 -0
- package/dist/skills/seo-consultant/SKILL.md +43 -0
- package/dist/skills/session-management/SKILL.md +36 -0
- package/dist/skills/state-manager/SKILL.md +37 -0
- package/dist/skills/storyteller/SKILL.md +130 -0
- package/dist/skills/strategist/SKILL.md +32 -0
- package/dist/skills/tech-writer/SKILL.md +37 -0
- package/dist/skills/testing-best-practices/SKILL.md +37 -0
- package/dist/skills/testing-strategy/SKILL.md +43 -0
- package/dist/skills/ui-ux-design/SKILL.md +603 -0
- package/dist/state/context-providers.js +1 -0
- package/dist/state/index.js +7 -0
- package/dist/state/state-manager.js +208 -0
- package/dist/state/state-types.js +1 -0
- package/dist/testing/memory-regression-suite.js +258 -0
- package/dist/utils/batch-operations.js +292 -0
- package/dist/utils/codex-parser.js +445 -0
- package/dist/utils/command-runner.js +96 -0
- package/dist/utils/import-resolver.js +189 -0
- package/dist/utils/language-detector.js +383 -0
- package/dist/utils/path-resolver.js +112 -0
- package/dist/utils/shutdown-handler.js +75 -0
- package/dist/utils/test-template-generator.js +178 -0
- package/dist/utils/token-manager.js +163 -0
- package/dist/validation/estimation-validator.js +241 -0
- package/dist/validation/report-content-validator.js +218 -0
- package/opencode.json +153 -0
- package/package.json +170 -0
- package/scripts/helpers/resolve-config-path.cjs +57 -0
- package/scripts/helpers/resolve-config-path.mjs +73 -0
- package/scripts/hooks/pre-command +26 -0
- package/scripts/hooks/pre-command.mjs +358 -0
- package/scripts/hooks/run-hook.js +570 -0
- package/scripts/mjs/test-consumer-readiness.mjs +273 -0
- package/scripts/mjs/test-mcp-functionality.mjs +507 -0
- package/scripts/mjs/validate-mcp-connectivity.cjs +75 -0
- package/scripts/mjs/validate-postinstall-config.mjs +308 -0
- package/scripts/node/auto-reflection-generator.mjs +496 -0
- package/scripts/node/basic-security-audit.cjs +338 -0
- package/scripts/node/ci-cd-auto-fix.cjs +263 -0
- package/scripts/node/ci-report-generator.mjs +227 -0
- package/scripts/node/enforce-agents-md.mjs +420 -0
- package/scripts/node/enforce-version-compliance.sh +22 -0
- package/scripts/node/enforce-version-compliance.ts +126 -0
- package/scripts/node/github-actions-monitor.cjs +23 -0
- package/scripts/node/govern-reflection.mjs +160 -0
- package/scripts/node/postinstall.cjs +78 -0
- package/scripts/node/pre-publish-guard.js +267 -0
- package/scripts/node/prepare-consumer.cjs +143 -0
- package/scripts/node/reflection-processor.cjs +213 -0
- package/scripts/node/reflection-validate.sh +194 -0
- package/scripts/node/release-tweet.mjs +39 -0
- package/scripts/node/release.js +159 -0
- package/scripts/node/release.mjs +213 -0
- package/scripts/node/setup-dev.cjs +83 -0
- package/scripts/node/setup.cjs +214 -0
- package/scripts/node/sync-versions.mjs +140 -0
- package/scripts/node/universal-version-manager.js +1025 -0
- package/scripts/node/validate-external-processes.js +265 -0
- package/scripts/node/validate-mcp-connectivity.js +258 -0
- package/scripts/node/version-manager.mjs +524 -0
- package/scripts/validate-stringray-comprehensive.js +636 -0
- package/src/integrations/grok/plugin/0xray/.mcp.json +15 -0
- package/src/integrations/grok/plugin/0xray/hooks/hooks.json +30 -0
- package/src/mcps/agent-resolver.ts +168 -0
- package/src/mcps/architect-tools.server.ts +343 -0
- package/src/mcps/auto-format.server.ts +529 -0
- package/src/mcps/boot-orchestrator.server.ts +1082 -0
- package/src/mcps/config/__tests__/config-loader.test.ts +338 -0
- package/src/mcps/config/__tests__/config-validator.test.ts +646 -0
- package/src/mcps/config/__tests__/server-config-registry.test.ts +257 -0
- package/src/mcps/config/config-loader.ts +127 -0
- package/src/mcps/config/config-validator.ts +127 -0
- package/src/mcps/config/index.ts +32 -0
- package/src/mcps/config/plugin-server-registry.ts +335 -0
- package/src/mcps/config/server-config-registry.ts +395 -0
- package/src/mcps/connection/connection-manager.ts +91 -0
- package/src/mcps/connection/connection-pool.ts +216 -0
- package/src/mcps/connection/mcp-connection.ts +327 -0
- package/src/mcps/connection/process-spawner.ts +47 -0
- package/src/mcps/enforcer-tools.server.ts +1106 -0
- package/src/mcps/estimation.server.ts +229 -0
- package/src/mcps/framework-compliance-audit.server.ts +635 -0
- package/src/mcps/framework-help.server.ts +467 -0
- package/src/mcps/governance.server.ts +551 -0
- package/src/mcps/in-process-skill-registry.ts +79 -0
- package/src/mcps/knowledge-skills/api-design.server.test.ts +41 -0
- package/src/mcps/knowledge-skills/api-design.server.ts +160 -0
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +152 -0
- package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +624 -0
- package/src/mcps/knowledge-skills/code-analyzer.server.test.ts +129 -0
- package/src/mcps/knowledge-skills/code-analyzer.server.ts +591 -0
- package/src/mcps/knowledge-skills/code-review.server.ts +1132 -0
- package/src/mcps/knowledge-skills/content-creator.server.ts +300 -0
- package/src/mcps/knowledge-skills/database-design.server.ts +1200 -0
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +1622 -0
- package/src/mcps/knowledge-skills/git-workflow.server.ts +152 -0
- package/src/mcps/knowledge-skills/growth-strategist.server.ts +413 -0
- package/src/mcps/knowledge-skills/log-monitor.server.ts +619 -0
- package/src/mcps/knowledge-skills/mobile-development.server.ts +672 -0
- package/src/mcps/knowledge-skills/multimodal-looker.server.ts +1500 -0
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +2065 -0
- package/src/mcps/knowledge-skills/project-analysis.server.ts +1111 -0
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +1092 -0
- package/src/mcps/knowledge-skills/security-audit.server.test.ts +112 -0
- package/src/mcps/knowledge-skills/security-audit.server.ts +1193 -0
- package/src/mcps/knowledge-skills/seo-consultant.server.ts +1160 -0
- package/src/mcps/knowledge-skills/session-management.server.ts +576 -0
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +941 -0
- package/src/mcps/knowledge-skills/strategist.server.ts +267 -0
- package/src/mcps/knowledge-skills/tech-writer.server.ts +1638 -0
- package/src/mcps/knowledge-skills/testing-best-practices.server.test.ts +136 -0
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +1232 -0
- package/src/mcps/knowledge-skills/testing-strategy.server.test.ts +100 -0
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +1172 -0
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +2076 -0
- package/src/mcps/lint.server.ts +483 -0
- package/src/mcps/mcp-client.ts +706 -0
- package/src/mcps/model-health-check.server.ts +292 -0
- package/src/mcps/orchestrator/config/agent-capabilities.ts +108 -0
- package/src/mcps/orchestrator/execution/execution-planner.ts +353 -0
- package/src/mcps/orchestrator/handlers/complexity-handler.ts +125 -0
- package/src/mcps/orchestrator/handlers/status-handler.ts +295 -0
- package/src/mcps/orchestrator/handlers/task-handler.ts +268 -0
- package/src/mcps/orchestrator/server.ts +388 -0
- package/src/mcps/orchestrator/types.ts +81 -0
- package/src/mcps/orchestrator.server.ts +34 -0
- package/src/mcps/performance-analysis.server.ts +715 -0
- package/src/mcps/processor-pipeline.server.ts +778 -0
- package/src/mcps/protocol/protocol-constants.ts +51 -0
- package/src/mcps/registry.json +110 -0
- package/src/mcps/researcher.server.ts +595 -0
- package/src/mcps/security-scan.server.ts +651 -0
- package/src/mcps/simulation/__tests__/simulation-engine.test.ts +275 -0
- package/src/mcps/simulation/index.ts +23 -0
- package/src/mcps/simulation/server-simulations.ts +241 -0
- package/src/mcps/simulation/simulation-engine.ts +126 -0
- package/src/mcps/state-manager.server.ts +777 -0
- package/src/mcps/tools/__tests__/tool-cache.test.ts +205 -0
- package/src/mcps/tools/__tests__/tool-discovery.test.ts +189 -0
- package/src/mcps/tools/__tests__/tool-executor.test.ts +215 -0
- package/src/mcps/tools/__tests__/tool-registry.test.ts +230 -0
- package/src/mcps/tools/index.ts +15 -0
- package/src/mcps/tools/tool-cache.ts +145 -0
- package/src/mcps/tools/tool-discovery.ts +83 -0
- package/src/mcps/tools/tool-executor.ts +106 -0
- package/src/mcps/tools/tool-registry.ts +78 -0
- package/src/mcps/types/__tests__/types.test.ts +341 -0
- package/src/mcps/types/index.ts +17 -0
- package/src/mcps/types/json-rpc.types.ts +38 -0
- package/src/mcps/types/mcp.types.ts +115 -0
- package/src/opencode/agents/api-design.yml +31 -0
- package/src/opencode/agents/architect.yml +15 -0
- package/src/opencode/agents/architecture-patterns.yml +14 -0
- package/src/opencode/agents/auto-format.yml +14 -0
- package/src/opencode/agents/backend-engineer.yml +12 -0
- package/src/opencode/agents/boot-orchestrator.yml +14 -0
- package/src/opencode/agents/bug-triage-specialist.yml +15 -0
- package/src/opencode/agents/code-analyzer.yml +12 -0
- package/src/opencode/agents/code-reviewer.yml +14 -0
- package/src/opencode/agents/content-creator.yml +12 -0
- package/src/opencode/agents/database-engineer.yml +12 -0
- package/src/opencode/agents/devops-engineer.yml +12 -0
- package/src/opencode/agents/framework-compliance-audit.yml +14 -0
- package/src/opencode/agents/frontend-engineer.yml +12 -0
- package/src/opencode/agents/frontend-ui-ux-engineer.yml +12 -0
- package/src/opencode/agents/git-workflow.yml +15 -0
- package/src/opencode/agents/growth-strategist.yml +12 -0
- package/src/opencode/agents/hermes-agent.yml +12 -0
- package/src/opencode/agents/inference-improve.yml +12 -0
- package/src/opencode/agents/lint.yml +14 -0
- package/src/opencode/agents/log-monitor.yml +12 -0
- package/src/opencode/agents/mobile-developer.yml +12 -0
- package/src/opencode/agents/model-health-check.yml +12 -0
- package/src/opencode/agents/multimodal-looker.yml +12 -0
- package/src/opencode/agents/performance-analysis.yml +12 -0
- package/src/opencode/agents/performance-engineer.yml +12 -0
- package/src/opencode/agents/performance-optimization.yml +12 -0
- package/src/opencode/agents/processor-pipeline.yml +14 -0
- package/src/opencode/agents/project-analysis.yml +12 -0
- package/src/opencode/agents/refactorer.yml +12 -0
- package/src/opencode/agents/researcher.yml +12 -0
- package/src/opencode/agents/security-auditor.yml +12 -0
- package/src/opencode/agents/security-scan.yml +12 -0
- package/src/opencode/agents/seo-consultant.yml +12 -0
- package/src/opencode/agents/session-management.yml +12 -0
- package/src/opencode/agents/state-manager.yml +12 -0
- package/src/opencode/agents/storyteller.yml +12 -0
- package/src/opencode/agents/strategist.yml +12 -0
- package/src/opencode/agents/tech-writer.yml +12 -0
- package/src/opencode/agents/testing-best-practices.yml +12 -0
- package/src/opencode/agents/testing-lead.yml +12 -0
- package/src/opencode/agents/ui-ux-design.yml +12 -0
- package/src/opencode/codex.codex +8 -0
- package/src/opencode/commands/auto-format.md +99 -0
- package/src/opencode/commands/auto-summary-capture.md +90 -0
- package/src/opencode/commands/dependency-audit.md +184 -0
- package/src/opencode/commands/enforcer-daily-scan.md +137 -0
- package/src/opencode/commands/framework-compliance-audit.md +205 -0
- package/src/opencode/commands/interactive-validator.md +75 -0
- package/src/opencode/commands/job-summary-logger.md +68 -0
- package/src/opencode/commands/lint.md +11 -0
- package/src/opencode/commands/mode-switch.md +95 -0
- package/src/opencode/commands/model-health-check.md +186 -0
- package/src/opencode/commands/performance-analysis.md +144 -0
- package/src/opencode/commands/pre-commit-introspection.md +185 -0
- package/src/opencode/commands/pre-commit-introspection.sh +133 -0
- package/src/opencode/commands/security-scan.md +157 -0
- package/src/opencode/commands/sisyphus-validation.md +128 -0
- package/src/opencode/commands/summary-logger.md +83 -0
- package/src/opencode/enforcer-config.json +285 -0
- package/src/opencode/openclaw/config.json +25 -0
- package/src/opencode/workflows/post-deployment-audit.yml +123 -0
- package/src/skills/api-design/SKILL.md +37 -0
- package/src/skills/architect-tools/SKILL.md +37 -0
- package/src/skills/architecture-patterns/SKILL.md +37 -0
- package/src/skills/auto-format/SKILL.md +37 -0
- package/src/skills/backend-engineer/SKILL.md +49 -0
- package/src/skills/boot-orchestrator/SKILL.md +37 -0
- package/src/skills/bug-triage/SKILL.md +43 -0
- package/src/skills/code-analyzer/SKILL.md +45 -0
- package/src/skills/code-review/SKILL.md +52 -0
- package/src/skills/content-creator/SKILL.md +38 -0
- package/src/skills/database-engineer/SKILL.md +46 -0
- package/src/skills/devops-engineer/SKILL.md +49 -0
- package/src/skills/enforcer/SKILL.md +37 -0
- package/src/skills/framework-compliance-audit/SKILL.md +37 -0
- package/src/skills/frontend-engineer/SKILL.md +49 -0
- package/src/skills/frontend-ui-ux-engineer/SKILL.md +41 -0
- package/src/skills/git-workflow/SKILL.md +37 -0
- package/src/skills/growth-strategist/SKILL.md +48 -0
- package/src/skills/hermes-agent/SKILL.md +212 -0
- package/src/skills/inference-improve/SKILL.md +97 -0
- package/src/skills/lint/SKILL.md +37 -0
- package/src/skills/log-monitor/SKILL.md +44 -0
- package/src/skills/mobile-developer/SKILL.md +42 -0
- package/src/skills/model-health-check/SKILL.md +37 -0
- package/src/skills/multimodal-looker/SKILL.md +45 -0
- package/src/skills/orchestrator/SKILL.md +37 -0
- package/src/skills/performance-analysis/SKILL.md +37 -0
- package/src/skills/performance-engineer/SKILL.md +41 -0
- package/src/skills/performance-optimization/SKILL.md +37 -0
- package/src/skills/processor-pipeline/SKILL.md +37 -0
- package/src/skills/project-analysis/SKILL.md +42 -0
- package/src/skills/refactoring-strategies/SKILL.md +37 -0
- package/src/skills/registry.json +66 -0
- package/src/skills/researcher/SKILL.md +37 -0
- package/src/skills/security-audit/SKILL.md +48 -0
- package/src/skills/security-scan/SKILL.md +37 -0
- package/src/skills/seo-consultant/SKILL.md +43 -0
- package/src/skills/session-management/SKILL.md +36 -0
- package/src/skills/state-manager/SKILL.md +37 -0
- package/src/skills/storyteller/SKILL.md +130 -0
- package/src/skills/strategist/SKILL.md +32 -0
- package/src/skills/tech-writer/SKILL.md +37 -0
- package/src/skills/testing-best-practices/SKILL.md +37 -0
- package/src/skills/testing-strategy/SKILL.md +43 -0
- package/src/skills/ui-ux-design/SKILL.md +603 -0
|
@@ -0,0 +1,1180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* xray DevOps Deployment MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Knowledge skill for DevOps practices, deployment strategies,
|
|
5
|
+
* CI/CD pipeline design, and infrastructure automation
|
|
6
|
+
*/
|
|
7
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
8
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
|
+
import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
|
|
10
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
11
|
+
class StringRayDevOpsDeploymentServer {
|
|
12
|
+
server;
|
|
13
|
+
constructor() {
|
|
14
|
+
this.server = new Server({
|
|
15
|
+
name: "devops-deployment", version: "1.22.67",
|
|
16
|
+
}, {
|
|
17
|
+
capabilities: {
|
|
18
|
+
tools: {},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
this.setupToolHandlers();
|
|
22
|
+
// Server initialization - removed unnecessary startup logging
|
|
23
|
+
}
|
|
24
|
+
setupToolHandlers() {
|
|
25
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
26
|
+
return {
|
|
27
|
+
tools: [
|
|
28
|
+
{
|
|
29
|
+
name: "analyze_ci_cd_pipeline",
|
|
30
|
+
description: "Analyze CI/CD pipeline configuration and suggest optimizations",
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: "object",
|
|
33
|
+
properties: {
|
|
34
|
+
pipelineConfig: {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "CI/CD pipeline configuration (YAML/JSON)",
|
|
37
|
+
},
|
|
38
|
+
platform: {
|
|
39
|
+
type: "string",
|
|
40
|
+
enum: [
|
|
41
|
+
"github-actions",
|
|
42
|
+
"gitlab-ci",
|
|
43
|
+
"jenkins",
|
|
44
|
+
"circle-ci",
|
|
45
|
+
"azure-devops",
|
|
46
|
+
],
|
|
47
|
+
description: "CI/CD platform being used",
|
|
48
|
+
},
|
|
49
|
+
includeSecurity: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
description: "Include security gate analysis",
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
required: ["pipelineConfig", "platform"],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "design_deployment_strategy",
|
|
60
|
+
description: "Design optimal deployment strategy for application requirements",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
applicationType: {
|
|
65
|
+
type: "string",
|
|
66
|
+
enum: [
|
|
67
|
+
"web-app",
|
|
68
|
+
"api",
|
|
69
|
+
"mobile",
|
|
70
|
+
"microservices",
|
|
71
|
+
"monolith",
|
|
72
|
+
],
|
|
73
|
+
description: "Type of application",
|
|
74
|
+
},
|
|
75
|
+
scale: {
|
|
76
|
+
type: "string",
|
|
77
|
+
enum: ["small", "medium", "large", "enterprise"],
|
|
78
|
+
description: "Expected scale/traffic",
|
|
79
|
+
},
|
|
80
|
+
availability: {
|
|
81
|
+
type: "string",
|
|
82
|
+
enum: ["basic", "high", "critical"],
|
|
83
|
+
description: "Required availability level",
|
|
84
|
+
},
|
|
85
|
+
budget: {
|
|
86
|
+
type: "string",
|
|
87
|
+
enum: ["cost-optimized", "balanced", "performance-optimized"],
|
|
88
|
+
description: "Budget considerations",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ["applicationType", "scale"],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "generate_infrastructure_code",
|
|
96
|
+
description: "Generate infrastructure as code for deployment",
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: "object",
|
|
99
|
+
properties: {
|
|
100
|
+
platform: {
|
|
101
|
+
type: "string",
|
|
102
|
+
enum: ["aws", "azure", "gcp", "kubernetes"],
|
|
103
|
+
description: "Target cloud platform",
|
|
104
|
+
},
|
|
105
|
+
services: {
|
|
106
|
+
type: "array",
|
|
107
|
+
items: { type: "string" },
|
|
108
|
+
description: "Required services (database, cache, storage, etc.)",
|
|
109
|
+
},
|
|
110
|
+
environment: {
|
|
111
|
+
type: "string",
|
|
112
|
+
enum: ["development", "staging", "production"],
|
|
113
|
+
description: "Deployment environment",
|
|
114
|
+
},
|
|
115
|
+
scaling: {
|
|
116
|
+
type: "boolean",
|
|
117
|
+
description: "Include auto-scaling configuration",
|
|
118
|
+
default: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
required: ["platform", "services"],
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "optimize_deployment_performance",
|
|
126
|
+
description: "Analyze and optimize deployment performance and reliability",
|
|
127
|
+
inputSchema: {
|
|
128
|
+
type: "object",
|
|
129
|
+
properties: {
|
|
130
|
+
currentMetrics: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
deployTime: { type: "number" },
|
|
134
|
+
failureRate: { type: "number" },
|
|
135
|
+
rollbackTime: { type: "number" },
|
|
136
|
+
},
|
|
137
|
+
description: "Current deployment metrics",
|
|
138
|
+
},
|
|
139
|
+
constraints: {
|
|
140
|
+
type: "object",
|
|
141
|
+
properties: {
|
|
142
|
+
maxDowntime: { type: "number" },
|
|
143
|
+
budget: { type: "number" },
|
|
144
|
+
teamSize: { type: "number" },
|
|
145
|
+
},
|
|
146
|
+
description: "Business and technical constraints",
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
required: ["currentMetrics"],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
156
|
+
const { name, arguments: args } = request.params;
|
|
157
|
+
switch (name) {
|
|
158
|
+
case "analyze_ci_cd_pipeline":
|
|
159
|
+
return await this.analyzeCICDPipeline(args);
|
|
160
|
+
case "design_deployment_strategy":
|
|
161
|
+
return await this.designDeploymentStrategy(args);
|
|
162
|
+
case "generate_infrastructure_code":
|
|
163
|
+
return await this.generateInfrastructureCode(args);
|
|
164
|
+
case "optimize_deployment_performance":
|
|
165
|
+
return await this.optimizeDeploymentPerformance(args);
|
|
166
|
+
default:
|
|
167
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
async analyzeCICDPipeline(args) {
|
|
172
|
+
const { pipelineConfig, platform, includeSecurity = true } = args;
|
|
173
|
+
try {
|
|
174
|
+
const pipeline = this.parsePipelineConfig(pipelineConfig, platform);
|
|
175
|
+
const analysis = this.analyzePipelineStructure(pipeline);
|
|
176
|
+
const optimizations = this.generatePipelineOptimizations(pipeline, analysis);
|
|
177
|
+
let securityAnalysis = null;
|
|
178
|
+
if (includeSecurity) {
|
|
179
|
+
securityAnalysis = this.analyzePipelineSecurity(pipeline);
|
|
180
|
+
}
|
|
181
|
+
const recommendations = [
|
|
182
|
+
...optimizations,
|
|
183
|
+
...(securityAnalysis ? securityAnalysis.recommendations : []),
|
|
184
|
+
];
|
|
185
|
+
return {
|
|
186
|
+
content: [
|
|
187
|
+
{
|
|
188
|
+
type: "text",
|
|
189
|
+
text: `CI/CD Pipeline Analysis for ${platform.toUpperCase()}:\n\n` +
|
|
190
|
+
`📊 PIPELINE METRICS\n` +
|
|
191
|
+
`Stages: ${pipeline.stages.length}\n` +
|
|
192
|
+
`Total Duration: ${pipeline.totalDuration} minutes\n` +
|
|
193
|
+
`Parallelizable Stages: ${pipeline.stages.filter((s) => s.parallelizable).length}/${pipeline.stages.length}\n` +
|
|
194
|
+
`Bottleneck Stage: ${pipeline.bottleneckStage}\n\n` +
|
|
195
|
+
`🔍 PERFORMANCE ANALYSIS\n` +
|
|
196
|
+
`Build Time: ${pipeline.performanceMetrics.buildTime} min\n` +
|
|
197
|
+
`Test Time: ${pipeline.performanceMetrics.testTime} min\n` +
|
|
198
|
+
`Deploy Time: ${pipeline.performanceMetrics.deployTime} min\n` +
|
|
199
|
+
`Failure Rate: ${(pipeline.performanceMetrics.failureRate * 100).toFixed(1)}%\n` +
|
|
200
|
+
`MTTR: ${pipeline.performanceMetrics.meanTimeToRecovery} min\n\n` +
|
|
201
|
+
`${includeSecurity
|
|
202
|
+
? `🛡️ SECURITY GATES\n` +
|
|
203
|
+
`Total Gates: ${securityAnalysis.securityGates.length}\n` +
|
|
204
|
+
`Blocking Gates: ${securityAnalysis.securityGates.filter((g) => g.blocking).length}\n` +
|
|
205
|
+
`Coverage: ${securityAnalysis.securityGates.reduce((sum, g) => sum + g.coverage, 0) / securityAnalysis.securityGates.length}%\n\n`
|
|
206
|
+
: ""}` +
|
|
207
|
+
`💡 OPTIMIZATION RECOMMENDATIONS\n${recommendations.map((rec, i) => `${i + 1}. ${rec}`).join("\n")}`,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
data: {
|
|
211
|
+
pipeline,
|
|
212
|
+
analysis,
|
|
213
|
+
securityAnalysis,
|
|
214
|
+
recommendations,
|
|
215
|
+
score: this.calculatePipelineScore(analysis, securityAnalysis),
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
return {
|
|
221
|
+
content: [
|
|
222
|
+
{
|
|
223
|
+
type: "text",
|
|
224
|
+
text: `Error analyzing CI/CD pipeline: ${error instanceof Error ? error.message : String(error)}`,
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
async designDeploymentStrategy(args) {
|
|
231
|
+
const { applicationType, scale, availability, budget = "balanced" } = args;
|
|
232
|
+
try {
|
|
233
|
+
const strategies = this.generateDeploymentStrategies(applicationType, scale, availability, budget);
|
|
234
|
+
const recommended = this.selectOptimalStrategy(strategies, {
|
|
235
|
+
applicationType,
|
|
236
|
+
scale,
|
|
237
|
+
availability,
|
|
238
|
+
budget,
|
|
239
|
+
});
|
|
240
|
+
const implementation = this.generateStrategyImplementation(recommended);
|
|
241
|
+
return {
|
|
242
|
+
content: [
|
|
243
|
+
{
|
|
244
|
+
type: "text",
|
|
245
|
+
text: `Deployment Strategy Design for ${applicationType.toUpperCase()}:\n\n` +
|
|
246
|
+
`🎯 REQUIREMENTS\n` +
|
|
247
|
+
`Scale: ${scale.toUpperCase()}\n` +
|
|
248
|
+
`Availability: ${availability.toUpperCase()}\n` +
|
|
249
|
+
`Budget: ${budget.toUpperCase()}\n\n` +
|
|
250
|
+
`🏆 RECOMMENDED STRATEGY: ${recommended.name.toUpperCase()}\n` +
|
|
251
|
+
`Type: ${recommended.type}\n` +
|
|
252
|
+
`Downtime: ${recommended.downtime}\n` +
|
|
253
|
+
`Complexity: ${recommended.complexity}\n` +
|
|
254
|
+
`Use Case: ${recommended.useCase}\n\n` +
|
|
255
|
+
`✅ PROS\n${recommended.pros.map((pro) => `• ${pro}`).join("\n")}\n\n` +
|
|
256
|
+
`⚠️ CONS\n${recommended.cons.map((con) => `• ${con}`).join("\n")}\n\n` +
|
|
257
|
+
`🚀 IMPLEMENTATION STEPS\n${implementation.steps.map((step, i) => `${i + 1}. ${step}`).join("\n")}\n\n` +
|
|
258
|
+
`🛠️ REQUIRED TOOLS\n${implementation.tools.join(", ")}\n\n` +
|
|
259
|
+
`📊 SUCCESS METRICS\n${implementation.metrics.map((metric) => `• ${metric}`).join("\n")}`,
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
data: {
|
|
263
|
+
strategies,
|
|
264
|
+
recommended,
|
|
265
|
+
implementation,
|
|
266
|
+
alternatives: strategies.filter((s) => s.name !== recommended.name),
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
return {
|
|
272
|
+
content: [
|
|
273
|
+
{
|
|
274
|
+
type: "text",
|
|
275
|
+
text: `Error designing deployment strategy: ${error instanceof Error ? error.message : String(error)}`,
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async generateInfrastructureCode(args) {
|
|
282
|
+
const { platform, services, environment, scaling = true } = args;
|
|
283
|
+
try {
|
|
284
|
+
const recommendations = this.analyzeInfrastructureNeeds(services, environment);
|
|
285
|
+
const infrastructure = this.generateInfrastructureAsCode(platform, recommendations, scaling);
|
|
286
|
+
const monitoring = this.generateMonitoringConfiguration(platform, services);
|
|
287
|
+
const security = this.generateSecurityConfiguration(platform, environment);
|
|
288
|
+
return {
|
|
289
|
+
content: [
|
|
290
|
+
{
|
|
291
|
+
type: "text",
|
|
292
|
+
text: `Infrastructure as Code for ${platform.toUpperCase()} (${environment}):\n\n` +
|
|
293
|
+
`🏗️ ARCHITECTURE OVERVIEW\n` +
|
|
294
|
+
`Platform: ${platform}\n` +
|
|
295
|
+
`Environment: ${environment}\n` +
|
|
296
|
+
`Services: ${services.join(", ")}\n` +
|
|
297
|
+
`Auto-scaling: ${scaling ? "Enabled" : "Disabled"}\n\n` +
|
|
298
|
+
`💰 COST ESTIMATE: $${recommendations.reduce((sum, r) => sum + r.costEstimate, 0)}/month\n\n` +
|
|
299
|
+
`🔧 GENERATED INFRASTRUCTURE CODE\n\`\`\`${this.getInfrastructureLanguage(platform)}\n${infrastructure.code}\n\`\`\`\n\n` +
|
|
300
|
+
`📊 SCALING CONFIGURATION\n` +
|
|
301
|
+
`Strategy: ${recommendations[0]?.scalingStrategy}\n` +
|
|
302
|
+
`Min Instances: ${infrastructure.scaling.min}\n` +
|
|
303
|
+
`Max Instances: ${infrastructure.scaling.max}\n` +
|
|
304
|
+
`Target CPU: ${infrastructure.scaling.cpuThreshold}%\n\n` +
|
|
305
|
+
`📈 MONITORING DASHBOARDS\n${monitoring.dashboards.map((d) => `• ${d}`).join("\n")}\n\n` +
|
|
306
|
+
`🛡️ SECURITY CONFIGURATION\n${security.policies.map((p) => `• ${p}`).join("\n")}`,
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
data: {
|
|
310
|
+
recommendations,
|
|
311
|
+
infrastructure,
|
|
312
|
+
monitoring,
|
|
313
|
+
security,
|
|
314
|
+
totalCost: recommendations.reduce((sum, r) => sum + r.costEstimate, 0),
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
return {
|
|
320
|
+
content: [
|
|
321
|
+
{
|
|
322
|
+
type: "text",
|
|
323
|
+
text: `Error generating infrastructure code: ${error instanceof Error ? error.message : String(error)}`,
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
async optimizeDeploymentPerformance(args) {
|
|
330
|
+
const { currentMetrics, constraints = {} } = args;
|
|
331
|
+
try {
|
|
332
|
+
const analysis = this.analyzeDeploymentMetrics(currentMetrics);
|
|
333
|
+
const bottlenecks = this.identifyDeploymentBottlenecks(analysis, constraints);
|
|
334
|
+
const optimizations = this.generateDeploymentOptimizations(bottlenecks, constraints);
|
|
335
|
+
const roadmap = this.createOptimizationRoadmap(optimizations, constraints);
|
|
336
|
+
return {
|
|
337
|
+
content: [
|
|
338
|
+
{
|
|
339
|
+
type: "text",
|
|
340
|
+
text: `Deployment Performance Optimization Analysis:\n\n` +
|
|
341
|
+
`📊 CURRENT METRICS\n` +
|
|
342
|
+
`Deploy Time: ${currentMetrics.deployTime || 0} minutes\n` +
|
|
343
|
+
`Failure Rate: ${(currentMetrics.failureRate || 0) * 100}%\n` +
|
|
344
|
+
`Rollback Time: ${currentMetrics.rollbackTime || 0} minutes\n\n` +
|
|
345
|
+
`🎯 CONSTRAINTS\n` +
|
|
346
|
+
`Max Downtime: ${constraints.maxDowntime || "N/A"} minutes\n` +
|
|
347
|
+
`Budget: $${constraints.budget || "N/A"}\n` +
|
|
348
|
+
`Team Size: ${constraints.teamSize || "N/A"} people\n\n` +
|
|
349
|
+
`🔍 BOTTLENECK ANALYSIS\n${bottlenecks.map((b, i) => `${i + 1}. ${b.issue} (Impact: ${b.impact})`).join("\n")}\n\n` +
|
|
350
|
+
`⚡ OPTIMIZATION RECOMMENDATIONS\n${optimizations.map((opt, i) => `${i + 1}. ${opt.title} (Effort: ${opt.effort}, Impact: ${opt.impact})`).join("\n")}\n\n` +
|
|
351
|
+
`🗓️ OPTIMIZATION ROADMAP\n${roadmap.phases.map((phase, i) => `Phase ${i + 1}: ${phase.name} (${phase.duration} weeks)`).join("\n")}\n\n` +
|
|
352
|
+
`📈 PROJECTED IMPROVEMENTS\n` +
|
|
353
|
+
`Deploy Time: ${roadmap.finalMetrics.deployTime ?? 0} min (-${currentMetrics.deployTime ? (((currentMetrics.deployTime - (roadmap.finalMetrics.deployTime ?? 0)) / currentMetrics.deployTime) * 100).toFixed(0) : 0}%)\n` +
|
|
354
|
+
`Failure Rate: ${((roadmap.finalMetrics.failureRate ?? 0) * 100).toFixed(1)}% (-${currentMetrics.failureRate ? (((currentMetrics.failureRate - (roadmap.finalMetrics.failureRate ?? 0)) / currentMetrics.failureRate) * 100).toFixed(0) : 0}%)\n` +
|
|
355
|
+
`Rollback Time: ${roadmap.finalMetrics.rollbackTime ?? 0} min (-${currentMetrics.rollbackTime ? (((currentMetrics.rollbackTime - (roadmap.finalMetrics.rollbackTime ?? 0)) / currentMetrics.rollbackTime) * 100).toFixed(0) : 0}%)`,
|
|
356
|
+
},
|
|
357
|
+
],
|
|
358
|
+
data: {
|
|
359
|
+
analysis,
|
|
360
|
+
bottlenecks,
|
|
361
|
+
optimizations,
|
|
362
|
+
roadmap,
|
|
363
|
+
improvements: roadmap.finalMetrics,
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
return {
|
|
369
|
+
content: [
|
|
370
|
+
{
|
|
371
|
+
type: "text",
|
|
372
|
+
text: `Error optimizing deployment performance: ${error instanceof Error ? error.message : String(error)}`,
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
parsePipelineConfig(config, platform) {
|
|
379
|
+
// Simplified pipeline parsing - in production would be more sophisticated
|
|
380
|
+
const stages = [];
|
|
381
|
+
let totalDuration = 0;
|
|
382
|
+
// Parse based on platform
|
|
383
|
+
switch (platform) {
|
|
384
|
+
case "github-actions":
|
|
385
|
+
// Parse GitHub Actions workflow
|
|
386
|
+
const jobs = config.match(/jobs:\s*\n((?:\s+\w+:[\s\S]*?(?=\n\s+\w+:|$))*)?/);
|
|
387
|
+
if (jobs) {
|
|
388
|
+
// Extract job definitions and estimate durations
|
|
389
|
+
stages.push({
|
|
390
|
+
name: "checkout",
|
|
391
|
+
type: "build",
|
|
392
|
+
duration: 0.5,
|
|
393
|
+
successRate: 0.99,
|
|
394
|
+
parallelizable: false,
|
|
395
|
+
dependencies: [],
|
|
396
|
+
}, {
|
|
397
|
+
name: "setup",
|
|
398
|
+
type: "build",
|
|
399
|
+
duration: 1,
|
|
400
|
+
successRate: 0.95,
|
|
401
|
+
parallelizable: false,
|
|
402
|
+
dependencies: ["checkout"],
|
|
403
|
+
}, {
|
|
404
|
+
name: "build",
|
|
405
|
+
type: "build",
|
|
406
|
+
duration: 3,
|
|
407
|
+
successRate: 0.9,
|
|
408
|
+
parallelizable: false,
|
|
409
|
+
dependencies: ["setup"],
|
|
410
|
+
}, {
|
|
411
|
+
name: "test",
|
|
412
|
+
type: "test",
|
|
413
|
+
duration: 5,
|
|
414
|
+
successRate: 0.85,
|
|
415
|
+
parallelizable: true,
|
|
416
|
+
dependencies: ["build"],
|
|
417
|
+
}, {
|
|
418
|
+
name: "security",
|
|
419
|
+
type: "security",
|
|
420
|
+
duration: 2,
|
|
421
|
+
successRate: 0.95,
|
|
422
|
+
parallelizable: true,
|
|
423
|
+
dependencies: ["build"],
|
|
424
|
+
}, {
|
|
425
|
+
name: "deploy",
|
|
426
|
+
type: "deploy",
|
|
427
|
+
duration: 2,
|
|
428
|
+
successRate: 0.8,
|
|
429
|
+
parallelizable: false,
|
|
430
|
+
dependencies: ["test", "security"],
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
break;
|
|
434
|
+
default:
|
|
435
|
+
// Generic pipeline structure
|
|
436
|
+
stages.push({
|
|
437
|
+
name: "build",
|
|
438
|
+
type: "build",
|
|
439
|
+
duration: 4,
|
|
440
|
+
successRate: 0.9,
|
|
441
|
+
parallelizable: false,
|
|
442
|
+
dependencies: [],
|
|
443
|
+
}, {
|
|
444
|
+
name: "test",
|
|
445
|
+
type: "test",
|
|
446
|
+
duration: 6,
|
|
447
|
+
successRate: 0.85,
|
|
448
|
+
parallelizable: true,
|
|
449
|
+
dependencies: ["build"],
|
|
450
|
+
}, {
|
|
451
|
+
name: "deploy",
|
|
452
|
+
type: "deploy",
|
|
453
|
+
duration: 3,
|
|
454
|
+
successRate: 0.8,
|
|
455
|
+
parallelizable: false,
|
|
456
|
+
dependencies: ["test"],
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
totalDuration = stages.reduce((sum, stage) => sum + stage.duration, 0);
|
|
460
|
+
return {
|
|
461
|
+
stages,
|
|
462
|
+
totalDuration,
|
|
463
|
+
bottleneckStage: stages.reduce((max, stage) => stage.duration > max.duration ? stage : max).name,
|
|
464
|
+
optimizationSuggestions: [],
|
|
465
|
+
securityGates: [],
|
|
466
|
+
performanceMetrics: {
|
|
467
|
+
buildTime: stages
|
|
468
|
+
.filter((s) => s.type === "build")
|
|
469
|
+
.reduce((sum, s) => sum + s.duration, 0),
|
|
470
|
+
testTime: stages
|
|
471
|
+
.filter((s) => s.type === "test")
|
|
472
|
+
.reduce((sum, s) => sum + s.duration, 0),
|
|
473
|
+
deployTime: stages
|
|
474
|
+
.filter((s) => s.type === "deploy")
|
|
475
|
+
.reduce((sum, s) => sum + s.duration, 0),
|
|
476
|
+
failureRate: 1 - stages.reduce((product, stage) => product * stage.successRate, 1),
|
|
477
|
+
meanTimeToRecovery: 15, // minutes
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
analyzePipelineStructure(pipeline) {
|
|
482
|
+
return {
|
|
483
|
+
parallelization: pipeline.stages.filter((s) => s.parallelizable).length /
|
|
484
|
+
pipeline.stages.length,
|
|
485
|
+
dependencyComplexity: this.calculateDependencyComplexity(pipeline.stages),
|
|
486
|
+
stageDistribution: this.analyzeStageDistribution(pipeline.stages),
|
|
487
|
+
optimizationOpportunities: this.identifyPipelineOptimizations(pipeline),
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
generatePipelineOptimizations(pipeline, analysis) {
|
|
491
|
+
const optimizations = [];
|
|
492
|
+
if (analysis.parallelization < 0.5) {
|
|
493
|
+
optimizations.push("Increase parallelization by running independent stages concurrently");
|
|
494
|
+
}
|
|
495
|
+
if (pipeline.bottleneckStage) {
|
|
496
|
+
optimizations.push(`Optimize ${pipeline.bottleneckStage} stage - consider caching or distributed processing`);
|
|
497
|
+
}
|
|
498
|
+
if (pipeline.totalDuration > 30) {
|
|
499
|
+
optimizations.push("Pipeline too slow - consider artifact caching and incremental builds");
|
|
500
|
+
}
|
|
501
|
+
if (pipeline.performanceMetrics.failureRate > 0.1) {
|
|
502
|
+
optimizations.push("High failure rate detected - improve test stability and add retries");
|
|
503
|
+
}
|
|
504
|
+
optimizations.push("Add automated rollback capability for failed deployments");
|
|
505
|
+
optimizations.push("Implement artifact versioning for reliable deployments");
|
|
506
|
+
return optimizations;
|
|
507
|
+
}
|
|
508
|
+
analyzePipelineSecurity(pipeline) {
|
|
509
|
+
const securityGates = [
|
|
510
|
+
{
|
|
511
|
+
name: "SAST",
|
|
512
|
+
type: "sast",
|
|
513
|
+
tools: ["eslint", "sonarcloud"],
|
|
514
|
+
blocking: true,
|
|
515
|
+
coverage: 85,
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "Dependency Scan",
|
|
519
|
+
type: "dependency-scan",
|
|
520
|
+
tools: ["npm audit", "snyk"],
|
|
521
|
+
blocking: true,
|
|
522
|
+
coverage: 95,
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: "Secrets Scan",
|
|
526
|
+
type: "secrets-scan",
|
|
527
|
+
tools: ["gitleaks", "trufflehog"],
|
|
528
|
+
blocking: true,
|
|
529
|
+
coverage: 90,
|
|
530
|
+
},
|
|
531
|
+
];
|
|
532
|
+
return {
|
|
533
|
+
securityGates,
|
|
534
|
+
recommendations: [
|
|
535
|
+
"Add DAST scanning for runtime security testing",
|
|
536
|
+
"Implement compliance checks for regulatory requirements",
|
|
537
|
+
"Add manual security review gates for critical changes",
|
|
538
|
+
],
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
calculatePipelineScore(analysis, securityAnalysis) {
|
|
542
|
+
let score = 100;
|
|
543
|
+
// Deduct for long duration
|
|
544
|
+
if ((analysis.totalDuration ?? 0) > 30)
|
|
545
|
+
score -= 20;
|
|
546
|
+
if ((analysis.totalDuration ?? 0) > 60)
|
|
547
|
+
score -= 30;
|
|
548
|
+
score -= (analysis.performanceMetrics?.failureRate ?? 0) * 100;
|
|
549
|
+
// Deduct for poor parallelization
|
|
550
|
+
if (analysis.parallelization < 0.3)
|
|
551
|
+
score -= 15;
|
|
552
|
+
// Bonus for security
|
|
553
|
+
if (securityAnalysis && securityAnalysis.securityGates.length >= 3) {
|
|
554
|
+
score += 10;
|
|
555
|
+
}
|
|
556
|
+
return Math.max(0, Math.min(100, score));
|
|
557
|
+
}
|
|
558
|
+
generateDeploymentStrategies(appType, scale, availability, budget) {
|
|
559
|
+
const strategies = [];
|
|
560
|
+
// Blue-Green Strategy
|
|
561
|
+
strategies.push({
|
|
562
|
+
name: "blue-green",
|
|
563
|
+
type: "blue-green",
|
|
564
|
+
description: "Maintain two identical environments, switch traffic between them",
|
|
565
|
+
useCase: "Zero-downtime deployments with instant rollback",
|
|
566
|
+
pros: ["Zero downtime", "Instant rollback", "Safe testing"],
|
|
567
|
+
cons: [
|
|
568
|
+
"Double infrastructure cost",
|
|
569
|
+
"Complex routing",
|
|
570
|
+
"Storage synchronization",
|
|
571
|
+
],
|
|
572
|
+
complexity: "high",
|
|
573
|
+
downtime: "zero",
|
|
574
|
+
});
|
|
575
|
+
// Canary Strategy
|
|
576
|
+
strategies.push({
|
|
577
|
+
name: "canary",
|
|
578
|
+
type: "canary",
|
|
579
|
+
description: "Gradually roll out to subset of users, monitor metrics",
|
|
580
|
+
useCase: "Risk mitigation with gradual rollout and monitoring",
|
|
581
|
+
pros: ["Gradual rollout", "Real-time monitoring", "Easy rollback"],
|
|
582
|
+
cons: [
|
|
583
|
+
"Complex traffic routing",
|
|
584
|
+
"Monitoring overhead",
|
|
585
|
+
"Slower rollout",
|
|
586
|
+
],
|
|
587
|
+
complexity: "medium",
|
|
588
|
+
downtime: "zero",
|
|
589
|
+
});
|
|
590
|
+
// Rolling Update
|
|
591
|
+
strategies.push({
|
|
592
|
+
name: "rolling",
|
|
593
|
+
type: "rolling",
|
|
594
|
+
description: "Update instances gradually, keeping some running during deployment",
|
|
595
|
+
useCase: "Simple deployments with minimal infrastructure requirements",
|
|
596
|
+
pros: [
|
|
597
|
+
"Simple implementation",
|
|
598
|
+
"Minimal extra resources",
|
|
599
|
+
"Fast completion",
|
|
600
|
+
],
|
|
601
|
+
cons: [
|
|
602
|
+
"Partial downtime",
|
|
603
|
+
"Mixed versions during update",
|
|
604
|
+
"Rollback complexity",
|
|
605
|
+
],
|
|
606
|
+
complexity: "low",
|
|
607
|
+
downtime: "minimal",
|
|
608
|
+
});
|
|
609
|
+
return strategies;
|
|
610
|
+
}
|
|
611
|
+
selectOptimalStrategy(strategies, requirements) {
|
|
612
|
+
// Score strategies based on requirements
|
|
613
|
+
const scored = strategies.map((strategy) => {
|
|
614
|
+
let score = 0;
|
|
615
|
+
// Availability scoring
|
|
616
|
+
if (requirements.availability === "critical" &&
|
|
617
|
+
strategy.downtime === "zero")
|
|
618
|
+
score += 30;
|
|
619
|
+
if (requirements.availability === "high" &&
|
|
620
|
+
strategy.downtime !== "planned")
|
|
621
|
+
score += 20;
|
|
622
|
+
if (requirements.availability === "basic")
|
|
623
|
+
score += 10;
|
|
624
|
+
// Scale scoring
|
|
625
|
+
if (requirements.scale === "enterprise" && strategy.complexity === "high")
|
|
626
|
+
score += 20;
|
|
627
|
+
if (requirements.scale === "large" && strategy.complexity !== "low")
|
|
628
|
+
score += 15;
|
|
629
|
+
// Budget scoring
|
|
630
|
+
if (requirements.budget === "cost-optimized" &&
|
|
631
|
+
strategy.cons.some((c) => c.includes("cost")))
|
|
632
|
+
score -= 20;
|
|
633
|
+
if (requirements.budget === "performance-optimized" &&
|
|
634
|
+
strategy.pros.some((p) => p.includes("performance")))
|
|
635
|
+
score += 15;
|
|
636
|
+
return { strategy, score };
|
|
637
|
+
});
|
|
638
|
+
const topScored = scored.sort((a, b) => b.score - a.score)[0];
|
|
639
|
+
return (topScored?.strategy || strategies[0]);
|
|
640
|
+
}
|
|
641
|
+
generateStrategyImplementation(strategy) {
|
|
642
|
+
const implementations = {
|
|
643
|
+
"blue-green": {
|
|
644
|
+
steps: [
|
|
645
|
+
"Set up two identical environments (Blue and Green)",
|
|
646
|
+
"Deploy new version to inactive environment",
|
|
647
|
+
"Run comprehensive tests on new environment",
|
|
648
|
+
"Switch traffic routing to new environment",
|
|
649
|
+
"Monitor for issues, rollback if needed",
|
|
650
|
+
"Clean up old environment after confirmation",
|
|
651
|
+
],
|
|
652
|
+
tools: ["Kubernetes", "Istio", "Terraform", "Prometheus"],
|
|
653
|
+
metrics: [
|
|
654
|
+
"Zero deployment downtime",
|
|
655
|
+
"99.9%+ availability during deployment",
|
|
656
|
+
"< 5 minute rollback time",
|
|
657
|
+
"100% traffic migration success rate",
|
|
658
|
+
],
|
|
659
|
+
},
|
|
660
|
+
canary: {
|
|
661
|
+
steps: [
|
|
662
|
+
"Deploy new version to canary group (1-5% of traffic)",
|
|
663
|
+
"Monitor key metrics and error rates",
|
|
664
|
+
"Gradually increase traffic to new version",
|
|
665
|
+
"Monitor for performance degradation",
|
|
666
|
+
"Complete rollout or rollback based on metrics",
|
|
667
|
+
"Clean up old version after stabilization",
|
|
668
|
+
],
|
|
669
|
+
tools: ["Kubernetes", "Istio", "Prometheus", "Grafana"],
|
|
670
|
+
metrics: [
|
|
671
|
+
"Real-time monitoring during rollout",
|
|
672
|
+
"< 10% error rate increase threshold",
|
|
673
|
+
"Gradual traffic increase (10% increments)",
|
|
674
|
+
"Automated rollback on metric violations",
|
|
675
|
+
],
|
|
676
|
+
},
|
|
677
|
+
rolling: {
|
|
678
|
+
steps: [
|
|
679
|
+
"Update instances in batches (typically 25-30%)",
|
|
680
|
+
"Wait for health checks after each batch",
|
|
681
|
+
"Continue with next batch if healthy",
|
|
682
|
+
"Complete rollout or rollback on failures",
|
|
683
|
+
"Verify all instances running new version",
|
|
684
|
+
],
|
|
685
|
+
tools: ["Kubernetes", "Docker", "AWS ECS", "Health checks"],
|
|
686
|
+
metrics: [
|
|
687
|
+
"Minimal service degradation during updates",
|
|
688
|
+
"< 2 minute per-instance update time",
|
|
689
|
+
"Automated health checks after each batch",
|
|
690
|
+
"Load balancer maintains service availability",
|
|
691
|
+
],
|
|
692
|
+
},
|
|
693
|
+
};
|
|
694
|
+
return (implementations[strategy.type] || {
|
|
695
|
+
steps: ["Implement deployment strategy"],
|
|
696
|
+
tools: ["Deployment tools"],
|
|
697
|
+
metrics: ["Deployment success rate"],
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
analyzeInfrastructureNeeds(services, environment) {
|
|
701
|
+
const recommendations = [];
|
|
702
|
+
if (services.includes("database")) {
|
|
703
|
+
if (environment === "production") {
|
|
704
|
+
recommendations.push({
|
|
705
|
+
platform: "aws",
|
|
706
|
+
service: "RDS PostgreSQL",
|
|
707
|
+
configuration: {
|
|
708
|
+
instanceClass: "db.r5.large",
|
|
709
|
+
multiAz: true,
|
|
710
|
+
backupRetention: 30,
|
|
711
|
+
},
|
|
712
|
+
scalingStrategy: "Read replicas for read-heavy workloads",
|
|
713
|
+
costEstimate: 300,
|
|
714
|
+
reliability: 99.9,
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
else {
|
|
718
|
+
recommendations.push({
|
|
719
|
+
platform: "aws",
|
|
720
|
+
service: "RDS PostgreSQL",
|
|
721
|
+
configuration: {
|
|
722
|
+
instanceClass: "db.t3.medium",
|
|
723
|
+
multiAz: false,
|
|
724
|
+
backupRetention: 7,
|
|
725
|
+
},
|
|
726
|
+
scalingStrategy: "Vertical scaling as needed",
|
|
727
|
+
costEstimate: 50,
|
|
728
|
+
reliability: 99.5,
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
if (services.includes("cache")) {
|
|
733
|
+
recommendations.push({
|
|
734
|
+
platform: "aws",
|
|
735
|
+
service: "ElastiCache Redis",
|
|
736
|
+
configuration: {
|
|
737
|
+
nodeType: "cache.t3.micro",
|
|
738
|
+
numNodes: 1,
|
|
739
|
+
clusterMode: false,
|
|
740
|
+
},
|
|
741
|
+
scalingStrategy: "Cluster mode for high availability",
|
|
742
|
+
costEstimate: 25,
|
|
743
|
+
reliability: 99.9,
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
if (services.includes("storage")) {
|
|
747
|
+
recommendations.push({
|
|
748
|
+
platform: "aws",
|
|
749
|
+
service: "S3",
|
|
750
|
+
configuration: {
|
|
751
|
+
storageClass: "STANDARD",
|
|
752
|
+
versioning: true,
|
|
753
|
+
encryption: "AES256",
|
|
754
|
+
},
|
|
755
|
+
scalingStrategy: "Intelligent tiering for cost optimization",
|
|
756
|
+
costEstimate: 5,
|
|
757
|
+
reliability: 99.999999999,
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
// Compute resources based on services
|
|
761
|
+
const computeNeeds = services.length;
|
|
762
|
+
recommendations.push({
|
|
763
|
+
platform: "aws",
|
|
764
|
+
service: "ECS Fargate",
|
|
765
|
+
configuration: {
|
|
766
|
+
cpu: `${computeNeeds * 256} CPU units`,
|
|
767
|
+
memory: `${computeNeeds * 512} MB`,
|
|
768
|
+
desiredCount: Math.max(2, computeNeeds),
|
|
769
|
+
},
|
|
770
|
+
scalingStrategy: "CPU utilization based auto-scaling (30-70%)",
|
|
771
|
+
costEstimate: computeNeeds * 50,
|
|
772
|
+
reliability: 99.9,
|
|
773
|
+
});
|
|
774
|
+
return recommendations;
|
|
775
|
+
}
|
|
776
|
+
generateInfrastructureAsCode(platform, recommendations, scaling) {
|
|
777
|
+
let code = "";
|
|
778
|
+
switch (platform) {
|
|
779
|
+
case "aws":
|
|
780
|
+
code = this.generateTerraformAWS(recommendations, scaling);
|
|
781
|
+
break;
|
|
782
|
+
case "kubernetes":
|
|
783
|
+
code = this.generateKubernetesYAML(recommendations, scaling);
|
|
784
|
+
break;
|
|
785
|
+
default:
|
|
786
|
+
code = `# Infrastructure code for ${platform}\n# Implementation depends on specific platform requirements`;
|
|
787
|
+
}
|
|
788
|
+
return {
|
|
789
|
+
code,
|
|
790
|
+
scaling: {
|
|
791
|
+
min: 2,
|
|
792
|
+
max: 10,
|
|
793
|
+
cpuThreshold: 70,
|
|
794
|
+
memoryThreshold: 80,
|
|
795
|
+
},
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
generateTerraformAWS(recommendations, scaling) {
|
|
799
|
+
let terraform = `# AWS Infrastructure as Code
|
|
800
|
+
terraform {
|
|
801
|
+
required_providers {
|
|
802
|
+
aws = {
|
|
803
|
+
source = "hashicorp/aws"
|
|
804
|
+
version = "~> 4.0"
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
# VPC Configuration
|
|
810
|
+
resource "aws_vpc" "main" {
|
|
811
|
+
cidr_block = "10.0.0.0/16"
|
|
812
|
+
enable_dns_support = true
|
|
813
|
+
enable_dns_hostnames = true
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
# Subnets
|
|
817
|
+
resource "aws_subnet" "public" {
|
|
818
|
+
vpc_id = aws_vpc.main.id
|
|
819
|
+
cidr_block = "10.0.1.0/24"
|
|
820
|
+
availability_zone = "us-east-1a"
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
# Security Groups
|
|
824
|
+
resource "aws_security_group" "web" {
|
|
825
|
+
name_prefix = "web-"
|
|
826
|
+
vpc_id = aws_vpc.main.id
|
|
827
|
+
|
|
828
|
+
ingress {
|
|
829
|
+
from_port = 80
|
|
830
|
+
to_port = 80
|
|
831
|
+
protocol = "tcp"
|
|
832
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
ingress {
|
|
836
|
+
from_port = 443
|
|
837
|
+
to_port = 443
|
|
838
|
+
protocol = "tcp"
|
|
839
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
`;
|
|
843
|
+
// Add service-specific resources
|
|
844
|
+
recommendations.forEach((rec) => {
|
|
845
|
+
switch (rec.service) {
|
|
846
|
+
case "ECS Fargate":
|
|
847
|
+
terraform += `
|
|
848
|
+
# ECS Cluster
|
|
849
|
+
resource "aws_ecs_cluster" "main" {
|
|
850
|
+
name = "main-cluster"
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
# ECS Task Definition
|
|
854
|
+
resource "aws_ecs_task_definition" "app" {
|
|
855
|
+
family = "app"
|
|
856
|
+
network_mode = "awsvpc"
|
|
857
|
+
requires_compatibilities = ["FARGATE"]
|
|
858
|
+
cpu = "${rec.configuration.cpu}"
|
|
859
|
+
memory = "${rec.configuration.memory}"
|
|
860
|
+
|
|
861
|
+
container_definitions = jsonencode([
|
|
862
|
+
{
|
|
863
|
+
name = "app"
|
|
864
|
+
image = "nginx:latest"
|
|
865
|
+
essential = true
|
|
866
|
+
}
|
|
867
|
+
])
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
# ECS Service
|
|
871
|
+
resource "aws_ecs_service" "app" {
|
|
872
|
+
name = "app-service"
|
|
873
|
+
cluster = aws_ecs_cluster.main.id
|
|
874
|
+
task_definition = aws_ecs_task_definition.app.arn
|
|
875
|
+
desired_count = ${rec.configuration.desiredCount}
|
|
876
|
+
launch_type = "FARGATE"
|
|
877
|
+
|
|
878
|
+
network_configuration {
|
|
879
|
+
subnets = [aws_subnet.public.id]
|
|
880
|
+
security_groups = [aws_security_group.web.id]
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
`;
|
|
884
|
+
break;
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
return terraform;
|
|
888
|
+
}
|
|
889
|
+
generateKubernetesYAML(recommendations, scaling) {
|
|
890
|
+
return `apiVersion: apps/v1
|
|
891
|
+
kind: Deployment
|
|
892
|
+
metadata:
|
|
893
|
+
name: app-deployment
|
|
894
|
+
spec:
|
|
895
|
+
replicas: 3
|
|
896
|
+
selector:
|
|
897
|
+
matchLabels:
|
|
898
|
+
app: my-app
|
|
899
|
+
template:
|
|
900
|
+
metadata:
|
|
901
|
+
labels:
|
|
902
|
+
app: my-app
|
|
903
|
+
spec:
|
|
904
|
+
containers:
|
|
905
|
+
- name: app
|
|
906
|
+
image: nginx:latest
|
|
907
|
+
ports:
|
|
908
|
+
- containerPort: 80
|
|
909
|
+
resources:
|
|
910
|
+
requests:
|
|
911
|
+
cpu: 100m
|
|
912
|
+
memory: 128Mi
|
|
913
|
+
limits:
|
|
914
|
+
cpu: 500m
|
|
915
|
+
memory: 512Mi
|
|
916
|
+
---
|
|
917
|
+
apiVersion: v1
|
|
918
|
+
kind: Service
|
|
919
|
+
metadata:
|
|
920
|
+
name: app-service
|
|
921
|
+
spec:
|
|
922
|
+
selector:
|
|
923
|
+
app: my-app
|
|
924
|
+
ports:
|
|
925
|
+
- port: 80
|
|
926
|
+
targetPort: 80
|
|
927
|
+
type: LoadBalancer
|
|
928
|
+
`;
|
|
929
|
+
}
|
|
930
|
+
generateMonitoringConfiguration(platform, services) {
|
|
931
|
+
return {
|
|
932
|
+
dashboards: [
|
|
933
|
+
"Application Performance Dashboard",
|
|
934
|
+
"Infrastructure Health Dashboard",
|
|
935
|
+
"Error Rate and Latency Dashboard",
|
|
936
|
+
"Resource Utilization Dashboard",
|
|
937
|
+
],
|
|
938
|
+
alerts: [
|
|
939
|
+
"High CPU utilization (>80%)",
|
|
940
|
+
"Memory usage spikes",
|
|
941
|
+
"Error rate increase (>5%)",
|
|
942
|
+
"Response time degradation (>2s)",
|
|
943
|
+
],
|
|
944
|
+
metrics: [
|
|
945
|
+
"CPU utilization",
|
|
946
|
+
"Memory usage",
|
|
947
|
+
"Network I/O",
|
|
948
|
+
"Disk I/O",
|
|
949
|
+
"Response times",
|
|
950
|
+
"Error rates",
|
|
951
|
+
"Request throughput",
|
|
952
|
+
],
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
generateSecurityConfiguration(platform, environment) {
|
|
956
|
+
return {
|
|
957
|
+
policies: [
|
|
958
|
+
"Least privilege access control",
|
|
959
|
+
"Network segmentation and security groups",
|
|
960
|
+
"Encryption at rest and in transit",
|
|
961
|
+
"Regular security updates and patching",
|
|
962
|
+
"Intrusion detection and monitoring",
|
|
963
|
+
"Backup and disaster recovery procedures",
|
|
964
|
+
],
|
|
965
|
+
tools: [
|
|
966
|
+
"AWS Config (for AWS)",
|
|
967
|
+
"Azure Policy (for Azure)",
|
|
968
|
+
"Security Command Center (for GCP)",
|
|
969
|
+
"Container security scanning",
|
|
970
|
+
"Secret management integration",
|
|
971
|
+
],
|
|
972
|
+
compliance: environment === "production"
|
|
973
|
+
? [
|
|
974
|
+
"SOC 2 Type II",
|
|
975
|
+
"ISO 27001",
|
|
976
|
+
"PCI DSS (if handling payments)",
|
|
977
|
+
"GDPR (if handling EU data)",
|
|
978
|
+
]
|
|
979
|
+
: [],
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
analyzeDeploymentMetrics(metrics) {
|
|
983
|
+
return {
|
|
984
|
+
efficiency: this.calculateDeploymentEfficiency(metrics),
|
|
985
|
+
reliability: this.calculateDeploymentReliability(metrics),
|
|
986
|
+
speed: this.calculateDeploymentSpeed(metrics),
|
|
987
|
+
bottlenecks: this.identifyMetricBottlenecks(metrics),
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
identifyDeploymentBottlenecks(analysis, constraints) {
|
|
991
|
+
const bottlenecks = [];
|
|
992
|
+
if (analysis.speed.deployTime > 30) {
|
|
993
|
+
bottlenecks.push({
|
|
994
|
+
issue: "Slow deployment time",
|
|
995
|
+
impact: "high",
|
|
996
|
+
cause: "Large artifacts, sequential processes, or inefficient pipelines",
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
if (analysis.reliability < 90) {
|
|
1000
|
+
bottlenecks.push({
|
|
1001
|
+
issue: "High failure rate",
|
|
1002
|
+
impact: "critical",
|
|
1003
|
+
cause: "Unstable tests, environment issues, or poor error handling",
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
if (analysis.speed.rollbackTime > 10) {
|
|
1007
|
+
bottlenecks.push({
|
|
1008
|
+
issue: "Slow rollback capability",
|
|
1009
|
+
impact: "high",
|
|
1010
|
+
cause: "Lack of automated rollback scripts or backup strategies",
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
if (constraints.maxDowntime &&
|
|
1014
|
+
analysis.speed.deployTime > constraints.maxDowntime) {
|
|
1015
|
+
bottlenecks.push({
|
|
1016
|
+
issue: "Deployment exceeds downtime constraints",
|
|
1017
|
+
impact: "critical",
|
|
1018
|
+
cause: "Deployment strategy incompatible with availability requirements",
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
return bottlenecks;
|
|
1022
|
+
}
|
|
1023
|
+
generateDeploymentOptimizations(bottlenecks, constraints) {
|
|
1024
|
+
const optimizations = [];
|
|
1025
|
+
bottlenecks.forEach((bottleneck) => {
|
|
1026
|
+
switch (bottleneck.issue) {
|
|
1027
|
+
case "Slow deployment time":
|
|
1028
|
+
optimizations.push({
|
|
1029
|
+
title: "Implement artifact caching and parallel processing",
|
|
1030
|
+
effort: "medium",
|
|
1031
|
+
impact: "high",
|
|
1032
|
+
description: "Cache dependencies and run independent stages in parallel",
|
|
1033
|
+
});
|
|
1034
|
+
break;
|
|
1035
|
+
case "High failure rate":
|
|
1036
|
+
optimizations.push({
|
|
1037
|
+
title: "Add comprehensive testing and health checks",
|
|
1038
|
+
effort: "high",
|
|
1039
|
+
impact: "high",
|
|
1040
|
+
description: "Implement smoke tests, contract tests, and environment validation",
|
|
1041
|
+
});
|
|
1042
|
+
break;
|
|
1043
|
+
case "Slow rollback capability":
|
|
1044
|
+
optimizations.push({
|
|
1045
|
+
title: "Implement automated rollback mechanisms",
|
|
1046
|
+
effort: "medium",
|
|
1047
|
+
impact: "high",
|
|
1048
|
+
description: "Create rollback scripts and backup strategies for instant recovery",
|
|
1049
|
+
});
|
|
1050
|
+
break;
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
return optimizations;
|
|
1054
|
+
}
|
|
1055
|
+
createOptimizationRoadmap(optimizations, constraints) {
|
|
1056
|
+
const phases = [];
|
|
1057
|
+
let currentWeek = 0;
|
|
1058
|
+
// Phase 1: Quick wins
|
|
1059
|
+
const quickWins = optimizations.filter((o) => o.effort === "low" || o.effort === "medium");
|
|
1060
|
+
if (quickWins.length > 0) {
|
|
1061
|
+
phases.push({
|
|
1062
|
+
name: "Quick Wins",
|
|
1063
|
+
duration: 2,
|
|
1064
|
+
optimizations: quickWins,
|
|
1065
|
+
focus: "Implement high-impact, low-effort optimizations",
|
|
1066
|
+
});
|
|
1067
|
+
currentWeek += 2;
|
|
1068
|
+
}
|
|
1069
|
+
// Phase 2: Infrastructure improvements
|
|
1070
|
+
const infraOpts = optimizations.filter((o) => o.title.includes("infrastructure") || o.title.includes("rollback"));
|
|
1071
|
+
if (infraOpts.length > 0) {
|
|
1072
|
+
phases.push({
|
|
1073
|
+
name: "Infrastructure Automation",
|
|
1074
|
+
duration: 3,
|
|
1075
|
+
optimizations: infraOpts,
|
|
1076
|
+
focus: "Automate deployment and rollback processes",
|
|
1077
|
+
});
|
|
1078
|
+
currentWeek += 3;
|
|
1079
|
+
}
|
|
1080
|
+
// Phase 3: Testing and quality
|
|
1081
|
+
const qualityOpts = optimizations.filter((o) => o.title.includes("testing") || o.title.includes("health"));
|
|
1082
|
+
if (qualityOpts.length > 0) {
|
|
1083
|
+
phases.push({
|
|
1084
|
+
name: "Quality Assurance",
|
|
1085
|
+
duration: 4,
|
|
1086
|
+
optimizations: qualityOpts,
|
|
1087
|
+
focus: "Improve testing and monitoring capabilities",
|
|
1088
|
+
});
|
|
1089
|
+
currentWeek += 4;
|
|
1090
|
+
}
|
|
1091
|
+
return {
|
|
1092
|
+
phases,
|
|
1093
|
+
totalDuration: currentWeek,
|
|
1094
|
+
finalMetrics: {
|
|
1095
|
+
deployTime: (constraints.currentMetrics?.deployTime ?? 10) * 0.6,
|
|
1096
|
+
failureRate: (constraints.currentMetrics?.failureRate ?? 0.05) * 0.3,
|
|
1097
|
+
rollbackTime: Math.min((constraints.currentMetrics?.rollbackTime ?? 5) * 0.2, 5),
|
|
1098
|
+
},
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
calculateDeploymentEfficiency(metrics) {
|
|
1102
|
+
// Efficiency based on resource utilization and process optimization
|
|
1103
|
+
let efficiency = 100;
|
|
1104
|
+
if ((metrics.deployTime ?? 0) > 20)
|
|
1105
|
+
efficiency -= 20;
|
|
1106
|
+
if ((metrics.failureRate ?? 0) > 0.05)
|
|
1107
|
+
efficiency -= 15;
|
|
1108
|
+
if ((metrics.rollbackTime ?? 0) > 5)
|
|
1109
|
+
efficiency -= 10;
|
|
1110
|
+
return Math.max(0, efficiency);
|
|
1111
|
+
}
|
|
1112
|
+
calculateDeploymentReliability(metrics) {
|
|
1113
|
+
return Math.max(0, 100 - (metrics.failureRate ?? 0) * 100);
|
|
1114
|
+
}
|
|
1115
|
+
calculateDeploymentSpeed(metrics) {
|
|
1116
|
+
return {
|
|
1117
|
+
deployTime: metrics.deployTime || 0,
|
|
1118
|
+
rollbackTime: metrics.rollbackTime || 0,
|
|
1119
|
+
efficiency: this.calculateDeploymentEfficiency(metrics),
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
identifyMetricBottlenecks(metrics) {
|
|
1123
|
+
const bottlenecks = [];
|
|
1124
|
+
if ((metrics.deployTime ?? 0) > 15)
|
|
1125
|
+
bottlenecks.push("deployment-speed");
|
|
1126
|
+
if ((metrics.failureRate ?? 0) > 0.05)
|
|
1127
|
+
bottlenecks.push("reliability");
|
|
1128
|
+
if ((metrics.rollbackTime ?? 0) > 3)
|
|
1129
|
+
bottlenecks.push("rollback-speed");
|
|
1130
|
+
return bottlenecks;
|
|
1131
|
+
}
|
|
1132
|
+
calculateDependencyComplexity(stages) {
|
|
1133
|
+
return stages.reduce((complexity, stage) => complexity + stage.dependencies.length, 0);
|
|
1134
|
+
}
|
|
1135
|
+
analyzeStageDistribution(stages) {
|
|
1136
|
+
const types = stages.reduce((acc, stage) => {
|
|
1137
|
+
acc[stage.type] = (acc[stage.type] || 0) + 1;
|
|
1138
|
+
return acc;
|
|
1139
|
+
}, {});
|
|
1140
|
+
return types;
|
|
1141
|
+
}
|
|
1142
|
+
identifyPipelineOptimizations(pipeline) {
|
|
1143
|
+
const optimizations = [];
|
|
1144
|
+
const parallelizableCount = pipeline.stages.filter((s) => s.parallelizable).length;
|
|
1145
|
+
if (parallelizableCount < pipeline.stages.length * 0.5) {
|
|
1146
|
+
optimizations.push("Increase parallelization of independent stages");
|
|
1147
|
+
}
|
|
1148
|
+
if (pipeline.totalDuration > 20) {
|
|
1149
|
+
optimizations.push("Implement artifact caching to reduce build times");
|
|
1150
|
+
}
|
|
1151
|
+
return optimizations;
|
|
1152
|
+
}
|
|
1153
|
+
getInfrastructureLanguage(platform) {
|
|
1154
|
+
switch (platform) {
|
|
1155
|
+
case "aws":
|
|
1156
|
+
case "azure":
|
|
1157
|
+
case "gcp":
|
|
1158
|
+
return "hcl";
|
|
1159
|
+
case "kubernetes":
|
|
1160
|
+
return "yaml";
|
|
1161
|
+
default:
|
|
1162
|
+
return "json";
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
async run() {
|
|
1166
|
+
const transport = new StdioServerTransport();
|
|
1167
|
+
await this.server.connect(transport);
|
|
1168
|
+
// Use centralized shutdown handler
|
|
1169
|
+
createGracefulShutdown({
|
|
1170
|
+
serverName: "devops-deployment.server",
|
|
1171
|
+
server: this.server,
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
// Run the server if this file is executed directly
|
|
1176
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
1177
|
+
const server = new StringRayDevOpsDeploymentServer();
|
|
1178
|
+
server.run().catch(() => { });
|
|
1179
|
+
}
|
|
1180
|
+
export { StringRayDevOpsDeploymentServer };
|