mcp-adr-analysis-server
Version:
MCP server for analyzing Architectural Decision Records and project architecture
712 lines (650 loc) • 23.3 kB
JavaScript
/**
* AI prompts for deployment completion analysis
* Following prompt-driven development approach
*/
/**
* AI prompt for identifying deployment tasks from ADRs
*/
export function generateDeploymentTaskIdentificationPrompt(adrFiles, todoContent) {
return `
**Note: Use this as guidance for analyzing ADRs and todo content to identify deployment-related tasks and requirements. Focus on the most critical deployment aspects for this specific context.**
${adrFiles
.map((adr, index) => `
**ID**: ${adr.id}
**Status**: ${adr.status}
**Content**:
\`\`\`markdown
${adr.content.slice(0, 1200)}${adr.content.length > 1200 ? '\n... (truncated)' : ''}
\`\`\`
`)
.join('')}
${todoContent
? `
\`\`\`markdown
${todoContent.slice(0, 1500)}${todoContent.length > 1500 ? '\n... (truncated)' : ''}
\`\`\`
`
: ''}
Consider identifying deployment-related tasks from these categories where applicable:
- **Environment Setup**: Development, staging, production environments
- **Resource Provisioning**: Servers, databases, storage, networking
- **Configuration Management**: Environment variables, secrets, configs
- **Security Setup**: SSL certificates, firewalls, access controls
- **Monitoring Setup**: Logging, metrics, alerting, observability
- **Build Processes**: Compilation, bundling, optimization
- **Container Deployment**: Docker builds, registry pushes, orchestration
- **Service Deployment**: Microservices, APIs, web applications
- **Database Deployment**: Schema migrations, data seeding, backups
- **Static Asset Deployment**: CDN setup, asset optimization
- **Pipeline Configuration**: Build, test, deploy workflows
- **Automation Setup**: Automated testing, deployment triggers
- **Quality Gates**: Code quality, security scans, performance tests
- **Rollback Mechanisms**: Blue-green deployment, canary releases
- **Integration Testing**: End-to-end testing, integration validation
- **Health Checks**: Service health monitoring, readiness probes
- **Performance Tuning**: Load balancing, caching, optimization
- **Backup & Recovery**: Data backup, disaster recovery procedures
- **Documentation**: Deployment guides, runbooks, troubleshooting
- **Training**: Team training, knowledge transfer
The following JSON structure provides a template for organizing your analysis (adapt fields as needed):
\`\`\`json
{
"deploymentTaskAnalysis": {
"totalAdrsAnalyzed": ${adrFiles.length},
"deploymentTasksFound": 0,
"taskCategories": 0,
"analysisConfidence": 0.0-1.0,
"completenessScore": 0.0-1.0
},
"identifiedTasks": [
{
"taskId": "task-id",
"taskName": "specific deployment task name",
"description": "detailed task description",
"category": "infrastructure|application|cicd|operational",
"subcategory": "specific subcategory",
"priority": "critical|high|medium|low",
"complexity": "low|medium|high",
"estimatedEffort": "estimated effort in hours/days",
"dependencies": ["task dependencies"],
"sourceAdr": "ADR ID that defines this task",
"sourceSection": "specific section in ADR",
"deploymentPhase": "planning|development|testing|staging|production|maintenance",
"automatable": true/false,
"verificationCriteria": [
"specific criteria to verify task completion"
],
"expectedOutcome": "expected result of task completion",
"riskLevel": "low|medium|high|critical",
"blockers": ["potential blockers or prerequisites"],
"resources": [
{
"type": "person|tool|service|infrastructure",
"description": "required resource description",
"availability": "available|required|unknown"
}
]
}
],
"deploymentPhases": [
{
"phase": "phase name",
"description": "phase description",
"tasks": ["task IDs in this phase"],
"duration": "estimated phase duration",
"prerequisites": ["phase prerequisites"],
"deliverables": ["phase deliverables"],
"successCriteria": ["criteria for phase completion"]
}
],
"deploymentDependencies": [
{
"dependencyType": "technical|business|external|regulatory",
"description": "dependency description",
"impact": "how this affects deployment",
"mitigation": "mitigation strategy",
"owner": "responsible party"
}
],
"riskAssessment": [
{
"risk": "deployment risk description",
"probability": "low|medium|high",
"impact": "low|medium|high|critical",
"category": "technical|operational|business|security",
"mitigation": "risk mitigation strategy",
"contingency": "contingency plan"
}
],
"recommendations": [
{
"type": "process|tooling|training|documentation",
"recommendation": "specific recommendation",
"rationale": "reasoning behind recommendation",
"implementation": "how to implement",
"priority": "critical|high|medium|low"
}
]
}
\`\`\`
1. **Comprehensive Review**: Analyze all ADRs for deployment implications
2. **Task Granularity**: Identify specific, actionable deployment tasks
3. **Dependency Mapping**: Clearly identify task dependencies and sequencing
4. **Risk Assessment**: Evaluate deployment risks and mitigation strategies
5. **Verification Focus**: Define clear completion criteria for each task
6. **Automation Potential**: Identify tasks suitable for automation
Please provide comprehensive deployment task identification and analysis.
`;
}
/**
* AI prompt for analyzing CI/CD logs and status
*/
export function generateCiCdAnalysisPrompt(cicdLogs, pipelineConfig, deploymentTasks) {
return `
Please analyze the following CI/CD logs and pipeline configuration to assess deployment progress and identify issues.
\`\`\`
${cicdLogs.slice(0, 2000)}${cicdLogs.length > 2000 ? '\n... (truncated for analysis)' : ''}
\`\`\`
${pipelineConfig
? `
\`\`\`
${pipelineConfig.slice(0, 1000)}${pipelineConfig.length > 1000 ? '\n... (truncated)' : ''}
\`\`\`
`
: ''}
${deploymentTasks
? `
${deploymentTasks
.map(task => `
- **${task.taskName}** (${task.category}): ${task.verificationCriteria.join(', ')}
`)
.join('')}
`
: ''}
Please analyze the CI/CD pipeline for:
- **Build Status**: Success, failure, in-progress, pending
- **Test Results**: Unit tests, integration tests, end-to-end tests
- **Quality Gates**: Code coverage, security scans, performance tests
- **Deployment Status**: Environment deployments, rollout progress
- **Error Analysis**: Failed steps, error messages, root causes
- **Completion Percentage**: Overall pipeline progress
- **Phase Progress**: Individual phase completion status
- **Time Analysis**: Execution times, bottlenecks, delays
- **Resource Utilization**: CPU, memory, storage usage
- **Throughput Metrics**: Build frequency, success rate, lead time
- **Failed Steps**: Specific failures and error messages
- **Performance Issues**: Slow steps, resource constraints
- **Quality Issues**: Test failures, coverage gaps, security vulnerabilities
- **Configuration Issues**: Misconfigurations, missing dependencies
- **Infrastructure Issues**: Environment problems, connectivity issues
- **Immediate Actions**: Critical issues requiring immediate attention
- **Optimization Opportunities**: Performance improvements, efficiency gains
- **Quality Improvements**: Test coverage, security enhancements
- **Process Improvements**: Workflow optimizations, automation opportunities
The following JSON structure provides a template for organizing your analysis (adapt fields as needed):
\`\`\`json
{
"cicdAnalysis": {
"analysisTimestamp": "ISO-8601-timestamp",
"pipelineStatus": "success|failure|in_progress|pending|unknown",
"overallProgress": 0-100,
"analysisConfidence": 0.0-1.0,
"logEntriesAnalyzed": 0
},
"pipelineStages": [
{
"stageName": "stage name",
"status": "success|failure|in_progress|pending|skipped",
"progress": 0-100,
"startTime": "ISO-8601-timestamp",
"endTime": "ISO-8601-timestamp",
"duration": "duration in seconds",
"steps": [
{
"stepName": "step name",
"status": "success|failure|in_progress|pending|skipped",
"duration": "duration in seconds",
"output": "relevant output or error message",
"exitCode": "exit code if applicable"
}
]
}
],
"testResults": {
"unitTests": {
"total": 0,
"passed": 0,
"failed": 0,
"skipped": 0,
"coverage": 0.0-1.0
},
"integrationTests": {
"total": 0,
"passed": 0,
"failed": 0,
"skipped": 0
},
"e2eTests": {
"total": 0,
"passed": 0,
"failed": 0,
"skipped": 0
}
},
"qualityGates": [
{
"gateName": "quality gate name",
"status": "passed|failed|pending",
"threshold": "threshold value",
"actualValue": "actual measured value",
"description": "gate description"
}
],
"deploymentStatus": [
{
"environment": "environment name",
"status": "deployed|deploying|failed|pending",
"version": "deployed version",
"deploymentTime": "ISO-8601-timestamp",
"healthStatus": "healthy|unhealthy|unknown",
"issues": ["any deployment issues"]
}
],
"issues": [
{
"severity": "critical|high|medium|low|info",
"category": "build|test|quality|deployment|infrastructure",
"issue": "issue description",
"location": "where the issue occurred",
"errorMessage": "specific error message",
"suggestedFix": "suggested resolution",
"impact": "impact on deployment"
}
],
"performanceMetrics": {
"totalDuration": "total pipeline duration",
"buildTime": "build phase duration",
"testTime": "test phase duration",
"deploymentTime": "deployment phase duration",
"resourceUsage": {
"cpu": "CPU usage percentage",
"memory": "memory usage",
"storage": "storage usage"
}
},
"recommendations": [
{
"priority": "critical|high|medium|low",
"category": "performance|quality|reliability|security",
"recommendation": "specific recommendation",
"rationale": "reasoning behind recommendation",
"implementation": "how to implement",
"expectedBenefit": "expected improvement"
}
]
}
\`\`\`
1. **Comprehensive Log Analysis**: Parse all relevant log entries
2. **Status Determination**: Accurately assess current pipeline status
3. **Issue Identification**: Identify and categorize all issues
4. **Performance Analysis**: Evaluate pipeline performance and efficiency
5. **Actionable Recommendations**: Provide specific, implementable suggestions
6. **Context Awareness**: Consider deployment task context when available
Please provide thorough CI/CD pipeline analysis and status assessment.
`;
}
/**
* AI prompt for calculating deployment progress
*/
export function generateDeploymentProgressCalculationPrompt(deploymentTasks, cicdStatus, environmentStatus) {
return `
Please calculate the overall deployment progress based on task status, CI/CD pipeline status, and environment status.
${deploymentTasks
.map((task, index) => `
**ID**: ${task.taskId}
**Status**: ${task.status}
**Progress**: ${task.progress}%
**Category**: ${task.category}
**Priority**: ${task.priority}
`)
.join('')}
${cicdStatus
? `
\`\`\`json
${JSON.stringify(cicdStatus, null, 2)}
\`\`\`
`
: ''}
${environmentStatus
? `
\`\`\`json
${JSON.stringify(environmentStatus, null, 2)}
\`\`\`
`
: ''}
Please calculate deployment progress considering:
- **Weighted Progress**: Weight tasks by priority and complexity
- **Category Progress**: Progress by deployment category
- **Critical Path**: Progress of critical path tasks
- **Dependency Impact**: How dependencies affect overall progress
- **Completion Criteria**: Task-specific completion verification
- **Build Progress**: Compilation, testing, packaging
- **Quality Progress**: Code quality, security, performance checks
- **Deployment Progress**: Environment deployments, rollouts
- **Verification Progress**: Health checks, smoke tests, validation
- **Rollback Readiness**: Rollback mechanisms and procedures
- **Infrastructure Readiness**: Environment provisioning and configuration
- **Service Health**: Application and service health status
- **Data Migration**: Database migrations and data consistency
- **Integration Status**: Service integration and connectivity
- **Performance Validation**: Performance benchmarks and SLA compliance
Please provide your calculation in the following JSON format:
\`\`\`json
{
"deploymentProgress": {
"calculationTimestamp": "ISO-8601-timestamp",
"overallProgress": 0-100,
"progressConfidence": 0.0-1.0,
"estimatedCompletion": "ISO-8601-timestamp",
"deploymentPhase": "planning|development|testing|staging|production|completed"
},
"categoryProgress": {
"infrastructure": 0-100,
"application": 0-100,
"cicd": 0-100,
"operational": 0-100
},
"taskProgress": [
{
"taskId": "task-id",
"taskName": "task name",
"status": "not_started|in_progress|completed|blocked|failed",
"progress": 0-100,
"weight": 0.0-1.0,
"contributionToOverall": 0-100,
"blockers": ["current blockers"],
"nextSteps": ["immediate next steps"],
"estimatedCompletion": "ISO-8601-timestamp"
}
],
"criticalPath": {
"tasks": ["task IDs on critical path"],
"progress": 0-100,
"bottlenecks": ["current bottlenecks"],
"riskFactors": ["factors that could delay completion"]
},
"milestones": [
{
"milestone": "milestone name",
"status": "pending|in_progress|completed|at_risk",
"progress": 0-100,
"targetDate": "ISO-8601-timestamp",
"actualDate": "ISO-8601-timestamp",
"dependencies": ["milestone dependencies"]
}
],
"qualityMetrics": {
"codeQuality": 0-100,
"testCoverage": 0-100,
"securityCompliance": 0-100,
"performanceTargets": 0-100,
"documentationCompleteness": 0-100
},
"riskAssessment": {
"overallRisk": "low|medium|high|critical",
"scheduleRisk": "low|medium|high|critical",
"qualityRisk": "low|medium|high|critical",
"technicalRisk": "low|medium|high|critical",
"riskFactors": [
{
"risk": "risk description",
"impact": "potential impact",
"probability": "low|medium|high",
"mitigation": "mitigation strategy"
}
]
},
"recommendations": [
{
"priority": "critical|high|medium|low",
"type": "acceleration|quality|risk_mitigation|resource",
"recommendation": "specific recommendation",
"rationale": "reasoning behind recommendation",
"implementation": "how to implement",
"expectedImpact": "expected impact on progress"
}
],
"nextActions": [
{
"action": "immediate action required",
"owner": "responsible party",
"deadline": "action deadline",
"priority": "critical|high|medium|low",
"dependencies": ["action dependencies"]
}
]
}
\`\`\`
1. **Weighted Progress**: Consider task priority, complexity, and impact
2. **Dependency Awareness**: Account for task dependencies and sequencing
3. **Quality Integration**: Include quality metrics in progress calculation
4. **Risk Consideration**: Factor in risks and potential delays
5. **Realistic Estimation**: Provide realistic completion estimates
6. **Actionable Insights**: Generate specific, actionable recommendations
Please provide comprehensive deployment progress calculation and analysis.
`;
}
/**
* AI prompt for verifying completion with outcome rules
*/
export function generateCompletionVerificationPrompt(deploymentTasks, outcomeRules, actualOutcomes) {
return `
Please verify deployment completion by comparing actual outcomes against expected outcome rules and verification criteria.
${deploymentTasks
.map((task, index) => `
**ID**: ${task.taskId}
**Status**: ${task.status}
**Expected Outcome**: ${task.expectedOutcome}
**Verification Criteria**:
${task.verificationCriteria.map(criteria => `- ${criteria}`).join('\n')}
`)
.join('')}
${outcomeRules
.map((rule, index) => `
**ID**: ${rule.ruleId}
**Verification Method**: ${rule.verificationMethod}
**Criteria**:
${rule.criteria.map(criteria => `- ${criteria}`).join('\n')}
`)
.join('')}
${actualOutcomes
? `
${actualOutcomes
.map((outcome, index) => `
**Outcome**: ${outcome.outcome}
**Timestamp**: ${outcome.timestamp}
**Evidence**:
${outcome.evidence.map(evidence => `- ${evidence}`).join('\n')}
`)
.join('')}
`
: ''}
Please verify completion by analyzing:
- **Task Completion**: Verify each task meets its completion criteria
- **Outcome Validation**: Compare actual outcomes against expected outcomes
- **Rule Compliance**: Ensure all outcome rules are satisfied
- **Evidence Assessment**: Evaluate the quality and completeness of evidence
- **Quality Standards**: Verify quality standards and acceptance criteria
- **Functional Requirements**: All functional requirements implemented
- **Non-Functional Requirements**: Performance, security, reliability standards met
- **Business Rules**: Business logic and rules properly implemented
- **Technical Standards**: Code quality, architecture, and design standards
- **Operational Requirements**: Monitoring, logging, and maintenance capabilities
- **Performance Metrics**: Response times, throughput, resource utilization
- **Quality Metrics**: Test coverage, defect rates, code quality scores
- **Reliability Metrics**: Uptime, error rates, recovery times
- **Security Metrics**: Vulnerability assessments, compliance scores
- **User Experience**: Usability, accessibility, satisfaction metrics
Please provide your verification in the following JSON format:
\`\`\`json
{
"completionVerification": {
"verificationTimestamp": "ISO-8601-timestamp",
"overallCompletion": true/false,
"completionPercentage": 0-100,
"verificationConfidence": 0.0-1.0,
"verificationMethod": "automated|manual|hybrid"
},
"taskVerification": [
{
"taskId": "task-id",
"taskName": "task name",
"completed": true/false,
"completionPercentage": 0-100,
"verificationStatus": "verified|failed|pending|partial",
"criteriaResults": [
{
"criteria": "verification criteria",
"status": "met|not_met|partial|unknown",
"evidence": "supporting evidence",
"confidence": 0.0-1.0
}
],
"outcomeVerification": {
"expectedOutcome": "expected outcome",
"actualOutcome": "actual outcome",
"outcomeMatch": true/false,
"variance": "description of any variance",
"acceptability": "acceptable|unacceptable|requires_review"
},
"issues": [
{
"issue": "issue description",
"severity": "critical|high|medium|low",
"impact": "impact on completion",
"resolution": "suggested resolution"
}
]
}
],
"ruleCompliance": [
{
"ruleId": "rule-id",
"description": "rule description",
"compliant": true/false,
"complianceLevel": 0-100,
"verificationResults": [
{
"criteria": "rule criteria",
"result": "passed|failed|partial|not_applicable",
"evidence": "supporting evidence",
"notes": "additional notes"
}
],
"violations": [
{
"violation": "violation description",
"severity": "critical|high|medium|low",
"remediation": "remediation steps"
}
]
}
],
"qualityAssessment": {
"functionalCompleteness": 0-100,
"performanceCompliance": 0-100,
"securityCompliance": 0-100,
"reliabilityScore": 0-100,
"maintainabilityScore": 0-100,
"usabilityScore": 0-100,
"overallQuality": 0-100
},
"successMetrics": [
{
"metric": "metric name",
"target": "target value",
"actual": "actual value",
"status": "met|not_met|exceeded|unknown",
"variance": "variance from target",
"trend": "improving|stable|declining"
}
],
"completionGaps": [
{
"gap": "completion gap description",
"impact": "low|medium|high|critical",
"category": "functional|performance|security|quality|operational",
"remediation": "steps to address gap",
"effort": "estimated effort to close gap",
"priority": "critical|high|medium|low"
}
],
"recommendations": [
{
"type": "completion|quality|performance|security|operational",
"recommendation": "specific recommendation",
"rationale": "reasoning behind recommendation",
"implementation": "implementation steps",
"priority": "critical|high|medium|low",
"timeline": "recommended timeline"
}
],
"signOffStatus": {
"readyForSignOff": true/false,
"requiredApprovals": ["required approvals"],
"pendingItems": ["items pending completion"],
"riskAssessment": "overall risk level",
"goLiveRecommendation": "go|no_go|conditional"
}
}
\`\`\`
1. **Objective Assessment**: Base verification on measurable criteria and evidence
2. **Comprehensive Coverage**: Verify all aspects of deployment completion
3. **Risk-Based Evaluation**: Prioritize critical and high-risk areas
4. **Evidence-Based**: Require concrete evidence for completion claims
5. **Quality Focus**: Ensure quality standards are met, not just functionality
6. **Stakeholder Perspective**: Consider all stakeholder requirements and expectations
Please provide thorough deployment completion verification and assessment.
`;
}
//# sourceMappingURL=deployment-analysis-prompts.js.map