mcp-adr-analysis-server 1.1.0 → 2.0.2

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 (118) hide show
  1. package/README.md +367 -150
  2. package/dist/src/config/ai-config.d.ts +81 -0
  3. package/dist/src/config/ai-config.d.ts.map +1 -0
  4. package/dist/src/config/ai-config.js +134 -0
  5. package/dist/src/config/ai-config.js.map +1 -0
  6. package/dist/src/index.d.ts +97 -1
  7. package/dist/src/index.d.ts.map +1 -1
  8. package/dist/src/index.js +2430 -186
  9. package/dist/src/index.js.map +1 -1
  10. package/dist/src/prompts/adr-suggestion-prompts.d.ts +2 -2
  11. package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -1
  12. package/dist/src/prompts/adr-suggestion-prompts.js +25 -17
  13. package/dist/src/prompts/adr-suggestion-prompts.js.map +1 -1
  14. package/dist/src/prompts/analysis-prompts.js +1 -1
  15. package/dist/src/prompts/analysis-prompts.js.map +1 -1
  16. package/dist/src/resources/index.d.ts +1 -1
  17. package/dist/src/resources/index.d.ts.map +1 -1
  18. package/dist/src/resources/index.js +52 -44
  19. package/dist/src/resources/index.js.map +1 -1
  20. package/dist/src/templates/domain-knowledge-templates.d.ts +36 -0
  21. package/dist/src/templates/domain-knowledge-templates.d.ts.map +1 -0
  22. package/dist/src/templates/domain-knowledge-templates.js +376 -0
  23. package/dist/src/templates/domain-knowledge-templates.js.map +1 -0
  24. package/dist/src/tools/adr-suggestion-tool.d.ts +8 -3
  25. package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
  26. package/dist/src/tools/adr-suggestion-tool.js +561 -172
  27. package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
  28. package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
  29. package/dist/src/tools/content-masking-tool.js +168 -22
  30. package/dist/src/tools/content-masking-tool.js.map +1 -1
  31. package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -1
  32. package/dist/src/tools/deployment-analysis-tool.js +64 -27
  33. package/dist/src/tools/deployment-analysis-tool.js.map +1 -1
  34. package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
  35. package/dist/src/tools/environment-analysis-tool.js +65 -29
  36. package/dist/src/tools/environment-analysis-tool.js.map +1 -1
  37. package/dist/src/tools/research-question-tool.d.ts.map +1 -1
  38. package/dist/src/tools/research-question-tool.js +150 -49
  39. package/dist/src/tools/research-question-tool.js.map +1 -1
  40. package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
  41. package/dist/src/tools/rule-generation-tool.js +328 -143
  42. package/dist/src/tools/rule-generation-tool.js.map +1 -1
  43. package/dist/src/types/ape-framework.d.ts +566 -0
  44. package/dist/src/types/ape-framework.d.ts.map +1 -0
  45. package/dist/src/types/ape-framework.js +98 -0
  46. package/dist/src/types/ape-framework.js.map +1 -0
  47. package/dist/src/types/index.d.ts +96 -93
  48. package/dist/src/types/index.d.ts.map +1 -1
  49. package/dist/src/types/knowledge-generation.d.ts +671 -0
  50. package/dist/src/types/knowledge-generation.d.ts.map +1 -0
  51. package/dist/src/types/knowledge-generation.js +107 -0
  52. package/dist/src/types/knowledge-generation.js.map +1 -0
  53. package/dist/src/types/reflexion-framework.d.ts +652 -0
  54. package/dist/src/types/reflexion-framework.d.ts.map +1 -0
  55. package/dist/src/types/reflexion-framework.js +85 -0
  56. package/dist/src/types/reflexion-framework.js.map +1 -0
  57. package/dist/src/utils/adr-suggestions.d.ts +1 -1
  58. package/dist/src/utils/adr-suggestions.d.ts.map +1 -1
  59. package/dist/src/utils/adr-suggestions.js +8 -50
  60. package/dist/src/utils/adr-suggestions.js.map +1 -1
  61. package/dist/src/utils/ai-executor.d.ts +125 -0
  62. package/dist/src/utils/ai-executor.d.ts.map +1 -0
  63. package/dist/src/utils/ai-executor.js +292 -0
  64. package/dist/src/utils/ai-executor.js.map +1 -0
  65. package/dist/src/utils/automatic-prompt-engineering.d.ts +72 -0
  66. package/dist/src/utils/automatic-prompt-engineering.d.ts.map +1 -0
  67. package/dist/src/utils/automatic-prompt-engineering.js +820 -0
  68. package/dist/src/utils/automatic-prompt-engineering.js.map +1 -0
  69. package/dist/src/utils/cache.d.ts +54 -22
  70. package/dist/src/utils/cache.d.ts.map +1 -1
  71. package/dist/src/utils/cache.js +1234 -143
  72. package/dist/src/utils/cache.js.map +1 -1
  73. package/dist/src/utils/config.d.ts +2 -2
  74. package/dist/src/utils/config.js +3 -3
  75. package/dist/src/utils/config.js.map +1 -1
  76. package/dist/src/utils/deployment-analysis.d.ts.map +1 -1
  77. package/dist/src/utils/deployment-analysis.js +57 -38
  78. package/dist/src/utils/deployment-analysis.js.map +1 -1
  79. package/dist/src/utils/environment-analysis.d.ts.map +1 -1
  80. package/dist/src/utils/environment-analysis.js +113 -100
  81. package/dist/src/utils/environment-analysis.js.map +1 -1
  82. package/dist/src/utils/file-system.d.ts +42 -13
  83. package/dist/src/utils/file-system.d.ts.map +1 -1
  84. package/dist/src/utils/file-system.js +795 -89
  85. package/dist/src/utils/file-system.js.map +1 -1
  86. package/dist/src/utils/index.d.ts +9 -0
  87. package/dist/src/utils/index.d.ts.map +1 -0
  88. package/dist/src/utils/index.js +13 -0
  89. package/dist/src/utils/index.js.map +1 -0
  90. package/dist/src/utils/knowledge-generation.d.ts +79 -0
  91. package/dist/src/utils/knowledge-generation.d.ts.map +1 -0
  92. package/dist/src/utils/knowledge-generation.js +646 -0
  93. package/dist/src/utils/knowledge-generation.js.map +1 -0
  94. package/dist/src/utils/output-masking.d.ts.map +1 -1
  95. package/dist/src/utils/output-masking.js +2 -1
  96. package/dist/src/utils/output-masking.js.map +1 -1
  97. package/dist/src/utils/prompt-composition.d.ts +234 -0
  98. package/dist/src/utils/prompt-composition.d.ts.map +1 -0
  99. package/dist/src/utils/prompt-composition.js +379 -0
  100. package/dist/src/utils/prompt-composition.js.map +1 -0
  101. package/dist/src/utils/prompt-execution.d.ts +88 -0
  102. package/dist/src/utils/prompt-execution.d.ts.map +1 -0
  103. package/dist/src/utils/prompt-execution.js +227 -0
  104. package/dist/src/utils/prompt-execution.js.map +1 -0
  105. package/dist/src/utils/reflexion.d.ts +92 -0
  106. package/dist/src/utils/reflexion.d.ts.map +1 -0
  107. package/dist/src/utils/reflexion.js +1100 -0
  108. package/dist/src/utils/reflexion.js.map +1 -0
  109. package/dist/src/utils/research-integration.d.ts.map +1 -1
  110. package/dist/src/utils/research-integration.js +156 -100
  111. package/dist/src/utils/research-integration.js.map +1 -1
  112. package/dist/src/utils/research-questions.d.ts.map +1 -1
  113. package/dist/src/utils/research-questions.js +85 -24
  114. package/dist/src/utils/research-questions.js.map +1 -1
  115. package/dist/src/utils/rule-generation.d.ts.map +1 -1
  116. package/dist/src/utils/rule-generation.js +92 -108
  117. package/dist/src/utils/rule-generation.js.map +1 -1
  118. package/package.json +9 -3
