mcp-adr-analysis-server 2.0.3 → 2.0.6
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/dist/src/index.d.ts +28 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +703 -325
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/adr-suggestion-prompts.d.ts +1 -0
- package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -1
- package/dist/src/prompts/adr-suggestion-prompts.js +14 -6
- package/dist/src/prompts/adr-suggestion-prompts.js.map +1 -1
- package/dist/src/resources/index.d.ts.map +1 -1
- package/dist/src/resources/index.js +31 -15
- package/dist/src/resources/index.js.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.d.ts +4 -1
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.js +72 -114
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
- package/dist/src/tools/content-masking-tool.d.ts +7 -0
- package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
- package/dist/src/tools/content-masking-tool.js +134 -17
- package/dist/src/tools/content-masking-tool.js.map +1 -1
- package/dist/src/tools/deployment-guidance-tool.d.ts +21 -0
- package/dist/src/tools/deployment-guidance-tool.d.ts.map +1 -0
- package/dist/src/tools/deployment-guidance-tool.js +289 -0
- package/dist/src/tools/deployment-guidance-tool.js.map +1 -0
- package/dist/src/tools/environment-analysis-tool.d.ts +4 -0
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/environment-analysis-tool.js +209 -25
- package/dist/src/tools/environment-analysis-tool.js.map +1 -1
- package/dist/src/tools/research-question-tool.d.ts +4 -0
- package/dist/src/tools/research-question-tool.d.ts.map +1 -1
- package/dist/src/tools/research-question-tool.js +42 -4
- package/dist/src/tools/research-question-tool.js.map +1 -1
- package/dist/src/tools/rule-generation-tool.d.ts +4 -0
- package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
- package/dist/src/tools/rule-generation-tool.js +136 -16
- package/dist/src/tools/rule-generation-tool.js.map +1 -1
- package/dist/src/tools/todo-management-tool.d.ts +166 -0
- package/dist/src/tools/todo-management-tool.d.ts.map +1 -0
- package/dist/src/tools/todo-management-tool.js +472 -0
- package/dist/src/tools/todo-management-tool.js.map +1 -0
- package/dist/src/types/conversation-context.d.ts +93 -0
- package/dist/src/types/conversation-context.d.ts.map +1 -0
- package/dist/src/types/conversation-context.js +101 -0
- package/dist/src/types/conversation-context.js.map +1 -0
- package/dist/src/utils/actual-file-operations.d.ts +40 -0
- package/dist/src/utils/actual-file-operations.d.ts.map +1 -0
- package/dist/src/utils/actual-file-operations.js +309 -0
- package/dist/src/utils/actual-file-operations.js.map +1 -0
- package/dist/src/utils/adr-discovery.d.ts +36 -0
- package/dist/src/utils/adr-discovery.d.ts.map +1 -0
- package/dist/src/utils/adr-discovery.js +237 -0
- package/dist/src/utils/adr-discovery.js.map +1 -0
- package/dist/src/utils/adr-suggestions.d.ts +2 -1
- package/dist/src/utils/adr-suggestions.d.ts.map +1 -1
- package/dist/src/utils/adr-suggestions.js +8 -2
- package/dist/src/utils/adr-suggestions.js.map +1 -1
- package/dist/src/utils/apply-cot-enhancement.d.ts +46 -0
- package/dist/src/utils/apply-cot-enhancement.d.ts.map +1 -0
- package/dist/src/utils/apply-cot-enhancement.js +165 -0
- package/dist/src/utils/apply-cot-enhancement.js.map +1 -0
- package/dist/src/utils/chain-of-thought-template.d.ts +48 -0
- package/dist/src/utils/chain-of-thought-template.d.ts.map +1 -0
- package/dist/src/utils/chain-of-thought-template.js +191 -0
- package/dist/src/utils/chain-of-thought-template.js.map +1 -0
- package/dist/src/utils/deployment-analysis.d.ts +1 -0
- package/dist/src/utils/deployment-analysis.d.ts.map +1 -1
- package/dist/src/utils/deployment-analysis.js +82 -39
- package/dist/src/utils/deployment-analysis.js.map +1 -1
- package/dist/src/utils/environment-analysis.d.ts +6 -1
- package/dist/src/utils/environment-analysis.d.ts.map +1 -1
- package/dist/src/utils/environment-analysis.js +176 -87
- package/dist/src/utils/environment-analysis.js.map +1 -1
- package/dist/src/utils/file-system.d.ts +1 -0
- package/dist/src/utils/file-system.d.ts.map +1 -1
- package/dist/src/utils/file-system.js +24 -47
- package/dist/src/utils/file-system.js.map +1 -1
- package/dist/src/utils/prompt-execution.d.ts.map +1 -1
- package/dist/src/utils/prompt-execution.js +67 -3
- package/dist/src/utils/prompt-execution.js.map +1 -1
- package/dist/src/utils/research-integration.d.ts +4 -0
- package/dist/src/utils/research-integration.d.ts.map +1 -1
- package/dist/src/utils/research-integration.js +275 -84
- package/dist/src/utils/research-integration.js.map +1 -1
- package/dist/src/utils/research-questions.d.ts.map +1 -1
- package/dist/src/utils/research-questions.js +134 -38
- package/dist/src/utils/research-questions.js.map +1 -1
- package/dist/src/utils/rule-generation.d.ts +2 -1
- package/dist/src/utils/rule-generation.d.ts.map +1 -1
- package/dist/src/utils/rule-generation.js +65 -36
- package/dist/src/utils/rule-generation.js.map +1 -1
- package/package.json +5 -5
|
@@ -3,52 +3,132 @@
|
|
|
3
3
|
* Implements intelligent environment context analysis and compliance assessment
|
|
4
4
|
*/
|
|
5
5
|
import { McpAdrError } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to get file extension for syntax highlighting
|
|
8
|
+
*/
|
|
9
|
+
function getFileExtension(filename) {
|
|
10
|
+
const ext = filename.split('.').pop()?.toLowerCase();
|
|
11
|
+
const mapping = {
|
|
12
|
+
'json': 'json',
|
|
13
|
+
'yml': 'yaml',
|
|
14
|
+
'yaml': 'yaml',
|
|
15
|
+
'js': 'javascript',
|
|
16
|
+
'ts': 'typescript',
|
|
17
|
+
'py': 'python',
|
|
18
|
+
'md': 'markdown',
|
|
19
|
+
'dockerfile': 'dockerfile',
|
|
20
|
+
'toml': 'toml',
|
|
21
|
+
'xml': 'xml',
|
|
22
|
+
'sh': 'bash',
|
|
23
|
+
'bash': 'bash',
|
|
24
|
+
'zsh': 'bash',
|
|
25
|
+
'fish': 'fish',
|
|
26
|
+
'ps1': 'powershell',
|
|
27
|
+
'bat': 'batch',
|
|
28
|
+
'cmd': 'batch'
|
|
29
|
+
};
|
|
30
|
+
return mapping[ext || ''] || 'bash'; // Default to bash for script files
|
|
31
|
+
}
|
|
6
32
|
/**
|
|
7
33
|
* Analyze system environment specifications
|
|
8
34
|
*/
|
|
9
35
|
export async function analyzeEnvironmentSpecs(projectPath = process.cwd()) {
|
|
10
36
|
try {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
37
|
+
// Use actual file operations to scan project structure
|
|
38
|
+
const { scanProjectStructure, findActualEnvironmentFiles } = await import('./actual-file-operations.js');
|
|
39
|
+
// Actually read environment files
|
|
40
|
+
const environmentFiles = await findActualEnvironmentFiles(projectPath);
|
|
41
|
+
const projectStructure = await scanProjectStructure(projectPath, { readContent: true });
|
|
16
42
|
const analysisPrompt = `
|
|
17
43
|
# Environment Specification Analysis
|
|
18
44
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Project Analysis Instructions
|
|
22
|
-
|
|
23
|
-
${projectAnalysisPrompt.prompt}
|
|
24
|
-
|
|
25
|
-
## Implementation Steps
|
|
45
|
+
Based on actual file system analysis, here are the findings:
|
|
26
46
|
|
|
27
|
-
|
|
47
|
+
## Project Structure
|
|
48
|
+
- **Root Path**: ${projectStructure.rootPath}
|
|
49
|
+
- **Total Files Analyzed**: ${projectStructure.totalFiles}
|
|
50
|
+
- **Directories**: ${projectStructure.directories.join(', ')}
|
|
28
51
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
${
|
|
52
|
+
## Package Management
|
|
53
|
+
${projectStructure.packageFiles.length > 0 ?
|
|
54
|
+
projectStructure.packageFiles.map(f => `
|
|
55
|
+
### ${f.filename}
|
|
56
|
+
\`\`\`${getFileExtension(f.filename)}
|
|
57
|
+
${f.content.slice(0, 1000)}${f.content.length > 1000 ? '\n... (truncated)' : ''}
|
|
58
|
+
\`\`\`
|
|
59
|
+
`).join('\n') : '- No package files found'}
|
|
60
|
+
|
|
61
|
+
## Docker Configuration
|
|
62
|
+
${projectStructure.dockerFiles.length > 0 ?
|
|
63
|
+
projectStructure.dockerFiles.map(f => `
|
|
64
|
+
### ${f.filename}
|
|
65
|
+
\`\`\`${getFileExtension(f.filename)}
|
|
66
|
+
${f.content.slice(0, 1000)}${f.content.length > 1000 ? '\n... (truncated)' : ''}
|
|
67
|
+
\`\`\`
|
|
68
|
+
`).join('\n') : '- No Docker files found'}
|
|
69
|
+
|
|
70
|
+
## Environment Configuration
|
|
71
|
+
${environmentFiles.filter(f => f.filename.includes('.env')).length > 0 ?
|
|
72
|
+
environmentFiles.filter(f => f.filename.includes('.env')).map(f => `
|
|
73
|
+
### ${f.filename}
|
|
74
|
+
\`\`\`bash
|
|
75
|
+
${f.content.slice(0, 500)}${f.content.length > 500 ? '\n... (truncated)' : ''}
|
|
76
|
+
\`\`\`
|
|
77
|
+
`).join('\n') : '- No environment files found'}
|
|
78
|
+
|
|
79
|
+
## Kubernetes Manifests
|
|
80
|
+
${projectStructure.kubernetesFiles.length > 0 ?
|
|
81
|
+
projectStructure.kubernetesFiles.map(f => `
|
|
82
|
+
### ${f.filename}
|
|
83
|
+
\`\`\`yaml
|
|
84
|
+
${f.content.slice(0, 800)}${f.content.length > 800 ? '\n... (truncated)' : ''}
|
|
85
|
+
\`\`\`
|
|
86
|
+
`).join('\n') : '- No Kubernetes manifests found'}
|
|
87
|
+
|
|
88
|
+
## CI/CD Configuration
|
|
89
|
+
${projectStructure.ciFiles.length > 0 ?
|
|
90
|
+
projectStructure.ciFiles.map(f => `
|
|
91
|
+
### ${f.filename}
|
|
92
|
+
\`\`\`yaml
|
|
93
|
+
${f.content.slice(0, 600)}${f.content.length > 600 ? '\n... (truncated)' : ''}
|
|
94
|
+
\`\`\`
|
|
95
|
+
`).join('\n') : '- No CI/CD files found'}
|
|
96
|
+
|
|
97
|
+
## Shell Scripts & Automation
|
|
98
|
+
${projectStructure.scriptFiles.length > 0 ?
|
|
99
|
+
projectStructure.scriptFiles.map(f => `
|
|
100
|
+
### ${f.filename}
|
|
101
|
+
\`\`\`${getFileExtension(f.filename)}
|
|
102
|
+
${f.content.slice(0, 800)}${f.content.length > 800 ? '\n... (truncated)' : ''}
|
|
103
|
+
\`\`\`
|
|
104
|
+
`).join('\n') : '- No shell scripts found'}
|
|
33
105
|
|
|
34
106
|
## Analysis Requirements
|
|
35
107
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
108
|
+
Please analyze the above **actual file contents** to:
|
|
109
|
+
|
|
110
|
+
1. **Infrastructure Assessment**: Determine deployment patterns and infrastructure requirements
|
|
111
|
+
2. **Containerization Analysis**: Evaluate Docker and container orchestration setup
|
|
112
|
+
3. **Environment Configuration**: Analyze environment variables and configuration management
|
|
113
|
+
4. **Security Review**: Identify security configurations and potential vulnerabilities
|
|
114
|
+
5. **Scalability Assessment**: Evaluate scalability and performance characteristics
|
|
115
|
+
6. **Compliance Check**: Assess adherence to best practices and standards
|
|
116
|
+
7. **Optimization Recommendations**: Suggest improvements for deployment and operations
|
|
42
117
|
`;
|
|
43
118
|
const instructions = `
|
|
44
119
|
# Environment Specification Analysis Instructions
|
|
45
120
|
|
|
46
|
-
This analysis
|
|
121
|
+
This analysis provides **actual file contents** from the project for comprehensive environment assessment.
|
|
47
122
|
|
|
48
123
|
## Analysis Scope
|
|
49
124
|
- **Project Path**: ${projectPath}
|
|
50
125
|
- **Environment Files**: ${environmentFiles.length} files found
|
|
51
|
-
- **
|
|
126
|
+
- **Package Files**: ${projectStructure.packageFiles.length} found
|
|
127
|
+
- **Docker Files**: ${projectStructure.dockerFiles.length} found
|
|
128
|
+
- **Kubernetes Files**: ${projectStructure.kubernetesFiles.length} found
|
|
129
|
+
- **CI/CD Files**: ${projectStructure.ciFiles.length} found
|
|
130
|
+
- **Script Files**: ${projectStructure.scriptFiles.length} found
|
|
131
|
+
- **Total Files Analyzed**: ${projectStructure.totalFiles}
|
|
52
132
|
|
|
53
133
|
## Discovered Files
|
|
54
134
|
${environmentFiles.map(f => `- **${f.filename}** (${f.type}): ${f.path}`).join('\n')}
|
|
@@ -80,6 +160,19 @@ const result = await analyzeEnvironmentSpecs(projectPath);
|
|
|
80
160
|
return {
|
|
81
161
|
analysisPrompt,
|
|
82
162
|
instructions,
|
|
163
|
+
actualData: {
|
|
164
|
+
projectStructure,
|
|
165
|
+
environmentFiles,
|
|
166
|
+
summary: {
|
|
167
|
+
totalFiles: projectStructure.totalFiles,
|
|
168
|
+
packageFiles: projectStructure.packageFiles.length,
|
|
169
|
+
dockerFiles: projectStructure.dockerFiles.length,
|
|
170
|
+
kubernetesFiles: projectStructure.kubernetesFiles.length,
|
|
171
|
+
ciFiles: projectStructure.ciFiles.length,
|
|
172
|
+
scriptFiles: projectStructure.scriptFiles.length,
|
|
173
|
+
environmentFiles: environmentFiles.length
|
|
174
|
+
}
|
|
175
|
+
}
|
|
83
176
|
};
|
|
84
177
|
}
|
|
85
178
|
catch (error) {
|
|
@@ -91,34 +184,42 @@ const result = await analyzeEnvironmentSpecs(projectPath);
|
|
|
91
184
|
*/
|
|
92
185
|
export async function detectContainerization(projectPath = process.cwd()) {
|
|
93
186
|
try {
|
|
94
|
-
const {
|
|
95
|
-
//
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
187
|
+
const { scanProjectStructure } = await import('./actual-file-operations.js');
|
|
188
|
+
// Use actual project structure scanning
|
|
189
|
+
const projectStructure = await scanProjectStructure(projectPath, {
|
|
190
|
+
readContent: true,
|
|
191
|
+
includeHidden: false
|
|
192
|
+
});
|
|
193
|
+
// Get container-related files
|
|
194
|
+
const containerFiles = [
|
|
195
|
+
...projectStructure.dockerFiles,
|
|
196
|
+
...projectStructure.kubernetesFiles
|
|
197
|
+
];
|
|
198
|
+
let containerAnalysis = '';
|
|
199
|
+
if (containerFiles.length > 0) {
|
|
200
|
+
containerAnalysis = `Found ${containerFiles.length} container-related files:\n\n`;
|
|
201
|
+
containerFiles.forEach(file => {
|
|
202
|
+
containerAnalysis += `### ${file.filename}\n`;
|
|
203
|
+
containerAnalysis += `- **Path**: ${file.relativePath}\n`;
|
|
204
|
+
containerAnalysis += `- **Type**: ${file.type}\n`;
|
|
205
|
+
containerAnalysis += `- **Size**: ${file.size} bytes\n`;
|
|
206
|
+
if (file.content && file.content !== '[Binary or unreadable file]') {
|
|
207
|
+
containerAnalysis += `- **Content**:\n\`\`\`\n${file.content.substring(0, 1000)}${file.content.length > 1000 ? '...' : ''}\n\`\`\`\n\n`;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
containerAnalysis += `- **Content**: Binary or unreadable\n\n`;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
containerAnalysis = 'No containerization files found in the project.\n\n';
|
|
216
|
+
}
|
|
110
217
|
const detectionPrompt = `
|
|
111
218
|
# Containerization Detection and Analysis
|
|
112
219
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
## File Discovery Instructions
|
|
116
|
-
|
|
117
|
-
${containerFileDiscoveryPrompt.prompt}
|
|
220
|
+
## Container File Analysis Results
|
|
118
221
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
${containerFileDiscoveryPrompt.instructions}
|
|
222
|
+
${containerAnalysis}
|
|
122
223
|
|
|
123
224
|
## Analysis Requirements
|
|
124
225
|
|
|
@@ -177,25 +278,37 @@ const result = await detectContainerization(projectPath);
|
|
|
177
278
|
/**
|
|
178
279
|
* Determine environment requirements from ADRs
|
|
179
280
|
*/
|
|
180
|
-
export async function determineEnvironmentRequirements(adrDirectory = 'docs/adrs') {
|
|
281
|
+
export async function determineEnvironmentRequirements(adrDirectory = 'docs/adrs', projectPath = process.cwd()) {
|
|
181
282
|
try {
|
|
182
|
-
const {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
283
|
+
const { discoverAdrsInDirectory } = await import('./adr-discovery.js');
|
|
284
|
+
const path = await import('path');
|
|
285
|
+
// Use absolute path for ADR directory
|
|
286
|
+
const absoluteAdrPath = path.isAbsolute(adrDirectory)
|
|
287
|
+
? adrDirectory
|
|
288
|
+
: path.resolve(projectPath, adrDirectory);
|
|
289
|
+
// Use actual ADR discovery
|
|
290
|
+
const discoveryResult = await discoverAdrsInDirectory(absoluteAdrPath, true, projectPath);
|
|
291
|
+
let adrAnalysis = '';
|
|
292
|
+
if (discoveryResult.adrs.length > 0) {
|
|
293
|
+
adrAnalysis = `Found ${discoveryResult.adrs.length} ADRs to analyze for environment requirements:\n\n`;
|
|
294
|
+
discoveryResult.adrs.forEach(adr => {
|
|
295
|
+
adrAnalysis += `### ${adr.title}\n`;
|
|
296
|
+
adrAnalysis += `- **File**: ${adr.filename}\n`;
|
|
297
|
+
adrAnalysis += `- **Status**: ${adr.status}\n`;
|
|
298
|
+
adrAnalysis += `- **Context**: ${adr.context}\n`;
|
|
299
|
+
adrAnalysis += `- **Decision**: ${adr.decision}\n`;
|
|
300
|
+
adrAnalysis += `- **Consequences**: ${adr.consequences}\n\n`;
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
adrAnalysis = `No ADRs found in ${absoluteAdrPath}. Cannot determine environment requirements from ADRs.\n\n`;
|
|
305
|
+
}
|
|
187
306
|
const requirementsPrompt = `
|
|
188
307
|
# Environment Requirements Analysis
|
|
189
308
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
## File Discovery Instructions
|
|
309
|
+
## ADR Analysis Results
|
|
193
310
|
|
|
194
|
-
${
|
|
195
|
-
|
|
196
|
-
## Implementation Steps
|
|
197
|
-
|
|
198
|
-
${adrFileDiscoveryPrompt.instructions}
|
|
311
|
+
${adrAnalysis}
|
|
199
312
|
|
|
200
313
|
## Requirements Analysis
|
|
201
314
|
|
|
@@ -314,29 +427,5 @@ const result = await assessEnvironmentCompliance(environment, requirements, stan
|
|
|
314
427
|
* Find environment-related files in the project
|
|
315
428
|
* Returns mock data for prompt-driven architecture
|
|
316
429
|
*/
|
|
317
|
-
async function findEnvironmentFiles(projectPath) {
|
|
318
|
-
// Return mock environment files for prompt-driven architecture
|
|
319
|
-
// The actual file discovery will be handled by AI agents through prompts
|
|
320
|
-
return [
|
|
321
|
-
{
|
|
322
|
-
filename: 'Dockerfile',
|
|
323
|
-
content: '',
|
|
324
|
-
path: `${projectPath}/Dockerfile`,
|
|
325
|
-
type: 'dockerfile',
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
filename: 'docker-compose.yml',
|
|
329
|
-
content: '',
|
|
330
|
-
path: `${projectPath}/docker-compose.yml`,
|
|
331
|
-
type: 'compose',
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
filename: '.env',
|
|
335
|
-
content: '',
|
|
336
|
-
path: `${projectPath}/.env`,
|
|
337
|
-
type: 'config',
|
|
338
|
-
},
|
|
339
|
-
];
|
|
340
|
-
}
|
|
341
430
|
// Removed unused function determineFileType
|
|
342
431
|
//# sourceMappingURL=environment-analysis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-analysis.js","sourceRoot":"","sources":["../../../src/utils/environment-analysis.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"environment-analysis.js","sourceRoot":"","sources":["../../../src/utils/environment-analysis.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,SAAS,gBAAgB,C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AiB,EACjB,iBAA4B;IAE5B,IAAI,CAAC;QACH,MAAM,EAAE,mCAAmC,EAAE,GAAG,MAAM,MAAM,CAC1D,4CAA4C,CAC7C,CAAC;QAEF,MAAM,gBAAgB,GAAG,mCAAmC,CAC1D,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,CAClB,CAAC;QAEF,MAAM,YAAY,GAAG;;;;;;;;4BAQG,iBAAiB,EAAE,MAAM,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BzD,CAAC;QAEE,OAAO;YACL,gBAAgB;YAChB,YAAY;SACb,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CACnB,4CAA4C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACpG,6BAA6B,CAC9B,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;GAGG;AAEH,4CAA4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../../src/utils/file-system.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../../src/utils/file-system.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB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AAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,CAqMlI;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;CAmChB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File system utilities for MCP ADR Analysis Server
|
|
3
3
|
* Generates prompts for AI-driven file discovery, reading, and analysis operations
|
|
4
|
+
* Enhanced with Chain-of-Thought prompting to reduce LLM confusion
|
|
4
5
|
*/
|
|
5
6
|
import { dirname } from 'path';
|
|
6
7
|
import { FileSystemError } from '../types/index.js';
|
|
8
|
+
import { enhancePromptWithCoT, COT_PATTERNS } from './chain-of-thought-template.js';
|
|
7
9
|
/**
|
|
8
10
|
* Generate prompt for AI-driven project structure analysis
|
|
9
11
|
*/
|
|
@@ -27,54 +29,37 @@ export async function analyzeProjectStructure(projectPath) {
|
|
|
27
29
|
];
|
|
28
30
|
console.error(`[DEBUG] Generated prompt for file patterns:`, filePatterns);
|
|
29
31
|
console.error(`[DEBUG] Target directory: ${safeProjectPath}`);
|
|
30
|
-
// Generate
|
|
31
|
-
const
|
|
32
|
+
// Generate Chain-of-Thought enhanced analysis prompt
|
|
33
|
+
const basePrompt = `
|
|
32
34
|
# Project Structure Analysis Request
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Path Resolution Instructions
|
|
37
|
-
|
|
38
|
-
The AI agent should:
|
|
39
|
-
1. **Resolve the project path safely**: If path is "." or "./", use the current working directory
|
|
40
|
-
2. **Validate path security**: Ensure the path is not a system directory (/, /usr, /bin, etc.)
|
|
41
|
-
3. **Handle relative paths**: Resolve relative paths from the current working directory
|
|
42
|
-
4. **Prevent unauthorized access**: Reject any attempts to scan system or sensitive directories
|
|
43
|
-
|
|
44
|
-
## Prerequisites
|
|
45
|
-
|
|
46
|
-
1. **Path Validation**: First verify the path exists and is accessible
|
|
47
|
-
- Check if the path exists and is a directory
|
|
48
|
-
- Report any access issues or invalid paths
|
|
49
|
-
- Proceed with analysis only if the path is valid
|
|
36
|
+
Analyze the project structure at: **${safeProjectPath}**
|
|
50
37
|
|
|
51
38
|
## Analysis Requirements
|
|
52
39
|
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
**File Discovery**: Scan the directory using the following patterns:
|
|
41
|
+
${filePatterns.map(pattern => ` - ${pattern}`).join('\n')}
|
|
55
42
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
**Technology Stack Detection**: Identify:
|
|
44
|
+
- Programming languages (based on file extensions)
|
|
45
|
+
- Frameworks and libraries (from package.json, requirements.txt, etc.)
|
|
46
|
+
- Build tools and configuration files
|
|
47
|
+
- Testing frameworks and tools
|
|
61
48
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
**Architectural Patterns**: Analyze:
|
|
50
|
+
- Directory structure and organization
|
|
51
|
+
- Code organization patterns (MVC, microservices, etc.)
|
|
52
|
+
- Configuration management approaches
|
|
53
|
+
- Documentation patterns
|
|
67
54
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
**Project Ecosystem**: Examine:
|
|
56
|
+
- Dependencies and package management
|
|
57
|
+
- Development tools and workflows
|
|
58
|
+
- CI/CD configurations
|
|
59
|
+
- Documentation and README files
|
|
73
60
|
|
|
74
61
|
## Expected Output Format
|
|
75
62
|
|
|
76
|
-
Please provide a structured analysis including:
|
|
77
|
-
|
|
78
63
|
\`\`\`json
|
|
79
64
|
{
|
|
80
65
|
"rootPath": "<resolved-absolute-path>",
|
|
@@ -109,17 +94,9 @@ Please provide a structured analysis including:
|
|
|
109
94
|
"summary": "Brief project description and key findings"
|
|
110
95
|
}
|
|
111
96
|
\`\`\`
|
|
112
|
-
|
|
113
|
-
## Analysis Instructions
|
|
114
|
-
|
|
115
|
-
1. Start by scanning the resolved project directory (safely resolve the provided path)
|
|
116
|
-
2. Apply the file patterns to exclude unnecessary files
|
|
117
|
-
3. Categorize files by type and purpose
|
|
118
|
-
4. Identify technology stack from file extensions and configuration files
|
|
119
|
-
5. Analyze directory structure for architectural patterns
|
|
120
|
-
6. Provide confidence scores for technology detection
|
|
121
|
-
7. Include evidence for all findings
|
|
122
97
|
`;
|
|
98
|
+
// Enhance the base prompt with Chain-of-Thought reasoning
|
|
99
|
+
const prompt = enhancePromptWithCoT(basePrompt, COT_PATTERNS.PROJECT_ANALYSIS);
|
|
123
100
|
const instructions = `
|
|
124
101
|
## Implementation Steps
|
|
125
102
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.js","sourceRoot":"","sources":["../../../src/utils/file-system.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"file-system.js","sourceRoot":"","sources":["../../../src/utils/file-system.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AA6BpF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,WAAmB;IAC/D,IAAI,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,wDAAwD,WAAW,EAAE,CAAC,CAAC;QAErF,kFAAkF;QAClF,MAAM,eAAe,GAAG,WAAW,IAAI,GAAG,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,kDAAkD,eAAe,EAAE,CAAC,CAAC;QAEnF,2FAA2F;QAE3F,oCAAoC;QACpC,MAAM,YAAY,GAAG;YACnB,MAAM;YACN,kBAAkB;YAClB,UAAU;YACV,UAAU;YACV,WAAW;YACX,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hC;
|
|
1
|
+
{"version":3,"file":"prompt-execution.d.ts","sourceRoot":"","sources":["../../../src/utils/prompt-execution.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAiB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGpE,MAAM,WAAW,sBAAsB;IACrC,oEAAoE;IACpE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,aAAa,EAAE,OAAO,CAAC;IACvB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC3C,mCAAmC;IACnC,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnC,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAyDhC;AA2FD;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAchC;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAchC;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAchC;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAchC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAOhD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CA6BA;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAeA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG;IAChE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD,CAuBA"}
|
|
@@ -67,10 +67,74 @@ export async function executePromptWithFallback(prompt, instructions, options =
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Standard context placeholders used across tools
|
|
71
71
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const STANDARD_CONTEXT_PLACEHOLDERS = [
|
|
73
|
+
{
|
|
74
|
+
placeholder: "{{userGoals}}",
|
|
75
|
+
description: "User's primary objectives from the conversation",
|
|
76
|
+
example: "microservices migration for better scalability"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
placeholder: "{{focusAreas}}",
|
|
80
|
+
description: "Specific areas of concern or interest",
|
|
81
|
+
example: "security, performance, maintainability"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
placeholder: "{{constraints}}",
|
|
85
|
+
description: "Limitations, compliance requirements, or restrictions",
|
|
86
|
+
example: "GDPR compliance required, budget under $50k, minimal downtime"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
placeholder: "{{projectPhase}}",
|
|
90
|
+
description: "Current project phase or stage",
|
|
91
|
+
example: "planning, development, migration, production"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
placeholder: "{{userRole}}",
|
|
95
|
+
description: "User's role or expertise level",
|
|
96
|
+
example: "senior architect, developer, project manager"
|
|
97
|
+
}
|
|
98
|
+
];
|
|
99
|
+
/**
|
|
100
|
+
* Format a prompt for external execution with enhanced LLM instructions
|
|
101
|
+
*/
|
|
102
|
+
function formatPromptForExternal(prompt, instructions, contextPlaceholders = STANDARD_CONTEXT_PLACEHOLDERS) {
|
|
103
|
+
// Check if prompt contains context placeholders
|
|
104
|
+
const hasPlaceholders = contextPlaceholders.some(cp => prompt.includes(cp.placeholder));
|
|
105
|
+
const response = {
|
|
106
|
+
executionMode: "prompt-only",
|
|
107
|
+
prompt: prompt,
|
|
108
|
+
instructions: {
|
|
109
|
+
howToUse: "Execute this prompt within your current conversation context to preserve user goals and discussion history",
|
|
110
|
+
contextIntegration: hasPlaceholders ?
|
|
111
|
+
"This prompt includes placeholders for conversation context. Replace them with relevant information from your discussion with the user before executing." :
|
|
112
|
+
"This prompt will work better if you provide context about the user's goals and constraints when executing it.",
|
|
113
|
+
expectedOutput: instructions,
|
|
114
|
+
bestPractices: [
|
|
115
|
+
"Maintain the user's stated objectives when executing this prompt",
|
|
116
|
+
"Include any constraints or preferences mentioned in the conversation",
|
|
117
|
+
"Consider the project phase and user's role when interpreting results",
|
|
118
|
+
"Tailor the analysis to address the user's specific concerns"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
...(hasPlaceholders && {
|
|
122
|
+
contextPlaceholders: contextPlaceholders.reduce((acc, cp) => ({
|
|
123
|
+
...acc,
|
|
124
|
+
[cp.placeholder]: {
|
|
125
|
+
description: cp.description,
|
|
126
|
+
example: cp.example
|
|
127
|
+
}
|
|
128
|
+
}), {}),
|
|
129
|
+
exampleUsage: `Before executing, customize the prompt. For example, replace:\n${contextPlaceholders.slice(0, 2).map(cp => ` ${cp.placeholder} → "${cp.example}"`).join('\n')}`
|
|
130
|
+
}),
|
|
131
|
+
tips: [
|
|
132
|
+
"The more context you provide, the more tailored and useful the analysis will be",
|
|
133
|
+
"Consider what the user has already discussed when executing this prompt",
|
|
134
|
+
"Focus the analysis on areas that matter most to the user's goals"
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
return JSON.stringify(response, null, 2);
|
|
74
138
|
}
|
|
75
139
|
/**
|
|
76
140
|
* Execute a prompt that expects structured ADR suggestions
|