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,630 @@
1
+ /**
2
+ * AI prompts for rule generation and validation
3
+ * Following prompt-driven development approach
4
+ */
5
+ /**
6
+ * AI prompt for extracting actionable rules from ADRs
7
+ */
8
+ export function generateRuleExtractionPrompt(adrFiles, existingRules) {
9
+ return `
10
+ # Architectural Rule Extraction from ADRs
11
+
12
+ Please analyze the following Architectural Decision Records and extract actionable rules that can be used to validate code and architectural compliance.
13
+
14
+ ## ADR Files
15
+ ${adrFiles
16
+ .map((adr, index) => `
17
+ ### ${index + 1}. ${adr.title}
18
+ **ID**: ${adr.id}
19
+ **Status**: ${adr.status}
20
+ **Category**: ${adr.category || 'Unknown'}
21
+
22
+ **Content**:
23
+ \`\`\`markdown
24
+ ${adr.content.slice(0, 1500)}${adr.content.length > 1500 ? '\n... (truncated for analysis)' : ''}
25
+ \`\`\`
26
+ `)
27
+ .join('')}
28
+
29
+ ${existingRules
30
+ ? `## Existing Rules
31
+ ${existingRules.map(rule => `- **${rule.name}**: ${rule.description}`).join('\n')}
32
+ `
33
+ : ''}
34
+
35
+ ## Rule Extraction Requirements
36
+
37
+ Please identify and extract rules in the following categories:
38
+
39
+ ### 🏗️ **Architectural Rules**
40
+ - **Component Structure**: How components should be organized and structured
41
+ - **Dependency Management**: Rules about dependencies between modules/components
42
+ - **Interface Design**: API design standards and conventions
43
+ - **Data Flow**: Rules about data movement and transformation
44
+ - **Service Boundaries**: Microservice or module boundary definitions
45
+ - **Integration Patterns**: How systems should integrate with each other
46
+
47
+ ### 🔧 **Technology Rules**
48
+ - **Framework Usage**: Specific framework usage patterns and restrictions
49
+ - **Library Selection**: Approved/prohibited libraries and versions
50
+ - **Database Access**: Data access patterns and restrictions
51
+ - **Security Requirements**: Security implementation requirements
52
+ - **Performance Standards**: Performance benchmarks and requirements
53
+ - **Configuration Management**: Configuration and environment rules
54
+
55
+ ### 📝 **Coding Rules**
56
+ - **Code Organization**: File and directory structure requirements
57
+ - **Naming Conventions**: Variable, function, class naming standards
58
+ - **Error Handling**: Error handling patterns and requirements
59
+ - **Logging Standards**: Logging format and level requirements
60
+ - **Testing Requirements**: Test coverage and testing pattern rules
61
+ - **Documentation Standards**: Code documentation requirements
62
+
63
+ ### 🔄 **Process Rules**
64
+ - **Development Workflow**: Development process requirements
65
+ - **Code Review Standards**: Code review criteria and processes
66
+ - **Deployment Rules**: Deployment process and environment rules
67
+ - **Monitoring Requirements**: Observability and monitoring standards
68
+ - **Maintenance Procedures**: Ongoing maintenance and update rules
69
+
70
+ ## Output Format
71
+
72
+ Please provide your analysis in the following JSON format:
73
+
74
+ \`\`\`json
75
+ {
76
+ "extractedRules": [
77
+ {
78
+ "id": "unique-rule-id",
79
+ "name": "Rule Name",
80
+ "description": "Detailed rule description",
81
+ "category": "architectural|technology|coding|process|security|performance",
82
+ "type": "must|should|may|must_not|should_not",
83
+ "severity": "info|warning|error|critical",
84
+ "scope": "global|module|component|function|file",
85
+ "pattern": "detection pattern or condition",
86
+ "message": "violation message template",
87
+ "examples": {
88
+ "valid": ["examples of valid implementations"],
89
+ "invalid": ["examples of rule violations"]
90
+ },
91
+ "sourceAdrs": ["adr-id-1", "adr-id-2"],
92
+ "evidence": ["specific text from ADRs supporting this rule"],
93
+ "automatable": true/false,
94
+ "confidence": 0.0-1.0,
95
+ "tags": ["relevant", "tags"]
96
+ }
97
+ ],
98
+ "ruleCategories": [
99
+ {
100
+ "category": "category-name",
101
+ "description": "category description",
102
+ "ruleCount": 0,
103
+ "priority": "low|medium|high|critical"
104
+ }
105
+ ],
106
+ "ruleDependencies": [
107
+ {
108
+ "ruleId": "rule-id",
109
+ "dependsOn": ["other-rule-ids"],
110
+ "conflictsWith": ["conflicting-rule-ids"],
111
+ "relationship": "requires|enhances|conflicts|supersedes"
112
+ }
113
+ ],
114
+ "validationStrategies": [
115
+ {
116
+ "strategy": "static_analysis|dynamic_analysis|manual_review|automated_testing",
117
+ "applicableRules": ["rule-ids"],
118
+ "toolRequirements": ["required tools or frameworks"],
119
+ "complexity": "low|medium|high"
120
+ }
121
+ ],
122
+ "implementationGuidance": {
123
+ "priorityOrder": ["rule-ids in priority order"],
124
+ "quickWins": ["easily implementable rule-ids"],
125
+ "complexRules": ["rule-ids requiring significant effort"],
126
+ "toolingNeeds": ["tools needed for validation"],
127
+ "trainingNeeds": ["areas where team training is needed"]
128
+ }
129
+ }
130
+ \`\`\`
131
+
132
+ ## Extraction Guidelines
133
+
134
+ 1. **Actionable Rules**: Focus on rules that can be validated or enforced
135
+ 2. **Clear Patterns**: Ensure rules have clear detection patterns
136
+ 3. **Specific Messages**: Provide helpful violation messages
137
+ 4. **Evidence-Based**: Link rules to specific ADR content
138
+ 5. **Practical Implementation**: Consider how rules can be validated in practice
139
+ 6. **Avoid Duplication**: Don't extract rules that already exist
140
+
141
+ Please provide a comprehensive extraction of actionable architectural rules.
142
+ `;
143
+ }
144
+ /**
145
+ * AI prompt for generating rules from code patterns
146
+ */
147
+ export function generatePatternBasedRulePrompt(projectStructure, codePatterns, existingRules) {
148
+ return `
149
+ # Pattern-Based Rule Generation
150
+
151
+ Please analyze the following code patterns and project structure to generate architectural rules that enforce consistency and best practices.
152
+
153
+ ## Project Structure
154
+ \`\`\`
155
+ ${projectStructure}
156
+ \`\`\`
157
+
158
+ ## Detected Code Patterns
159
+ ${codePatterns
160
+ .map((pattern, index) => `
161
+ ### Pattern ${index + 1}: ${pattern.pattern}
162
+ **Category**: ${pattern.category}
163
+ **Frequency**: ${pattern.frequency} occurrences
164
+ **Examples**:
165
+ ${pattern.examples.map(example => `\`\`\`\n${example}\n\`\`\``).join('\n')}
166
+ `)
167
+ .join('')}
168
+
169
+ ${existingRules
170
+ ? `## Existing Rules
171
+ ${existingRules.map(rule => `- ${rule}`).join('\n')}
172
+ `
173
+ : ''}
174
+
175
+ ## Pattern Analysis Requirements
176
+
177
+ Please analyze patterns to generate rules for:
178
+
179
+ ### 🔍 **Consistency Rules**
180
+ - **Naming Patterns**: Consistent naming across similar components
181
+ - **Structure Patterns**: Consistent file and directory organization
182
+ - **Import Patterns**: Consistent dependency import styles
183
+ - **Export Patterns**: Consistent module export conventions
184
+ - **Configuration Patterns**: Consistent configuration approaches
185
+
186
+ ### 📐 **Quality Rules**
187
+ - **Complexity Limits**: Based on observed complexity patterns
188
+ - **Size Limits**: File, function, or component size constraints
189
+ - **Dependency Rules**: Dependency count and type restrictions
190
+ - **Coupling Rules**: Loose coupling enforcement based on patterns
191
+ - **Cohesion Rules**: High cohesion requirements
192
+
193
+ ### 🛡️ **Safety Rules**
194
+ - **Error Handling**: Consistent error handling patterns
195
+ - **Null Safety**: Null/undefined handling patterns
196
+ - **Type Safety**: Type usage and validation patterns
197
+ - **Security Patterns**: Security implementation consistency
198
+ - **Resource Management**: Resource cleanup and management
199
+
200
+ ### 🎯 **Performance Rules**
201
+ - **Optimization Patterns**: Performance optimization consistency
202
+ - **Caching Rules**: Caching strategy enforcement
203
+ - **Lazy Loading**: Lazy loading pattern consistency
204
+ - **Memory Management**: Memory usage pattern rules
205
+ - **Network Efficiency**: Network call optimization rules
206
+
207
+ ## Output Format
208
+
209
+ Please provide your analysis in the following JSON format:
210
+
211
+ \`\`\`json
212
+ {
213
+ "generatedRules": [
214
+ {
215
+ "id": "pattern-rule-id",
216
+ "name": "Rule Name",
217
+ "description": "Rule description based on observed patterns",
218
+ "category": "consistency|quality|safety|performance|structure",
219
+ "type": "must|should|may|must_not|should_not",
220
+ "severity": "info|warning|error|critical",
221
+ "pattern": "regex or detection pattern",
222
+ "message": "violation message",
223
+ "sourcePattern": "original pattern that inspired this rule",
224
+ "frequency": "how often this pattern appears",
225
+ "examples": {
226
+ "compliant": ["examples following the pattern"],
227
+ "violations": ["examples violating the pattern"]
228
+ },
229
+ "automatable": true/false,
230
+ "confidence": 0.0-1.0,
231
+ "rationale": "why this rule is beneficial"
232
+ }
233
+ ],
234
+ "patternAnalysis": {
235
+ "totalPatterns": ${codePatterns.length},
236
+ "consistencyScore": 0.0-1.0,
237
+ "qualityIndicators": ["identified quality patterns"],
238
+ "antiPatterns": ["identified anti-patterns"],
239
+ "recommendations": ["recommendations for improvement"]
240
+ },
241
+ "ruleMetrics": {
242
+ "highConfidenceRules": 0,
243
+ "automatableRules": 0,
244
+ "criticalRules": 0,
245
+ "quickWinRules": 0
246
+ },
247
+ "implementationPlan": {
248
+ "phase1": ["immediate rules to implement"],
249
+ "phase2": ["medium-term rules"],
250
+ "phase3": ["long-term rules"],
251
+ "toolingRequirements": ["tools needed for validation"]
252
+ }
253
+ }
254
+ \`\`\`
255
+
256
+ ## Generation Guidelines
257
+
258
+ 1. **Pattern-Based**: Base rules on actual observed patterns
259
+ 2. **Frequency-Weighted**: Prioritize rules based on pattern frequency
260
+ 3. **Consistency-Focused**: Emphasize consistency over perfection
261
+ 4. **Practical Validation**: Ensure rules can be automatically validated
262
+ 5. **Clear Rationale**: Explain why each rule is beneficial
263
+ 6. **Incremental Implementation**: Provide phased implementation approach
264
+
265
+ Please generate practical, pattern-based architectural rules.
266
+ `;
267
+ }
268
+ /**
269
+ * AI prompt for validating code against rules
270
+ */
271
+ export function generateCodeValidationPrompt(codeToValidate, fileName, rules, validationType = 'file') {
272
+ return `
273
+ # Code Validation Against Architectural Rules
274
+
275
+ Please validate the following code against the specified architectural rules and report any violations.
276
+
277
+ ## Code to Validate
278
+ **File**: ${fileName}
279
+ **Validation Type**: ${validationType}
280
+
281
+ \`\`\`
282
+ ${codeToValidate.slice(0, 3000)}${codeToValidate.length > 3000 ? '\n... (truncated for analysis)' : ''}
283
+ \`\`\`
284
+
285
+ ## Architectural Rules
286
+ ${rules
287
+ .map((rule, index) => `
288
+ ### Rule ${index + 1}: ${rule.name}
289
+ **ID**: ${rule.id}
290
+ **Severity**: ${rule.severity}
291
+ **Pattern**: ${rule.pattern}
292
+ **Description**: ${rule.description}
293
+ **Violation Message**: ${rule.message}
294
+ `)
295
+ .join('')}
296
+
297
+ ## Validation Requirements
298
+
299
+ Please perform comprehensive validation checking for:
300
+
301
+ ### 🔍 **Rule Compliance**
302
+ - **Pattern Matching**: Check if code matches required patterns
303
+ - **Constraint Violations**: Identify violations of constraints
304
+ - **Convention Adherence**: Verify adherence to naming and structure conventions
305
+ - **Dependency Rules**: Validate dependency usage and restrictions
306
+ - **Security Rules**: Check security implementation requirements
307
+
308
+ ### 📊 **Violation Analysis**
309
+ - **Severity Assessment**: Categorize violations by severity
310
+ - **Location Identification**: Pinpoint exact locations of violations
311
+ - **Impact Analysis**: Assess impact of each violation
312
+ - **Fix Suggestions**: Provide specific remediation suggestions
313
+ - **Priority Ranking**: Rank violations by fix priority
314
+
315
+ ### 🎯 **Quality Metrics**
316
+ - **Overall Compliance**: Calculate compliance percentage
317
+ - **Rule Coverage**: Identify which rules were applicable
318
+ - **Code Quality Score**: Assess overall code quality
319
+ - **Improvement Areas**: Highlight areas for improvement
320
+
321
+ ## Output Format
322
+
323
+ Please provide your validation results in the following JSON format:
324
+
325
+ \`\`\`json
326
+ {
327
+ "validationResults": {
328
+ "fileName": "${fileName}",
329
+ "validationType": "${validationType}",
330
+ "timestamp": "ISO-8601-timestamp",
331
+ "overallCompliance": 0.0-1.0,
332
+ "totalRulesChecked": ${rules.length},
333
+ "rulesViolated": 0,
334
+ "qualityScore": 0.0-1.0
335
+ },
336
+ "violations": [
337
+ {
338
+ "ruleId": "rule-id",
339
+ "ruleName": "Rule Name",
340
+ "severity": "info|warning|error|critical",
341
+ "message": "specific violation message",
342
+ "location": {
343
+ "line": 0,
344
+ "column": 0,
345
+ "endLine": 0,
346
+ "endColumn": 0
347
+ },
348
+ "codeSnippet": "relevant code snippet",
349
+ "suggestion": "specific fix suggestion",
350
+ "effort": "low|medium|high",
351
+ "priority": "low|medium|high|critical",
352
+ "category": "architectural|technology|coding|process|security|performance"
353
+ }
354
+ ],
355
+ "compliance": [
356
+ {
357
+ "ruleId": "rule-id",
358
+ "ruleName": "Rule Name",
359
+ "status": "compliant",
360
+ "evidence": "evidence of compliance",
361
+ "location": "where compliance was verified"
362
+ }
363
+ ],
364
+ "metrics": {
365
+ "criticalViolations": 0,
366
+ "errorViolations": 0,
367
+ "warningViolations": 0,
368
+ "infoViolations": 0,
369
+ "linesAnalyzed": 0,
370
+ "complexityScore": 0.0-1.0,
371
+ "maintainabilityScore": 0.0-1.0
372
+ },
373
+ "recommendations": [
374
+ {
375
+ "priority": "high|medium|low",
376
+ "category": "immediate|short_term|long_term",
377
+ "description": "specific recommendation",
378
+ "impact": "expected impact of implementing this recommendation",
379
+ "effort": "estimated effort required"
380
+ }
381
+ ],
382
+ "summary": {
383
+ "status": "compliant|violations_found|critical_issues",
384
+ "keyIssues": ["most important issues to address"],
385
+ "strengths": ["areas where code excels"],
386
+ "nextSteps": ["recommended next actions"]
387
+ }
388
+ }
389
+ \`\`\`
390
+
391
+ ## Validation Guidelines
392
+
393
+ 1. **Thorough Analysis**: Check every applicable rule carefully
394
+ 2. **Precise Locations**: Provide exact line and column numbers
395
+ 3. **Actionable Feedback**: Give specific, implementable suggestions
396
+ 4. **Severity Appropriate**: Use appropriate severity levels
397
+ 5. **Context Aware**: Consider the specific context and purpose of the code
398
+ 6. **Constructive Tone**: Focus on improvement rather than criticism
399
+
400
+ Please provide comprehensive, actionable validation results.
401
+ `;
402
+ }
403
+ /**
404
+ * AI prompt for reporting rule deviations and compliance status
405
+ */
406
+ export function generateRuleDeviationReportPrompt(validationResults, rules, reportType = 'summary') {
407
+ return `
408
+ # Rule Deviation and Compliance Report
409
+
410
+ Please generate a comprehensive report analyzing rule violations and compliance across the codebase.
411
+
412
+ ## Validation Results
413
+ ${validationResults
414
+ .map((result, index) => `
415
+ ### File ${index + 1}: ${result.fileName}
416
+ **Overall Compliance**: ${(result.overallCompliance * 100).toFixed(1)}%
417
+ **Violations**: ${result.violations.length}
418
+ **Compliant Rules**: ${result.compliance.length}
419
+
420
+ **Violations**:
421
+ ${result.violations.map(v => `- **${v.ruleName}** (${v.severity}): ${v.message}`).join('\n')}
422
+ `)
423
+ .join('')}
424
+
425
+ ## Rule Definitions
426
+ ${rules
427
+ .map((rule, index) => `
428
+ ### Rule ${index + 1}: ${rule.name}
429
+ **ID**: ${rule.id}
430
+ **Category**: ${rule.category}
431
+ **Severity**: ${rule.severity}
432
+ `)
433
+ .join('')}
434
+
435
+ ## Report Type
436
+ ${reportType.toUpperCase()}
437
+
438
+ ## Report Requirements
439
+
440
+ Please generate a comprehensive report including:
441
+
442
+ ### 📊 **Executive Summary**
443
+ - **Overall Compliance Rate**: Across all files and rules
444
+ - **Critical Issues**: Number and description of critical violations
445
+ - **Improvement Trends**: Progress over time (if trend report)
446
+ - **Key Recommendations**: Top 3-5 recommendations for improvement
447
+ - **Risk Assessment**: Overall risk level and mitigation priorities
448
+
449
+ ### 📈 **Detailed Analysis**
450
+ - **Rule-by-Rule Breakdown**: Compliance rate for each rule
451
+ - **Category Analysis**: Compliance by rule category
452
+ - **Severity Distribution**: Breakdown of violations by severity
453
+ - **File-by-File Analysis**: Compliance status for each file
454
+ - **Hotspot Identification**: Files or areas with most violations
455
+
456
+ ### 🎯 **Actionable Insights**
457
+ - **Priority Fixes**: Violations that should be addressed first
458
+ - **Quick Wins**: Easy fixes that improve compliance significantly
459
+ - **Systemic Issues**: Patterns indicating broader architectural problems
460
+ - **Training Needs**: Areas where team education would help
461
+ - **Tool Recommendations**: Tools that could help improve compliance
462
+
463
+ ### 📋 **Implementation Roadmap**
464
+ - **Immediate Actions**: Critical fixes needed within days
465
+ - **Short-term Goals**: Improvements for next 1-4 weeks
466
+ - **Medium-term Objectives**: Goals for next 1-3 months
467
+ - **Long-term Vision**: Architectural improvements over 3+ months
468
+ - **Success Metrics**: How to measure improvement progress
469
+
470
+ ## Output Format
471
+
472
+ Please provide your report in the following JSON format:
473
+
474
+ \`\`\`json
475
+ {
476
+ "reportMetadata": {
477
+ "reportType": "${reportType}",
478
+ "generatedAt": "ISO-8601-timestamp",
479
+ "filesAnalyzed": ${validationResults.length},
480
+ "rulesEvaluated": ${rules.length},
481
+ "reportVersion": "1.0"
482
+ },
483
+ "executiveSummary": {
484
+ "overallComplianceRate": 0.0-1.0,
485
+ "totalViolations": 0,
486
+ "criticalIssues": 0,
487
+ "riskLevel": "low|medium|high|critical",
488
+ "keyFindings": ["most important findings"],
489
+ "topRecommendations": ["priority recommendations"],
490
+ "complianceTrend": "improving|stable|declining|unknown"
491
+ },
492
+ "detailedAnalysis": {
493
+ "ruleCompliance": [
494
+ {
495
+ "ruleId": "rule-id",
496
+ "ruleName": "Rule Name",
497
+ "category": "rule category",
498
+ "complianceRate": 0.0-1.0,
499
+ "violationCount": 0,
500
+ "affectedFiles": ["file names"],
501
+ "severity": "rule severity",
502
+ "trend": "improving|stable|declining"
503
+ }
504
+ ],
505
+ "categoryBreakdown": [
506
+ {
507
+ "category": "category name",
508
+ "complianceRate": 0.0-1.0,
509
+ "violationCount": 0,
510
+ "ruleCount": 0,
511
+ "priority": "high|medium|low"
512
+ }
513
+ ],
514
+ "severityDistribution": {
515
+ "critical": 0,
516
+ "error": 0,
517
+ "warning": 0,
518
+ "info": 0
519
+ },
520
+ "fileAnalysis": [
521
+ {
522
+ "fileName": "file name",
523
+ "complianceRate": 0.0-1.0,
524
+ "violationCount": 0,
525
+ "riskScore": 0.0-1.0,
526
+ "priority": "high|medium|low"
527
+ }
528
+ ]
529
+ },
530
+ "actionableInsights": {
531
+ "priorityFixes": [
532
+ {
533
+ "description": "fix description",
534
+ "impact": "high|medium|low",
535
+ "effort": "low|medium|high",
536
+ "affectedFiles": ["file names"],
537
+ "deadline": "suggested deadline"
538
+ }
539
+ ],
540
+ "quickWins": [
541
+ {
542
+ "description": "quick win description",
543
+ "benefit": "expected benefit",
544
+ "effort": "minimal effort required",
545
+ "files": ["affected files"]
546
+ }
547
+ ],
548
+ "systemicIssues": [
549
+ {
550
+ "pattern": "identified pattern",
551
+ "description": "issue description",
552
+ "rootCause": "likely root cause",
553
+ "solution": "recommended solution"
554
+ }
555
+ ],
556
+ "trainingNeeds": [
557
+ {
558
+ "area": "training area",
559
+ "description": "what training is needed",
560
+ "priority": "high|medium|low",
561
+ "audience": "who needs training"
562
+ }
563
+ ]
564
+ },
565
+ "implementationRoadmap": {
566
+ "immediate": [
567
+ {
568
+ "action": "immediate action",
569
+ "timeline": "within days",
570
+ "owner": "suggested owner",
571
+ "success_criteria": "how to measure success"
572
+ }
573
+ ],
574
+ "shortTerm": [
575
+ {
576
+ "action": "short-term action",
577
+ "timeline": "1-4 weeks",
578
+ "dependencies": ["what this depends on"],
579
+ "resources": ["required resources"]
580
+ }
581
+ ],
582
+ "mediumTerm": [
583
+ {
584
+ "action": "medium-term action",
585
+ "timeline": "1-3 months",
586
+ "strategic_value": "strategic importance",
587
+ "investment": "required investment"
588
+ }
589
+ ],
590
+ "longTerm": [
591
+ {
592
+ "action": "long-term action",
593
+ "timeline": "3+ months",
594
+ "vision": "long-term vision",
595
+ "transformation": "expected transformation"
596
+ }
597
+ ]
598
+ },
599
+ "successMetrics": {
600
+ "complianceTargets": {
601
+ "immediate": 0.0-1.0,
602
+ "shortTerm": 0.0-1.0,
603
+ "mediumTerm": 0.0-1.0,
604
+ "longTerm": 0.0-1.0
605
+ },
606
+ "violationReduction": {
607
+ "critical": "target reduction percentage",
608
+ "error": "target reduction percentage",
609
+ "warning": "target reduction percentage"
610
+ },
611
+ "qualityMetrics": [
612
+ "specific quality metrics to track"
613
+ ]
614
+ }
615
+ }
616
+ \`\`\`
617
+
618
+ ## Report Guidelines
619
+
620
+ 1. **Data-Driven**: Base all conclusions on actual validation data
621
+ 2. **Actionable**: Provide specific, implementable recommendations
622
+ 3. **Prioritized**: Rank issues and actions by impact and urgency
623
+ 4. **Realistic**: Set achievable goals and timelines
624
+ 5. **Comprehensive**: Cover all aspects of compliance and improvement
625
+ 6. **Strategic**: Align recommendations with business and technical goals
626
+
627
+ Please generate a comprehensive, actionable compliance report.
628
+ `;
629
+ }
630
+ //# sourceMappingURL=rule-generation-prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-generation-prompts.js","sourceRoot":"","sources":["../../../src/prompts/rule-generation-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,QAME,EACF,aAIE;IAEF,OAAO;;;;;;EAMP,QAAQ;SACP,GAAG,CACF,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;MACd,KAAK,GAAG,CAAC,KAAK,GA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AiB,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;kBACnD,MAAM,CAAC,UAAU,CAAC,MAAM;uBACnB,MAAM,CAAC,UAAU,CAAC,MAAM;;;EAG7C,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,QAAQ,OAAO,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CAC3F,CACE;SACA,IAAI,CAAC,EAAE,CAAC;;;EAGT,KAAK;SACJ,GAAG,CACF,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;WACV,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI;UACxB,IAAI,CAAC,EAAE;gBACD,IAAI,CAAC,QAAQ;gBACb,IAAI,CAAC,QAAQ;CAC5B,CACE;SACA,IAAI,CAAC,EAAE,CAAC;;;EAGT,UAAU,CAAC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAyCL,UAAU;;uBAER,iBAAiB,CAAC,MAAM;wBACvB,KAAK,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoJnC,CAAC;AACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Security-focused prompts for content masking and secret detection
3
+ * Following prompt-driven development approach
4
+ */
5
+ /**
6
+ * AI prompt for detecting sensitive information patterns in content
7
+ */
8
+ export declare function generateSensitiveContentDetectionPrompt(content: string, contentType?: 'code' | 'documentation' | 'configuration' | 'logs' | 'general', userDefinedPatterns?: string[]): string;
9
+ /**
10
+ * AI prompt for intelligent content masking decisions
11
+ */
12
+ export declare function generateContentMaskingPrompt(content: string, detectedSensitiveItems: Array<{
13
+ type: string;
14
+ content: string;
15
+ startPosition: number;
16
+ endPosition: number;
17
+ severity: string;
18
+ }>, maskingStrategy?: 'full' | 'partial' | 'placeholder' | 'environment'): string;
19
+ /**
20
+ * AI prompt for user-defined sensitive pattern configuration
21
+ */
22
+ export declare function generateCustomPatternConfigurationPrompt(projectContext: string, existingPatterns?: string[]): string;
23
+ //# sourceMappingURL=security-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-prompts.d.ts","sourceRoot":"","sources":["../../../src/prompts/security-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,uCAAuC,CACrD,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,MAAM,GAAG,SAAqB,EACxF,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAC7B,MAAM,CA2GR;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,KAAK,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,EACF,eAAe,GAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,aAAsB,GAC3E,MAAM,CAsFR;AAED;;GAEG;AACH,wBAAgB,wCAAwC,CACtD,cAAc,EAAE,MAAM,EACtB,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAC1B,MAAM,CAmFR"}