mcp-adr-analysis-server 1.1.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/LICENSE +21 -0
- package/README.md +608 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +1722 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/prompts/adr-suggestion-prompts.d.ts +24 -0
- package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -0
- package/dist/src/prompts/adr-suggestion-prompts.js +383 -0
- package/dist/src/prompts/adr-suggestion-prompts.js.map +1 -0
- package/dist/src/prompts/analysis-prompts.d.ts +24 -0
- package/dist/src/prompts/analysis-prompts.d.ts.map +1 -0
- package/dist/src/prompts/analysis-prompts.js +489 -0
- package/dist/src/prompts/analysis-prompts.js.map +1 -0
- package/dist/src/prompts/deployment-analysis-prompts.d.ts +54 -0
- package/dist/src/prompts/deployment-analysis-prompts.d.ts.map +1 -0
- package/dist/src/prompts/deployment-analysis-prompts.js +712 -0
- package/dist/src/prompts/deployment-analysis-prompts.js.map +1 -0
- package/dist/src/prompts/environment-analysis-prompts.d.ts +34 -0
- package/dist/src/prompts/environment-analysis-prompts.d.ts.map +1 -0
- package/dist/src/prompts/environment-analysis-prompts.js +724 -0
- package/dist/src/prompts/environment-analysis-prompts.js.map +1 -0
- package/dist/src/prompts/index.d.ts +43 -0
- package/dist/src/prompts/index.d.ts.map +1 -0
- package/dist/src/prompts/index.js +384 -0
- package/dist/src/prompts/index.js.map +1 -0
- package/dist/src/prompts/research-integration-prompts.d.ts +43 -0
- package/dist/src/prompts/research-integration-prompts.d.ts.map +1 -0
- package/dist/src/prompts/research-integration-prompts.js +398 -0
- package/dist/src/prompts/research-integration-prompts.js.map +1 -0
- package/dist/src/prompts/research-question-prompts.d.ts +75 -0
- package/dist/src/prompts/research-question-prompts.d.ts.map +1 -0
- package/dist/src/prompts/research-question-prompts.js +695 -0
- package/dist/src/prompts/research-question-prompts.js.map +1 -0
- package/dist/src/prompts/rule-generation-prompts.d.ts +63 -0
- package/dist/src/prompts/rule-generation-prompts.d.ts.map +1 -0
- package/dist/src/prompts/rule-generation-prompts.js +630 -0
- package/dist/src/prompts/rule-generation-prompts.js.map +1 -0
- package/dist/src/prompts/security-prompts.d.ts +23 -0
- package/dist/src/prompts/security-prompts.d.ts.map +1 -0
- package/dist/src/prompts/security-prompts.js +287 -0
- package/dist/src/prompts/security-prompts.js.map +1 -0
- package/dist/src/resources/index.d.ts +24 -0
- package/dist/src/resources/index.d.ts.map +1 -0
- package/dist/src/resources/index.js +458 -0
- package/dist/src/resources/index.js.map +1 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts +40 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -0
- package/dist/src/tools/adr-suggestion-tool.js +338 -0
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -0
- package/dist/src/tools/content-masking-tool.d.ts +52 -0
- package/dist/src/tools/content-masking-tool.d.ts.map +1 -0
- package/dist/src/tools/content-masking-tool.js +206 -0
- package/dist/src/tools/content-masking-tool.js.map +1 -0
- package/dist/src/tools/deployment-analysis-tool.d.ts +39 -0
- package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -0
- package/dist/src/tools/deployment-analysis-tool.js +310 -0
- package/dist/src/tools/deployment-analysis-tool.js.map +1 -0
- package/dist/src/tools/environment-analysis-tool.d.ts +16 -0
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -0
- package/dist/src/tools/environment-analysis-tool.js +298 -0
- package/dist/src/tools/environment-analysis-tool.js.map +1 -0
- package/dist/src/tools/research-integration-tool.d.ts +44 -0
- package/dist/src/tools/research-integration-tool.d.ts.map +1 -0
- package/dist/src/tools/research-integration-tool.js +429 -0
- package/dist/src/tools/research-integration-tool.js.map +1 -0
- package/dist/src/tools/research-question-tool.d.ts +55 -0
- package/dist/src/tools/research-question-tool.d.ts.map +1 -0
- package/dist/src/tools/research-question-tool.js +333 -0
- package/dist/src/tools/research-question-tool.js.map +1 -0
- package/dist/src/tools/rule-generation-tool.d.ts +49 -0
- package/dist/src/tools/rule-generation-tool.d.ts.map +1 -0
- package/dist/src/tools/rule-generation-tool.js +432 -0
- package/dist/src/tools/rule-generation-tool.js.map +1 -0
- package/dist/src/types/index.d.ts +531 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +129 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utils/adr-suggestions.d.ts +104 -0
- package/dist/src/utils/adr-suggestions.d.ts.map +1 -0
- package/dist/src/utils/adr-suggestions.js +228 -0
- package/dist/src/utils/adr-suggestions.js.map +1 -0
- package/dist/src/utils/cache.d.ts +51 -0
- package/dist/src/utils/cache.d.ts.map +1 -0
- package/dist/src/utils/cache.js +243 -0
- package/dist/src/utils/cache.js.map +1 -0
- package/dist/src/utils/config.d.ts +65 -0
- package/dist/src/utils/config.d.ts.map +1 -0
- package/dist/src/utils/config.js +118 -0
- package/dist/src/utils/config.js.map +1 -0
- package/dist/src/utils/content-masking.d.ts +79 -0
- package/dist/src/utils/content-masking.d.ts.map +1 -0
- package/dist/src/utils/content-masking.js +203 -0
- package/dist/src/utils/content-masking.js.map +1 -0
- package/dist/src/utils/deployment-analysis.d.ts +67 -0
- package/dist/src/utils/deployment-analysis.d.ts.map +1 -0
- package/dist/src/utils/deployment-analysis.js +263 -0
- package/dist/src/utils/deployment-analysis.js.map +1 -0
- package/dist/src/utils/environment-analysis.d.ts +76 -0
- package/dist/src/utils/environment-analysis.d.ts.map +1 -0
- package/dist/src/utils/environment-analysis.js +329 -0
- package/dist/src/utils/environment-analysis.js.map +1 -0
- package/dist/src/utils/file-system.d.ts +63 -0
- package/dist/src/utils/file-system.d.ts.map +1 -0
- package/dist/src/utils/file-system.js +189 -0
- package/dist/src/utils/file-system.js.map +1 -0
- package/dist/src/utils/output-masking.d.ts +45 -0
- package/dist/src/utils/output-masking.d.ts.map +1 -0
- package/dist/src/utils/output-masking.js +200 -0
- package/dist/src/utils/output-masking.js.map +1 -0
- package/dist/src/utils/research-documentation.d.ts +58 -0
- package/dist/src/utils/research-documentation.d.ts.map +1 -0
- package/dist/src/utils/research-documentation.js +438 -0
- package/dist/src/utils/research-documentation.js.map +1 -0
- package/dist/src/utils/research-integration.d.ts +89 -0
- package/dist/src/utils/research-integration.d.ts.map +1 -0
- package/dist/src/utils/research-integration.js +432 -0
- package/dist/src/utils/research-integration.js.map +1 -0
- package/dist/src/utils/research-questions.d.ts +97 -0
- package/dist/src/utils/research-questions.d.ts.map +1 -0
- package/dist/src/utils/research-questions.js +319 -0
- package/dist/src/utils/research-questions.js.map +1 -0
- package/dist/src/utils/rule-format.d.ts +76 -0
- package/dist/src/utils/rule-format.d.ts.map +1 -0
- package/dist/src/utils/rule-format.js +257 -0
- package/dist/src/utils/rule-format.js.map +1 -0
- package/dist/src/utils/rule-generation.d.ts +86 -0
- package/dist/src/utils/rule-generation.d.ts.map +1 -0
- package/dist/src/utils/rule-generation.js +330 -0
- package/dist/src/utils/rule-generation.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment analysis utilities using prompt-driven AI analysis
|
|
3
|
+
* Implements intelligent deployment progress tracking and completion verification
|
|
4
|
+
*/
|
|
5
|
+
import { McpAdrError } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Identify deployment tasks from ADRs and todo content
|
|
8
|
+
*/
|
|
9
|
+
export async function identifyDeploymentTasks(adrDirectory = 'docs/adrs', todoPath) {
|
|
10
|
+
try {
|
|
11
|
+
const { findFiles } = await import('./file-system.js');
|
|
12
|
+
const { generateDeploymentTaskIdentificationPrompt } = await import('../prompts/deployment-analysis-prompts.js');
|
|
13
|
+
// Find all ADR files
|
|
14
|
+
const adrFiles = await findFiles(process.cwd(), [`${adrDirectory}/**/*.md`], {
|
|
15
|
+
includeContent: true,
|
|
16
|
+
});
|
|
17
|
+
if (adrFiles.length === 0) {
|
|
18
|
+
throw new McpAdrError(`No ADR files found in ${adrDirectory}`, 'NO_ADRS_FOUND');
|
|
19
|
+
}
|
|
20
|
+
// Prepare ADR data
|
|
21
|
+
const adrData = adrFiles.map(file => {
|
|
22
|
+
const titleMatch = file.content?.match(/^#\s+(.+)$/m);
|
|
23
|
+
const statusMatch = file.content?.match(/##\s+Status\s*\n\s*(.+)/i);
|
|
24
|
+
return {
|
|
25
|
+
id: file.name.replace(/\.md$/, ''),
|
|
26
|
+
title: titleMatch?.[1] || file.name.replace(/\.md$/, ''),
|
|
27
|
+
content: file.content || '',
|
|
28
|
+
status: statusMatch?.[1] || 'Unknown',
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
// Read todo content if provided
|
|
32
|
+
let todoContent;
|
|
33
|
+
if (todoPath) {
|
|
34
|
+
try {
|
|
35
|
+
const { promises: fs } = await import('fs');
|
|
36
|
+
todoContent = await fs.readFile(todoPath, 'utf-8');
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.warn(`Failed to read todo file: ${todoPath}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const identificationPrompt = generateDeploymentTaskIdentificationPrompt(adrData, todoContent);
|
|
43
|
+
const instructions = `
|
|
44
|
+
# Deployment Task Identification Instructions
|
|
45
|
+
|
|
46
|
+
This analysis will identify deployment-related tasks from ADRs and todo content for comprehensive deployment tracking.
|
|
47
|
+
|
|
48
|
+
## Identification Scope
|
|
49
|
+
- **ADR Directory**: ${adrDirectory}
|
|
50
|
+
- **ADRs Analyzed**: ${adrFiles.length} files
|
|
51
|
+
- **Todo Content**: ${todoPath ? 'Included' : 'Not provided'}
|
|
52
|
+
- **Task Categories**: Infrastructure, Application, CI/CD, Operational
|
|
53
|
+
|
|
54
|
+
## Next Steps
|
|
55
|
+
1. **Submit the identification prompt** to an AI agent for comprehensive task analysis
|
|
56
|
+
2. **Parse the JSON response** to get identified deployment tasks
|
|
57
|
+
3. **Review task dependencies** and deployment phases
|
|
58
|
+
4. **Use tasks** for deployment progress tracking and management
|
|
59
|
+
|
|
60
|
+
## Expected AI Response Format
|
|
61
|
+
The AI will return a JSON object with:
|
|
62
|
+
- \`deploymentTaskAnalysis\`: Overall analysis metadata and confidence
|
|
63
|
+
- \`identifiedTasks\`: Detailed deployment tasks with verification criteria
|
|
64
|
+
- \`deploymentPhases\`: Organized deployment phases and sequencing
|
|
65
|
+
- \`deploymentDependencies\`: Task dependencies and constraints
|
|
66
|
+
- \`riskAssessment\`: Deployment risks and mitigation strategies
|
|
67
|
+
- \`recommendations\`: Process and tooling recommendations
|
|
68
|
+
|
|
69
|
+
## Usage Example
|
|
70
|
+
\`\`\`typescript
|
|
71
|
+
const result = await identifyDeploymentTasks(adrDirectory, todoPath);
|
|
72
|
+
// Submit result.identificationPrompt to AI agent
|
|
73
|
+
// Parse AI response for deployment tasks
|
|
74
|
+
\`\`\`
|
|
75
|
+
`;
|
|
76
|
+
return {
|
|
77
|
+
identificationPrompt,
|
|
78
|
+
instructions,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw new McpAdrError(`Failed to identify deployment tasks: ${error instanceof Error ? error.message : String(error)}`, 'DEPLOYMENT_TASK_IDENTIFICATION_ERROR');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Analyze CI/CD logs and pipeline status
|
|
87
|
+
*/
|
|
88
|
+
export async function analyzeCiCdStatus(cicdLogs, pipelineConfig, deploymentTasks) {
|
|
89
|
+
try {
|
|
90
|
+
const { generateCiCdAnalysisPrompt } = await import('../prompts/deployment-analysis-prompts.js');
|
|
91
|
+
// Prepare deployment tasks context
|
|
92
|
+
const tasksContext = deploymentTasks?.map(task => ({
|
|
93
|
+
taskId: task.taskId,
|
|
94
|
+
taskName: task.taskName,
|
|
95
|
+
category: task.category,
|
|
96
|
+
verificationCriteria: task.verificationCriteria,
|
|
97
|
+
}));
|
|
98
|
+
const analysisPrompt = generateCiCdAnalysisPrompt(cicdLogs, pipelineConfig, tasksContext);
|
|
99
|
+
const instructions = `
|
|
100
|
+
# CI/CD Pipeline Analysis Instructions
|
|
101
|
+
|
|
102
|
+
This analysis will examine CI/CD logs and pipeline configuration to assess deployment progress and identify issues.
|
|
103
|
+
|
|
104
|
+
## Analysis Scope
|
|
105
|
+
- **CI/CD Logs**: ${cicdLogs.length} characters of log data
|
|
106
|
+
- **Pipeline Config**: ${pipelineConfig ? 'Included' : 'Not provided'}
|
|
107
|
+
- **Deployment Tasks**: ${deploymentTasks?.length || 0} tasks for context
|
|
108
|
+
- **Analysis Areas**: Build status, test results, quality gates, deployment status
|
|
109
|
+
|
|
110
|
+
## Next Steps
|
|
111
|
+
1. **Submit the analysis prompt** to an AI agent for comprehensive CI/CD analysis
|
|
112
|
+
2. **Parse the JSON response** to get pipeline status and issues
|
|
113
|
+
3. **Review performance metrics** and optimization opportunities
|
|
114
|
+
4. **Use findings** for deployment progress calculation and issue resolution
|
|
115
|
+
|
|
116
|
+
## Expected AI Response Format
|
|
117
|
+
The AI will return a JSON object with:
|
|
118
|
+
- \`cicdAnalysis\`: Overall pipeline status and progress
|
|
119
|
+
- \`pipelineStages\`: Detailed stage-by-stage analysis
|
|
120
|
+
- \`testResults\`: Comprehensive test result analysis
|
|
121
|
+
- \`qualityGates\`: Quality gate status and compliance
|
|
122
|
+
- \`deploymentStatus\`: Environment deployment status
|
|
123
|
+
- \`issues\`: Identified issues with suggested fixes
|
|
124
|
+
- \`performanceMetrics\`: Pipeline performance and resource usage
|
|
125
|
+
- \`recommendations\`: Optimization and improvement recommendations
|
|
126
|
+
|
|
127
|
+
## Usage Example
|
|
128
|
+
\`\`\`typescript
|
|
129
|
+
const result = await analyzeCiCdStatus(logs, config, tasks);
|
|
130
|
+
// Submit result.analysisPrompt to AI agent
|
|
131
|
+
// Parse AI response for CI/CD analysis
|
|
132
|
+
\`\`\`
|
|
133
|
+
`;
|
|
134
|
+
return {
|
|
135
|
+
analysisPrompt,
|
|
136
|
+
instructions,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
throw new McpAdrError(`Failed to analyze CI/CD status: ${error instanceof Error ? error.message : String(error)}`, 'CICD_ANALYSIS_ERROR');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Calculate deployment progress
|
|
145
|
+
*/
|
|
146
|
+
export async function calculateDeploymentProgress(deploymentTasks, cicdStatus, environmentStatus) {
|
|
147
|
+
try {
|
|
148
|
+
const { generateDeploymentProgressCalculationPrompt } = await import('../prompts/deployment-analysis-prompts.js');
|
|
149
|
+
// Prepare task data for progress calculation
|
|
150
|
+
const taskData = deploymentTasks.map(task => ({
|
|
151
|
+
taskId: task.taskId,
|
|
152
|
+
taskName: task.taskName,
|
|
153
|
+
status: task.status,
|
|
154
|
+
progress: task.progress,
|
|
155
|
+
category: task.category,
|
|
156
|
+
priority: task.priority,
|
|
157
|
+
}));
|
|
158
|
+
const progressPrompt = generateDeploymentProgressCalculationPrompt(taskData, cicdStatus, environmentStatus);
|
|
159
|
+
const instructions = `
|
|
160
|
+
# Deployment Progress Calculation Instructions
|
|
161
|
+
|
|
162
|
+
This analysis will calculate comprehensive deployment progress based on tasks, CI/CD status, and environment status.
|
|
163
|
+
|
|
164
|
+
## Progress Calculation
|
|
165
|
+
- **Deployment Tasks**: ${deploymentTasks.length} tasks
|
|
166
|
+
- **Task Categories**: ${Array.from(new Set(deploymentTasks.map(t => t.category))).join(', ')}
|
|
167
|
+
- **CI/CD Status**: ${cicdStatus ? 'Included' : 'Not provided'}
|
|
168
|
+
- **Environment Status**: ${environmentStatus ? 'Included' : 'Not provided'}
|
|
169
|
+
|
|
170
|
+
## Next Steps
|
|
171
|
+
1. **Submit the progress prompt** to an AI agent for comprehensive calculation
|
|
172
|
+
2. **Parse the JSON response** to get detailed progress analysis
|
|
173
|
+
3. **Review critical path** and bottlenecks
|
|
174
|
+
4. **Use progress data** for stakeholder reporting and decision making
|
|
175
|
+
|
|
176
|
+
## Expected AI Response Format
|
|
177
|
+
The AI will return a JSON object with:
|
|
178
|
+
- \`deploymentProgress\`: Overall progress and completion estimates
|
|
179
|
+
- \`categoryProgress\`: Progress by deployment category
|
|
180
|
+
- \`taskProgress\`: Individual task progress and contributions
|
|
181
|
+
- \`criticalPath\`: Critical path analysis and bottlenecks
|
|
182
|
+
- \`milestones\`: Milestone progress and status
|
|
183
|
+
- \`qualityMetrics\`: Quality and compliance metrics
|
|
184
|
+
- \`riskAssessment\`: Risk analysis and mitigation
|
|
185
|
+
- \`recommendations\`: Progress acceleration recommendations
|
|
186
|
+
- \`nextActions\`: Immediate actions required
|
|
187
|
+
|
|
188
|
+
## Usage Example
|
|
189
|
+
\`\`\`typescript
|
|
190
|
+
const result = await calculateDeploymentProgress(tasks, cicdStatus, envStatus);
|
|
191
|
+
// Submit result.progressPrompt to AI agent
|
|
192
|
+
// Parse AI response for progress calculation
|
|
193
|
+
\`\`\`
|
|
194
|
+
`;
|
|
195
|
+
return {
|
|
196
|
+
progressPrompt,
|
|
197
|
+
instructions,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
throw new McpAdrError(`Failed to calculate deployment progress: ${error instanceof Error ? error.message : String(error)}`, 'PROGRESS_CALCULATION_ERROR');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Verify deployment completion with outcome rules
|
|
206
|
+
*/
|
|
207
|
+
export async function verifyDeploymentCompletion(deploymentTasks, outcomeRules, actualOutcomes) {
|
|
208
|
+
try {
|
|
209
|
+
const { generateCompletionVerificationPrompt } = await import('../prompts/deployment-analysis-prompts.js');
|
|
210
|
+
// Prepare task data for verification
|
|
211
|
+
const taskData = deploymentTasks.map(task => ({
|
|
212
|
+
taskId: task.taskId,
|
|
213
|
+
taskName: task.taskName,
|
|
214
|
+
verificationCriteria: task.verificationCriteria,
|
|
215
|
+
expectedOutcome: task.expectedOutcome,
|
|
216
|
+
status: task.status,
|
|
217
|
+
}));
|
|
218
|
+
const verificationPrompt = generateCompletionVerificationPrompt(taskData, outcomeRules, actualOutcomes);
|
|
219
|
+
const instructions = `
|
|
220
|
+
# Deployment Completion Verification Instructions
|
|
221
|
+
|
|
222
|
+
This analysis will verify deployment completion by comparing actual outcomes against expected outcome rules.
|
|
223
|
+
|
|
224
|
+
## Verification Scope
|
|
225
|
+
- **Deployment Tasks**: ${deploymentTasks.length} tasks to verify
|
|
226
|
+
- **Outcome Rules**: ${outcomeRules.length} rules to validate
|
|
227
|
+
- **Actual Outcomes**: ${actualOutcomes?.length || 0} outcomes provided
|
|
228
|
+
- **Verification Areas**: Criteria compliance, outcome validation, quality assessment
|
|
229
|
+
|
|
230
|
+
## Next Steps
|
|
231
|
+
1. **Submit the verification prompt** to an AI agent for comprehensive verification
|
|
232
|
+
2. **Parse the JSON response** to get completion verification results
|
|
233
|
+
3. **Review compliance gaps** and quality assessments
|
|
234
|
+
4. **Use verification results** for sign-off decisions and go-live recommendations
|
|
235
|
+
|
|
236
|
+
## Expected AI Response Format
|
|
237
|
+
The AI will return a JSON object with:
|
|
238
|
+
- \`completionVerification\`: Overall completion status and confidence
|
|
239
|
+
- \`taskVerification\`: Individual task verification results
|
|
240
|
+
- \`ruleCompliance\`: Outcome rule compliance assessment
|
|
241
|
+
- \`qualityAssessment\`: Quality and compliance metrics
|
|
242
|
+
- \`successMetrics\`: Success metric evaluation
|
|
243
|
+
- \`completionGaps\`: Identified gaps and remediation
|
|
244
|
+
- \`recommendations\`: Completion and quality recommendations
|
|
245
|
+
- \`signOffStatus\`: Sign-off readiness and go-live recommendation
|
|
246
|
+
|
|
247
|
+
## Usage Example
|
|
248
|
+
\`\`\`typescript
|
|
249
|
+
const result = await verifyDeploymentCompletion(tasks, rules, outcomes);
|
|
250
|
+
// Submit result.verificationPrompt to AI agent
|
|
251
|
+
// Parse AI response for completion verification
|
|
252
|
+
\`\`\`
|
|
253
|
+
`;
|
|
254
|
+
return {
|
|
255
|
+
verificationPrompt,
|
|
256
|
+
instructions,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
throw new McpAdrError(`Failed to verify deployment completion: ${error instanceof Error ? error.message : String(error)}`, 'COMPLETION_VERIFICATION_ERROR');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=deployment-analysis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-analysis.js","sourceRoot":"","sources":["../../../src/utils/deployment-analysis.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAkChD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,eAAuB,WAAW,EAClC,QAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;QACvD,MAAM,EAAE,0CAA0C,EAAE,GAAG,MAAM,MAAM,CACjE,2CAA2C,CAC5C,CAAC;QAEF,qBAAqB;QACrB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,YAAY,UAAU,CAAC,EAAE;YAC3E,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,WAAW,CAAC,yBAAyB,YAAY,EAAE,EAAE,eAAe,CAAC,CAAC;QAClF,CAAC;QAED,mBAAmB;QACnB,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAClC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;YACtD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO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F,IAAI,CAAC;QACH,MAAM,EAAE,oCAAoC,EAAE,GAAG,MAAM,MAAM,CAC3D,2CAA2C,CAC5C,CAAC;QAEF,qCAAqC;QACrC,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC5C,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;YAC/C,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC,CAAC;QAEJ,MAAM,kBAAkB,GAAG,oCAAoC,CAC7D,QAAQ,EACR,YAAY,EACZ,cAAc,CACf,CAAC;QAEF,MAAM,YAAY,GAAG;;;;;;0BAMC,eAAe,CAAC,MAAM;uBACzB,YAAY,CAAC,MAAM;yBACjB,cAAc,EAAE,MAAM,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BnD,CAAC;QAEE,OAAO;YACL,kBAAkB;YAClB,YAAY;SACb,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CACnB,2CAA2C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACnG,+BAA+B,CAChC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment analysis utilities using prompt-driven AI analysis
|
|
3
|
+
* Implements intelligent environment context analysis and compliance assessment
|
|
4
|
+
*/
|
|
5
|
+
export interface EnvironmentFile {
|
|
6
|
+
filename: string;
|
|
7
|
+
content: string;
|
|
8
|
+
path: string;
|
|
9
|
+
type: 'dockerfile' | 'compose' | 'kubernetes' | 'terraform' | 'config' | 'other';
|
|
10
|
+
}
|
|
11
|
+
export interface ContainerizationAnalysis {
|
|
12
|
+
detected: boolean;
|
|
13
|
+
technology: string;
|
|
14
|
+
maturity: string;
|
|
15
|
+
orchestration: string;
|
|
16
|
+
dockerfiles: any[];
|
|
17
|
+
composeFiles: any[];
|
|
18
|
+
kubernetesManifests: any[];
|
|
19
|
+
buildConfiguration: any;
|
|
20
|
+
resourceManagement: any;
|
|
21
|
+
bestPractices: any;
|
|
22
|
+
recommendations: any[];
|
|
23
|
+
securityFindings: any[];
|
|
24
|
+
}
|
|
25
|
+
export interface EnvironmentRequirements {
|
|
26
|
+
infrastructure: any;
|
|
27
|
+
platform: any;
|
|
28
|
+
security: any;
|
|
29
|
+
performance: any;
|
|
30
|
+
operationalRequirements: any;
|
|
31
|
+
gaps: any[];
|
|
32
|
+
recommendations: any[];
|
|
33
|
+
}
|
|
34
|
+
export interface ComplianceAssessment {
|
|
35
|
+
overallScore: number;
|
|
36
|
+
assessmentDate: string;
|
|
37
|
+
riskLevel: string;
|
|
38
|
+
complianceStatus: string;
|
|
39
|
+
categoryScores: any;
|
|
40
|
+
complianceDetails: any[];
|
|
41
|
+
violations: any[];
|
|
42
|
+
strengths: any[];
|
|
43
|
+
recommendations: any[];
|
|
44
|
+
improvementPlan: any;
|
|
45
|
+
riskAssessment: any;
|
|
46
|
+
complianceMetrics: any;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Analyze system environment specifications
|
|
50
|
+
*/
|
|
51
|
+
export declare function analyzeEnvironmentSpecs(projectPath?: string): Promise<{
|
|
52
|
+
analysisPrompt: string;
|
|
53
|
+
instructions: string;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Detect containerization technologies
|
|
57
|
+
*/
|
|
58
|
+
export declare function detectContainerization(projectPath?: string): Promise<{
|
|
59
|
+
detectionPrompt: string;
|
|
60
|
+
instructions: string;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Determine environment requirements from ADRs
|
|
64
|
+
*/
|
|
65
|
+
export declare function determineEnvironmentRequirements(adrDirectory?: string): Promise<{
|
|
66
|
+
requirementsPrompt: string;
|
|
67
|
+
instructions: string;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Assess environment compliance
|
|
71
|
+
*/
|
|
72
|
+
export declare function assessEnvironmentCompliance(currentEnvironment: any, requirements: any, industryStandards?: string[]): Promise<{
|
|
73
|
+
compliancePrompt: string;
|
|
74
|
+
instructions: string;
|
|
75
|
+
}>;
|
|
76
|
+
//# sourceMappingURL=environment-analysis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-analysis.d.ts","sourceRoot":"","sources":["../../../src/utils/environment-analysis.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;CAClF;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,YAAY,EAAE,GAAG,EAAE,CAAC;IACpB,mBAAmB,EAAE,GAAG,EAAE,CAAC;IAC3B,kBAAkB,EAAE,GAAG,CAAC;IACxB,kBAAkB,EAAE,GAAG,CAAC;IACxB,aAAa,EAAE,GAAG,CAAC;IACnB,eAAe,EAAE,GAAG,EAAE,CAAC;IACvB,gBAAgB,EAAE,GAAG,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,GAAG,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,GAAG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AAY,EAAE,MAAM,CAAA;CAAE,CAAC,CA2D7D"}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment analysis utilities using prompt-driven AI analysis
|
|
3
|
+
* Implements intelligent environment context analysis and compliance assessment
|
|
4
|
+
*/
|
|
5
|
+
import { McpAdrError } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Analyze system environment specifications
|
|
8
|
+
*/
|
|
9
|
+
export async function analyzeEnvironmentSpecs(projectPath = process.cwd()) {
|
|
10
|
+
try {
|
|
11
|
+
const { analyzeProjectStructure } = await import('./file-system.js');
|
|
12
|
+
const { generateAnalysisContext } = await import('../prompts/analysis-prompts.js');
|
|
13
|
+
const { generateEnvironmentSpecAnalysisPrompt } = await import('../prompts/environment-analysis-prompts.js');
|
|
14
|
+
// Find environment-related files
|
|
15
|
+
const environmentFiles = await findEnvironmentFiles(projectPath);
|
|
16
|
+
// Analyze project structure
|
|
17
|
+
const projectStructure = await analyzeProjectStructure(projectPath);
|
|
18
|
+
const analysisContext = generateAnalysisContext(projectStructure);
|
|
19
|
+
const analysisPrompt = generateEnvironmentSpecAnalysisPrompt(environmentFiles, analysisContext);
|
|
20
|
+
const instructions = `
|
|
21
|
+
# Environment Specification Analysis Instructions
|
|
22
|
+
|
|
23
|
+
This analysis will examine environment specifications and infrastructure configurations to understand deployment requirements.
|
|
24
|
+
|
|
25
|
+
## Analysis Scope
|
|
26
|
+
- **Project Path**: ${projectPath}
|
|
27
|
+
- **Environment Files**: ${environmentFiles.length} files found
|
|
28
|
+
- **File Types**: ${Array.from(new Set(environmentFiles.map(f => f.type))).join(', ')}
|
|
29
|
+
|
|
30
|
+
## Discovered Files
|
|
31
|
+
${environmentFiles.map(f => `- **${f.filename}** (${f.type}): ${f.path}`).join('\n')}
|
|
32
|
+
|
|
33
|
+
## Next Steps
|
|
34
|
+
1. **Submit the analysis prompt** to an AI agent for comprehensive environment analysis
|
|
35
|
+
2. **Parse the JSON response** to get environment specifications and recommendations
|
|
36
|
+
3. **Review infrastructure requirements** and compliance status
|
|
37
|
+
4. **Use findings** for environment optimization and compliance improvement
|
|
38
|
+
|
|
39
|
+
## Expected AI Response Format
|
|
40
|
+
The AI will return a JSON object with:
|
|
41
|
+
- \`environmentAnalysis\`: Overall environment assessment and classification
|
|
42
|
+
- \`infrastructure\`: Detailed infrastructure component analysis
|
|
43
|
+
- \`containerization\`: Container technology detection and evaluation
|
|
44
|
+
- \`cloudServices\`: Cloud platform and service analysis
|
|
45
|
+
- \`configuration\`: Configuration management assessment
|
|
46
|
+
- \`qualityAttributes\`: Non-functional requirement evaluation
|
|
47
|
+
- \`recommendations\`: Prioritized improvement suggestions
|
|
48
|
+
- \`gaps\`: Identified missing or inadequate components
|
|
49
|
+
|
|
50
|
+
## Usage Example
|
|
51
|
+
\`\`\`typescript
|
|
52
|
+
const result = await analyzeEnvironmentSpecs(projectPath);
|
|
53
|
+
// Submit result.analysisPrompt to AI agent
|
|
54
|
+
// Parse AI response for environment analysis
|
|
55
|
+
\`\`\`
|
|
56
|
+
`;
|
|
57
|
+
return {
|
|
58
|
+
analysisPrompt,
|
|
59
|
+
instructions,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw new McpAdrError(`Failed to analyze environment specs: ${error instanceof Error ? error.message : String(error)}`, 'ENVIRONMENT_ANALYSIS_ERROR');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Detect containerization technologies
|
|
68
|
+
*/
|
|
69
|
+
export async function detectContainerization(projectPath = process.cwd()) {
|
|
70
|
+
try {
|
|
71
|
+
const { findFiles } = await import('./file-system.js');
|
|
72
|
+
const { generateContainerizationDetectionPrompt } = await import('../prompts/environment-analysis-prompts.js');
|
|
73
|
+
// Find container-related files
|
|
74
|
+
const containerFiles = await findFiles(process.cwd(), [
|
|
75
|
+
'**/Dockerfile*',
|
|
76
|
+
'**/docker-compose*.yml',
|
|
77
|
+
'**/docker-compose*.yaml',
|
|
78
|
+
'**/*.dockerfile',
|
|
79
|
+
'**/Containerfile*',
|
|
80
|
+
'**/k8s/**/*.yml',
|
|
81
|
+
'**/k8s/**/*.yaml',
|
|
82
|
+
'**/kubernetes/**/*.yml',
|
|
83
|
+
'**/kubernetes/**/*.yaml',
|
|
84
|
+
'**/helm/**/*.yml',
|
|
85
|
+
'**/helm/**/*.yaml',
|
|
86
|
+
'**/.dockerignore',
|
|
87
|
+
], { includeContent: true });
|
|
88
|
+
// Prepare file data
|
|
89
|
+
const projectFiles = containerFiles.map(file => ({
|
|
90
|
+
filename: file.name,
|
|
91
|
+
content: file.content || '',
|
|
92
|
+
path: file.path,
|
|
93
|
+
}));
|
|
94
|
+
const detectionPrompt = generateContainerizationDetectionPrompt(projectFiles);
|
|
95
|
+
const instructions = `
|
|
96
|
+
# Containerization Detection Instructions
|
|
97
|
+
|
|
98
|
+
This analysis will detect and evaluate containerization technologies and configurations in the project.
|
|
99
|
+
|
|
100
|
+
## Detection Scope
|
|
101
|
+
- **Project Path**: ${projectPath}
|
|
102
|
+
- **Container Files**: ${containerFiles.length} files found
|
|
103
|
+
- **File Types**: Dockerfiles, Compose files, Kubernetes manifests, Helm charts
|
|
104
|
+
|
|
105
|
+
## Discovered Files
|
|
106
|
+
${containerFiles.map(f => `- **${f.name}**: ${f.path}`).join('\n')}
|
|
107
|
+
|
|
108
|
+
## Next Steps
|
|
109
|
+
1. **Submit the detection prompt** to an AI agent for containerization analysis
|
|
110
|
+
2. **Parse the JSON response** to get containerization assessment
|
|
111
|
+
3. **Review security findings** and best practice compliance
|
|
112
|
+
4. **Implement recommendations** for container optimization
|
|
113
|
+
|
|
114
|
+
## Expected AI Response Format
|
|
115
|
+
The AI will return a JSON object with:
|
|
116
|
+
- \`containerization\`: Overall containerization status and maturity
|
|
117
|
+
- \`dockerfiles\`: Analysis of Dockerfile configurations
|
|
118
|
+
- \`composeFiles\`: Docker Compose file evaluation
|
|
119
|
+
- \`kubernetesManifests\`: Kubernetes resource analysis
|
|
120
|
+
- \`buildConfiguration\`: Build optimization assessment
|
|
121
|
+
- \`resourceManagement\`: Resource limit and scaling evaluation
|
|
122
|
+
- \`bestPractices\`: Security and optimization best practices
|
|
123
|
+
- \`recommendations\`: Prioritized improvement suggestions
|
|
124
|
+
- \`securityFindings\`: Security issues and remediation
|
|
125
|
+
|
|
126
|
+
## Usage Example
|
|
127
|
+
\`\`\`typescript
|
|
128
|
+
const result = await detectContainerization(projectPath);
|
|
129
|
+
// Submit result.detectionPrompt to AI agent
|
|
130
|
+
// Parse AI response as ContainerizationAnalysis
|
|
131
|
+
\`\`\`
|
|
132
|
+
`;
|
|
133
|
+
return {
|
|
134
|
+
detectionPrompt,
|
|
135
|
+
instructions,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
throw new McpAdrError(`Failed to detect containerization: ${error instanceof Error ? error.message : String(error)}`, 'CONTAINERIZATION_DETECTION_ERROR');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Determine environment requirements from ADRs
|
|
144
|
+
*/
|
|
145
|
+
export async function determineEnvironmentRequirements(adrDirectory = 'docs/adrs') {
|
|
146
|
+
try {
|
|
147
|
+
const { findFiles } = await import('./file-system.js');
|
|
148
|
+
const { generateAdrEnvironmentRequirementsPrompt } = await import('../prompts/environment-analysis-prompts.js');
|
|
149
|
+
// Find all ADR files
|
|
150
|
+
const adrFiles = await findFiles(process.cwd(), [`${adrDirectory}/**/*.md`], {
|
|
151
|
+
includeContent: true,
|
|
152
|
+
});
|
|
153
|
+
if (adrFiles.length === 0) {
|
|
154
|
+
throw new McpAdrError(`No ADR files found in ${adrDirectory}`, 'NO_ADRS_FOUND');
|
|
155
|
+
}
|
|
156
|
+
// Prepare ADR data
|
|
157
|
+
const adrData = adrFiles.map(file => {
|
|
158
|
+
const titleMatch = file.content?.match(/^#\s+(.+)$/m);
|
|
159
|
+
const statusMatch = file.content?.match(/##\s+Status\s*\n\s*(.+)/i);
|
|
160
|
+
return {
|
|
161
|
+
id: file.name.replace(/\.md$/, ''),
|
|
162
|
+
title: titleMatch?.[1] || file.name.replace(/\.md$/, ''),
|
|
163
|
+
content: file.content || '',
|
|
164
|
+
status: statusMatch?.[1] || 'Unknown',
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
const requirementsPrompt = generateAdrEnvironmentRequirementsPrompt(adrData);
|
|
168
|
+
const instructions = `
|
|
169
|
+
# Environment Requirements Analysis Instructions
|
|
170
|
+
|
|
171
|
+
This analysis will extract environment and infrastructure requirements from Architectural Decision Records.
|
|
172
|
+
|
|
173
|
+
## Requirements Extraction
|
|
174
|
+
- **ADR Directory**: ${adrDirectory}
|
|
175
|
+
- **ADRs Analyzed**: ${adrFiles.length} files
|
|
176
|
+
- **Requirement Categories**: Infrastructure, Platform, Security, Performance, Operational
|
|
177
|
+
|
|
178
|
+
## Next Steps
|
|
179
|
+
1. **Submit the requirements prompt** to an AI agent for ADR analysis
|
|
180
|
+
2. **Parse the JSON response** to get extracted requirements
|
|
181
|
+
3. **Review requirement completeness** and identify gaps
|
|
182
|
+
4. **Use requirements** for environment compliance assessment
|
|
183
|
+
|
|
184
|
+
## Expected AI Response Format
|
|
185
|
+
The AI will return a JSON object with:
|
|
186
|
+
- \`environmentRequirements\`: Overall requirements metadata
|
|
187
|
+
- \`infrastructure\`: Compute, networking, and availability requirements
|
|
188
|
+
- \`platform\`: Containerization, cloud services, and database requirements
|
|
189
|
+
- \`security\`: Compliance, access control, and data protection requirements
|
|
190
|
+
- \`performance\`: Response time, throughput, and scalability requirements
|
|
191
|
+
- \`operationalRequirements\`: Monitoring, deployment, and maintenance requirements
|
|
192
|
+
- \`gaps\`: Missing or unclear requirements
|
|
193
|
+
- \`recommendations\`: Suggested requirement clarifications
|
|
194
|
+
|
|
195
|
+
## Usage Example
|
|
196
|
+
\`\`\`typescript
|
|
197
|
+
const result = await determineEnvironmentRequirements(adrDirectory);
|
|
198
|
+
// Submit result.requirementsPrompt to AI agent
|
|
199
|
+
// Parse AI response as EnvironmentRequirements
|
|
200
|
+
\`\`\`
|
|
201
|
+
`;
|
|
202
|
+
return {
|
|
203
|
+
requirementsPrompt,
|
|
204
|
+
instructions,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
throw new McpAdrError(`Failed to determine environment requirements: ${error instanceof Error ? error.message : String(error)}`, 'REQUIREMENTS_ANALYSIS_ERROR');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Assess environment compliance
|
|
213
|
+
*/
|
|
214
|
+
export async function assessEnvironmentCompliance(currentEnvironment, requirements, industryStandards) {
|
|
215
|
+
try {
|
|
216
|
+
const { generateEnvironmentCompliancePrompt } = await import('../prompts/environment-analysis-prompts.js');
|
|
217
|
+
const compliancePrompt = generateEnvironmentCompliancePrompt(currentEnvironment, requirements, industryStandards);
|
|
218
|
+
const instructions = `
|
|
219
|
+
# Environment Compliance Assessment Instructions
|
|
220
|
+
|
|
221
|
+
This analysis will assess the current environment against requirements and industry standards.
|
|
222
|
+
|
|
223
|
+
## Assessment Scope
|
|
224
|
+
- **Current Environment**: Analyzed environment specifications
|
|
225
|
+
- **Requirements**: Extracted from ADRs and project needs
|
|
226
|
+
- **Industry Standards**: ${industryStandards?.length || 0} standards
|
|
227
|
+
- **Assessment Areas**: Infrastructure, Security, Performance, Operational
|
|
228
|
+
|
|
229
|
+
## Next Steps
|
|
230
|
+
1. **Submit the compliance prompt** to an AI agent for assessment
|
|
231
|
+
2. **Parse the JSON response** to get compliance evaluation
|
|
232
|
+
3. **Review violations** and prioritize remediation
|
|
233
|
+
4. **Implement improvement plan** based on recommendations
|
|
234
|
+
|
|
235
|
+
## Expected AI Response Format
|
|
236
|
+
The AI will return a JSON object with:
|
|
237
|
+
- \`complianceAssessment\`: Overall compliance score and status
|
|
238
|
+
- \`categoryScores\`: Compliance scores by category
|
|
239
|
+
- \`complianceDetails\`: Detailed requirement-by-requirement assessment
|
|
240
|
+
- \`violations\`: Specific compliance violations with remediation
|
|
241
|
+
- \`strengths\`: Areas where compliance exceeds requirements
|
|
242
|
+
- \`recommendations\`: Prioritized improvement recommendations
|
|
243
|
+
- \`improvementPlan\`: Phased implementation roadmap
|
|
244
|
+
- \`riskAssessment\`: Risk analysis and mitigation strategies
|
|
245
|
+
- \`complianceMetrics\`: Quantitative compliance measurements
|
|
246
|
+
|
|
247
|
+
## Usage Example
|
|
248
|
+
\`\`\`typescript
|
|
249
|
+
const result = await assessEnvironmentCompliance(environment, requirements, standards);
|
|
250
|
+
// Submit result.compliancePrompt to AI agent
|
|
251
|
+
// Parse AI response as ComplianceAssessment
|
|
252
|
+
\`\`\`
|
|
253
|
+
`;
|
|
254
|
+
return {
|
|
255
|
+
compliancePrompt,
|
|
256
|
+
instructions,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
throw new McpAdrError(`Failed to assess environment compliance: ${error instanceof Error ? error.message : String(error)}`, 'COMPLIANCE_ASSESSMENT_ERROR');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Find environment-related files in the project
|
|
265
|
+
*/
|
|
266
|
+
async function findEnvironmentFiles(projectPath) {
|
|
267
|
+
try {
|
|
268
|
+
const { findFiles } = await import('./file-system.js');
|
|
269
|
+
const files = await findFiles(projectPath, [
|
|
270
|
+
'**/Dockerfile*',
|
|
271
|
+
'**/docker-compose*.yml',
|
|
272
|
+
'**/docker-compose*.yaml',
|
|
273
|
+
'**/*.dockerfile',
|
|
274
|
+
'**/Containerfile*',
|
|
275
|
+
'**/k8s/**/*.yml',
|
|
276
|
+
'**/k8s/**/*.yaml',
|
|
277
|
+
'**/kubernetes/**/*.yml',
|
|
278
|
+
'**/kubernetes/**/*.yaml',
|
|
279
|
+
'**/terraform/**/*.tf',
|
|
280
|
+
'**/terraform/**/*.tfvars',
|
|
281
|
+
'**/.env*',
|
|
282
|
+
'**/config/**/*.yml',
|
|
283
|
+
'**/config/**/*.yaml',
|
|
284
|
+
'**/config/**/*.json',
|
|
285
|
+
'**/helm/**/*.yml',
|
|
286
|
+
'**/helm/**/*.yaml',
|
|
287
|
+
], { includeContent: true });
|
|
288
|
+
return files.map(file => ({
|
|
289
|
+
filename: file.name,
|
|
290
|
+
content: file.content || '',
|
|
291
|
+
path: file.path,
|
|
292
|
+
type: determineFileType(file.name, file.path),
|
|
293
|
+
}));
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
console.warn('Failed to find environment files:', error);
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Determine file type based on filename and path
|
|
302
|
+
*/
|
|
303
|
+
function determineFileType(filename, path) {
|
|
304
|
+
const lowerFilename = filename.toLowerCase();
|
|
305
|
+
const lowerPath = path.toLowerCase();
|
|
306
|
+
if (lowerFilename.includes('dockerfile') || lowerFilename.includes('containerfile')) {
|
|
307
|
+
return 'dockerfile';
|
|
308
|
+
}
|
|
309
|
+
if (lowerFilename.includes('docker-compose') || lowerFilename.includes('compose')) {
|
|
310
|
+
return 'compose';
|
|
311
|
+
}
|
|
312
|
+
if (lowerPath.includes('k8s') || lowerPath.includes('kubernetes') || lowerPath.includes('helm')) {
|
|
313
|
+
return 'kubernetes';
|
|
314
|
+
}
|
|
315
|
+
if (lowerPath.includes('terraform') ||
|
|
316
|
+
lowerFilename.endsWith('.tf') ||
|
|
317
|
+
lowerFilename.endsWith('.tfvars')) {
|
|
318
|
+
return 'terraform';
|
|
319
|
+
}
|
|
320
|
+
if (lowerFilename.includes('config') ||
|
|
321
|
+
lowerFilename.startsWith('.env') ||
|
|
322
|
+
lowerFilename.endsWith('.yml') ||
|
|
323
|
+
lowerFilename.endsWith('.yaml') ||
|
|
324
|
+
lowerFilename.endsWith('.json')) {
|
|
325
|
+
return 'config';
|
|
326
|
+
}
|
|
327
|
+
return 'other';
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=environment-analysis.js.map
|