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,1622 @@
|
|
|
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
|
+
|
|
8
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
9
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
|
+
import { frameworkLogger } from "../../core/framework-logger.js";
|
|
11
|
+
import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
|
|
12
|
+
import {
|
|
13
|
+
CallToolRequestSchema,
|
|
14
|
+
ListToolsRequestSchema,
|
|
15
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
16
|
+
|
|
17
|
+
interface DeploymentStrategy {
|
|
18
|
+
name: string;
|
|
19
|
+
type: "blue-green" | "canary" | "rolling" | "recreate" | "shadow";
|
|
20
|
+
description: string;
|
|
21
|
+
useCase: string;
|
|
22
|
+
pros: string[];
|
|
23
|
+
cons: string[];
|
|
24
|
+
complexity: "low" | "medium" | "high";
|
|
25
|
+
downtime: "zero" | "minimal" | "planned";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface PipelineAnalysis {
|
|
29
|
+
stages: PipelineStage[];
|
|
30
|
+
totalDuration: number;
|
|
31
|
+
bottleneckStage: string;
|
|
32
|
+
optimizationSuggestions: string[];
|
|
33
|
+
securityGates: SecurityGate[];
|
|
34
|
+
performanceMetrics: PipelineMetrics;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface PipelineStage {
|
|
38
|
+
name: string;
|
|
39
|
+
type: "build" | "test" | "security" | "deploy" | "monitor";
|
|
40
|
+
duration: number;
|
|
41
|
+
successRate: number;
|
|
42
|
+
parallelizable: boolean;
|
|
43
|
+
dependencies: string[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface SecurityGate {
|
|
47
|
+
name: string;
|
|
48
|
+
type: "sast" | "dast" | "dependency-scan" | "secrets-scan" | "compliance";
|
|
49
|
+
tools: string[];
|
|
50
|
+
blocking: boolean;
|
|
51
|
+
coverage: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface PipelineMetrics {
|
|
55
|
+
buildTime: number;
|
|
56
|
+
testTime: number;
|
|
57
|
+
deployTime: number;
|
|
58
|
+
failureRate: number;
|
|
59
|
+
meanTimeToRecovery: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface InfrastructureRecommendation {
|
|
63
|
+
platform: "aws" | "azure" | "gcp" | "kubernetes" | "docker";
|
|
64
|
+
service: string;
|
|
65
|
+
configuration: Record<string, unknown>;
|
|
66
|
+
scalingStrategy: string;
|
|
67
|
+
costEstimate: number;
|
|
68
|
+
reliability: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface CICDPipelineArgs {
|
|
72
|
+
pipelineConfig: string;
|
|
73
|
+
platform: string;
|
|
74
|
+
includeSecurity?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface DeploymentStrategyArgs {
|
|
78
|
+
applicationType: string;
|
|
79
|
+
scale: string;
|
|
80
|
+
availability: string;
|
|
81
|
+
budget?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface InfrastructureCodeArgs {
|
|
85
|
+
platform: string;
|
|
86
|
+
services: string[];
|
|
87
|
+
environment: string;
|
|
88
|
+
scaling?: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface DeploymentMetricsInput {
|
|
92
|
+
deployTime?: number;
|
|
93
|
+
failureRate?: number;
|
|
94
|
+
rollbackTime?: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface DeploymentPerformanceArgs {
|
|
98
|
+
currentMetrics: DeploymentMetricsInput;
|
|
99
|
+
constraints?: {
|
|
100
|
+
maxDowntime?: number;
|
|
101
|
+
budget?: number;
|
|
102
|
+
teamSize?: number;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface McpToolResponse {
|
|
107
|
+
content: Array<{ type: string; text: string }>;
|
|
108
|
+
data?: Record<string, unknown>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface PipelineStructureAnalysis {
|
|
112
|
+
parallelization: number;
|
|
113
|
+
dependencyComplexity: number;
|
|
114
|
+
stageDistribution: Record<string, number>;
|
|
115
|
+
optimizationOpportunities: string[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface PipelineSecurityAnalysis {
|
|
119
|
+
securityGates: SecurityGate[];
|
|
120
|
+
recommendations: string[];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
type PipelineScoreAnalysis = PipelineStructureAnalysis & {
|
|
124
|
+
totalDuration?: number;
|
|
125
|
+
performanceMetrics?: PipelineMetrics;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
interface StrategyRequirements {
|
|
129
|
+
applicationType: string;
|
|
130
|
+
scale: string;
|
|
131
|
+
availability: string;
|
|
132
|
+
budget: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface StrategyImplementation {
|
|
136
|
+
steps: string[];
|
|
137
|
+
tools: string[];
|
|
138
|
+
metrics: string[];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface InfrastructureCodeResult {
|
|
142
|
+
code: string;
|
|
143
|
+
scaling: {
|
|
144
|
+
min: number;
|
|
145
|
+
max: number;
|
|
146
|
+
cpuThreshold: number;
|
|
147
|
+
memoryThreshold: number;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface MonitoringConfig {
|
|
152
|
+
dashboards: string[];
|
|
153
|
+
alerts: string[];
|
|
154
|
+
metrics: string[];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface SecurityConfig {
|
|
158
|
+
policies: string[];
|
|
159
|
+
tools: string[];
|
|
160
|
+
compliance: string[];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
interface DeploymentSpeedResult {
|
|
164
|
+
deployTime: number;
|
|
165
|
+
rollbackTime: number;
|
|
166
|
+
efficiency: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface DeploymentMetricsAnalysis {
|
|
170
|
+
efficiency: number;
|
|
171
|
+
reliability: number;
|
|
172
|
+
speed: DeploymentSpeedResult;
|
|
173
|
+
bottlenecks: string[];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface DeploymentBottleneck {
|
|
177
|
+
issue: string;
|
|
178
|
+
impact: string;
|
|
179
|
+
cause: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface DeploymentOptimization {
|
|
183
|
+
title: string;
|
|
184
|
+
effort: string;
|
|
185
|
+
impact: string;
|
|
186
|
+
description: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
interface DeploymentConstraints {
|
|
190
|
+
maxDowntime?: number;
|
|
191
|
+
budget?: number;
|
|
192
|
+
teamSize?: number;
|
|
193
|
+
currentMetrics?: DeploymentMetricsInput;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface RoadmapPhase {
|
|
197
|
+
name: string;
|
|
198
|
+
duration: number;
|
|
199
|
+
optimizations: DeploymentOptimization[];
|
|
200
|
+
focus: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface OptimizationRoadmap {
|
|
204
|
+
phases: RoadmapPhase[];
|
|
205
|
+
totalDuration: number;
|
|
206
|
+
finalMetrics: DeploymentMetricsInput;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
class StringRayDevOpsDeploymentServer {
|
|
210
|
+
private server: Server;
|
|
211
|
+
|
|
212
|
+
constructor() {
|
|
213
|
+
this.server = new Server(
|
|
214
|
+
{
|
|
215
|
+
name: "devops-deployment", version: "1.22.67",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
capabilities: {
|
|
219
|
+
tools: {},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
this.setupToolHandlers();
|
|
225
|
+
// Server initialization - removed unnecessary startup logging
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private setupToolHandlers() {
|
|
229
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
230
|
+
return {
|
|
231
|
+
tools: [
|
|
232
|
+
{
|
|
233
|
+
name: "analyze_ci_cd_pipeline",
|
|
234
|
+
description:
|
|
235
|
+
"Analyze CI/CD pipeline configuration and suggest optimizations",
|
|
236
|
+
inputSchema: {
|
|
237
|
+
type: "object",
|
|
238
|
+
properties: {
|
|
239
|
+
pipelineConfig: {
|
|
240
|
+
type: "string",
|
|
241
|
+
description: "CI/CD pipeline configuration (YAML/JSON)",
|
|
242
|
+
},
|
|
243
|
+
platform: {
|
|
244
|
+
type: "string",
|
|
245
|
+
enum: [
|
|
246
|
+
"github-actions",
|
|
247
|
+
"gitlab-ci",
|
|
248
|
+
"jenkins",
|
|
249
|
+
"circle-ci",
|
|
250
|
+
"azure-devops",
|
|
251
|
+
],
|
|
252
|
+
description: "CI/CD platform being used",
|
|
253
|
+
},
|
|
254
|
+
includeSecurity: {
|
|
255
|
+
type: "boolean",
|
|
256
|
+
description: "Include security gate analysis",
|
|
257
|
+
default: true,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
required: ["pipelineConfig", "platform"],
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "design_deployment_strategy",
|
|
265
|
+
description:
|
|
266
|
+
"Design optimal deployment strategy for application requirements",
|
|
267
|
+
inputSchema: {
|
|
268
|
+
type: "object",
|
|
269
|
+
properties: {
|
|
270
|
+
applicationType: {
|
|
271
|
+
type: "string",
|
|
272
|
+
enum: [
|
|
273
|
+
"web-app",
|
|
274
|
+
"api",
|
|
275
|
+
"mobile",
|
|
276
|
+
"microservices",
|
|
277
|
+
"monolith",
|
|
278
|
+
],
|
|
279
|
+
description: "Type of application",
|
|
280
|
+
},
|
|
281
|
+
scale: {
|
|
282
|
+
type: "string",
|
|
283
|
+
enum: ["small", "medium", "large", "enterprise"],
|
|
284
|
+
description: "Expected scale/traffic",
|
|
285
|
+
},
|
|
286
|
+
availability: {
|
|
287
|
+
type: "string",
|
|
288
|
+
enum: ["basic", "high", "critical"],
|
|
289
|
+
description: "Required availability level",
|
|
290
|
+
},
|
|
291
|
+
budget: {
|
|
292
|
+
type: "string",
|
|
293
|
+
enum: ["cost-optimized", "balanced", "performance-optimized"],
|
|
294
|
+
description: "Budget considerations",
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
required: ["applicationType", "scale"],
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: "generate_infrastructure_code",
|
|
302
|
+
description: "Generate infrastructure as code for deployment",
|
|
303
|
+
inputSchema: {
|
|
304
|
+
type: "object",
|
|
305
|
+
properties: {
|
|
306
|
+
platform: {
|
|
307
|
+
type: "string",
|
|
308
|
+
enum: ["aws", "azure", "gcp", "kubernetes"],
|
|
309
|
+
description: "Target cloud platform",
|
|
310
|
+
},
|
|
311
|
+
services: {
|
|
312
|
+
type: "array",
|
|
313
|
+
items: { type: "string" },
|
|
314
|
+
description:
|
|
315
|
+
"Required services (database, cache, storage, etc.)",
|
|
316
|
+
},
|
|
317
|
+
environment: {
|
|
318
|
+
type: "string",
|
|
319
|
+
enum: ["development", "staging", "production"],
|
|
320
|
+
description: "Deployment environment",
|
|
321
|
+
},
|
|
322
|
+
scaling: {
|
|
323
|
+
type: "boolean",
|
|
324
|
+
description: "Include auto-scaling configuration",
|
|
325
|
+
default: true,
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
required: ["platform", "services"],
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "optimize_deployment_performance",
|
|
333
|
+
description:
|
|
334
|
+
"Analyze and optimize deployment performance and reliability",
|
|
335
|
+
inputSchema: {
|
|
336
|
+
type: "object",
|
|
337
|
+
properties: {
|
|
338
|
+
currentMetrics: {
|
|
339
|
+
type: "object",
|
|
340
|
+
properties: {
|
|
341
|
+
deployTime: { type: "number" },
|
|
342
|
+
failureRate: { type: "number" },
|
|
343
|
+
rollbackTime: { type: "number" },
|
|
344
|
+
},
|
|
345
|
+
description: "Current deployment metrics",
|
|
346
|
+
},
|
|
347
|
+
constraints: {
|
|
348
|
+
type: "object",
|
|
349
|
+
properties: {
|
|
350
|
+
maxDowntime: { type: "number" },
|
|
351
|
+
budget: { type: "number" },
|
|
352
|
+
teamSize: { type: "number" },
|
|
353
|
+
},
|
|
354
|
+
description: "Business and technical constraints",
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
required: ["currentMetrics"],
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
],
|
|
361
|
+
};
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
365
|
+
const { name, arguments: args } = request.params;
|
|
366
|
+
|
|
367
|
+
switch (name) {
|
|
368
|
+
case "analyze_ci_cd_pipeline":
|
|
369
|
+
return await this.analyzeCICDPipeline(args as unknown as CICDPipelineArgs);
|
|
370
|
+
case "design_deployment_strategy":
|
|
371
|
+
return await this.designDeploymentStrategy(args as unknown as DeploymentStrategyArgs);
|
|
372
|
+
case "generate_infrastructure_code":
|
|
373
|
+
return await this.generateInfrastructureCode(args as unknown as InfrastructureCodeArgs);
|
|
374
|
+
case "optimize_deployment_performance":
|
|
375
|
+
return await this.optimizeDeploymentPerformance(args as unknown as DeploymentPerformanceArgs);
|
|
376
|
+
default:
|
|
377
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
private async analyzeCICDPipeline(args: CICDPipelineArgs) {
|
|
383
|
+
const { pipelineConfig, platform, includeSecurity = true } = args;
|
|
384
|
+
|
|
385
|
+
try {
|
|
386
|
+
const pipeline = this.parsePipelineConfig(pipelineConfig, platform);
|
|
387
|
+
const analysis = this.analyzePipelineStructure(pipeline);
|
|
388
|
+
const optimizations = this.generatePipelineOptimizations(
|
|
389
|
+
pipeline,
|
|
390
|
+
analysis,
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
let securityAnalysis = null;
|
|
394
|
+
if (includeSecurity) {
|
|
395
|
+
securityAnalysis = this.analyzePipelineSecurity(pipeline);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const recommendations = [
|
|
399
|
+
...optimizations,
|
|
400
|
+
...(securityAnalysis ? securityAnalysis.recommendations : []),
|
|
401
|
+
];
|
|
402
|
+
|
|
403
|
+
return {
|
|
404
|
+
content: [
|
|
405
|
+
{
|
|
406
|
+
type: "text",
|
|
407
|
+
text:
|
|
408
|
+
`CI/CD Pipeline Analysis for ${platform.toUpperCase()}:\n\n` +
|
|
409
|
+
`📊 PIPELINE METRICS\n` +
|
|
410
|
+
`Stages: ${pipeline.stages.length}\n` +
|
|
411
|
+
`Total Duration: ${pipeline.totalDuration} minutes\n` +
|
|
412
|
+
`Parallelizable Stages: ${pipeline.stages.filter((s) => s.parallelizable).length}/${pipeline.stages.length}\n` +
|
|
413
|
+
`Bottleneck Stage: ${pipeline.bottleneckStage}\n\n` +
|
|
414
|
+
`🔍 PERFORMANCE ANALYSIS\n` +
|
|
415
|
+
`Build Time: ${pipeline.performanceMetrics.buildTime} min\n` +
|
|
416
|
+
`Test Time: ${pipeline.performanceMetrics.testTime} min\n` +
|
|
417
|
+
`Deploy Time: ${pipeline.performanceMetrics.deployTime} min\n` +
|
|
418
|
+
`Failure Rate: ${(pipeline.performanceMetrics.failureRate * 100).toFixed(1)}%\n` +
|
|
419
|
+
`MTTR: ${pipeline.performanceMetrics.meanTimeToRecovery} min\n\n` +
|
|
420
|
+
`${
|
|
421
|
+
includeSecurity
|
|
422
|
+
? `🛡️ SECURITY GATES\n` +
|
|
423
|
+
`Total Gates: ${securityAnalysis!.securityGates.length}\n` +
|
|
424
|
+
`Blocking Gates: ${securityAnalysis!.securityGates.filter((g: SecurityGate) => g.blocking).length}\n` +
|
|
425
|
+
`Coverage: ${securityAnalysis!.securityGates.reduce((sum: number, g: SecurityGate) => sum + g.coverage, 0) / securityAnalysis!.securityGates.length}%\n\n`
|
|
426
|
+
: ""
|
|
427
|
+
}` +
|
|
428
|
+
`💡 OPTIMIZATION RECOMMENDATIONS\n${recommendations.map((rec, i) => `${i + 1}. ${rec}`).join("\n")}`,
|
|
429
|
+
},
|
|
430
|
+
],
|
|
431
|
+
data: {
|
|
432
|
+
pipeline,
|
|
433
|
+
analysis,
|
|
434
|
+
securityAnalysis,
|
|
435
|
+
recommendations,
|
|
436
|
+
score: this.calculatePipelineScore(analysis, securityAnalysis),
|
|
437
|
+
},
|
|
438
|
+
};
|
|
439
|
+
} catch (error) {
|
|
440
|
+
return {
|
|
441
|
+
content: [
|
|
442
|
+
{
|
|
443
|
+
type: "text",
|
|
444
|
+
text: `Error analyzing CI/CD pipeline: ${error instanceof Error ? error.message : String(error)}`,
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
private async designDeploymentStrategy(args: DeploymentStrategyArgs) {
|
|
452
|
+
const { applicationType, scale, availability, budget = "balanced" } = args;
|
|
453
|
+
|
|
454
|
+
try {
|
|
455
|
+
const strategies = this.generateDeploymentStrategies(
|
|
456
|
+
applicationType,
|
|
457
|
+
scale,
|
|
458
|
+
availability,
|
|
459
|
+
budget,
|
|
460
|
+
);
|
|
461
|
+
const recommended = this.selectOptimalStrategy(strategies, {
|
|
462
|
+
applicationType,
|
|
463
|
+
scale,
|
|
464
|
+
availability,
|
|
465
|
+
budget,
|
|
466
|
+
});
|
|
467
|
+
const implementation = this.generateStrategyImplementation(recommended);
|
|
468
|
+
|
|
469
|
+
return {
|
|
470
|
+
content: [
|
|
471
|
+
{
|
|
472
|
+
type: "text",
|
|
473
|
+
text:
|
|
474
|
+
`Deployment Strategy Design for ${applicationType.toUpperCase()}:\n\n` +
|
|
475
|
+
`🎯 REQUIREMENTS\n` +
|
|
476
|
+
`Scale: ${scale.toUpperCase()}\n` +
|
|
477
|
+
`Availability: ${availability.toUpperCase()}\n` +
|
|
478
|
+
`Budget: ${budget.toUpperCase()}\n\n` +
|
|
479
|
+
`🏆 RECOMMENDED STRATEGY: ${recommended.name.toUpperCase()}\n` +
|
|
480
|
+
`Type: ${recommended.type}\n` +
|
|
481
|
+
`Downtime: ${recommended.downtime}\n` +
|
|
482
|
+
`Complexity: ${recommended.complexity}\n` +
|
|
483
|
+
`Use Case: ${recommended.useCase}\n\n` +
|
|
484
|
+
`✅ PROS\n${recommended.pros.map((pro) => `• ${pro}`).join("\n")}\n\n` +
|
|
485
|
+
`⚠️ CONS\n${recommended.cons.map((con) => `• ${con}`).join("\n")}\n\n` +
|
|
486
|
+
`🚀 IMPLEMENTATION STEPS\n${implementation.steps.map((step: string, i: number) => `${i + 1}. ${step}`).join("\n")}\n\n` +
|
|
487
|
+
`🛠️ REQUIRED TOOLS\n${implementation.tools.join(", ")}\n\n` +
|
|
488
|
+
`📊 SUCCESS METRICS\n${implementation.metrics.map((metric: string) => `• ${metric}`).join("\n")}`,
|
|
489
|
+
},
|
|
490
|
+
],
|
|
491
|
+
data: {
|
|
492
|
+
strategies,
|
|
493
|
+
recommended,
|
|
494
|
+
implementation,
|
|
495
|
+
alternatives: strategies.filter((s) => s.name !== recommended.name),
|
|
496
|
+
},
|
|
497
|
+
};
|
|
498
|
+
} catch (error) {
|
|
499
|
+
return {
|
|
500
|
+
content: [
|
|
501
|
+
{
|
|
502
|
+
type: "text",
|
|
503
|
+
text: `Error designing deployment strategy: ${error instanceof Error ? error.message : String(error)}`,
|
|
504
|
+
},
|
|
505
|
+
],
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
private async generateInfrastructureCode(args: InfrastructureCodeArgs) {
|
|
511
|
+
const { platform, services, environment, scaling = true } = args;
|
|
512
|
+
|
|
513
|
+
try {
|
|
514
|
+
const recommendations = this.analyzeInfrastructureNeeds(
|
|
515
|
+
services,
|
|
516
|
+
environment,
|
|
517
|
+
);
|
|
518
|
+
const infrastructure = this.generateInfrastructureAsCode(
|
|
519
|
+
platform,
|
|
520
|
+
recommendations,
|
|
521
|
+
scaling,
|
|
522
|
+
);
|
|
523
|
+
const monitoring = this.generateMonitoringConfiguration(
|
|
524
|
+
platform,
|
|
525
|
+
services,
|
|
526
|
+
);
|
|
527
|
+
const security = this.generateSecurityConfiguration(
|
|
528
|
+
platform,
|
|
529
|
+
environment,
|
|
530
|
+
);
|
|
531
|
+
|
|
532
|
+
return {
|
|
533
|
+
content: [
|
|
534
|
+
{
|
|
535
|
+
type: "text",
|
|
536
|
+
text:
|
|
537
|
+
`Infrastructure as Code for ${platform.toUpperCase()} (${environment}):\n\n` +
|
|
538
|
+
`🏗️ ARCHITECTURE OVERVIEW\n` +
|
|
539
|
+
`Platform: ${platform}\n` +
|
|
540
|
+
`Environment: ${environment}\n` +
|
|
541
|
+
`Services: ${services.join(", ")}\n` +
|
|
542
|
+
`Auto-scaling: ${scaling ? "Enabled" : "Disabled"}\n\n` +
|
|
543
|
+
`💰 COST ESTIMATE: $${recommendations.reduce((sum, r) => sum + r.costEstimate, 0)}/month\n\n` +
|
|
544
|
+
`🔧 GENERATED INFRASTRUCTURE CODE\n\`\`\`${this.getInfrastructureLanguage(platform)}\n${infrastructure.code}\n\`\`\`\n\n` +
|
|
545
|
+
`📊 SCALING CONFIGURATION\n` +
|
|
546
|
+
`Strategy: ${recommendations[0]?.scalingStrategy}\n` +
|
|
547
|
+
`Min Instances: ${infrastructure.scaling.min}\n` +
|
|
548
|
+
`Max Instances: ${infrastructure.scaling.max}\n` +
|
|
549
|
+
`Target CPU: ${infrastructure.scaling.cpuThreshold}%\n\n` +
|
|
550
|
+
`📈 MONITORING DASHBOARDS\n${monitoring.dashboards.map((d: string) => `• ${d}`).join("\n")}\n\n` +
|
|
551
|
+
`🛡️ SECURITY CONFIGURATION\n${security.policies.map((p: string) => `• ${p}`).join("\n")}`,
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
data: {
|
|
555
|
+
recommendations,
|
|
556
|
+
infrastructure,
|
|
557
|
+
monitoring,
|
|
558
|
+
security,
|
|
559
|
+
totalCost: recommendations.reduce(
|
|
560
|
+
(sum, r) => sum + r.costEstimate,
|
|
561
|
+
0,
|
|
562
|
+
),
|
|
563
|
+
},
|
|
564
|
+
};
|
|
565
|
+
} catch (error) {
|
|
566
|
+
return {
|
|
567
|
+
content: [
|
|
568
|
+
{
|
|
569
|
+
type: "text",
|
|
570
|
+
text: `Error generating infrastructure code: ${error instanceof Error ? error.message : String(error)}`,
|
|
571
|
+
},
|
|
572
|
+
],
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
private async optimizeDeploymentPerformance(args: DeploymentPerformanceArgs) {
|
|
578
|
+
const { currentMetrics, constraints = {} } = args;
|
|
579
|
+
|
|
580
|
+
try {
|
|
581
|
+
const analysis = this.analyzeDeploymentMetrics(currentMetrics);
|
|
582
|
+
const bottlenecks = this.identifyDeploymentBottlenecks(
|
|
583
|
+
analysis,
|
|
584
|
+
constraints,
|
|
585
|
+
);
|
|
586
|
+
const optimizations = this.generateDeploymentOptimizations(
|
|
587
|
+
bottlenecks,
|
|
588
|
+
constraints,
|
|
589
|
+
);
|
|
590
|
+
const roadmap = this.createOptimizationRoadmap(
|
|
591
|
+
optimizations,
|
|
592
|
+
constraints,
|
|
593
|
+
);
|
|
594
|
+
|
|
595
|
+
return {
|
|
596
|
+
content: [
|
|
597
|
+
{
|
|
598
|
+
type: "text",
|
|
599
|
+
text:
|
|
600
|
+
`Deployment Performance Optimization Analysis:\n\n` +
|
|
601
|
+
`📊 CURRENT METRICS\n` +
|
|
602
|
+
`Deploy Time: ${currentMetrics.deployTime || 0} minutes\n` +
|
|
603
|
+
`Failure Rate: ${(currentMetrics.failureRate || 0) * 100}%\n` +
|
|
604
|
+
`Rollback Time: ${currentMetrics.rollbackTime || 0} minutes\n\n` +
|
|
605
|
+
`🎯 CONSTRAINTS\n` +
|
|
606
|
+
`Max Downtime: ${constraints.maxDowntime || "N/A"} minutes\n` +
|
|
607
|
+
`Budget: $${constraints.budget || "N/A"}\n` +
|
|
608
|
+
`Team Size: ${constraints.teamSize || "N/A"} people\n\n` +
|
|
609
|
+
`🔍 BOTTLENECK ANALYSIS\n${bottlenecks.map((b, i) => `${i + 1}. ${b.issue} (Impact: ${b.impact})`).join("\n")}\n\n` +
|
|
610
|
+
`⚡ OPTIMIZATION RECOMMENDATIONS\n${optimizations.map((opt, i) => `${i + 1}. ${opt.title} (Effort: ${opt.effort}, Impact: ${opt.impact})`).join("\n")}\n\n` +
|
|
611
|
+
`🗓️ OPTIMIZATION ROADMAP\n${roadmap.phases.map((phase: RoadmapPhase, i: number) => `Phase ${i + 1}: ${phase.name} (${phase.duration} weeks)`).join("\n")}\n\n` +
|
|
612
|
+
`📈 PROJECTED IMPROVEMENTS\n` +
|
|
613
|
+
`Deploy Time: ${roadmap.finalMetrics.deployTime ?? 0} min (-${currentMetrics.deployTime ? (((currentMetrics.deployTime - (roadmap.finalMetrics.deployTime ?? 0)) / currentMetrics.deployTime) * 100).toFixed(0) : 0}%)\n` +
|
|
614
|
+
`Failure Rate: ${((roadmap.finalMetrics.failureRate ?? 0) * 100).toFixed(1)}% (-${currentMetrics.failureRate ? (((currentMetrics.failureRate - (roadmap.finalMetrics.failureRate ?? 0)) / currentMetrics.failureRate) * 100).toFixed(0) : 0}%)\n` +
|
|
615
|
+
`Rollback Time: ${roadmap.finalMetrics.rollbackTime ?? 0} min (-${currentMetrics.rollbackTime ? (((currentMetrics.rollbackTime - (roadmap.finalMetrics.rollbackTime ?? 0)) / currentMetrics.rollbackTime) * 100).toFixed(0) : 0}%)`,
|
|
616
|
+
},
|
|
617
|
+
],
|
|
618
|
+
data: {
|
|
619
|
+
analysis,
|
|
620
|
+
bottlenecks,
|
|
621
|
+
optimizations,
|
|
622
|
+
roadmap,
|
|
623
|
+
improvements: roadmap.finalMetrics,
|
|
624
|
+
},
|
|
625
|
+
};
|
|
626
|
+
} catch (error) {
|
|
627
|
+
return {
|
|
628
|
+
content: [
|
|
629
|
+
{
|
|
630
|
+
type: "text",
|
|
631
|
+
text: `Error optimizing deployment performance: ${error instanceof Error ? error.message : String(error)}`,
|
|
632
|
+
},
|
|
633
|
+
],
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
private parsePipelineConfig(
|
|
639
|
+
config: string,
|
|
640
|
+
platform: string,
|
|
641
|
+
): PipelineAnalysis {
|
|
642
|
+
// Simplified pipeline parsing - in production would be more sophisticated
|
|
643
|
+
const stages: PipelineStage[] = [];
|
|
644
|
+
let totalDuration = 0;
|
|
645
|
+
|
|
646
|
+
// Parse based on platform
|
|
647
|
+
switch (platform) {
|
|
648
|
+
case "github-actions":
|
|
649
|
+
// Parse GitHub Actions workflow
|
|
650
|
+
const jobs = config.match(
|
|
651
|
+
/jobs:\s*\n((?:\s+\w+:[\s\S]*?(?=\n\s+\w+:|$))*)?/,
|
|
652
|
+
);
|
|
653
|
+
if (jobs) {
|
|
654
|
+
// Extract job definitions and estimate durations
|
|
655
|
+
stages.push(
|
|
656
|
+
{
|
|
657
|
+
name: "checkout",
|
|
658
|
+
type: "build",
|
|
659
|
+
duration: 0.5,
|
|
660
|
+
successRate: 0.99,
|
|
661
|
+
parallelizable: false,
|
|
662
|
+
dependencies: [],
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
name: "setup",
|
|
666
|
+
type: "build",
|
|
667
|
+
duration: 1,
|
|
668
|
+
successRate: 0.95,
|
|
669
|
+
parallelizable: false,
|
|
670
|
+
dependencies: ["checkout"],
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
name: "build",
|
|
674
|
+
type: "build",
|
|
675
|
+
duration: 3,
|
|
676
|
+
successRate: 0.9,
|
|
677
|
+
parallelizable: false,
|
|
678
|
+
dependencies: ["setup"],
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
name: "test",
|
|
682
|
+
type: "test",
|
|
683
|
+
duration: 5,
|
|
684
|
+
successRate: 0.85,
|
|
685
|
+
parallelizable: true,
|
|
686
|
+
dependencies: ["build"],
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
name: "security",
|
|
690
|
+
type: "security",
|
|
691
|
+
duration: 2,
|
|
692
|
+
successRate: 0.95,
|
|
693
|
+
parallelizable: true,
|
|
694
|
+
dependencies: ["build"],
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
name: "deploy",
|
|
698
|
+
type: "deploy",
|
|
699
|
+
duration: 2,
|
|
700
|
+
successRate: 0.8,
|
|
701
|
+
parallelizable: false,
|
|
702
|
+
dependencies: ["test", "security"],
|
|
703
|
+
},
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
break;
|
|
707
|
+
|
|
708
|
+
default:
|
|
709
|
+
// Generic pipeline structure
|
|
710
|
+
stages.push(
|
|
711
|
+
{
|
|
712
|
+
name: "build",
|
|
713
|
+
type: "build",
|
|
714
|
+
duration: 4,
|
|
715
|
+
successRate: 0.9,
|
|
716
|
+
parallelizable: false,
|
|
717
|
+
dependencies: [],
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: "test",
|
|
721
|
+
type: "test",
|
|
722
|
+
duration: 6,
|
|
723
|
+
successRate: 0.85,
|
|
724
|
+
parallelizable: true,
|
|
725
|
+
dependencies: ["build"],
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
name: "deploy",
|
|
729
|
+
type: "deploy",
|
|
730
|
+
duration: 3,
|
|
731
|
+
successRate: 0.8,
|
|
732
|
+
parallelizable: false,
|
|
733
|
+
dependencies: ["test"],
|
|
734
|
+
},
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
totalDuration = stages.reduce((sum, stage) => sum + stage.duration, 0);
|
|
739
|
+
|
|
740
|
+
return {
|
|
741
|
+
stages,
|
|
742
|
+
totalDuration,
|
|
743
|
+
bottleneckStage: stages.reduce((max, stage) =>
|
|
744
|
+
stage.duration > max.duration ? stage : max,
|
|
745
|
+
).name,
|
|
746
|
+
optimizationSuggestions: [],
|
|
747
|
+
securityGates: [],
|
|
748
|
+
performanceMetrics: {
|
|
749
|
+
buildTime: stages
|
|
750
|
+
.filter((s) => s.type === "build")
|
|
751
|
+
.reduce((sum, s) => sum + s.duration, 0),
|
|
752
|
+
testTime: stages
|
|
753
|
+
.filter((s) => s.type === "test")
|
|
754
|
+
.reduce((sum, s) => sum + s.duration, 0),
|
|
755
|
+
deployTime: stages
|
|
756
|
+
.filter((s) => s.type === "deploy")
|
|
757
|
+
.reduce((sum, s) => sum + s.duration, 0),
|
|
758
|
+
failureRate:
|
|
759
|
+
1 - stages.reduce((product, stage) => product * stage.successRate, 1),
|
|
760
|
+
meanTimeToRecovery: 15, // minutes
|
|
761
|
+
},
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
private analyzePipelineStructure(pipeline: PipelineAnalysis): PipelineStructureAnalysis {
|
|
766
|
+
return {
|
|
767
|
+
parallelization:
|
|
768
|
+
pipeline.stages.filter((s) => s.parallelizable).length /
|
|
769
|
+
pipeline.stages.length,
|
|
770
|
+
dependencyComplexity: this.calculateDependencyComplexity(pipeline.stages),
|
|
771
|
+
stageDistribution: this.analyzeStageDistribution(pipeline.stages),
|
|
772
|
+
optimizationOpportunities: this.identifyPipelineOptimizations(pipeline),
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
private generatePipelineOptimizations(
|
|
777
|
+
pipeline: PipelineAnalysis,
|
|
778
|
+
analysis: PipelineStructureAnalysis,
|
|
779
|
+
): string[] {
|
|
780
|
+
const optimizations: string[] = [];
|
|
781
|
+
|
|
782
|
+
if (analysis.parallelization < 0.5) {
|
|
783
|
+
optimizations.push(
|
|
784
|
+
"Increase parallelization by running independent stages concurrently",
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
if (pipeline.bottleneckStage) {
|
|
789
|
+
optimizations.push(
|
|
790
|
+
`Optimize ${pipeline.bottleneckStage} stage - consider caching or distributed processing`,
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
if (pipeline.totalDuration > 30) {
|
|
795
|
+
optimizations.push(
|
|
796
|
+
"Pipeline too slow - consider artifact caching and incremental builds",
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if (pipeline.performanceMetrics.failureRate > 0.1) {
|
|
801
|
+
optimizations.push(
|
|
802
|
+
"High failure rate detected - improve test stability and add retries",
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
optimizations.push(
|
|
807
|
+
"Add automated rollback capability for failed deployments",
|
|
808
|
+
);
|
|
809
|
+
optimizations.push(
|
|
810
|
+
"Implement artifact versioning for reliable deployments",
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
return optimizations;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
private analyzePipelineSecurity(pipeline: PipelineAnalysis): PipelineSecurityAnalysis {
|
|
817
|
+
const securityGates: SecurityGate[] = [
|
|
818
|
+
{
|
|
819
|
+
name: "SAST",
|
|
820
|
+
type: "sast",
|
|
821
|
+
tools: ["eslint", "sonarcloud"],
|
|
822
|
+
blocking: true,
|
|
823
|
+
coverage: 85,
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
name: "Dependency Scan",
|
|
827
|
+
type: "dependency-scan",
|
|
828
|
+
tools: ["npm audit", "snyk"],
|
|
829
|
+
blocking: true,
|
|
830
|
+
coverage: 95,
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
name: "Secrets Scan",
|
|
834
|
+
type: "secrets-scan",
|
|
835
|
+
tools: ["gitleaks", "trufflehog"],
|
|
836
|
+
blocking: true,
|
|
837
|
+
coverage: 90,
|
|
838
|
+
},
|
|
839
|
+
];
|
|
840
|
+
|
|
841
|
+
return {
|
|
842
|
+
securityGates,
|
|
843
|
+
recommendations: [
|
|
844
|
+
"Add DAST scanning for runtime security testing",
|
|
845
|
+
"Implement compliance checks for regulatory requirements",
|
|
846
|
+
"Add manual security review gates for critical changes",
|
|
847
|
+
],
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
private calculatePipelineScore(analysis: PipelineScoreAnalysis, securityAnalysis: PipelineSecurityAnalysis | null): number {
|
|
852
|
+
let score = 100;
|
|
853
|
+
|
|
854
|
+
// Deduct for long duration
|
|
855
|
+
if ((analysis.totalDuration ?? 0) > 30) score -= 20;
|
|
856
|
+
if ((analysis.totalDuration ?? 0) > 60) score -= 30;
|
|
857
|
+
|
|
858
|
+
score -= (analysis.performanceMetrics?.failureRate ?? 0) * 100;
|
|
859
|
+
|
|
860
|
+
// Deduct for poor parallelization
|
|
861
|
+
if (analysis.parallelization < 0.3) score -= 15;
|
|
862
|
+
|
|
863
|
+
// Bonus for security
|
|
864
|
+
if (securityAnalysis && securityAnalysis.securityGates.length >= 3) {
|
|
865
|
+
score += 10;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
return Math.max(0, Math.min(100, score));
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
private generateDeploymentStrategies(
|
|
872
|
+
appType: string,
|
|
873
|
+
scale: string,
|
|
874
|
+
availability: string,
|
|
875
|
+
budget: string,
|
|
876
|
+
): DeploymentStrategy[] {
|
|
877
|
+
const strategies: DeploymentStrategy[] = [];
|
|
878
|
+
|
|
879
|
+
// Blue-Green Strategy
|
|
880
|
+
strategies.push({
|
|
881
|
+
name: "blue-green",
|
|
882
|
+
type: "blue-green",
|
|
883
|
+
description:
|
|
884
|
+
"Maintain two identical environments, switch traffic between them",
|
|
885
|
+
useCase: "Zero-downtime deployments with instant rollback",
|
|
886
|
+
pros: ["Zero downtime", "Instant rollback", "Safe testing"],
|
|
887
|
+
cons: [
|
|
888
|
+
"Double infrastructure cost",
|
|
889
|
+
"Complex routing",
|
|
890
|
+
"Storage synchronization",
|
|
891
|
+
],
|
|
892
|
+
complexity: "high",
|
|
893
|
+
downtime: "zero",
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
// Canary Strategy
|
|
897
|
+
strategies.push({
|
|
898
|
+
name: "canary",
|
|
899
|
+
type: "canary",
|
|
900
|
+
description: "Gradually roll out to subset of users, monitor metrics",
|
|
901
|
+
useCase: "Risk mitigation with gradual rollout and monitoring",
|
|
902
|
+
pros: ["Gradual rollout", "Real-time monitoring", "Easy rollback"],
|
|
903
|
+
cons: [
|
|
904
|
+
"Complex traffic routing",
|
|
905
|
+
"Monitoring overhead",
|
|
906
|
+
"Slower rollout",
|
|
907
|
+
],
|
|
908
|
+
complexity: "medium",
|
|
909
|
+
downtime: "zero",
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
// Rolling Update
|
|
913
|
+
strategies.push({
|
|
914
|
+
name: "rolling",
|
|
915
|
+
type: "rolling",
|
|
916
|
+
description:
|
|
917
|
+
"Update instances gradually, keeping some running during deployment",
|
|
918
|
+
useCase: "Simple deployments with minimal infrastructure requirements",
|
|
919
|
+
pros: [
|
|
920
|
+
"Simple implementation",
|
|
921
|
+
"Minimal extra resources",
|
|
922
|
+
"Fast completion",
|
|
923
|
+
],
|
|
924
|
+
cons: [
|
|
925
|
+
"Partial downtime",
|
|
926
|
+
"Mixed versions during update",
|
|
927
|
+
"Rollback complexity",
|
|
928
|
+
],
|
|
929
|
+
complexity: "low",
|
|
930
|
+
downtime: "minimal",
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
return strategies;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
private selectOptimalStrategy(
|
|
937
|
+
strategies: DeploymentStrategy[],
|
|
938
|
+
requirements: StrategyRequirements,
|
|
939
|
+
): DeploymentStrategy {
|
|
940
|
+
// Score strategies based on requirements
|
|
941
|
+
const scored = strategies.map((strategy) => {
|
|
942
|
+
let score = 0;
|
|
943
|
+
|
|
944
|
+
// Availability scoring
|
|
945
|
+
if (
|
|
946
|
+
requirements.availability === "critical" &&
|
|
947
|
+
strategy.downtime === "zero"
|
|
948
|
+
)
|
|
949
|
+
score += 30;
|
|
950
|
+
if (
|
|
951
|
+
requirements.availability === "high" &&
|
|
952
|
+
strategy.downtime !== "planned"
|
|
953
|
+
)
|
|
954
|
+
score += 20;
|
|
955
|
+
if (requirements.availability === "basic") score += 10;
|
|
956
|
+
|
|
957
|
+
// Scale scoring
|
|
958
|
+
if (requirements.scale === "enterprise" && strategy.complexity === "high")
|
|
959
|
+
score += 20;
|
|
960
|
+
if (requirements.scale === "large" && strategy.complexity !== "low")
|
|
961
|
+
score += 15;
|
|
962
|
+
|
|
963
|
+
// Budget scoring
|
|
964
|
+
if (
|
|
965
|
+
requirements.budget === "cost-optimized" &&
|
|
966
|
+
strategy.cons.some((c) => c.includes("cost"))
|
|
967
|
+
)
|
|
968
|
+
score -= 20;
|
|
969
|
+
if (
|
|
970
|
+
requirements.budget === "performance-optimized" &&
|
|
971
|
+
strategy.pros.some((p) => p.includes("performance"))
|
|
972
|
+
)
|
|
973
|
+
score += 15;
|
|
974
|
+
|
|
975
|
+
return { strategy, score };
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
const topScored = scored.sort((a, b) => b.score - a.score)[0];
|
|
979
|
+
return (topScored?.strategy || strategies[0]) as DeploymentStrategy;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
private generateStrategyImplementation(strategy: DeploymentStrategy): StrategyImplementation {
|
|
983
|
+
const implementations = {
|
|
984
|
+
"blue-green": {
|
|
985
|
+
steps: [
|
|
986
|
+
"Set up two identical environments (Blue and Green)",
|
|
987
|
+
"Deploy new version to inactive environment",
|
|
988
|
+
"Run comprehensive tests on new environment",
|
|
989
|
+
"Switch traffic routing to new environment",
|
|
990
|
+
"Monitor for issues, rollback if needed",
|
|
991
|
+
"Clean up old environment after confirmation",
|
|
992
|
+
],
|
|
993
|
+
tools: ["Kubernetes", "Istio", "Terraform", "Prometheus"],
|
|
994
|
+
metrics: [
|
|
995
|
+
"Zero deployment downtime",
|
|
996
|
+
"99.9%+ availability during deployment",
|
|
997
|
+
"< 5 minute rollback time",
|
|
998
|
+
"100% traffic migration success rate",
|
|
999
|
+
],
|
|
1000
|
+
},
|
|
1001
|
+
canary: {
|
|
1002
|
+
steps: [
|
|
1003
|
+
"Deploy new version to canary group (1-5% of traffic)",
|
|
1004
|
+
"Monitor key metrics and error rates",
|
|
1005
|
+
"Gradually increase traffic to new version",
|
|
1006
|
+
"Monitor for performance degradation",
|
|
1007
|
+
"Complete rollout or rollback based on metrics",
|
|
1008
|
+
"Clean up old version after stabilization",
|
|
1009
|
+
],
|
|
1010
|
+
tools: ["Kubernetes", "Istio", "Prometheus", "Grafana"],
|
|
1011
|
+
metrics: [
|
|
1012
|
+
"Real-time monitoring during rollout",
|
|
1013
|
+
"< 10% error rate increase threshold",
|
|
1014
|
+
"Gradual traffic increase (10% increments)",
|
|
1015
|
+
"Automated rollback on metric violations",
|
|
1016
|
+
],
|
|
1017
|
+
},
|
|
1018
|
+
rolling: {
|
|
1019
|
+
steps: [
|
|
1020
|
+
"Update instances in batches (typically 25-30%)",
|
|
1021
|
+
"Wait for health checks after each batch",
|
|
1022
|
+
"Continue with next batch if healthy",
|
|
1023
|
+
"Complete rollout or rollback on failures",
|
|
1024
|
+
"Verify all instances running new version",
|
|
1025
|
+
],
|
|
1026
|
+
tools: ["Kubernetes", "Docker", "AWS ECS", "Health checks"],
|
|
1027
|
+
metrics: [
|
|
1028
|
+
"Minimal service degradation during updates",
|
|
1029
|
+
"< 2 minute per-instance update time",
|
|
1030
|
+
"Automated health checks after each batch",
|
|
1031
|
+
"Load balancer maintains service availability",
|
|
1032
|
+
],
|
|
1033
|
+
},
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
return (
|
|
1037
|
+
implementations[strategy.type as keyof typeof implementations] || {
|
|
1038
|
+
steps: ["Implement deployment strategy"],
|
|
1039
|
+
tools: ["Deployment tools"],
|
|
1040
|
+
metrics: ["Deployment success rate"],
|
|
1041
|
+
}
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
private analyzeInfrastructureNeeds(
|
|
1046
|
+
services: string[],
|
|
1047
|
+
environment: string,
|
|
1048
|
+
): InfrastructureRecommendation[] {
|
|
1049
|
+
const recommendations: InfrastructureRecommendation[] = [];
|
|
1050
|
+
|
|
1051
|
+
if (services.includes("database")) {
|
|
1052
|
+
if (environment === "production") {
|
|
1053
|
+
recommendations.push({
|
|
1054
|
+
platform: "aws",
|
|
1055
|
+
service: "RDS PostgreSQL",
|
|
1056
|
+
configuration: {
|
|
1057
|
+
instanceClass: "db.r5.large",
|
|
1058
|
+
multiAz: true,
|
|
1059
|
+
backupRetention: 30,
|
|
1060
|
+
},
|
|
1061
|
+
scalingStrategy: "Read replicas for read-heavy workloads",
|
|
1062
|
+
costEstimate: 300,
|
|
1063
|
+
reliability: 99.9,
|
|
1064
|
+
});
|
|
1065
|
+
} else {
|
|
1066
|
+
recommendations.push({
|
|
1067
|
+
platform: "aws",
|
|
1068
|
+
service: "RDS PostgreSQL",
|
|
1069
|
+
configuration: {
|
|
1070
|
+
instanceClass: "db.t3.medium",
|
|
1071
|
+
multiAz: false,
|
|
1072
|
+
backupRetention: 7,
|
|
1073
|
+
},
|
|
1074
|
+
scalingStrategy: "Vertical scaling as needed",
|
|
1075
|
+
costEstimate: 50,
|
|
1076
|
+
reliability: 99.5,
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
if (services.includes("cache")) {
|
|
1082
|
+
recommendations.push({
|
|
1083
|
+
platform: "aws",
|
|
1084
|
+
service: "ElastiCache Redis",
|
|
1085
|
+
configuration: {
|
|
1086
|
+
nodeType: "cache.t3.micro",
|
|
1087
|
+
numNodes: 1,
|
|
1088
|
+
clusterMode: false,
|
|
1089
|
+
},
|
|
1090
|
+
scalingStrategy: "Cluster mode for high availability",
|
|
1091
|
+
costEstimate: 25,
|
|
1092
|
+
reliability: 99.9,
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
if (services.includes("storage")) {
|
|
1097
|
+
recommendations.push({
|
|
1098
|
+
platform: "aws",
|
|
1099
|
+
service: "S3",
|
|
1100
|
+
configuration: {
|
|
1101
|
+
storageClass: "STANDARD",
|
|
1102
|
+
versioning: true,
|
|
1103
|
+
encryption: "AES256",
|
|
1104
|
+
},
|
|
1105
|
+
scalingStrategy: "Intelligent tiering for cost optimization",
|
|
1106
|
+
costEstimate: 5,
|
|
1107
|
+
reliability: 99.999999999,
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// Compute resources based on services
|
|
1112
|
+
const computeNeeds = services.length;
|
|
1113
|
+
recommendations.push({
|
|
1114
|
+
platform: "aws",
|
|
1115
|
+
service: "ECS Fargate",
|
|
1116
|
+
configuration: {
|
|
1117
|
+
cpu: `${computeNeeds * 256} CPU units`,
|
|
1118
|
+
memory: `${computeNeeds * 512} MB`,
|
|
1119
|
+
desiredCount: Math.max(2, computeNeeds),
|
|
1120
|
+
},
|
|
1121
|
+
scalingStrategy: "CPU utilization based auto-scaling (30-70%)",
|
|
1122
|
+
costEstimate: computeNeeds * 50,
|
|
1123
|
+
reliability: 99.9,
|
|
1124
|
+
});
|
|
1125
|
+
|
|
1126
|
+
return recommendations;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
private generateInfrastructureAsCode(
|
|
1130
|
+
platform: string,
|
|
1131
|
+
recommendations: InfrastructureRecommendation[],
|
|
1132
|
+
scaling: boolean,
|
|
1133
|
+
): InfrastructureCodeResult {
|
|
1134
|
+
let code = "";
|
|
1135
|
+
|
|
1136
|
+
switch (platform) {
|
|
1137
|
+
case "aws":
|
|
1138
|
+
code = this.generateTerraformAWS(recommendations, scaling);
|
|
1139
|
+
break;
|
|
1140
|
+
case "kubernetes":
|
|
1141
|
+
code = this.generateKubernetesYAML(recommendations, scaling);
|
|
1142
|
+
break;
|
|
1143
|
+
default:
|
|
1144
|
+
code = `# Infrastructure code for ${platform}\n# Implementation depends on specific platform requirements`;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
return {
|
|
1148
|
+
code,
|
|
1149
|
+
scaling: {
|
|
1150
|
+
min: 2,
|
|
1151
|
+
max: 10,
|
|
1152
|
+
cpuThreshold: 70,
|
|
1153
|
+
memoryThreshold: 80,
|
|
1154
|
+
},
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
private generateTerraformAWS(
|
|
1159
|
+
recommendations: InfrastructureRecommendation[],
|
|
1160
|
+
scaling: boolean,
|
|
1161
|
+
): string {
|
|
1162
|
+
let terraform = `# AWS Infrastructure as Code
|
|
1163
|
+
terraform {
|
|
1164
|
+
required_providers {
|
|
1165
|
+
aws = {
|
|
1166
|
+
source = "hashicorp/aws"
|
|
1167
|
+
version = "~> 4.0"
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
# VPC Configuration
|
|
1173
|
+
resource "aws_vpc" "main" {
|
|
1174
|
+
cidr_block = "10.0.0.0/16"
|
|
1175
|
+
enable_dns_support = true
|
|
1176
|
+
enable_dns_hostnames = true
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
# Subnets
|
|
1180
|
+
resource "aws_subnet" "public" {
|
|
1181
|
+
vpc_id = aws_vpc.main.id
|
|
1182
|
+
cidr_block = "10.0.1.0/24"
|
|
1183
|
+
availability_zone = "us-east-1a"
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
# Security Groups
|
|
1187
|
+
resource "aws_security_group" "web" {
|
|
1188
|
+
name_prefix = "web-"
|
|
1189
|
+
vpc_id = aws_vpc.main.id
|
|
1190
|
+
|
|
1191
|
+
ingress {
|
|
1192
|
+
from_port = 80
|
|
1193
|
+
to_port = 80
|
|
1194
|
+
protocol = "tcp"
|
|
1195
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
ingress {
|
|
1199
|
+
from_port = 443
|
|
1200
|
+
to_port = 443
|
|
1201
|
+
protocol = "tcp"
|
|
1202
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
`;
|
|
1206
|
+
|
|
1207
|
+
// Add service-specific resources
|
|
1208
|
+
recommendations.forEach((rec) => {
|
|
1209
|
+
switch (rec.service) {
|
|
1210
|
+
case "ECS Fargate":
|
|
1211
|
+
terraform += `
|
|
1212
|
+
# ECS Cluster
|
|
1213
|
+
resource "aws_ecs_cluster" "main" {
|
|
1214
|
+
name = "main-cluster"
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
# ECS Task Definition
|
|
1218
|
+
resource "aws_ecs_task_definition" "app" {
|
|
1219
|
+
family = "app"
|
|
1220
|
+
network_mode = "awsvpc"
|
|
1221
|
+
requires_compatibilities = ["FARGATE"]
|
|
1222
|
+
cpu = "${rec.configuration.cpu}"
|
|
1223
|
+
memory = "${rec.configuration.memory}"
|
|
1224
|
+
|
|
1225
|
+
container_definitions = jsonencode([
|
|
1226
|
+
{
|
|
1227
|
+
name = "app"
|
|
1228
|
+
image = "nginx:latest"
|
|
1229
|
+
essential = true
|
|
1230
|
+
}
|
|
1231
|
+
])
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
# ECS Service
|
|
1235
|
+
resource "aws_ecs_service" "app" {
|
|
1236
|
+
name = "app-service"
|
|
1237
|
+
cluster = aws_ecs_cluster.main.id
|
|
1238
|
+
task_definition = aws_ecs_task_definition.app.arn
|
|
1239
|
+
desired_count = ${rec.configuration.desiredCount}
|
|
1240
|
+
launch_type = "FARGATE"
|
|
1241
|
+
|
|
1242
|
+
network_configuration {
|
|
1243
|
+
subnets = [aws_subnet.public.id]
|
|
1244
|
+
security_groups = [aws_security_group.web.id]
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
`;
|
|
1248
|
+
break;
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
|
|
1252
|
+
return terraform;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
private generateKubernetesYAML(
|
|
1256
|
+
recommendations: InfrastructureRecommendation[],
|
|
1257
|
+
scaling: boolean,
|
|
1258
|
+
): string {
|
|
1259
|
+
return `apiVersion: apps/v1
|
|
1260
|
+
kind: Deployment
|
|
1261
|
+
metadata:
|
|
1262
|
+
name: app-deployment
|
|
1263
|
+
spec:
|
|
1264
|
+
replicas: 3
|
|
1265
|
+
selector:
|
|
1266
|
+
matchLabels:
|
|
1267
|
+
app: my-app
|
|
1268
|
+
template:
|
|
1269
|
+
metadata:
|
|
1270
|
+
labels:
|
|
1271
|
+
app: my-app
|
|
1272
|
+
spec:
|
|
1273
|
+
containers:
|
|
1274
|
+
- name: app
|
|
1275
|
+
image: nginx:latest
|
|
1276
|
+
ports:
|
|
1277
|
+
- containerPort: 80
|
|
1278
|
+
resources:
|
|
1279
|
+
requests:
|
|
1280
|
+
cpu: 100m
|
|
1281
|
+
memory: 128Mi
|
|
1282
|
+
limits:
|
|
1283
|
+
cpu: 500m
|
|
1284
|
+
memory: 512Mi
|
|
1285
|
+
---
|
|
1286
|
+
apiVersion: v1
|
|
1287
|
+
kind: Service
|
|
1288
|
+
metadata:
|
|
1289
|
+
name: app-service
|
|
1290
|
+
spec:
|
|
1291
|
+
selector:
|
|
1292
|
+
app: my-app
|
|
1293
|
+
ports:
|
|
1294
|
+
- port: 80
|
|
1295
|
+
targetPort: 80
|
|
1296
|
+
type: LoadBalancer
|
|
1297
|
+
`;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
private generateMonitoringConfiguration(
|
|
1301
|
+
platform: string,
|
|
1302
|
+
services: string[],
|
|
1303
|
+
): MonitoringConfig {
|
|
1304
|
+
return {
|
|
1305
|
+
dashboards: [
|
|
1306
|
+
"Application Performance Dashboard",
|
|
1307
|
+
"Infrastructure Health Dashboard",
|
|
1308
|
+
"Error Rate and Latency Dashboard",
|
|
1309
|
+
"Resource Utilization Dashboard",
|
|
1310
|
+
],
|
|
1311
|
+
alerts: [
|
|
1312
|
+
"High CPU utilization (>80%)",
|
|
1313
|
+
"Memory usage spikes",
|
|
1314
|
+
"Error rate increase (>5%)",
|
|
1315
|
+
"Response time degradation (>2s)",
|
|
1316
|
+
],
|
|
1317
|
+
metrics: [
|
|
1318
|
+
"CPU utilization",
|
|
1319
|
+
"Memory usage",
|
|
1320
|
+
"Network I/O",
|
|
1321
|
+
"Disk I/O",
|
|
1322
|
+
"Response times",
|
|
1323
|
+
"Error rates",
|
|
1324
|
+
"Request throughput",
|
|
1325
|
+
],
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
private generateSecurityConfiguration(
|
|
1330
|
+
platform: string,
|
|
1331
|
+
environment: string,
|
|
1332
|
+
): SecurityConfig {
|
|
1333
|
+
return {
|
|
1334
|
+
policies: [
|
|
1335
|
+
"Least privilege access control",
|
|
1336
|
+
"Network segmentation and security groups",
|
|
1337
|
+
"Encryption at rest and in transit",
|
|
1338
|
+
"Regular security updates and patching",
|
|
1339
|
+
"Intrusion detection and monitoring",
|
|
1340
|
+
"Backup and disaster recovery procedures",
|
|
1341
|
+
],
|
|
1342
|
+
tools: [
|
|
1343
|
+
"AWS Config (for AWS)",
|
|
1344
|
+
"Azure Policy (for Azure)",
|
|
1345
|
+
"Security Command Center (for GCP)",
|
|
1346
|
+
"Container security scanning",
|
|
1347
|
+
"Secret management integration",
|
|
1348
|
+
],
|
|
1349
|
+
compliance:
|
|
1350
|
+
environment === "production"
|
|
1351
|
+
? [
|
|
1352
|
+
"SOC 2 Type II",
|
|
1353
|
+
"ISO 27001",
|
|
1354
|
+
"PCI DSS (if handling payments)",
|
|
1355
|
+
"GDPR (if handling EU data)",
|
|
1356
|
+
]
|
|
1357
|
+
: [],
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
private analyzeDeploymentMetrics(metrics: DeploymentMetricsInput): DeploymentMetricsAnalysis {
|
|
1362
|
+
return {
|
|
1363
|
+
efficiency: this.calculateDeploymentEfficiency(metrics),
|
|
1364
|
+
reliability: this.calculateDeploymentReliability(metrics),
|
|
1365
|
+
speed: this.calculateDeploymentSpeed(metrics),
|
|
1366
|
+
bottlenecks: this.identifyMetricBottlenecks(metrics),
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
private identifyDeploymentBottlenecks(
|
|
1371
|
+
analysis: DeploymentMetricsAnalysis,
|
|
1372
|
+
constraints: DeploymentConstraints,
|
|
1373
|
+
): DeploymentBottleneck[] {
|
|
1374
|
+
const bottlenecks = [];
|
|
1375
|
+
|
|
1376
|
+
if (analysis.speed.deployTime > 30) {
|
|
1377
|
+
bottlenecks.push({
|
|
1378
|
+
issue: "Slow deployment time",
|
|
1379
|
+
impact: "high",
|
|
1380
|
+
cause:
|
|
1381
|
+
"Large artifacts, sequential processes, or inefficient pipelines",
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
if (analysis.reliability < 90) {
|
|
1386
|
+
bottlenecks.push({
|
|
1387
|
+
issue: "High failure rate",
|
|
1388
|
+
impact: "critical",
|
|
1389
|
+
cause: "Unstable tests, environment issues, or poor error handling",
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
if (analysis.speed.rollbackTime > 10) {
|
|
1394
|
+
bottlenecks.push({
|
|
1395
|
+
issue: "Slow rollback capability",
|
|
1396
|
+
impact: "high",
|
|
1397
|
+
cause: "Lack of automated rollback scripts or backup strategies",
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
if (
|
|
1402
|
+
constraints.maxDowntime &&
|
|
1403
|
+
analysis.speed.deployTime > constraints.maxDowntime
|
|
1404
|
+
) {
|
|
1405
|
+
bottlenecks.push({
|
|
1406
|
+
issue: "Deployment exceeds downtime constraints",
|
|
1407
|
+
impact: "critical",
|
|
1408
|
+
cause:
|
|
1409
|
+
"Deployment strategy incompatible with availability requirements",
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
return bottlenecks;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
private generateDeploymentOptimizations(
|
|
1417
|
+
bottlenecks: DeploymentBottleneck[],
|
|
1418
|
+
constraints: DeploymentConstraints,
|
|
1419
|
+
): DeploymentOptimization[] {
|
|
1420
|
+
const optimizations: DeploymentOptimization[] = [];
|
|
1421
|
+
|
|
1422
|
+
bottlenecks.forEach((bottleneck) => {
|
|
1423
|
+
switch (bottleneck.issue) {
|
|
1424
|
+
case "Slow deployment time":
|
|
1425
|
+
optimizations.push({
|
|
1426
|
+
title: "Implement artifact caching and parallel processing",
|
|
1427
|
+
effort: "medium",
|
|
1428
|
+
impact: "high",
|
|
1429
|
+
description:
|
|
1430
|
+
"Cache dependencies and run independent stages in parallel",
|
|
1431
|
+
});
|
|
1432
|
+
break;
|
|
1433
|
+
|
|
1434
|
+
case "High failure rate":
|
|
1435
|
+
optimizations.push({
|
|
1436
|
+
title: "Add comprehensive testing and health checks",
|
|
1437
|
+
effort: "high",
|
|
1438
|
+
impact: "high",
|
|
1439
|
+
description:
|
|
1440
|
+
"Implement smoke tests, contract tests, and environment validation",
|
|
1441
|
+
});
|
|
1442
|
+
break;
|
|
1443
|
+
|
|
1444
|
+
case "Slow rollback capability":
|
|
1445
|
+
optimizations.push({
|
|
1446
|
+
title: "Implement automated rollback mechanisms",
|
|
1447
|
+
effort: "medium",
|
|
1448
|
+
impact: "high",
|
|
1449
|
+
description:
|
|
1450
|
+
"Create rollback scripts and backup strategies for instant recovery",
|
|
1451
|
+
});
|
|
1452
|
+
break;
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
|
|
1456
|
+
return optimizations;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
private createOptimizationRoadmap(
|
|
1460
|
+
optimizations: DeploymentOptimization[],
|
|
1461
|
+
constraints: DeploymentConstraints,
|
|
1462
|
+
): OptimizationRoadmap {
|
|
1463
|
+
const phases = [];
|
|
1464
|
+
let currentWeek = 0;
|
|
1465
|
+
|
|
1466
|
+
// Phase 1: Quick wins
|
|
1467
|
+
const quickWins = optimizations.filter(
|
|
1468
|
+
(o) => o.effort === "low" || o.effort === "medium",
|
|
1469
|
+
);
|
|
1470
|
+
if (quickWins.length > 0) {
|
|
1471
|
+
phases.push({
|
|
1472
|
+
name: "Quick Wins",
|
|
1473
|
+
duration: 2,
|
|
1474
|
+
optimizations: quickWins,
|
|
1475
|
+
focus: "Implement high-impact, low-effort optimizations",
|
|
1476
|
+
});
|
|
1477
|
+
currentWeek += 2;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
// Phase 2: Infrastructure improvements
|
|
1481
|
+
const infraOpts = optimizations.filter(
|
|
1482
|
+
(o) => o.title.includes("infrastructure") || o.title.includes("rollback"),
|
|
1483
|
+
);
|
|
1484
|
+
if (infraOpts.length > 0) {
|
|
1485
|
+
phases.push({
|
|
1486
|
+
name: "Infrastructure Automation",
|
|
1487
|
+
duration: 3,
|
|
1488
|
+
optimizations: infraOpts,
|
|
1489
|
+
focus: "Automate deployment and rollback processes",
|
|
1490
|
+
});
|
|
1491
|
+
currentWeek += 3;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
// Phase 3: Testing and quality
|
|
1495
|
+
const qualityOpts = optimizations.filter(
|
|
1496
|
+
(o) => o.title.includes("testing") || o.title.includes("health"),
|
|
1497
|
+
);
|
|
1498
|
+
if (qualityOpts.length > 0) {
|
|
1499
|
+
phases.push({
|
|
1500
|
+
name: "Quality Assurance",
|
|
1501
|
+
duration: 4,
|
|
1502
|
+
optimizations: qualityOpts,
|
|
1503
|
+
focus: "Improve testing and monitoring capabilities",
|
|
1504
|
+
});
|
|
1505
|
+
currentWeek += 4;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
return {
|
|
1509
|
+
phases,
|
|
1510
|
+
totalDuration: currentWeek,
|
|
1511
|
+
finalMetrics: {
|
|
1512
|
+
deployTime: (constraints.currentMetrics?.deployTime ?? 10) * 0.6,
|
|
1513
|
+
failureRate: (constraints.currentMetrics?.failureRate ?? 0.05) * 0.3,
|
|
1514
|
+
rollbackTime: Math.min(
|
|
1515
|
+
(constraints.currentMetrics?.rollbackTime ?? 5) * 0.2,
|
|
1516
|
+
5,
|
|
1517
|
+
),
|
|
1518
|
+
},
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
private calculateDeploymentEfficiency(metrics: DeploymentMetricsInput): number {
|
|
1523
|
+
// Efficiency based on resource utilization and process optimization
|
|
1524
|
+
let efficiency = 100;
|
|
1525
|
+
|
|
1526
|
+
if ((metrics.deployTime ?? 0) > 20) efficiency -= 20;
|
|
1527
|
+
if ((metrics.failureRate ?? 0) > 0.05) efficiency -= 15;
|
|
1528
|
+
if ((metrics.rollbackTime ?? 0) > 5) efficiency -= 10;
|
|
1529
|
+
|
|
1530
|
+
return Math.max(0, efficiency);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
private calculateDeploymentReliability(metrics: DeploymentMetricsInput): number {
|
|
1534
|
+
return Math.max(0, 100 - (metrics.failureRate ?? 0) * 100);
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
private calculateDeploymentSpeed(metrics: DeploymentMetricsInput): DeploymentSpeedResult {
|
|
1538
|
+
return {
|
|
1539
|
+
deployTime: metrics.deployTime || 0,
|
|
1540
|
+
rollbackTime: metrics.rollbackTime || 0,
|
|
1541
|
+
efficiency: this.calculateDeploymentEfficiency(metrics),
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
private identifyMetricBottlenecks(metrics: DeploymentMetricsInput): string[] {
|
|
1546
|
+
const bottlenecks = [];
|
|
1547
|
+
|
|
1548
|
+
if ((metrics.deployTime ?? 0) > 15) bottlenecks.push("deployment-speed");
|
|
1549
|
+
if ((metrics.failureRate ?? 0) > 0.05) bottlenecks.push("reliability");
|
|
1550
|
+
if ((metrics.rollbackTime ?? 0) > 3) bottlenecks.push("rollback-speed");
|
|
1551
|
+
|
|
1552
|
+
return bottlenecks;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
private calculateDependencyComplexity(stages: PipelineStage[]): number {
|
|
1556
|
+
return stages.reduce(
|
|
1557
|
+
(complexity, stage) => complexity + stage.dependencies.length,
|
|
1558
|
+
0,
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
private analyzeStageDistribution(stages: PipelineStage[]): Record<string, number> {
|
|
1563
|
+
const types = stages.reduce(
|
|
1564
|
+
(acc, stage) => {
|
|
1565
|
+
acc[stage.type] = (acc[stage.type] || 0) + 1;
|
|
1566
|
+
return acc;
|
|
1567
|
+
},
|
|
1568
|
+
{} as Record<string, number>,
|
|
1569
|
+
);
|
|
1570
|
+
|
|
1571
|
+
return types;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
private identifyPipelineOptimizations(pipeline: PipelineAnalysis): string[] {
|
|
1575
|
+
const optimizations: string[] = [];
|
|
1576
|
+
|
|
1577
|
+
const parallelizableCount = pipeline.stages.filter(
|
|
1578
|
+
(s) => s.parallelizable,
|
|
1579
|
+
).length;
|
|
1580
|
+
if (parallelizableCount < pipeline.stages.length * 0.5) {
|
|
1581
|
+
optimizations.push("Increase parallelization of independent stages");
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
if (pipeline.totalDuration > 20) {
|
|
1585
|
+
optimizations.push("Implement artifact caching to reduce build times");
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
return optimizations;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
private getInfrastructureLanguage(platform: string): string {
|
|
1592
|
+
switch (platform) {
|
|
1593
|
+
case "aws":
|
|
1594
|
+
case "azure":
|
|
1595
|
+
case "gcp":
|
|
1596
|
+
return "hcl";
|
|
1597
|
+
case "kubernetes":
|
|
1598
|
+
return "yaml";
|
|
1599
|
+
default:
|
|
1600
|
+
return "json";
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
async run(): Promise<void> {
|
|
1605
|
+
const transport = new StdioServerTransport();
|
|
1606
|
+
await this.server.connect(transport);
|
|
1607
|
+
|
|
1608
|
+
// Use centralized shutdown handler
|
|
1609
|
+
createGracefulShutdown({
|
|
1610
|
+
serverName: "devops-deployment.server",
|
|
1611
|
+
server: this.server,
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
// Run the server if this file is executed directly
|
|
1617
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
1618
|
+
const server = new StringRayDevOpsDeploymentServer();
|
|
1619
|
+
server.run().catch(() => {});
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
export { StringRayDevOpsDeploymentServer };
|