@@ -13,11 +13,76 @@ export async function generateRules(args) {
13
13
  switch (source) {
14
14
  case 'adrs': {
15
15
  const result = await extractRulesFromAdrs(adrDirectory, existingRules);
16
- return {
17
- content: [
18
- {
19
- type: 'text',
20
- text: `# Rule Generation: ADR-Based Rules
16
+ // Execute the rule extraction with AI if enabled, otherwise return prompt
17
+ const { executePromptWithFallback, formatMCPResponse } = await import('../utils/prompt-execution.js');
18
+ const executionResult = await executePromptWithFallback(result.extractionPrompt, result.instructions, {
19
+ temperature: 0.1,
20
+ maxTokens: 6000,
21
+ systemPrompt: `You are an expert software architect specializing in architectural rule extraction.
22
+ Analyze the provided ADRs to extract actionable architectural rules and governance policies.
23
+ Focus on creating specific, measurable rules that can be validated automatically.
24
+ Provide clear reasoning for each rule and practical implementation guidance.`,
25
+ responseFormat: 'text'
26
+ });
27
+ if (executionResult.isAIGenerated) {
28
+ // AI execution successful - return actual rule extraction results
29
+ return formatMCPResponse({
30
+ ...executionResult,
31
+ content: `# ADR-Based Rule Generation Results
32
+
33
+ ## Analysis Information
34
+ - **ADR Directory**: ${adrDirectory}
35
+ - **Existing Rules**: ${existingRules?.length || 0} rules
36
+ - **Output Format**: ${outputFormat.toUpperCase()}
37
+
38
+ ## AI Rule Extraction Results
39
+
40
+ ${executionResult.content}
41
+
42
+ ## Next Steps
43
+
44
+ Based on the extracted rules:
45
+
46
+ 1. **Review Generated Rules**: Examine each rule for accuracy and completeness
47
+ 2. **Save Rule Set**: Create ${outputFormat.toUpperCase()} files for the extracted rules
48
+ 3. **Implement Validation**: Set up automated rule checking in your CI/CD pipeline
49
+ 4. **Team Training**: Share rules with development team for adoption
50
+ 5. **Monitor Compliance**: Track rule adherence and adjust as needed
51
+
52
+ ## Integration Commands
53
+
54
+ To validate code against these rules, use:
55
+ \`\`\`json
56
+ {
57
+ "tool": "validate_rules",
58
+ "args": {
59
+ "filePath": "path/to/code/file.js",
60
+ "rules": [extracted rules from above]
61
+ }
62
+ }
63
+ \`\`\`
64
+
65
+ To create a machine-readable rule set:
66
+ \`\`\`json
67
+ {
68
+ "tool": "create_rule_set",
69
+ "args": {
70
+ "name": "ADR-Based Architectural Rules",
71
+ "adrRules": [extracted rules from above],
72
+ "outputFormat": "${outputFormat}"
73
+ }
74
+ }
75
+ \`\`\`
76
+ `,
77
+ });
78
+ }
79
+ else {
80
+ // Fallback to prompt-only mode
81
+ return {
82
+ content: [
83
+ {
84
+ type: 'text',
85
+ text: `# Rule Generation: ADR-Based Rules
21
86
 
22
87
  ${result.instructions}
23
88
 
@@ -32,49 +97,83 @@ ${result.extractionPrompt}
32
97
  3. **Review the rules** for accuracy and completeness
33
98
  4. **Save rules** in ${outputFormat.toUpperCase()} format using the rule format utilities
34
99
  5. **Integrate with validation tools** for automated compliance checking
100
+ `,
101
+ },
102
+ ],
103
+ };
104
+ }
105
+ }
106
+ case 'patterns': {
107
+ const existingRuleNames = existingRules?.map(r => r.name);
108
+ const result = await generateRulesFromPatterns(projectPath, existingRuleNames);
109
+ // Execute the pattern-based rule generation with AI if enabled, otherwise return prompt
110
+ const { executePromptWithFallback, formatMCPResponse } = await import('../utils/prompt-execution.js');
111
+ const executionResult = await executePromptWithFallback(result.generationPrompt, result.instructions, {
112
+ temperature: 0.1,
113
+ maxTokens: 6000,
114
+ systemPrompt: `You are an expert software architect specializing in code pattern analysis and rule generation.
115
+ Analyze the provided codebase to identify consistent patterns and generate actionable architectural rules.
116
+ Focus on creating rules that enforce consistency, quality, and maintainability based on observed patterns.
117
+ Provide confidence scores and practical implementation guidance for each rule.`,
118
+ responseFormat: 'text'
119
+ });
120
+ if (executionResult.isAIGenerated) {
121
+ // AI execution successful - return actual pattern-based rule generation results
122
+ return formatMCPResponse({
123
+ ...executionResult,
124
+ content: `# Pattern-Based Rule Generation Results
125
+
126
+ ## Analysis Information
127
+ - **Project Path**: ${projectPath}
128
+ - **Existing Rules**: ${existingRules?.length || 0} rules
129
+ - **Output Format**: ${outputFormat.toUpperCase()}
130
+
131
+ ## AI Pattern Analysis Results
132
+
133
+ ${executionResult.content}
35
134
 
36
- ## Expected Output
135
+ ## Next Steps
37
136
 
38
- The AI will provide:
39
- - **Extracted Rules**: Actionable architectural rules with validation patterns
40
- - **Rule Categories**: Organization and prioritization of rules
41
- - **Rule Dependencies**: Relationships between rules
42
- - **Validation Strategies**: Approaches for automated rule checking
43
- - **Implementation Guidance**: Prioritized rollout plan
137
+ Based on the pattern analysis:
44
138
 
45
- ## Rule Format
139
+ 1. **Review Generated Rules**: Examine each rule for relevance and accuracy
140
+ 2. **Validate Patterns**: Confirm patterns are representative of desired practices
141
+ 3. **Implement High-Confidence Rules**: Start with rules that have high confidence scores
142
+ 4. **Combine with ADR Rules**: Merge with ADR-extracted rules for comprehensive coverage
143
+ 5. **Set Up Validation**: Implement automated checking for pattern-based rules
46
144
 
47
- Rules will be provided in machine-readable format:
48
- - **JSON**: Structured data for tool integration
49
- - **YAML**: Human-readable format for documentation
50
- - **Validation Patterns**: Regex or logic patterns for automated checking
51
- - **Examples**: Valid and invalid code examples for each rule
145
+ ## Pattern-Based Benefits
146
+
147
+ These rules offer:
148
+ - **Consistency Enforcement**: Based on actual project patterns
149
+ - **Team Alignment**: Reflects current team practices
150
+ - **Gradual Improvement**: Incremental quality improvements
151
+ - **Automated Detection**: High automatability for validation tools
52
152
 
53
- ## Integration Workflow
153
+ ## Integration Commands
54
154
 
55
- After rule generation, use the validation tools:
155
+ To create a comprehensive rule set combining patterns and ADRs:
56
156
  \`\`\`json
57
157
  {
58
- "tool": "validate_rules",
158
+ "tool": "generate_rules",
59
159
  "args": {
60
- "filePath": "path/to/code/file.js",
61
- "rules": [extracted rules from AI response]
160
+ "source": "both",
161
+ "projectPath": "${projectPath}",
162
+ "adrDirectory": "${adrDirectory}",
163
+ "outputFormat": "${outputFormat}"
62
164
  }
63
165
  }
64
166
  \`\`\`
65
167
  `,
66
- },
67
- ],
68
- };
69
- }
70
- case 'patterns': {
71
- const existingRuleNames = existingRules?.map(r => r.name);
72
- const result = await generateRulesFromPatterns(projectPath, existingRuleNames);
73
- return {
74
- content: [
75
- {
76
- type: 'text',
77
- text: `# Rule Generation: Pattern-Based Rules
168
+ });
169
+ }
170
+ else {
171
+ // Fallback to prompt-only mode
172
+ return {
173
+ content: [
174
+ {
175
+ type: 'text',
176
+ text: `# Rule Generation: Pattern-Based Rules
78
177
 
79
178
  ${result.instructions}
80
179
 
@@ -89,44 +188,131 @@ ${result.generationPrompt}
89
188
  3. **Review pattern-based rules** for relevance and accuracy
90
189
  4. **Combine with ADR-extracted rules** for comprehensive rule set
91
190
  5. **Implement validation** for high-confidence rules
191
+ `,
192
+ },
193
+ ],
194
+ };
195
+ }
196
+ }
197
+ case 'both': {
198
+ const adrResult = await extractRulesFromAdrs(adrDirectory, existingRules);
199
+ const existingRuleNames = existingRules?.map(r => r.name);
200
+ const patternResult = await generateRulesFromPatterns(projectPath, existingRuleNames);
201
+ // Create comprehensive prompt combining both ADR and pattern analysis
202
+ const comprehensivePrompt = `
203
+ # Comprehensive Architectural Rule Generation
92
204
 
93
- ## Expected Output
205
+ Generate a complete set of architectural rules by analyzing both ADRs and code patterns.
94
206
 
95
- The AI will provide:
96
- - **Generated Rules**: Rules based on observed code patterns
97
- - **Pattern Analysis**: Analysis of code consistency and quality
98
- - **Rule Metrics**: Statistics about generated rules (confidence, automatability)
99
- - **Implementation Plan**: Phased approach for rule implementation
207
+ ## ADR-Based Rule Extraction
100
208
 
101
- ## Pattern-Based Benefits
209
+ ${adrResult.extractionPrompt}
102
210
 
103
- Pattern-based rules offer:
104
- - **Consistency Enforcement**: Based on actual project patterns
105
- - **Team Alignment**: Reflects current team practices
106
- - **Gradual Improvement**: Incremental quality improvements
107
- - **Automated Detection**: High automatability for validation tools
211
+ ## Pattern-Based Rule Generation
108
212
 
109
- ## Quality Assurance
213
+ ${patternResult.generationPrompt}
214
+
215
+ ## Consolidation Requirements
216
+
217
+ After extracting rules from both sources:
218
+
219
+ 1. **Merge and Deduplicate**: Combine rules from ADRs and patterns, removing duplicates
220
+ 2. **Resolve Conflicts**: When ADR rules conflict with pattern rules, prioritize ADR rules (explicit decisions)
221
+ 3. **Assign Priorities**: High priority for ADR rules, medium for consistent patterns, low for inconsistent patterns
222
+ 4. **Create Dependencies**: Identify relationships between rules and create dependency chains
223
+ 5. **Validate Completeness**: Ensure rules cover all major architectural concerns
224
+
225
+ ## Output Requirements
226
+
227
+ Provide a unified rule set with:
228
+ - **Rule Source**: Whether from ADR, pattern, or both
229
+ - **Confidence Score**: 1-10 rating of rule validity
230
+ - **Priority Level**: High/Medium/Low implementation priority
231
+ - **Validation Pattern**: How to automatically check compliance
232
+ - **Examples**: Valid and invalid code examples
233
+ - **Dependencies**: Other rules this rule depends on
234
+ `;
235
+ // Execute the comprehensive rule generation with AI if enabled, otherwise return prompt
236
+ const { executePromptWithFallback, formatMCPResponse } = await import('../utils/prompt-execution.js');
237
+ const executionResult = await executePromptWithFallback(comprehensivePrompt, `${adrResult.instructions}\n\n${patternResult.instructions}`, {
238
+ temperature: 0.1,
239
+ maxTokens: 8000,
240
+ systemPrompt: `You are an expert software architect specializing in comprehensive architectural rule generation.
241
+ Analyze both ADRs and code patterns to create a unified, actionable rule set for the project.
242
+ Focus on creating rules that are specific, measurable, and can be validated automatically.
243
+ Prioritize explicit architectural decisions (ADRs) over implicit patterns when conflicts arise.`,
244
+ responseFormat: 'text'
245
+ });
246
+ if (executionResult.isAIGenerated) {
247
+ // AI execution successful - return actual comprehensive rule generation results
248
+ return formatMCPResponse({
249
+ ...executionResult,
250
+ content: `# Comprehensive Rule Generation Results
251
+
252
+ ## Analysis Information
253
+ - **ADR Directory**: ${adrDirectory}
254
+ - **Project Path**: ${projectPath}
255
+ - **Existing Rules**: ${existingRules?.length || 0} rules
256
+ - **Output Format**: ${outputFormat.toUpperCase()}
257
+
258
+ ## AI Comprehensive Analysis Results
259
+
260
+ ${executionResult.content}
261
+
262
+ ## Next Steps
263
+
264
+ Based on the comprehensive analysis:
265
+
266
+ 1. **Review Unified Rule Set**: Examine the consolidated rules for completeness
267
+ 2. **Validate Rule Priorities**: Confirm priority assignments align with project needs
268
+ 3. **Implement High-Priority Rules**: Start with rules marked as high priority
269
+ 4. **Set Up Automated Validation**: Configure CI/CD to check rule compliance
270
+ 5. **Create Rule Documentation**: Document rules for team reference and training
271
+
272
+ ## Comprehensive Benefits
273
+
274
+ This approach provides:
275
+ - **Complete Coverage**: Both explicit (ADR) and implicit (pattern) rules
276
+ - **Balanced Approach**: Combines intentional decisions with observed practices
277
+ - **High Confidence**: Rules backed by both documentation and code evidence
278
+ - **Practical Implementation**: Rules that can be validated and enforced
279
+ - **Team Alignment**: Rules that reflect both intentions and reality
280
+
281
+ ## Integration Commands
282
+
283
+ To create the final rule set:
284
+ \`\`\`json
285
+ {
286
+ "tool": "create_rule_set",
287
+ "args": {
288
+ "name": "Comprehensive Architectural Rules",
289
+ "adrRules": [ADR rules from above],
290
+ "patternRules": [pattern rules from above],
291
+ "outputFormat": "${outputFormat}"
292
+ }
293
+ }
294
+ \`\`\`
110
295
 
111
- All generated rules include:
112
- - **Confidence Scores**: AI assessment of rule validity
113
- - **Evidence**: Specific code examples supporting the rule
114
- - **Frequency Data**: How often patterns appear in codebase
115
- - **Automation Feasibility**: Whether rule can be automatically validated
296
+ To validate code against the complete rule set:
297
+ \`\`\`json
298
+ {
299
+ "tool": "validate_rules",
300
+ "args": {
301
+ "filePath": "path/to/code/file.js",
302
+ "rules": [unified rules from above]
303
+ }
304
+ }
305
+ \`\`\`
116
306
  `,
117
- },
118
- ],
119
- };
120
- }
121
- case 'both': {
122
- const adrResult = await extractRulesFromAdrs(adrDirectory, existingRules);
123
- const existingRuleNames = existingRules?.map(r => r.name);
124
- const patternResult = await generateRulesFromPatterns(projectPath, existingRuleNames);
125
- return {
126
- content: [
127
- {
128
- type: 'text',
129
- text: `# Comprehensive Rule Generation
307
+ });
308
+ }
309
+ else {
310
+ // Fallback to prompt-only mode
311
+ return {
312
+ content: [
313
+ {
314
+ type: 'text',
315
+ text: `# Comprehensive Rule Generation
130
316
 
131
317
  This comprehensive analysis will generate architectural rules from both ADRs and code patterns for complete coverage.
132
318
 
@@ -159,45 +345,11 @@ Submit the pattern analysis prompt to generate rules from code patterns
159
345
  - Remove duplicates and conflicts
160
346
  - Prioritize based on confidence and impact
161
347
  - Create unified rule set with dependencies
162
-
163
- ### 4. **Rule Set Creation**
164
- Use the rule format utilities to create machine-readable rule sets:
165
- \`\`\`json
166
- {
167
- "tool": "create_rule_set",
168
- "args": {
169
- "name": "Project Architectural Rules",
170
- "adrRules": [rules from step 1],
171
- "patternRules": [rules from step 2],
172
- "outputFormat": "${outputFormat}"
173
- }
174
- }
175
- \`\`\`
176
-
177
- ### 5. **Validation Implementation**
178
- Apply the complete rule set for code validation and compliance checking
179
-
180
- ## Expected Outcomes
181
-
182
- This comprehensive approach will provide:
183
- - **Complete Rule Coverage**: Both explicit (ADR) and implicit (pattern) rules
184
- - **Balanced Approach**: Combines intentional decisions with observed practices
185
- - **High Confidence**: Rules backed by both documentation and code evidence
186
- - **Practical Implementation**: Rules that can be validated and enforced
187
- - **Team Alignment**: Rules that reflect both intentions and reality
188
-
189
- ## Quality Assurance
190
-
191
- All rules will include:
192
- - **Source Traceability**: Clear link to ADRs or code patterns
193
- - **Validation Patterns**: Automated checking capabilities
194
- - **Examples**: Valid and invalid implementations
195
- - **Priority Levels**: Implementation priority based on impact
196
- - **Confidence Scores**: AI assessment of rule validity and importance
197
348
  `,
198
- },
199
- ],
200
- };
349
+ },
350
+ ],
351
+ };
352
+ }
201
353
  }
