mcp-adr-analysis-server 2.1.0 → 2.1.11

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.
Files changed (94) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/src/index.d.ts +9 -0
  3. package/dist/src/index.d.ts.map +1 -1
  4. package/dist/src/index.js +129 -0
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/templates/domain-knowledge-templates.d.ts.map +1 -1
  7. package/dist/src/templates/domain-knowledge-templates.js +49 -49
  8. package/dist/src/templates/domain-knowledge-templates.js.map +1 -1
  9. package/dist/src/tools/adr-suggestion-tool.d.ts +2 -2
  10. package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
  11. package/dist/src/tools/adr-suggestion-tool.js +125 -11
  12. package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
  13. package/dist/src/tools/adr-validation-tool.d.ts +46 -0
  14. package/dist/src/tools/adr-validation-tool.d.ts.map +1 -0
  15. package/dist/src/tools/adr-validation-tool.js +320 -0
  16. package/dist/src/tools/adr-validation-tool.js.map +1 -0
  17. package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -1
  18. package/dist/src/tools/deployment-analysis-tool.js +35 -1
  19. package/dist/src/tools/deployment-analysis-tool.js.map +1 -1
  20. package/dist/src/tools/deployment-guidance-tool.d.ts.map +1 -1
  21. package/dist/src/tools/deployment-guidance-tool.js +78 -24
  22. package/dist/src/tools/deployment-guidance-tool.js.map +1 -1
  23. package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
  24. package/dist/src/tools/deployment-readiness-tool.js +151 -4
  25. package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
  26. package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
  27. package/dist/src/tools/environment-analysis-tool.js +36 -1
  28. package/dist/src/tools/environment-analysis-tool.js.map +1 -1
  29. package/dist/src/tools/interactive-adr-planning-tool.d.ts.map +1 -1
  30. package/dist/src/tools/interactive-adr-planning-tool.js +82 -9
  31. package/dist/src/tools/interactive-adr-planning-tool.js.map +1 -1
  32. package/dist/src/tools/perform-research-tool.d.ts +17 -0
  33. package/dist/src/tools/perform-research-tool.d.ts.map +1 -0
  34. package/dist/src/tools/perform-research-tool.js +180 -0
  35. package/dist/src/tools/perform-research-tool.js.map +1 -0
  36. package/dist/src/tools/research-question-tool.d.ts.map +1 -1
  37. package/dist/src/tools/research-question-tool.js +11 -9
  38. package/dist/src/tools/research-question-tool.js.map +1 -1
  39. package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -1
  40. package/dist/src/tools/review-existing-adrs-tool.js +38 -2
  41. package/dist/src/tools/review-existing-adrs-tool.js.map +1 -1
  42. package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
  43. package/dist/src/tools/troubleshoot-guided-workflow-tool.js +89 -0
  44. package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
  45. package/dist/src/types/conversation-context.d.ts.map +1 -1
  46. package/dist/src/types/conversation-context.js +12 -12
  47. package/dist/src/types/conversation-context.js.map +1 -1
  48. package/dist/src/utils/ai-executor.d.ts.map +1 -1
  49. package/dist/src/utils/ai-executor.js +3 -3
  50. package/dist/src/utils/ai-executor.js.map +1 -1
  51. package/dist/src/utils/apply-cot-enhancement.d.ts.map +1 -1
  52. package/dist/src/utils/apply-cot-enhancement.js +15 -15
  53. package/dist/src/utils/apply-cot-enhancement.js.map +1 -1
  54. package/dist/src/utils/automatic-prompt-engineering.d.ts.map +1 -1
  55. package/dist/src/utils/automatic-prompt-engineering.js +68 -58
  56. package/dist/src/utils/automatic-prompt-engineering.js.map +1 -1
  57. package/dist/src/utils/deployment-analysis.d.ts.map +1 -1
  58. package/dist/src/utils/deployment-analysis.js +13 -8
  59. package/dist/src/utils/deployment-analysis.js.map +1 -1
  60. package/dist/src/utils/environment-analysis.d.ts.map +1 -1
  61. package/dist/src/utils/environment-analysis.js +59 -43
  62. package/dist/src/utils/environment-analysis.js.map +1 -1
  63. package/dist/src/utils/environment-capability-registry.d.ts +101 -0
  64. package/dist/src/utils/environment-capability-registry.d.ts.map +1 -0
  65. package/dist/src/utils/environment-capability-registry.js +489 -0
  66. package/dist/src/utils/environment-capability-registry.js.map +1 -0
  67. package/dist/src/utils/index.d.ts +3 -3
  68. package/dist/src/utils/index.d.ts.map +1 -1
  69. package/dist/src/utils/index.js +3 -3
  70. package/dist/src/utils/index.js.map +1 -1
  71. package/dist/src/utils/knowledge-generation.d.ts.map +1 -1
  72. package/dist/src/utils/knowledge-generation.js +61 -35
  73. package/dist/src/utils/knowledge-generation.js.map +1 -1
  74. package/dist/src/utils/knowledge-graph-manager.d.ts +4 -0
  75. package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
  76. package/dist/src/utils/knowledge-graph-manager.js +8 -0
  77. package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
  78. package/dist/src/utils/llm-artifact-detector.d.ts.map +1 -1
  79. package/dist/src/utils/llm-artifact-detector.js +28 -24
  80. package/dist/src/utils/llm-artifact-detector.js.map +1 -1
  81. package/dist/src/utils/prompt-composition.d.ts.map +1 -1
  82. package/dist/src/utils/prompt-composition.js +1 -4
  83. package/dist/src/utils/prompt-composition.js.map +1 -1
  84. package/dist/src/utils/reflexion.d.ts.map +1 -1
  85. package/dist/src/utils/reflexion.js +51 -42
  86. package/dist/src/utils/reflexion.js.map +1 -1
  87. package/dist/src/utils/research-orchestrator.d.ts +77 -0
  88. package/dist/src/utils/research-orchestrator.d.ts.map +1 -0
  89. package/dist/src/utils/research-orchestrator.js +450 -0
  90. package/dist/src/utils/research-orchestrator.js.map +1 -0
  91. package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -1
  92. package/dist/src/utils/tree-sitter-analyzer.js +83 -11
  93. package/dist/src/utils/tree-sitter-analyzer.js.map +1 -1
  94. package/package.json +2 -2
