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.
Files changed (131) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +608 -0
  3. package/dist/src/index.d.ts +10 -0
  4. package/dist/src/index.d.ts.map +1 -0
  5. package/dist/src/index.js +1722 -0
  6. package/dist/src/index.js.map +1 -0
  7. package/dist/src/prompts/adr-suggestion-prompts.d.ts +24 -0
  8. package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -0
  9. package/dist/src/prompts/adr-suggestion-prompts.js +383 -0
  10. package/dist/src/prompts/adr-suggestion-prompts.js.map +1 -0
  11. package/dist/src/prompts/analysis-prompts.d.ts +24 -0
  12. package/dist/src/prompts/analysis-prompts.d.ts.map +1 -0
  13. package/dist/src/prompts/analysis-prompts.js +489 -0
  14. package/dist/src/prompts/analysis-prompts.js.map +1 -0
  15. package/dist/src/prompts/deployment-analysis-prompts.d.ts +54 -0
  16. package/dist/src/prompts/deployment-analysis-prompts.d.ts.map +1 -0
  17. package/dist/src/prompts/deployment-analysis-prompts.js +712 -0
  18. package/dist/src/prompts/deployment-analysis-prompts.js.map +1 -0
  19. package/dist/src/prompts/environment-analysis-prompts.d.ts +34 -0
  20. package/dist/src/prompts/environment-analysis-prompts.d.ts.map +1 -0
  21. package/dist/src/prompts/environment-analysis-prompts.js +724 -0
  22. package/dist/src/prompts/environment-analysis-prompts.js.map +1 -0
  23. package/dist/src/prompts/index.d.ts +43 -0
  24. package/dist/src/prompts/index.d.ts.map +1 -0
  25. package/dist/src/prompts/index.js +384 -0
  26. package/dist/src/prompts/index.js.map +1 -0
  27. package/dist/src/prompts/research-integration-prompts.d.ts +43 -0
  28. package/dist/src/prompts/research-integration-prompts.d.ts.map +1 -0
  29. package/dist/src/prompts/research-integration-prompts.js +398 -0
  30. package/dist/src/prompts/research-integration-prompts.js.map +1 -0
  31. package/dist/src/prompts/research-question-prompts.d.ts +75 -0
  32. package/dist/src/prompts/research-question-prompts.d.ts.map +1 -0
  33. package/dist/src/prompts/research-question-prompts.js +695 -0
  34. package/dist/src/prompts/research-question-prompts.js.map +1 -0
  35. package/dist/src/prompts/rule-generation-prompts.d.ts +63 -0
  36. package/dist/src/prompts/rule-generation-prompts.d.ts.map +1 -0
  37. package/dist/src/prompts/rule-generation-prompts.js +630 -0
  38. package/dist/src/prompts/rule-generation-prompts.js.map +1 -0
  39. package/dist/src/prompts/security-prompts.d.ts +23 -0
  40. package/dist/src/prompts/security-prompts.d.ts.map +1 -0
  41. package/dist/src/prompts/security-prompts.js +287 -0
  42. package/dist/src/prompts/security-prompts.js.map +1 -0
  43. package/dist/src/resources/index.d.ts +24 -0
  44. package/dist/src/resources/index.d.ts.map +1 -0
  45. package/dist/src/resources/index.js +458 -0
  46. package/dist/src/resources/index.js.map +1 -0
  47. package/dist/src/tools/adr-suggestion-tool.d.ts +40 -0
  48. package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -0
  49. package/dist/src/tools/adr-suggestion-tool.js +338 -0
  50. package/dist/src/tools/adr-suggestion-tool.js.map +1 -0
  51. package/dist/src/tools/content-masking-tool.d.ts +52 -0
  52. package/dist/src/tools/content-masking-tool.d.ts.map +1 -0
  53. package/dist/src/tools/content-masking-tool.js +206 -0
  54. package/dist/src/tools/content-masking-tool.js.map +1 -0
  55. package/dist/src/tools/deployment-analysis-tool.d.ts +39 -0
  56. package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -0
  57. package/dist/src/tools/deployment-analysis-tool.js +310 -0
  58. package/dist/src/tools/deployment-analysis-tool.js.map +1 -0
  59. package/dist/src/tools/environment-analysis-tool.d.ts +16 -0
  60. package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -0
  61. package/dist/src/tools/environment-analysis-tool.js +298 -0
  62. package/dist/src/tools/environment-analysis-tool.js.map +1 -0
  63. package/dist/src/tools/research-integration-tool.d.ts +44 -0
  64. package/dist/src/tools/research-integration-tool.d.ts.map +1 -0
  65. package/dist/src/tools/research-integration-tool.js +429 -0
  66. package/dist/src/tools/research-integration-tool.js.map +1 -0
  67. package/dist/src/tools/research-question-tool.d.ts +55 -0
  68. package/dist/src/tools/research-question-tool.d.ts.map +1 -0
  69. package/dist/src/tools/research-question-tool.js +333 -0
  70. package/dist/src/tools/research-question-tool.js.map +1 -0
  71. package/dist/src/tools/rule-generation-tool.d.ts +49 -0
  72. package/dist/src/tools/rule-generation-tool.d.ts.map +1 -0
  73. package/dist/src/tools/rule-generation-tool.js +432 -0
  74. package/dist/src/tools/rule-generation-tool.js.map +1 -0
  75. package/dist/src/types/index.d.ts +531 -0
  76. package/dist/src/types/index.d.ts.map +1 -0
  77. package/dist/src/types/index.js +129 -0
  78. package/dist/src/types/index.js.map +1 -0
  79. package/dist/src/utils/adr-suggestions.d.ts +104 -0
  80. package/dist/src/utils/adr-suggestions.d.ts.map +1 -0
  81. package/dist/src/utils/adr-suggestions.js +228 -0
  82. package/dist/src/utils/adr-suggestions.js.map +1 -0
  83. package/dist/src/utils/cache.d.ts +51 -0
  84. package/dist/src/utils/cache.d.ts.map +1 -0
  85. package/dist/src/utils/cache.js +243 -0
  86. package/dist/src/utils/cache.js.map +1 -0
  87. package/dist/src/utils/config.d.ts +65 -0
  88. package/dist/src/utils/config.d.ts.map +1 -0
  89. package/dist/src/utils/config.js +118 -0
  90. package/dist/src/utils/config.js.map +1 -0
  91. package/dist/src/utils/content-masking.d.ts +79 -0
  92. package/dist/src/utils/content-masking.d.ts.map +1 -0
  93. package/dist/src/utils/content-masking.js +203 -0
  94. package/dist/src/utils/content-masking.js.map +1 -0
  95. package/dist/src/utils/deployment-analysis.d.ts +67 -0
  96. package/dist/src/utils/deployment-analysis.d.ts.map +1 -0
  97. package/dist/src/utils/deployment-analysis.js +263 -0
  98. package/dist/src/utils/deployment-analysis.js.map +1 -0
  99. package/dist/src/utils/environment-analysis.d.ts +76 -0
  100. package/dist/src/utils/environment-analysis.d.ts.map +1 -0
  101. package/dist/src/utils/environment-analysis.js +329 -0
  102. package/dist/src/utils/environment-analysis.js.map +1 -0
  103. package/dist/src/utils/file-system.d.ts +63 -0
  104. package/dist/src/utils/file-system.d.ts.map +1 -0
  105. package/dist/src/utils/file-system.js +189 -0
  106. package/dist/src/utils/file-system.js.map +1 -0
  107. package/dist/src/utils/output-masking.d.ts +45 -0
  108. package/dist/src/utils/output-masking.d.ts.map +1 -0
  109. package/dist/src/utils/output-masking.js +200 -0
  110. package/dist/src/utils/output-masking.js.map +1 -0
  111. package/dist/src/utils/research-documentation.d.ts +58 -0
  112. package/dist/src/utils/research-documentation.d.ts.map +1 -0
  113. package/dist/src/utils/research-documentation.js +438 -0
  114. package/dist/src/utils/research-documentation.js.map +1 -0
  115. package/dist/src/utils/research-integration.d.ts +89 -0
  116. package/dist/src/utils/research-integration.d.ts.map +1 -0
  117. package/dist/src/utils/research-integration.js +432 -0
  118. package/dist/src/utils/research-integration.js.map +1 -0
  119. package/dist/src/utils/research-questions.d.ts +97 -0
  120. package/dist/src/utils/research-questions.d.ts.map +1 -0
  121. package/dist/src/utils/research-questions.js +319 -0
  122. package/dist/src/utils/research-questions.js.map +1 -0
  123. package/dist/src/utils/rule-format.d.ts +76 -0
  124. package/dist/src/utils/rule-format.d.ts.map +1 -0
  125. package/dist/src/utils/rule-format.js +257 -0
  126. package/dist/src/utils/rule-format.js.map +1 -0
  127. package/dist/src/utils/rule-generation.d.ts +86 -0
  128. package/dist/src/utils/rule-generation.d.ts.map +1 -0
  129. package/dist/src/utils/rule-generation.js +330 -0
  130. package/dist/src/utils/rule-generation.js.map +1 -0
  131. package/package.json +71 -0