202
354
  default:
203
355
  throw new McpAdrError(`Unknown rule generation source: ${source}`, 'INVALID_INPUT');
@@ -250,41 +402,42 @@ export async function validateRules(args) {
250
402
  instructions: `Validation for ${tempFileName} with ${rules.length} rules`,
251
403
  };
252
404
  }
253
- return {
254
- content: [
255
- {
256
- type: 'text',
257
- text: `# Code Validation Against Architectural Rules
258
-
259
- ${result.instructions}
260
-
261
- ## AI Validation Prompt
262
-
263
- ${result.validationPrompt}
264
-
265
- ## Next Steps
266
-
267
- 1. **Submit the validation prompt** to an AI agent for comprehensive analysis
268
- 2. **Parse the JSON response** to get validation results and violations
269
- 3. **Review violations** and prioritize fixes based on severity
270
- 4. **Apply suggested fixes** to improve compliance
271
- 5. **Re-validate** to confirm improvements
272
-
273
- ## Validation Details
274
-
405
+ // Execute the rule validation with AI if enabled, otherwise return prompt
406
+ const { executePromptWithFallback, formatMCPResponse } = await import('../utils/prompt-execution.js');
407
+ const executionResult = await executePromptWithFallback(result.validationPrompt, result.instructions, {
408
+ temperature: 0.1,
409
+ maxTokens: 5000,
410
+ systemPrompt: `You are a senior software architect specializing in code quality and architectural compliance.
411
+ Analyze the provided code against architectural rules to identify violations and provide improvement recommendations.
412
+ Focus on providing specific, actionable feedback with clear explanations and fix suggestions.
413
+ Prioritize violations by severity and impact on system architecture.`,
414
+ responseFormat: 'text'
415
+ });
416
+ if (executionResult.isAIGenerated) {
417
+ // AI execution successful - return actual rule validation results
418
+ return formatMCPResponse({
419
+ ...executionResult,
420
+ content: `# Code Validation Results
421
+
422
+ ## Validation Information
275
423
  - **File**: ${fileName || filePath || 'Content provided'}
276
424
  - **Validation Type**: ${validationType}
277
425
  - **Rules Applied**: ${rules.length} rules
278
426
  - **Report Format**: ${reportFormat}
279
427
 
280
- ## Expected Output
428
+ ## AI Validation Results
281
429
 
282
- The AI will provide:
283
- - **Validation Results**: Overall compliance scores and metrics
284
- - **Violations**: Specific rule violations with locations and suggestions
285
- - **Compliance**: Rules that were successfully followed
286
- - **Recommendations**: Prioritized improvement suggestions
287
- - **Quality Metrics**: Code quality and maintainability scores
430
+ ${executionResult.content}
431
+
432
+ ## Next Steps
433
+
434
+ Based on the validation results:
435
+
436
+ 1. **Address Critical Issues**: Fix any critical violations immediately
437
+ 2. **Plan Error Fixes**: Schedule error-level violations for next release
438
+ 3. **Batch Warning Fixes**: Group warning-level issues for efficient resolution
439
+ 4. **Track Compliance**: Monitor improvement trends over time
440
+ 5. **Update Rules**: Refine rules based on validation experience
288
441
 
289
442
  ## Violation Severity Levels
290
443
 
@@ -293,13 +446,6 @@ The AI will provide:
293
446
  - **Warning**: Should be addressed in next iteration (quality issues)
294
447
  - **Info**: Consider for future improvements (style, optimization)
295
448
 
296
- ## Fix Priority Guidelines
297
-
298
- 1. **Critical violations**: Fix immediately
299
- 2. **High-impact errors**: Fix before next release
300
- 3. **Consistency warnings**: Address in batches
301
- 4. **Style info**: Include in regular refactoring
302
-
303
449
  ## Compliance Tracking
304
450
 
305
451
  Use validation results to:
@@ -307,10 +453,49 @@ Use validation results to:
307
453
  - Identify problematic areas or patterns
308
454
  - Measure improvement after fixes
309
455
  - Generate compliance reports for stakeholders
456
+
457
+ ## Re-validation Command
458
+
459
+ After applying fixes, re-validate with:
460
+ \`\`\`json
461
+ {
462
+ "tool": "validate_rules",
463
+ "args": {
464
+ "filePath": "${filePath || 'updated-file-path'}",
465
+ "rules": [same rules array],
466
+ "reportFormat": "${reportFormat}"
467
+ }
468
+ }
469
+ \`\`\`
310
470
  `,
311
- },
312
- ],
313
- };
471
+ });
472
+ }
473
+ else {
474
+ // Fallback to prompt-only mode
475
+ return {
476
+ content: [
477
+ {
478
+ type: 'text',
479
+ text: `# Code Validation Against Architectural Rules
480
+
481
+ ${result.instructions}
482
+
483
+ ## AI Validation Prompt
484
+
485
+ ${result.validationPrompt}
486
+
487
+ ## Next Steps
488
+
489
+ 1. **Submit the validation prompt** to an AI agent for comprehensive analysis
490
+ 2. **Parse the JSON response** to get validation results and violations
491
+ 3. **Review violations** and prioritize fixes based on severity
492
+ 4. **Apply suggested fixes** to improve compliance
493
+ 5. **Re-validate** to confirm improvements
494
+ `,
495
+ },
496
+ ],
497
+ };
498
+ }
314
499
  }
315
500
  catch (error) {
316
501
  throw new McpAdrError(`Failed to validate rules: ${error instanceof Error ? error.message : String(error)}`, 'RULE_VALIDATION_ERROR');
@@ -1 +1 @@
1
- {"version":3,"file":"rule-generation-tool.js","sourceRoot":"","sources":["../../../src/tools/rule-generation-tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAUnC;IACC,MAAM,EACJ,MAAM,GAAG,MAAM,EACf,YAAY,GAAG,WAAW,EAC1B,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,EAC3B,aAAa,EACb,YAAY,GAAG,MAAM,GACtB,GAAG,IAAI,CAAC;IAET,IAAI,CAAC;QACH,MAAM,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,GAAG,MAAM,MAAM,CACtE,6BAA6B,CAC9B,CAAC;QAEF,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,MAAM,CAAC,CAAC,CAAC;gBACZ,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,YAAY,EAAE,aAAoB,CAAC,CAAC;gBAE9E,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE;;EAElB,MAAM,CAAC,YAAY;;;;EAInB,MAAM,CAAC,gBAAgB;;;;;;;uBAOF,YA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