analyze_deployment_progress
Track and verify deployment progress by analyzing tasks, CI/CD logs, and outcomes against defined rules to ensure successful completion.
Instructions
Analyze deployment progress and verify completion with outcome rules
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actualOutcomes | No | Actual deployment outcomes | |
| adrDirectory | No | Directory containing ADR files | docs/adrs |
| analysisType | No | Type of deployment analysis to perform | comprehensive |
| cicdLogs | No | CI/CD pipeline logs for analysis | |
| cicdStatus | No | CI/CD pipeline status data | |
| deploymentTasks | No | Deployment tasks for progress calculation | |
| environmentStatus | No | Environment status data | |
| outcomeRules | No | Outcome rules for completion verification | |
| pipelineConfig | No | CI/CD pipeline configuration | |
| todoPath | No | Path to TODO.md file for task identification | TODO.md |
Input Schema (JSON Schema)
{
"properties": {
"actualOutcomes": {
"description": "Actual deployment outcomes",
"items": {
"properties": {
"evidence": {
"items": {
"type": "string"
},
"type": "array"
},
"outcome": {
"type": "string"
},
"taskId": {
"type": "string"
},
"timestamp": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"adrDirectory": {
"default": "docs/adrs",
"description": "Directory containing ADR files",
"type": "string"
},
"analysisType": {
"default": "comprehensive",
"description": "Type of deployment analysis to perform",
"enum": [
"tasks",
"cicd",
"progress",
"completion",
"comprehensive"
],
"type": "string"
},
"cicdLogs": {
"description": "CI/CD pipeline logs for analysis",
"type": "string"
},
"cicdStatus": {
"description": "CI/CD pipeline status data",
"type": "object"
},
"deploymentTasks": {
"description": "Deployment tasks for progress calculation",
"items": {
"properties": {
"category": {
"type": "string"
},
"expectedOutcome": {
"type": "string"
},
"priority": {
"type": "string"
},
"progress": {
"type": "number"
},
"status": {
"type": "string"
},
"taskId": {
"type": "string"
},
"taskName": {
"type": "string"
},
"verificationCriteria": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"type": "array"
},
"environmentStatus": {
"description": "Environment status data",
"type": "object"
},
"outcomeRules": {
"description": "Outcome rules for completion verification",
"items": {
"properties": {
"criteria": {
"items": {
"type": "string"
},
"type": "array"
},
"description": {
"type": "string"
},
"ruleId": {
"type": "string"
},
"verificationMethod": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"pipelineConfig": {
"description": "CI/CD pipeline configuration",
"type": "string"
},
"todoPath": {
"default": "TODO.md",
"description": "Path to TODO.md file for task identification",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- Core handler function that implements the analyze_deployment_progress tool. Handles multiple analysis types: 'tasks' (identify from ADRs), 'cicd' (pipeline analysis), 'progress' (calculate progress), 'completion' (verify outcomes), 'comprehensive' (full workflow). Uses AI prompts, tiered responses, and research orchestration.export async function analyzeDeploymentProgress(args: { analysisType?: 'tasks' | 'cicd' | 'progress' | 'completion' | 'comprehensive'; adrDirectory?: string; todoPath?: string; cicdLogs?: string; pipelineConfig?: string; deploymentTasks?: Array<{ taskId: string; taskName: string; status: string; progress: number; category: string; priority: string; verificationCriteria: string[]; expectedOutcome: string; }>; outcomeRules?: Array<{ ruleId: string; description: string; criteria: string[]; verificationMethod: string; }>; actualOutcomes?: Array<{ taskId: string; outcome: string; evidence: string[]; timestamp: string; }>; cicdStatus?: any; environmentStatus?: any; }): Promise<any> { const { analysisType = 'comprehensive', adrDirectory = 'docs/adrs', todoPath, cicdLogs, pipelineConfig, deploymentTasks, outcomeRules, actualOutcomes, cicdStatus, environmentStatus, } = args; try { const { identifyDeploymentTasks, analyzeCiCdStatus, calculateDeploymentProgress, verifyDeploymentCompletion, } = await import('../utils/deployment-analysis.js'); switch (analysisType) { case 'tasks': { const result = await identifyDeploymentTasks(adrDirectory, todoPath); // Execute the deployment task identification with AI if enabled, otherwise return prompt const { executePromptWithFallback, formatMCPResponse } = await import( '../utils/prompt-execution.js' ); const executionResult = await executePromptWithFallback( result.identificationPrompt, result.instructions, { temperature: 0.1, maxTokens: 5000, systemPrompt: `You are a DevOps expert specializing in deployment task identification and management. Analyze the provided ADRs and project context to identify comprehensive deployment tasks. Focus on creating actionable tasks with clear verification criteria and proper sequencing. Provide detailed risk assessment and practical implementation guidance.`, responseFormat: 'text', } ); if (executionResult.isAIGenerated) { // AI execution successful - use tiered response for token efficiency const { TieredResponseManager } = await import('../utils/tiered-response-manager.js'); const { MemoryEntityManager } = await import('../utils/memory-entity-manager.js'); const memoryManager = new MemoryEntityManager(); const tieredManager = new TieredResponseManager(memoryManager); await tieredManager.initialize(); // Build full analysis content const fullContent = `# Deployment Task Identification Results ## Analysis Information - **ADR Directory**: ${adrDirectory} - **Todo Path**: ${todoPath || 'Not specified'} ## AI Deployment Task Analysis Results ${executionResult.content} ## Next Steps Based on the identified deployment tasks: 1. **Review Task List**: Examine each deployment task for completeness and accuracy 2. **Validate Dependencies**: Confirm task sequencing and dependency relationships 3. **Assign Responsibilities**: Determine who will execute each deployment task 4. **Create Timeline**: Establish deployment schedule with milestones 5. **Set Up Monitoring**: Implement progress tracking and verification systems ## Deployment Task Management Use the identified tasks to: - **Track Progress**: Monitor deployment progress across all categories - **Manage Dependencies**: Ensure proper task sequencing and coordination - **Assess Risks**: Identify and mitigate deployment risks - **Verify Completion**: Use verification criteria for completion validation - **Optimize Process**: Improve deployment efficiency and reliability ## Follow-up Analysis For deeper deployment insights: - **CI/CD Analysis**: \`analyze_deployment_progress\` with \`analysisType: "cicd"\` - **Progress Tracking**: \`analyze_deployment_progress\` with \`analysisType: "progress"\` - **Completion Verification**: \`analyze_deployment_progress\` with \`analysisType: "completion"\` `; // Define sections for expandable content const sections = { 'Analysis Information': `## Analysis Information - **ADR Directory**: ${adrDirectory} - **Todo Path**: ${todoPath || 'Not specified'}`, 'Task Analysis': `## AI Deployment Task Analysis Results ${executionResult.content}`, 'Next Steps': `## Next Steps Based on the identified deployment tasks: 1. **Review Task List**: Examine each deployment task for completeness and accuracy 2. **Validate Dependencies**: Confirm task sequencing and dependency relationships 3. **Assign Responsibilities**: Determine who will execute each deployment task 4. **Create Timeline**: Establish deployment schedule with milestones 5. **Set Up Monitoring**: Implement progress tracking and verification systems`, 'Task Management': `## Deployment Task Management Use the identified tasks to: - **Track Progress**: Monitor deployment progress across all categories - **Manage Dependencies**: Ensure proper task sequencing and coordination - **Assess Risks**: Identify and mitigate deployment risks - **Verify Completion**: Use verification criteria for completion validation - **Optimize Process**: Improve deployment efficiency and reliability`, 'Follow-up Analysis': `## Follow-up Analysis For deeper deployment insights: - **CI/CD Analysis**: \`analyze_deployment_progress\` with \`analysisType: "cicd"\` - **Progress Tracking**: \`analyze_deployment_progress\` with \`analysisType: "progress"\` - **Completion Verification**: \`analyze_deployment_progress\` with \`analysisType: "completion"\``, }; // Create tiered response const tieredResponse = await tieredManager.createTieredResponse( 'analyze_deployment_progress', fullContent, sections, { analysisType, adrDirectory, todoPath } ); // Format and return tiered response return formatMCPResponse({ ...executionResult, content: tieredManager.formatTieredResponse(tieredResponse), }); } else { // Fallback to prompt-only mode return { content: [ { type: 'text', text: `# Deployment Task Identification ${result.instructions} ## AI Task Identification Prompt ${result.identificationPrompt} ## Next Steps 1. **Submit the prompt** to an AI agent for comprehensive task identification 2. **Parse the JSON response** to get deployment tasks and phases 3. **Review task dependencies** and deployment sequencing 4. **Use tasks** for deployment progress tracking and management `, }, ], }; } } case 'cicd': { if (!cicdLogs) { throw new McpAdrError('CI/CD logs are required for pipeline analysis', 'INVALID_INPUT'); } const result = await analyzeCiCdStatus(cicdLogs, pipelineConfig, deploymentTasks as any); return { content: [ { type: 'text', text: `# CI/CD Pipeline Analysis ${result.instructions} ## AI Pipeline Analysis Prompt ${result.analysisPrompt} ## Next Steps 1. **Submit the prompt** to an AI agent for comprehensive pipeline analysis 2. **Parse the JSON response** to get pipeline status and issues 3. **Review performance metrics** and optimization opportunities 4. **Use findings** for deployment progress calculation and issue resolution ## Expected Output The AI will provide: - **CI/CD Analysis**: Overall pipeline status and progress assessment - **Pipeline Stages**: Detailed stage-by-stage analysis with timings - **Test Results**: Comprehensive test result analysis and coverage - **Quality Gates**: Quality gate status and compliance assessment - **Deployment Status**: Environment deployment status and health - **Issues**: Identified issues with severity and suggested fixes - **Performance Metrics**: Pipeline performance and resource utilization - **Recommendations**: Optimization and improvement recommendations ## Pipeline Optimization Use the analysis results to: - **Resolve Issues**: Address identified pipeline problems and failures - **Improve Performance**: Optimize build times and resource usage - **Enhance Quality**: Strengthen quality gates and testing coverage - **Increase Reliability**: Improve pipeline stability and success rates - **Automate Processes**: Identify automation opportunities `, }, ], }; } case 'progress': { if (!deploymentTasks) { throw new McpAdrError( 'Deployment tasks are required for progress calculation', 'INVALID_INPUT' ); } const result = await calculateDeploymentProgress( deploymentTasks as any, cicdStatus, environmentStatus ); return { content: [ { type: 'text', text: `# Deployment Progress Calculation ${result.instructions} ## AI Progress Calculation Prompt ${result.progressPrompt} ## Next Steps 1. **Submit the prompt** to an AI agent for comprehensive progress calculation 2. **Parse the JSON response** to get detailed progress analysis 3. **Review critical path** and bottlenecks 4. **Use progress data** for stakeholder reporting and decision making ## Expected Output The AI will provide: - **Deployment Progress**: Overall progress and completion estimates - **Category Progress**: Progress breakdown by deployment category - **Task Progress**: Individual task progress and contributions - **Critical Path**: Critical path analysis and bottleneck identification - **Milestones**: Milestone progress and status tracking - **Quality Metrics**: Quality and compliance metric assessment - **Risk Assessment**: Risk analysis and mitigation strategies - **Recommendations**: Progress acceleration recommendations - **Next Actions**: Immediate actions required for progress ## Progress Management Use the progress calculation to: - **Track Completion**: Monitor overall deployment completion status - **Identify Bottlenecks**: Find and address critical path bottlenecks - **Manage Risks**: Proactively address deployment risks - **Report Status**: Provide accurate progress reports to stakeholders - **Accelerate Delivery**: Implement recommendations for faster delivery `, }, ], }; } case 'completion': { if (!deploymentTasks || !outcomeRules) { throw new McpAdrError( 'Deployment tasks and outcome rules are required for completion verification', 'INVALID_INPUT' ); } const result = await verifyDeploymentCompletion( deploymentTasks as any, outcomeRules, actualOutcomes ); return { content: [ { type: 'text', text: `# Deployment Completion Verification ${result.instructions} ## AI Completion Verification Prompt ${result.verificationPrompt} ## Next Steps 1. **Submit the prompt** to an AI agent for comprehensive completion verification 2. **Parse the JSON response** to get verification results and compliance status 3. **Review completion gaps** and quality assessments 4. **Use verification results** for sign-off decisions and go-live recommendations ## Expected Output The AI will provide: - **Completion Verification**: Overall completion status and confidence - **Task Verification**: Individual task verification results - **Rule Compliance**: Outcome rule compliance assessment - **Quality Assessment**: Quality and compliance metric evaluation - **Success Metrics**: Success metric evaluation and variance analysis - **Completion Gaps**: Identified gaps and remediation strategies - **Recommendations**: Completion and quality improvement recommendations - **Sign-Off Status**: Sign-off readiness and go-live recommendation ## Completion Management Use the verification results to: - **Validate Completion**: Ensure all deployment tasks are properly completed - **Assess Quality**: Verify quality standards and acceptance criteria - **Manage Sign-Off**: Make informed sign-off and go-live decisions - **Address Gaps**: Remediate identified completion gaps - **Ensure Compliance**: Verify compliance with outcome rules and standards `, }, ], }; } case 'comprehensive': { // Step 0: Research environment state let environmentResearch = ''; try { const orchestrator = new ResearchOrchestrator(process.cwd(), adrDirectory); const research = await orchestrator.answerResearchQuestion( `Analyze current deployment environment state: 1. What deployment tools and infrastructure are available? 2. What is the current deployment pipeline status? 3. Are there any deployment blockers or issues? 4. What deployment-related ADRs are documented?` ); const envSource = research.sources.find(s => s.type === 'environment'); const capabilities = envSource?.data?.capabilities || []; environmentResearch = ` ## 🔍 Environment Research Analysis **Research Confidence**: ${(research.confidence * 100).toFixed(1)}% ### Current Environment State ${research.answer || 'No environment data available'} ### Available Infrastructure ${capabilities.length > 0 ? capabilities.map((c: string) => `- ${c}`).join('\n') : '- No infrastructure tools detected'} ### Sources Consulted ${research.sources.map(s => `- ${s.type}: ✅ Available`).join('\n')} ${research.needsWebSearch ? '⚠️ **Note**: Local data may be insufficient - external verification recommended\n' : ''} `; } catch (error) { environmentResearch = `\n## ⚠️ Environment Research\nFailed to analyze environment: ${error instanceof Error ? error.message : String(error)}\n`; } const taskResult = await identifyDeploymentTasks(adrDirectory, todoPath); return { content: [ { type: 'text', text: `# Comprehensive Deployment Analysis This comprehensive analysis will provide end-to-end deployment progress tracking and completion verification. ${environmentResearch} ## Deployment Analysis Workflow ### 1. **Task Identification** (First Step) Identify deployment tasks from ADRs and todo content. ${taskResult.instructions} #### Task Identification Prompt ${taskResult.identificationPrompt} ### 2. **CI/CD Analysis** (Second Step) Analyze CI/CD pipeline status and performance: \`\`\`json { "tool": "analyze_deployment_progress", "args": { "analysisType": "cicd", "cicdLogs": "[CI/CD log content]", "pipelineConfig": "[pipeline configuration]", "deploymentTasks": [results from step 1] } } \`\`\` ### 3. **Progress Calculation** (Third Step) Calculate comprehensive deployment progress: \`\`\`json { "tool": "analyze_deployment_progress", "args": { "analysisType": "progress", "deploymentTasks": [results from step 1], "cicdStatus": [results from step 2], "environmentStatus": "[environment status data]" } } \`\`\` ### 4. **Completion Verification** (Fourth Step) Verify deployment completion with outcome rules: \`\`\`json { "tool": "analyze_deployment_progress", "args": { "analysisType": "completion", "deploymentTasks": [results from step 1], "outcomeRules": [defined outcome rules], "actualOutcomes": [actual deployment outcomes] } } \`\`\` ## Expected Outcomes This comprehensive analysis will provide: - **Complete Task Inventory**: All deployment tasks identified and categorized - **Pipeline Health Assessment**: CI/CD pipeline status and performance analysis - **Accurate Progress Tracking**: Real-time deployment progress calculation - **Completion Verification**: Rigorous completion verification with outcome rules - **Risk Management**: Comprehensive risk assessment and mitigation - **Quality Assurance**: Quality metrics and compliance verification - **Stakeholder Reporting**: Executive dashboards and progress reports ## Deployment Excellence This analysis ensures: - **Visibility**: Complete visibility into deployment status and progress - **Quality**: High-quality deployments meeting all criteria - **Reliability**: Reliable deployment processes with risk mitigation - **Compliance**: Compliance with outcome rules and standards - **Efficiency**: Optimized deployment processes and timelines - **Accountability**: Clear accountability and sign-off processes ## Integration with AI Agents The deployment analysis integrates with AI agents for: - **Automated Monitoring**: Continuous monitoring of deployment progress - **Intelligent Alerting**: Smart alerts for issues and bottlenecks - **Predictive Analysis**: Predictive insights for deployment success - **Automated Remediation**: Automated issue resolution and optimization - **Continuous Improvement**: Learning from deployment patterns and outcomes `, }, ], }; } default: throw new McpAdrError(`Unknown analysis type: ${analysisType}`, 'INVALID_INPUT'); } } catch (error) { throw new McpAdrError( `Failed to analyze deployment progress: ${error instanceof Error ? error.message : String(error)}`, 'DEPLOYMENT_ANALYSIS_ERROR' ); } }
- Input schema defined by the function parameters, specifying options for different analysis modes and required data like tasks, logs, rules.export async function analyzeDeploymentProgress(args: { analysisType?: 'tasks' | 'cicd' | 'progress' | 'completion' | 'comprehensive'; adrDirectory?: string; todoPath?: string; cicdLogs?: string; pipelineConfig?: string; deploymentTasks?: Array<{ taskId: string; taskName: string; status: string; progress: number; category: string; priority: string; verificationCriteria: string[]; expectedOutcome: string; }>; outcomeRules?: Array<{ ruleId: string; description: string; criteria: string[]; verificationMethod: string; }>; actualOutcomes?: Array<{ taskId: string; outcome: string; evidence: string[]; timestamp: string; }>; cicdStatus?: any; environmentStatus?: any; }): Promise<any> {
- Helper function to identify deployment tasks by analyzing actual ADR files and TODO content, generating AI prompts.export async function identifyDeploymentTasks( adrDirectory: string = 'docs/adrs', todoPath?: string ): Promise<{ identificationPrompt: string; instructions: string; actualData?: any }> { try { // Use actual ADR discovery instead of prompts const { discoverAdrsInDirectory } = await import('./adr-discovery.js'); // Actually read ADR files const discoveryResult = await discoverAdrsInDirectory(adrDirectory, process.cwd(), { includeContent: true, includeTimeline: false, }); // Read TODO file if provided let todoContent = ''; if (todoPath) { try { const fs = await import('fs/promises'); const path = await import('path'); const fullTodoPath = path.resolve(process.cwd(), todoPath); todoContent = await fs.readFile(fullTodoPath, 'utf-8'); } catch (error) { console.warn(`Could not read TODO file at ${todoPath}: ${error}`); todoContent = `[TODO file at ${todoPath} could not be read]`; } } // Create comprehensive deployment task identification prompt const deploymentAnalysisPrompt = ` # Deployment Task Identification Based on actual ADR file analysis and TODO content, identify deployment-related tasks: ## Discovered ADRs (${discoveryResult.totalAdrs} total) ${ discoveryResult.adrs.length > 0 ? discoveryResult.adrs .map( (adr, index) => ` ### ${index + 1}. ${adr.title} - **File**: ${adr.filename} - **Status**: ${adr.status} - **Path**: ${adr.path} ${adr.metadata?.number ? `- **Number**: ${adr.metadata.number}` : ''} #### ADR Content: \`\`\`markdown ${adr.content || 'Content not available'} \`\`\` --- ` ) .join('\n') : 'No ADRs found in the specified directory.' } ## TODO Content Analysis ${ todoPath ? ` ### TODO File: ${todoPath} \`\`\` ${todoContent} \`\`\` Extract any deployment-related tasks, infrastructure requirements, or operational concerns from the actual TODO content above. ` : '**No TODO file provided.** Only ADR content will be analyzed for deployment tasks.' } ## Task Identification Criteria For each ADR with **actual content** and TODO content shown above: 1. Extract deployment-related decisions and requirements from **actual ADR content** 2. Identify infrastructure components mentioned 3. Find CI/CD pipeline requirements 4. Detect operational concerns and monitoring needs 5. Categorize tasks by type: Infrastructure, Application, CI/CD, Operational ## Required Output Format Please provide deployment task analysis in JSON format with: - Task identification and categorization based on actual content - Priority and complexity assessment - Dependencies between tasks derived from actual ADR content - Implementation timeline recommendations ## Expected AI Response Format The AI will return a JSON object with: - \`deploymentTaskAnalysis\`: Overall analysis metadata and confidence - \`identifiedTasks\`: Detailed deployment tasks with verification criteria based on actual content - \`deploymentPhases\`: Organized deployment phases and sequencing - \`deploymentDependencies\`: Task dependencies and constraints from actual ADRs - \`riskAssessment\`: Deployment risks and mitigation strategies - \`recommendations\`: Process and tooling recommendations `; const instructions = ` # Deployment Task Identification Instructions This analysis provides **actual ADR content and TODO content** to identify deployment-related tasks for comprehensive deployment tracking. ## Analysis Scope - **ADR Directory**: ${adrDirectory} - **ADRs Found**: ${discoveryResult.totalAdrs} files - **ADRs with Content**: ${discoveryResult.adrs.filter(adr => adr.content).length} ADRs - **Todo Content**: ${todoPath ? `✅ Included (${todoContent.length} characters)` : '❌ Not provided'} - **Task Categories**: Infrastructure, Application, CI/CD, Operational ## Discovered ADR Summary ${discoveryResult.adrs.map(adr => `- **${adr.title}** (${adr.status})`).join('\n')} ## Next Steps 1. **Submit the analysis prompt** to an AI agent for deployment task identification based on **actual content** 2. **Parse the JSON response** to get categorized deployment tasks 3. **Review task priorities** and dependencies derived from actual ADR content 4. **Use findings** for deployment planning and execution ## Expected AI Response Format The AI will return a JSON object with: - \`deploymentTaskAnalysis\`: Overall analysis metadata and confidence - \`identifiedTasks\`: Detailed deployment tasks with verification criteria based on actual ADR content - \`deploymentPhases\`: Organized deployment phases and sequencing - \`deploymentDependencies\`: Task dependencies and constraints from actual ADRs - \`riskAssessment\`: Deployment risks and mitigation strategies - \`recommendations\`: Process and tooling recommendations ## Usage Example \`\`\`typescript const result = await identifyDeploymentTasks(adrDirectory, todoPath); // Submit result.identificationPrompt to AI agent // Parse AI response for deployment tasks based on actual ADR and TODO content \`\`\` `; return { identificationPrompt: deploymentAnalysisPrompt, instructions, actualData: { discoveryResult, todoContent, todoPath, summary: { totalAdrs: discoveryResult.totalAdrs, adrsWithContent: discoveryResult.adrs.filter(adr => adr.content).length, todoProvided: !!todoPath, todoLength: todoContent.length, }, }, }; } catch (error) { throw new McpAdrError( `Failed to identify deployment tasks: ${error instanceof Error ? error.message : String(error)}`, 'DEPLOYMENT_TASK_IDENTIFICATION_ERROR' ); } }
- Supporting helper functions for CI/CD analysis, progress calculation, and deployment completion verification using prompt generation.export async function analyzeCiCdStatus( cicdLogs: string, pipelineConfig?: string, deploymentTasks?: DeploymentTask[] ): Promise<{ analysisPrompt: string; instructions: string }> { try { const { generateCiCdAnalysisPrompt } = await import( '../prompts/deployment-analysis-prompts.js' ); // Prepare deployment tasks context const tasksContext = deploymentTasks?.map(task => ({ taskId: task.taskId, taskName: task.taskName, category: task.category, verificationCriteria: task.verificationCriteria, })); const analysisPrompt = generateCiCdAnalysisPrompt(cicdLogs, pipelineConfig, tasksContext); const instructions = ` # CI/CD Pipeline Analysis Instructions This analysis will examine CI/CD logs and pipeline configuration to assess deployment progress and identify issues. ## Analysis Scope - **CI/CD Logs**: ${cicdLogs.length} characters of log data - **Pipeline Config**: ${pipelineConfig ? 'Included' : 'Not provided'} - **Deployment Tasks**: ${deploymentTasks?.length || 0} tasks for context - **Analysis Areas**: Build status, test results, quality gates, deployment status ## Next Steps 1. **Submit the analysis prompt** to an AI agent for comprehensive CI/CD analysis 2. **Parse the JSON response** to get pipeline status and issues 3. **Review performance metrics** and optimization opportunities 4. **Use findings** for deployment progress calculation and issue resolution ## Expected AI Response Format The AI will return a JSON object with: - \`cicdAnalysis\`: Overall pipeline status and progress - \`pipelineStages\`: Detailed stage-by-stage analysis - \`testResults\`: Comprehensive test result analysis - \`qualityGates\`: Quality gate status and compliance - \`deploymentStatus\`: Environment deployment status - \`issues\`: Identified issues with suggested fixes - \`performanceMetrics\`: Pipeline performance and resource usage - \`recommendations\`: Optimization and improvement recommendations ## Usage Example \`\`\`typescript const result = await analyzeCiCdStatus(logs, config, tasks); // Submit result.analysisPrompt to AI agent // Parse AI response for CI/CD analysis \`\`\` `; return { analysisPrompt, instructions, }; } catch (error) { throw new McpAdrError( `Failed to analyze CI/CD status: ${error instanceof Error ? error.message : String(error)}`, 'CICD_ANALYSIS_ERROR' ); } } /** * Calculate deployment progress */ export async function calculateDeploymentProgress( deploymentTasks: DeploymentTask[], cicdStatus?: any, environmentStatus?: any ): Promise<{ progressPrompt: string; instructions: string }> { try { const { generateDeploymentProgressCalculationPrompt } = await import( '../prompts/deployment-analysis-prompts.js' ); // Prepare task data for progress calculation const taskData = deploymentTasks.map(task => ({ taskId: task.taskId, taskName: task.taskName, status: task.status, progress: task.progress, category: task.category, priority: task.priority, })); const progressPrompt = generateDeploymentProgressCalculationPrompt( taskData, cicdStatus, environmentStatus ); const instructions = ` # Deployment Progress Calculation Instructions This analysis will calculate comprehensive deployment progress based on tasks, CI/CD status, and environment status. ## Progress Calculation - **Deployment Tasks**: ${deploymentTasks.length} tasks - **Task Categories**: ${Array.from(new Set(deploymentTasks.map(t => t.category))).join(', ')} - **CI/CD Status**: ${cicdStatus ? 'Included' : 'Not provided'} - **Environment Status**: ${environmentStatus ? 'Included' : 'Not provided'} ## Next Steps 1. **Submit the progress prompt** to an AI agent for comprehensive calculation 2. **Parse the JSON response** to get detailed progress analysis 3. **Review critical path** and bottlenecks 4. **Use progress data** for stakeholder reporting and decision making ## Expected AI Response Format The AI will return a JSON object with: - \`deploymentProgress\`: Overall progress and completion estimates - \`categoryProgress\`: Progress by deployment category - \`taskProgress\`: Individual task progress and contributions - \`criticalPath\`: Critical path analysis and bottlenecks - \`milestones\`: Milestone progress and status - \`qualityMetrics\`: Quality and compliance metrics - \`riskAssessment\`: Risk analysis and mitigation - \`recommendations\`: Progress acceleration recommendations - \`nextActions\`: Immediate actions required ## Usage Example \`\`\`typescript const result = await calculateDeploymentProgress(tasks, cicdStatus, envStatus); // Submit result.progressPrompt to AI agent // Parse AI response for progress calculation \`\`\` `; return { progressPrompt, instructions, }; } catch (error) { throw new McpAdrError( `Failed to calculate deployment progress: ${error instanceof Error ? error.message : String(error)}`, 'PROGRESS_CALCULATION_ERROR' ); } } /** * Verify deployment completion with outcome rules */ export async function verifyDeploymentCompletion( deploymentTasks: DeploymentTask[], outcomeRules: OutcomeRule[], actualOutcomes?: Array<{ taskId: string; outcome: string; evidence: string[]; timestamp: string; }> ): Promise<{ verificationPrompt: string; instructions: string }> { try { const { generateCompletionVerificationPrompt } = await import( '../prompts/deployment-analysis-prompts.js' ); // Prepare task data for verification const taskData = deploymentTasks.map(task => ({ taskId: task.taskId, taskName: task.taskName, verificationCriteria: task.verificationCriteria, expectedOutcome: task.expectedOutcome, status: task.status, })); const verificationPrompt = generateCompletionVerificationPrompt( taskData, outcomeRules, actualOutcomes ); const instructions = ` # Deployment Completion Verification Instructions This analysis will verify deployment completion by comparing actual outcomes against expected outcome rules. ## Verification Scope - **Deployment Tasks**: ${deploymentTasks.length} tasks to verify - **Outcome Rules**: ${outcomeRules.length} rules to validate - **Actual Outcomes**: ${actualOutcomes?.length || 0} outcomes provided - **Verification Areas**: Criteria compliance, outcome validation, quality assessment ## Next Steps 1. **Submit the verification prompt** to an AI agent for comprehensive verification 2. **Parse the JSON response** to get completion verification results 3. **Review compliance gaps** and quality assessments 4. **Use verification results** for sign-off decisions and go-live recommendations ## Expected AI Response Format The AI will return a JSON object with: - \`completionVerification\`: Overall completion status and confidence - \`taskVerification\`: Individual task verification results - \`ruleCompliance\`: Outcome rule compliance assessment - \`qualityAssessment\`: Quality and compliance metrics - \`successMetrics\`: Success metric evaluation - \`completionGaps\`: Identified gaps and remediation - \`recommendations\`: Completion and quality recommendations - \`signOffStatus\`: Sign-off readiness and go-live recommendation ## Usage Example \`\`\`typescript const result = await verifyDeploymentCompletion(tasks, rules, outcomes); // Submit result.verificationPrompt to AI agent // Parse AI response for completion verification \`\`\` `; return { verificationPrompt, instructions, }; } catch (error) { throw new McpAdrError( `Failed to verify deployment completion: ${error instanceof Error ? error.message : String(error)}`, 'COMPLETION_VERIFICATION_ERROR' ); } }
- Type definitions for deployment tasks, outcome rules, and progress metrics used throughout the tool.export interface DeploymentTask { taskId: string; taskName: string; description: string; category: 'infrastructure' | 'application' | 'cicd' | 'operational'; priority: 'critical' | 'high' | 'medium' | 'low'; status: 'not_started' | 'in_progress' | 'completed' | 'blocked' | 'failed'; progress: number; verificationCriteria: string[]; expectedOutcome: string; sourceAdr?: string; } export interface OutcomeRule { ruleId: string; description: string; criteria: string[]; verificationMethod: string; } export interface DeploymentProgress { overallProgress: number; categoryProgress: Record<string, number>; criticalPath: { tasks: string[]; progress: number; bottlenecks: string[]; }; estimatedCompletion: string; riskLevel: 'low' | 'medium' | 'high' | 'critical'; }