@@ -0,0 +1,432 @@
1
+ /**
2
+ * MCP Tools for rule generation and validation
3
+ * Implements prompt-driven architectural rule management
4
+ */
5
+ import { McpAdrError } from '../types/index.js';
6
+ /**
7
+ * Generate architectural rules from ADRs and code patterns
8
+ */
9
+ export async function generateRules(args) {
10
+ const { source = 'both', adrDirectory = 'docs/adrs', projectPath = process.cwd(), existingRules, outputFormat = 'json', } = args;
11
+ try {
12
+ const { extractRulesFromAdrs, generateRulesFromPatterns } = await import('../utils/rule-generation.js');
13
+ switch (source) {
14
+ case 'adrs': {
15
+ const result = await extractRulesFromAdrs(adrDirectory, existingRules);
16
+ return {
17
+ content: [
18
+ {
19
+ type: 'text',
20
+ text: `# Rule Generation: ADR-Based Rules
21
+
22
+ ${result.instructions}
23
+
24
+ ## AI Analysis Prompt
25
+
26
+ ${result.extractionPrompt}
27
+
28
+ ## Next Steps
29
+
30
+ 1. **Submit the prompt** to an AI agent for comprehensive rule extraction
31
+ 2. **Parse the JSON response** to get extracted rules and metadata
32
+ 3. **Review the rules** for accuracy and completeness
33
+ 4. **Save rules** in ${outputFormat.toUpperCase()} format using the rule format utilities
34
+ 5. **Integrate with validation tools** for automated compliance checking
35
+
36
+ ## Expected Output
37
+
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
44
+
45
+ ## Rule Format
46
+
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
52
+
53
+ ## Integration Workflow
54
+
55
+ After rule generation, use the validation tools:
56
+ \`\`\`json
57
+ {
58
+ "tool": "validate_rules",
59
+ "args": {
60
+ "filePath": "path/to/code/file.js",
61
+ "rules": [extracted rules from AI response]
62
+ }
63
+ }
64
+ \`\`\`
65
+ `,
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
78
+
79
+ ${result.instructions}
80
+
81
+ ## AI Analysis Prompt
82
+
83
+ ${result.generationPrompt}
84
+
85
+ ## Next Steps
86
+
87
+ 1. **Submit the prompt** to an AI agent for pattern analysis
88
+ 2. **Parse the JSON response** to get generated rules and metrics
89
+ 3. **Review pattern-based rules** for relevance and accuracy
90
+ 4. **Combine with ADR-extracted rules** for comprehensive rule set
91
+ 5. **Implement validation** for high-confidence rules
92
+
93
+ ## Expected Output
94
+
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
100
+
101
+ ## Pattern-Based Benefits
102
+
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
108
+
109
+ ## Quality Assurance
110
+
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
116
+ `,
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
130
+
131
+ This comprehensive analysis will generate architectural rules from both ADRs and code patterns for complete coverage.
132
+
133
+ ## ADR-Based Rule Extraction
134
+
135
+ ${adrResult.instructions}
136
+
137
+ ### ADR Analysis Prompt
138
+
139
+ ${adrResult.extractionPrompt}
140
+
141
+ ## Pattern-Based Rule Generation
142
+
143
+ ${patternResult.instructions}
144
+
145
+ ### Pattern Analysis Prompt
146
+
147
+ ${patternResult.generationPrompt}
148
+
149
+ ## Comprehensive Workflow
150
+
151
+ ### 1. **ADR Rule Extraction** (First Step)
152
+ Submit the ADR analysis prompt to extract rules from architectural decisions
153
+
154
+ ### 2. **Pattern Rule Generation** (Second Step)
155
+ Submit the pattern analysis prompt to generate rules from code patterns
156
+
157
+ ### 3. **Rule Consolidation**
158
+ - Merge rules from both sources
159
+ - Remove duplicates and conflicts
160
+ - Prioritize based on confidence and impact
161
+ - 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
+ `,
198
+ },
199
+ ],
200
+ };
201
+ }
202
+ default:
203
+ throw new McpAdrError(`Unknown rule generation source: ${source}`, 'INVALID_INPUT');
204
+ }
205
+ }
206
+ catch (error) {
207
+ throw new McpAdrError(`Failed to generate rules: ${error instanceof Error ? error.message : String(error)}`, 'RULE_GENERATION_ERROR');
208
+ }
209
+ }
210
+ /**
211
+ * Validate code against architectural rules
212
+ */
213
+ export async function validateRules(args) {
214
+ const { filePath, fileContent, fileName, rules, validationType = 'file', reportFormat = 'detailed', } = args;
215
+ try {
216
+ const { validateCodeAgainstRules } = await import('../utils/rule-generation.js');
217
+ if (!filePath && !fileContent) {
218
+ throw new McpAdrError('Either filePath or fileContent must be provided', 'INVALID_INPUT');
219
+ }
220
+ if (!rules || rules.length === 0) {
221
+ throw new McpAdrError('Rules array is required and cannot be empty', 'INVALID_INPUT');
222
+ }
223
+ // Convert rules to ArchitecturalRule format
224
+ const architecturalRules = rules.map(rule => ({
225
+ id: rule.id,
226
+ name: rule.name,
227
+ description: rule.description,
228
+ category: 'coding',
229
+ type: 'should',
230
+ severity: rule.severity,
231
+ scope: 'file',
232
+ pattern: rule.pattern,
233
+ message: rule.message,
234
+ examples: { valid: [], invalid: [] },
235
+ sourceAdrs: [],
236
+ evidence: [],
237
+ automatable: true,
238
+ confidence: 0.8,
239
+ tags: [],
240
+ }));
241
+ let result;
242
+ if (filePath) {
243
+ result = await validateCodeAgainstRules(filePath, architecturalRules, validationType);
244
+ }
245
+ else {
246
+ // Handle fileContent case by creating a temporary validation
247
+ const tempFileName = fileName || 'temp-file';
248
+ result = {
249
+ validationPrompt: `Validate the following code content against rules: ${fileContent?.slice(0, 100)}...`,
250
+ instructions: `Validation for ${tempFileName} with ${rules.length} rules`,
251
+ };
252
+ }
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
+
275
+ - **File**: ${fileName || filePath || 'Content provided'}
276
+ - **Validation Type**: ${validationType}
277
+ - **Rules Applied**: ${rules.length} rules
278
+ - **Report Format**: ${reportFormat}
279
+
280
+ ## Expected Output
281
+
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
288
+
289
+ ## Violation Severity Levels
290
+
291
+ - **Critical**: Must be fixed immediately (security, breaking changes)
292
+ - **Error**: Should be fixed before deployment (functionality issues)
293
+ - **Warning**: Should be addressed in next iteration (quality issues)
294
+ - **Info**: Consider for future improvements (style, optimization)
295
+
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
+ ## Compliance Tracking
304
+
305
+ Use validation results to:
306
+ - Track compliance trends over time
307
+ - Identify problematic areas or patterns
308
+ - Measure improvement after fixes
309
+ - Generate compliance reports for stakeholders
310
+ `,
311
+ },
312
+ ],
313
+ };
314
+ }
315
+ catch (error) {
316
+ throw new McpAdrError(`Failed to validate rules: ${error instanceof Error ? error.message : String(error)}`, 'RULE_VALIDATION_ERROR');
317
+ }
318
+ }
319
+ /**
320
+ * Create machine-readable rule set
321
+ */
322
+ export async function createRuleSet(args) {
323
+ const { name, description = 'Generated architectural rule set', adrRules = [], patternRules = [], rules = [], outputFormat = 'json', author = 'MCP ADR Analysis Server', } = args;
324
+ try {
325
+ const { createRuleSet, serializeRuleSetToJson, serializeRuleSetToYaml } = await import('../utils/rule-format.js');
326
+ // Combine all rules
327
+ const allRules = [...adrRules, ...patternRules, ...rules];
328
+ if (allRules.length === 0) {
329
+ throw new McpAdrError('At least one rule must be provided', 'INVALID_INPUT');
330
+ }
331
+ // Create rule set
332
+ const ruleSet = createRuleSet(name, description, allRules, author);
333
+ // Serialize based on output format
334
+ let jsonOutput = '';
335
+ let yamlOutput = '';
336
+ if (outputFormat === 'json' || outputFormat === 'both') {
337
+ jsonOutput = serializeRuleSetToJson(ruleSet);
338
+ }
339
+ if (outputFormat === 'yaml' || outputFormat === 'both') {
340
+ yamlOutput = serializeRuleSetToYaml(ruleSet);
341
+ }
342
+ return {
343
+ content: [
344
+ {
345
+ type: 'text',
346
+ text: `# Machine-Readable Rule Set Created
347
+
348
+ ## Rule Set Details
349
+ - **Name**: ${name}
350
+ - **Description**: ${description}
351
+ - **Total Rules**: ${allRules.length}
352
+ - **Author**: ${author}
353
+ - **Format**: ${outputFormat.toUpperCase()}
354
+ - **Version**: ${ruleSet.metadata.version}
355
+
356
+ ## Rule Categories
357
+ ${ruleSet.categories.map(cat => `- **${cat.name}**: ${cat.ruleCount} rules (${cat.priority} priority)`).join('\n')}
358
+
359
+ ## Rule Distribution
360
+ - **ADR-based Rules**: ${adrRules.length}
361
+ - **Pattern-based Rules**: ${patternRules.length}
362
+ - **Other Rules**: ${rules.length}
363
+
364
+ ${outputFormat === 'json' || outputFormat === 'both'
365
+ ? `
366
+ ## JSON Format
367
+
368
+ \`\`\`json
369
+ ${jsonOutput}
370
+ \`\`\`
371
+ `
372
+ : ''}
373
+
374
+ ${outputFormat === 'yaml' || outputFormat === 'both'
375
+ ? `
376
+ ## YAML Format
377
+
378
+ \`\`\`yaml
379
+ ${yamlOutput}
380
+ \`\`\`
381
+ `
382
+ : ''}
383
+
384
+ ## Usage Instructions
385
+
386
+ ### Save Rule Set
387
+ Save the rule set to your project:
388
+ - **JSON**: \`rules/architectural-rules.json\`
389
+ - **YAML**: \`rules/architectural-rules.yaml\`
390
+
391
+ ### Integrate with Tools
392
+ Use the rule set with validation tools:
393
+ \`\`\`json
394
+ {
395
+ "tool": "validate_rules",
396
+ "args": {
397
+ "filePath": "src/components/MyComponent.tsx",
398
+ "rules": [rules from this rule set]
399
+ }
400
+ }
401
+ \`\`\`
402
+
403
+ ### Version Control
404
+ - Commit rule sets to version control
405
+ - Track changes to rules over time
406
+ - Use semantic versioning for rule set updates
407
+ - Document rule changes in release notes
408
+
409
+ ### Team Adoption
410
+ - Share rule sets across team members
411
+ - Integrate with CI/CD pipelines
412
+ - Set up automated validation checks
413
+ - Provide training on rule compliance
414
+
415
+ ## Quality Assurance
416
+
417
+ This rule set includes:
418
+ - **Validation Patterns**: Automated checking capabilities
419
+ - **Examples**: Valid and invalid code examples
420
+ - **Severity Levels**: Appropriate priority for each rule
421
+ - **Traceability**: Links to source ADRs and patterns
422
+ - **Metadata**: Complete rule set documentation
423
+ `,
424
+ },
425
+ ],
426
+ };
427
+ }
428
+ catch (error) {
429
+ throw new McpAdrError(`Failed to create rule set: ${error instanceof Error ? error.message : String(error)}`, 'RULE_SET_CREATION_ERROR');
430
+ }
431
+ }
432
+ //# sourceMappingURL=rule-generation-tool.js.map
@@ -0,0 +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,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