@@ -3,18 +3,20 @@
3
3
  * Implements prompt-driven deployment guidance generation following project patterns
4
4
  */
5
5
  import { McpAdrError } from '../types/index.js';
6
+ import { ResearchOrchestrator } from '../utils/research-orchestrator.js';
6
7
  /**
7
8
  * Generate deployment guidance from ADRs using AI-driven analysis
8
9
  */
9
10
  export async function generateDeploymentGuidance(args) {
10
- const { adrDirectory = 'docs/adrs', environment = 'production', format = 'markdown', projectPath = process.cwd(), includeScripts = true, includeConfigs = true, includeValidation = true, technologyFilter, customRequirements, includeRollback = true, generateFiles = false } = args;
11
+ const { adrDirectory = 'docs/adrs', environment = 'production', format = 'markdown', projectPath = process.cwd(), includeScripts = true, includeConfigs = true, includeValidation = true, technologyFilter, customRequirements, includeRollback = true, generateFiles = false, } = args;
11
12
  try {
12
13
  // Use existing ADR discovery
13
14
  const { discoverAdrsInDirectory } = await import('../utils/adr-discovery.js');
14
15
  const discoveryResult = await discoverAdrsInDirectory(adrDirectory, true, projectPath);
15
16
  if (discoveryResult.adrs.length === 0) {
16
17
  return {
17
- content: [{
18
+ content: [
19
+ {
18
20
  type: 'text',
19
21
  text: `# No ADRs Found for Deployment Guidance
20
22
 
@@ -46,10 +48,41 @@ Use Docker containers with docker-compose for orchestration.
46
48
  - Requires container registry and orchestration setup
47
49
  - Port 3000 for application, 5432 for PostgreSQL
48
50
  \`\`\`
49
- `
50
- }]
51
+ `,
52
+ },
53
+ ],
51
54
  };
52
55
  }
56
+ // Research current deployment environment
57
+ let environmentContext = '';
58
+ try {
59
+ const orchestrator = new ResearchOrchestrator(projectPath, adrDirectory);
60
+ const research = await orchestrator.answerResearchQuestion(`Analyze deployment requirements for ${environment} environment:
61
+ 1. What deployment infrastructure is currently available?
62
+ 2. What deployment patterns are documented in ADRs?
63
+ 3. Are there existing deployment scripts or configurations?
64
+ 4. What are the deployment constraints or requirements?`);
65
+ const envSource = research.sources.find(s => s.type === 'environment');
66
+ const capabilities = envSource?.data?.capabilities || [];
67
+ environmentContext = `
68
+
69
+ ## šŸ” Current Environment Analysis
70
+
71
+ **Research Confidence**: ${(research.confidence * 100).toFixed(1)}%
72
+
73
+ ### Available Infrastructure
74
+ ${capabilities.length > 0 ? capabilities.map((c) => `- ${c}`).join('\n') : '- No infrastructure tools detected'}
75
+
76
+ ### Deployment Context
77
+ ${research.answer || 'No specific deployment context found'}
78
+
79
+ ### Key Findings
80
+ ${research.sources.map(s => `- ${s.type}: Consulted`).join('\n')}
81
+ `;
82
+ }
83
+ catch (error) {
84
+ environmentContext = `\n## āš ļø Environment Analysis Failed\n${error instanceof Error ? error.message : String(error)}\n`;
85
+ }
53
86
  // Create comprehensive deployment guidance prompt
54
87
  const deploymentPrompt = `
55
88
  # Deployment Guidance Generation
@@ -61,16 +94,19 @@ You are an expert DevOps engineer tasked with creating comprehensive deployment
61
94
  - **Target Environment**: ${environment}
62
95
  - **ADR Directory**: ${adrDirectory}
63
96
  - **Total ADRs**: ${discoveryResult.adrs.length}
97
+ ${environmentContext}
64
98
 
65
99
  ## ADR Content
66
- ${discoveryResult.adrs.map(adr => `
100
+ ${discoveryResult.adrs
101
+ .map(adr => `
67
102
  ### ${adr.title} (${adr.filename})
68
103
  **Status**: ${adr.status}
69
104
  **Content**:
70
105
  \`\`\`markdown
71
106
  ${adr.content?.slice(0, 1000) || 'No content available'}${adr.content && adr.content.length > 1000 ? '...' : ''}
72
107
  \`\`\`
73
- `).join('\n')}
108
+ `)
109
+ .join('\n')}
74
110
 
75
111
  ## Deployment Analysis Instructions
76
112
 
@@ -94,16 +130,20 @@ Extract specific configuration details:
94
130
 
95
131
  ### 3. **Environment-Specific Considerations**
96
132
  For **${environment}** environment:
97
- ${environment === 'production' ? `
133
+ ${environment === 'production'
134
+ ? `
98
135
  - **Security**: TLS certificates, secure connections, secrets management
99
136
  - **Performance**: Load balancing, caching, optimization
100
137
  - **Reliability**: Backup procedures, monitoring, alerting
101
138
  - **Scalability**: Auto-scaling, resource allocation
102
- ` : environment === 'staging' ? `
139
+ `
140
+ : environment === 'staging'
141
+ ? `
103
142
  - **Testing**: Staging-specific configurations
104
143
  - **Data**: Test data setup, database seeding
105
144
  - **Integration**: External service connections
106
- ` : `
145
+ `
146
+ : `
107
147
  - **Development**: Hot-reload, debugging, local services
108
148
  - **Convenience**: Simplified setup, development tools
109
149
  `}
@@ -117,30 +157,36 @@ Create step-by-step deployment instructions:
117
157
  5. **Service Configuration**: Web server, load balancer, SSL
118
158
  6. **Verification**: Health checks, smoke tests, monitoring
119
159
 
120
- ${includeScripts ? `
160
+ ${includeScripts
161
+ ? `
121
162
  ### 5. **Script Generation**
122
163
  Generate deployment scripts:
123
164
  - **Shell scripts** for automated deployment
124
165
  - **Docker commands** for containerized deployment
125
166
  - **Configuration files** (nginx.conf, docker-compose.yml, .env)
126
- ` : ''}
167
+ `
168
+ : ''}
127
169
 
128
- ${includeValidation ? `
170
+ ${includeValidation
171
+ ? `
129
172
  ### 6. **Validation & Health Checks**
130
173
  Create verification procedures:
131
174
  - **Health check endpoints** and commands
132
175
  - **Service connectivity tests**
133
176
  - **Performance validation**
134
177
  - **Security verification**
135
- ` : ''}
178
+ `
179
+ : ''}
136
180
 
137
- ${includeRollback ? `
181
+ ${includeRollback
182
+ ? `
138
183
  ### 7. **Rollback Procedures**
139
184
  Document rollback steps:
140
185
  - **Rollback commands** in reverse order
141
186
  - **Data migration rollback** if applicable
142
187
  - **Service restoration** procedures
143
- ` : ''}
188
+ `
189
+ : ''}
144
190
 
145
191
  ## Output Format
146
192
 
@@ -219,22 +265,27 @@ KEY=value
219
265
  - **Complete**: Cover entire deployment lifecycle
220
266
  - **Evidence-based**: Base all recommendations on ADR content
221
267
 
222
- ${technologyFilter && technologyFilter.length > 0 ? `
268
+ ${technologyFilter && technologyFilter.length > 0
269
+ ? `
223
270
  ## Technology Filter
224
271
  Focus only on these technologies: ${technologyFilter.join(', ')}
225
- ` : ''}
272
+ `
273
+ : ''}
226
274
 
227
- ${customRequirements && customRequirements.length > 0 ? `
275
+ ${customRequirements && customRequirements.length > 0
276
+ ? `
228
277
  ## Custom Requirements
229
278
  Additionally address these requirements:
230
279
  ${customRequirements.map(req => `- ${req}`).join('\n')}
231
- ` : ''}
280
+ `
281
+ : ''}
232
282
 
233
283
  Begin deployment guidance generation now.
234
284
  `;
235
285
  // Return the prompt for AI execution
236
286
  return {
237
- content: [{
287
+ content: [
288
+ {
238
289
  type: 'text',
239
290
  text: `# Deployment Guidance Generation
240
291
 
@@ -271,15 +322,18 @@ The AI will generate:
271
322
 
272
323
  All based on the architectural decisions documented in your ADRs.
273
324
 
274
- ${generateFiles ? `
325
+ ${generateFiles
326
+ ? `
275
327
  ## File Generation Mode
276
328
  **Note**: File generation is enabled. The AI guidance will include instructions for creating actual deployment files in your project.
277
- ` : ''}
329
+ `
330
+ : ''}
278
331
 
279
332
  ## ADR Sources
280
333
  ${discoveryResult.adrs.map(adr => `- **${adr.title}** (${adr.filename})`).join('\n')}
281
- `
282
- }]
334
+ `,
335
+ },
336
+ ],
283
337
  };
284
338
  }
285
339
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"deployment-guidance-tool.js","sourceRoot":"","sources":["../../../src/tools/deployment-guidance-tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,IAYhD;IACC,MAAM,EACJ,YAAY,GAAG,WAAW,EAC1B,WAAW,GAAG,YAAY,EAC1B,MAAM,GAAG,UAAU,EACnB,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,EAC3B,cAAc,GAAG,IAAI,EACrB,cAAc,GAAG,IAAI,EACrB,iBAAiB,GAAG,IAAI,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAAG,IAAI,EACtB,aAAa,GAAG,KAAK,EACtB,GAAG,IAAI,CAAC;IAET,IAAI,CAAC;QACH,6BAA6B;QAC7B,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAC9E,MAAM,eAAe,GAAG,M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AAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAClG,2BAA2B,CAC5B,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"deployment-guidance-tool.js","sourceRoot":"","sources":["../../../src/tools/deployment-guidance-tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,IAYhD;IACC,MAAM,EACJ,YAAY,GAAG,WAAW,EAC1B,WAAW,GAAG,YAAY,EAC1B,MAAM,GAAG,UAAU,EACnB,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,EAC3B,cAAc,GAAG,IAAI,EACrB,cAAc,GAAG,IAAI,EACrB,iBAAiB,GAAG,IAAI,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAAG,IAAI,EACtB,aAAa,GAAG,KAAK,GACtB,GAAG,IAAI,CAAC;IAET,IAAI,CAAC;QACH,6BAA6B;QAC7B,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAC9E,MAAM,eAAe,GAAG,MAAM,uBAAuB,CAAC,YAAY,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QAEvF,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;;uBAGK,YAAY;sBACb,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BhC;qBACU;iBACF;aACF,CAAC;QACJ,CAAC;QAED,0CAA0C;QAC1C,IAAI,kBAAkB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,IAAI,oBAAoB,CAAC,WA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CAAC,CAAC,EACN;;;CAGC,CAAC;QAEE,qCAAqC;QACrC,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;;YAGJ,eAAe,CAAC,IAAI,CAAC,MAAM;4BACX,WAAW;gBACvB,MAAM;yBACG,cAAc;yBACd,cAAc;4BACX,iBAAiB;0BACnB,eAAe;;;;EAIvC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAuBhB,aAAa;wBACX,CAAC,CAAC;;;CAGL;wBACG,CAAC,CAAC,EACN;;;EAGE,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,CAAC,KAAK,OAAO,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CACnF;iBACQ;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CACnB,0CAA0C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAClG,2BAA2B,CAC5B,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deployment-readiness-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/deployment-readiness-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA2zBH;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CA4JjE"}
1
+ {"version":3,"file":"deployment-readiness-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/deployment-readiness-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA60BH;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CA4JjE"}
@@ -31,6 +31,7 @@ import { MemoryEntityManager } from '../utils/memory-entity-manager.js';
31
31
  import { EnhancedLogger } from '../utils/enhanced-logging.js';
32
32
  import { TreeSitterAnalyzer } from '../utils/tree-sitter-analyzer.js';
33
33
  import { findFiles, findRelatedCode } from '../utils/file-system.js';
34
+ import { ResearchOrchestrator } from '../utils/research-orchestrator.js';
34
35
  // Core schemas
35
36
  const DeploymentReadinessSchema = z.object({
36
37
  operation: z
@@ -106,6 +107,15 @@ const DeploymentReadinessSchema = z.object({
106
107
  .array(z.string())
107
108
  .default(['typescript', 'javascript', 'python', 'yaml', 'hcl'])
108
109
  .describe('Languages to analyze with tree-sitter'),
110
+ // Research-Driven Integration
111
+ enableResearchIntegration: z
112
+ .boolean()
113
+ .default(true)
114
+ .describe('Use research-orchestrator to verify environment readiness'),
115
+ researchConfidenceThreshold: z
116
+ .number()
117
+ .default(0.7)
118
+ .describe('Minimum confidence for environment research (0-1)'),
109
119
  });
110
120
  /**
111
121
  * Deployment Memory Manager for tracking deployment assessments and patterns
@@ -1047,10 +1057,74 @@ function analyzeFailurePatterns(failedDeployments) {
1047
1057
  });
1048
1058
  return Array.from(patterns.values());
1049
1059
  }
1060
+ /**
1061
+ * Research environment readiness using research-orchestrator
1062
+ */
1063
+ async function performEnvironmentResearch(args, projectPath) {
1064
+ if (!args.enableResearchIntegration) {
1065
+ return {
1066
+ answer: 'Environment research disabled',
1067
+ confidence: 1.0,
1068
+ sources: [],
1069
+ needsWebSearch: false,
1070
+ warnings: [],
1071
+ };
1072
+ }
1073
+ try {
1074
+ const orchestrator = new ResearchOrchestrator(projectPath, 'docs/adrs');
1075
+ const researchQuestion = `Verify deployment readiness for ${args.targetEnvironment} environment:
1076
+ 1. Are required deployment tools available (Docker/Podman, Kubernetes/OpenShift)?
1077
+ 2. What is the current infrastructure state and health?
1078
+ 3. Are environment configurations present and valid?
1079
+ 4. What deployment patterns are documented in ADRs?
1080
+ 5. Are there any known deployment blockers or issues?`;
1081
+ const research = await orchestrator.answerResearchQuestion(researchQuestion);
1082
+ const warnings = [];
1083
+ // Check confidence level
1084
+ if (research.confidence < args.researchConfidenceThreshold) {
1085
+ warnings.push(`Research confidence (${(research.confidence * 100).toFixed(1)}%) below threshold (${(args.researchConfidenceThreshold * 100).toFixed(1)}%)`);
1086
+ }
1087
+ // Check if web search is needed
1088
+ if (research.needsWebSearch) {
1089
+ warnings.push('Local environment data insufficient - external research may be needed');
1090
+ }
1091
+ // Check for environment capability availability
1092
+ const hasKubernetes = research.sources.some(s => s.type === 'environment' && s.data?.capabilities?.includes('kubernetes'));
1093
+ const hasDocker = research.sources.some(s => s.type === 'environment' && s.data?.capabilities?.includes('docker'));
1094
+ const hasOpenShift = research.sources.some(s => s.type === 'environment' && s.data?.capabilities?.includes('openshift'));
1095
+ const hasPodman = research.sources.some(s => s.type === 'environment' && s.data?.capabilities?.includes('podman'));
1096
+ if (!hasKubernetes && !hasOpenShift && !hasDocker && !hasPodman) {
1097
+ warnings.push('No container orchestration tools detected - manual deployment verification required');
1098
+ }
1099
+ return {
1100
+ answer: research.answer || 'No environment research results available',
1101
+ confidence: research.confidence,
1102
+ sources: research.sources.map(s => ({
1103
+ type: s.type,
1104
+ found: true, // Sources in array are already found
1105
+ })),
1106
+ needsWebSearch: research.needsWebSearch,
1107
+ warnings,
1108
+ };
1109
+ }
1110
+ catch (error) {
1111
+ return {
1112
+ answer: `Environment research failed: ${error instanceof Error ? error.message : String(error)}`,
1113
+ confidence: 0,
1114
+ sources: [],
1115
+ needsWebSearch: true,
1116
+ warnings: [
1117
+ 'Failed to perform environment research - proceeding without environment validation',
1118
+ ],
1119
+ };
1120
+ }
1121
+ }
1050
1122
  /**
1051
1123
  * Perform full audit (all checks)
1052
1124
  */
1053
1125
  async function performFullAudit(args, projectPath, historyPath) {
1126
+ // Step 0: Research environment readiness
1127
+ const environmentResearch = await performEnvironmentResearch(args, projectPath);
1054
1128
  // Combine all validations
1055
1129
  const testResult = await performTestValidation(args, projectPath);
1056
1130
  const historyResult = await performDeploymentHistoryAnalysis(args, historyPath);
@@ -1156,17 +1230,43 @@ ${deploymentCriticalFiles.length > 0
1156
1230
  `;
1157
1231
  }
1158
1232
  }
1233
+ // Create environment blockers based on research findings
1234
+ const environmentBlockers = [];
1235
+ if (environmentResearch.warnings.length > 0) {
1236
+ environmentResearch.warnings.forEach(warning => {
1237
+ if (warning.includes('threshold') || warning.includes('No container orchestration')) {
1238
+ environmentBlockers.push({
1239
+ category: 'environment',
1240
+ title: 'Environment Readiness Concern',
1241
+ description: warning,
1242
+ severity: warning.includes('No container orchestration') ? 'high' : 'medium',
1243
+ impact: 'May affect deployment execution',
1244
+ resolutionSteps: [
1245
+ 'Verify environment tools are installed',
1246
+ 'Check environment configurations',
1247
+ 'Consult deployment documentation',
1248
+ ],
1249
+ estimatedResolutionTime: '30 minutes - 1 hour',
1250
+ blocksDeployment: args.strictMode && warning.includes('No container orchestration'),
1251
+ });
1252
+ }
1253
+ });
1254
+ }
1159
1255
  const allBlockers = [
1160
1256
  ...testResult.criticalBlockers,
1161
1257
  ...testResult.testFailureBlockers,
1162
1258
  ...historyResult.deploymentHistoryBlockers,
1259
+ ...environmentBlockers,
1163
1260
  ];
1164
- const overallScore = (testResult.overallScore + historyResult.overallScore) / 2;
1165
- const isReady = allBlockers.length === 0;
1261
+ // Adjust overall score based on environment research confidence
1262
+ const baseScore = (testResult.overallScore + historyResult.overallScore) / 2;
1263
+ const environmentScore = environmentResearch.confidence * 100;
1264
+ const overallScore = baseScore * 0.7 + environmentScore * 0.3;
1265
+ const isReady = allBlockers.filter(b => b.blocksDeployment).length === 0;
1166
1266
  const result = {
1167
1267
  isDeploymentReady: isReady,
1168
1268
  overallScore,
1169
- confidence: Math.min(testResult.confidence, historyResult.confidence),
1269
+ confidence: Math.min(testResult.confidence, historyResult.confidence, environmentResearch.confidence * 100),
1170
1270
  codeQualityAnalysis: testResult.codeQualityAnalysis,
1171
1271
  testValidationResult: testResult.testValidationResult,
1172
1272
  deploymentHistoryAnalysis: historyResult.deploymentHistoryAnalysis,
@@ -1174,12 +1274,13 @@ ${deploymentCriticalFiles.length > 0
1174
1274
  criticalBlockers: allBlockers.filter(b => b.severity === 'critical'),
1175
1275
  testFailureBlockers: testResult.testFailureBlockers,
1176
1276
  deploymentHistoryBlockers: historyResult.deploymentHistoryBlockers,
1177
- warnings: [...testResult.warnings, ...historyResult.warnings],
1277
+ warnings: [...testResult.warnings, ...historyResult.warnings, ...environmentResearch.warnings],
1178
1278
  todoTasksCreated: [],
1179
1279
  healthScoreUpdate: {},
1180
1280
  gitPushStatus: isReady ? 'allowed' : 'blocked',
1181
1281
  overrideStatus: {},
1182
1282
  smartCodeAnalysis, // Include Smart Code Linking analysis
1283
+ environmentResearch, // Include environment research results
1183
1284
  };
1184
1285
  return result;
1185
1286
  }
@@ -1367,6 +1468,29 @@ function generateSuccessResponse(result, args) {
1367
1468
  - **ADRs Analyzed**: ${result.adrComplianceResult.compliantAdrs}/${result.adrComplianceResult.totalAdrs}
1368
1469
  - **Missing Implementations**: ${result.adrComplianceResult.missingImplementations.length} items
1369
1470
 
1471
+ ${result.environmentResearch
1472
+ ? `
1473
+ ## šŸ” Environment Research Analysis
1474
+
1475
+ **Research Confidence**: ${(result.environmentResearch.confidence * 100).toFixed(1)}%
1476
+
1477
+ ### Infrastructure State
1478
+ ${result.environmentResearch.answer}
1479
+
1480
+ ### Sources Consulted
1481
+ ${result.environmentResearch.sources.map(s => `- ${s.type}: ${s.found ? 'āœ… Available' : 'āŒ Not found'}`).join('\n')}
1482
+
1483
+ ${result.environmentResearch.warnings.length > 0
1484
+ ? `### Environment Warnings
1485
+ ${result.environmentResearch.warnings.map(w => `- āš ļø ${w}`).join('\n')}`
1486
+ : '### Environment Status\nāœ… All environment checks passed'}
1487
+
1488
+ ${result.environmentResearch.needsWebSearch
1489
+ ? 'āš ļø **Note**: Local environment data may be insufficient - consider external verification'
1490
+ : ''}
1491
+ `
1492
+ : ''}
1493
+
1370
1494
  ${result.smartCodeAnalysis || ''}
1371
1495
 
1372
1496
  ## šŸš€ Deployment Approved
@@ -1421,6 +1545,29 @@ ${result.deploymentHistoryAnalysis.failurePatterns.map(p => `- **${p.pattern}**:
1421
1545
  `
1422
1546
  : 'āœ… Deployment history stable'}
1423
1547
 
1548
+ ${result.environmentResearch
1549
+ ? `
1550
+ ## šŸ” Environment Research Analysis
1551
+
1552
+ **Research Confidence**: ${(result.environmentResearch.confidence * 100).toFixed(1)}%
1553
+
1554
+ ### Infrastructure State
1555
+ ${result.environmentResearch.answer}
1556
+
1557
+ ### Sources Consulted
1558
+ ${result.environmentResearch.sources.map(s => `- ${s.type}: ${s.found ? 'āœ… Available' : 'āŒ Not found'}`).join('\n')}
1559
+
1560
+ ${result.environmentResearch.warnings.length > 0
1561
+ ? `### Environment Warnings
1562
+ ${result.environmentResearch.warnings.map(w => `- āš ļø ${w}`).join('\n')}`
1563
+ : '### Environment Status\nāœ… All environment checks passed'}
1564
+
1565
+ ${result.environmentResearch.needsWebSearch
1566
+ ? 'āš ļø **Note**: Local environment data may be insufficient - consider external verification'
1567
+ : ''}
1568
+ `
1569
+ : ''}
1570
+
1424
1571
  ${result.smartCodeAnalysis || ''}
1425
1572
 
1426
1573
  ## 🚨 Critical Blockers (Must Fix Before Deployment)