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.
- package/LICENSE +21 -0
- package/README.md +608 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +1722 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/prompts/adr-suggestion-prompts.d.ts +24 -0
- package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -0
- package/dist/src/prompts/adr-suggestion-prompts.js +383 -0
- package/dist/src/prompts/adr-suggestion-prompts.js.map +1 -0
- package/dist/src/prompts/analysis-prompts.d.ts +24 -0
- package/dist/src/prompts/analysis-prompts.d.ts.map +1 -0
- package/dist/src/prompts/analysis-prompts.js +489 -0
- package/dist/src/prompts/analysis-prompts.js.map +1 -0
- package/dist/src/prompts/deployment-analysis-prompts.d.ts +54 -0
- package/dist/src/prompts/deployment-analysis-prompts.d.ts.map +1 -0
- package/dist/src/prompts/deployment-analysis-prompts.js +712 -0
- package/dist/src/prompts/deployment-analysis-prompts.js.map +1 -0
- package/dist/src/prompts/environment-analysis-prompts.d.ts +34 -0
- package/dist/src/prompts/environment-analysis-prompts.d.ts.map +1 -0
- package/dist/src/prompts/environment-analysis-prompts.js +724 -0
- package/dist/src/prompts/environment-analysis-prompts.js.map +1 -0
- package/dist/src/prompts/index.d.ts +43 -0
- package/dist/src/prompts/index.d.ts.map +1 -0
- package/dist/src/prompts/index.js +384 -0
- package/dist/src/prompts/index.js.map +1 -0
- package/dist/src/prompts/research-integration-prompts.d.ts +43 -0
- package/dist/src/prompts/research-integration-prompts.d.ts.map +1 -0
- package/dist/src/prompts/research-integration-prompts.js +398 -0
- package/dist/src/prompts/research-integration-prompts.js.map +1 -0
- package/dist/src/prompts/research-question-prompts.d.ts +75 -0
- package/dist/src/prompts/research-question-prompts.d.ts.map +1 -0
- package/dist/src/prompts/research-question-prompts.js +695 -0
- package/dist/src/prompts/research-question-prompts.js.map +1 -0
- package/dist/src/prompts/rule-generation-prompts.d.ts +63 -0
- package/dist/src/prompts/rule-generation-prompts.d.ts.map +1 -0
- package/dist/src/prompts/rule-generation-prompts.js +630 -0
- package/dist/src/prompts/rule-generation-prompts.js.map +1 -0
- package/dist/src/prompts/security-prompts.d.ts +23 -0
- package/dist/src/prompts/security-prompts.d.ts.map +1 -0
- package/dist/src/prompts/security-prompts.js +287 -0
- package/dist/src/prompts/security-prompts.js.map +1 -0
- package/dist/src/resources/index.d.ts +24 -0
- package/dist/src/resources/index.d.ts.map +1 -0
- package/dist/src/resources/index.js +458 -0
- package/dist/src/resources/index.js.map +1 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts +40 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -0
- package/dist/src/tools/adr-suggestion-tool.js +338 -0
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -0
- package/dist/src/tools/content-masking-tool.d.ts +52 -0
- package/dist/src/tools/content-masking-tool.d.ts.map +1 -0
- package/dist/src/tools/content-masking-tool.js +206 -0
- package/dist/src/tools/content-masking-tool.js.map +1 -0
- package/dist/src/tools/deployment-analysis-tool.d.ts +39 -0
- package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -0
- package/dist/src/tools/deployment-analysis-tool.js +310 -0
- package/dist/src/tools/deployment-analysis-tool.js.map +1 -0
- package/dist/src/tools/environment-analysis-tool.d.ts +16 -0
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -0
- package/dist/src/tools/environment-analysis-tool.js +298 -0
- package/dist/src/tools/environment-analysis-tool.js.map +1 -0
- package/dist/src/tools/research-integration-tool.d.ts +44 -0
- package/dist/src/tools/research-integration-tool.d.ts.map +1 -0
- package/dist/src/tools/research-integration-tool.js +429 -0
- package/dist/src/tools/research-integration-tool.js.map +1 -0
- package/dist/src/tools/research-question-tool.d.ts +55 -0
- package/dist/src/tools/research-question-tool.d.ts.map +1 -0
- package/dist/src/tools/research-question-tool.js +333 -0
- package/dist/src/tools/research-question-tool.js.map +1 -0
- package/dist/src/tools/rule-generation-tool.d.ts +49 -0
- package/dist/src/tools/rule-generation-tool.d.ts.map +1 -0
- package/dist/src/tools/rule-generation-tool.js +432 -0
- package/dist/src/tools/rule-generation-tool.js.map +1 -0
- package/dist/src/types/index.d.ts +531 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +129 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utils/adr-suggestions.d.ts +104 -0
- package/dist/src/utils/adr-suggestions.d.ts.map +1 -0
- package/dist/src/utils/adr-suggestions.js +228 -0
- package/dist/src/utils/adr-suggestions.js.map +1 -0
- package/dist/src/utils/cache.d.ts +51 -0
- package/dist/src/utils/cache.d.ts.map +1 -0
- package/dist/src/utils/cache.js +243 -0
- package/dist/src/utils/cache.js.map +1 -0
- package/dist/src/utils/config.d.ts +65 -0
- package/dist/src/utils/config.d.ts.map +1 -0
- package/dist/src/utils/config.js +118 -0
- package/dist/src/utils/config.js.map +1 -0
- package/dist/src/utils/content-masking.d.ts +79 -0
- package/dist/src/utils/content-masking.d.ts.map +1 -0
- package/dist/src/utils/content-masking.js +203 -0
- package/dist/src/utils/content-masking.js.map +1 -0
- package/dist/src/utils/deployment-analysis.d.ts +67 -0
- package/dist/src/utils/deployment-analysis.d.ts.map +1 -0
- package/dist/src/utils/deployment-analysis.js +263 -0
- package/dist/src/utils/deployment-analysis.js.map +1 -0
- package/dist/src/utils/environment-analysis.d.ts +76 -0
- package/dist/src/utils/environment-analysis.d.ts.map +1 -0
- package/dist/src/utils/environment-analysis.js +329 -0
- package/dist/src/utils/environment-analysis.js.map +1 -0
- package/dist/src/utils/file-system.d.ts +63 -0
- package/dist/src/utils/file-system.d.ts.map +1 -0
- package/dist/src/utils/file-system.js +189 -0
- package/dist/src/utils/file-system.js.map +1 -0
- package/dist/src/utils/output-masking.d.ts +45 -0
- package/dist/src/utils/output-masking.d.ts.map +1 -0
- package/dist/src/utils/output-masking.js +200 -0
- package/dist/src/utils/output-masking.js.map +1 -0
- package/dist/src/utils/research-documentation.d.ts +58 -0
- package/dist/src/utils/research-documentation.d.ts.map +1 -0
- package/dist/src/utils/research-documentation.js +438 -0
- package/dist/src/utils/research-documentation.js.map +1 -0
- package/dist/src/utils/research-integration.d.ts +89 -0
- package/dist/src/utils/research-integration.d.ts.map +1 -0
- package/dist/src/utils/research-integration.js +432 -0
- package/dist/src/utils/research-integration.js.map +1 -0
- package/dist/src/utils/research-questions.d.ts +97 -0
- package/dist/src/utils/research-questions.d.ts.map +1 -0
- package/dist/src/utils/research-questions.js +319 -0
- package/dist/src/utils/research-questions.js.map +1 -0
- package/dist/src/utils/rule-format.d.ts +76 -0
- package/dist/src/utils/rule-format.d.ts.map +1 -0
- package/dist/src/utils/rule-format.js +257 -0
- package/dist/src/utils/rule-format.js.map +1 -0
- package/dist/src/utils/rule-generation.d.ts +86 -0
- package/dist/src/utils/rule-generation.d.ts.map +1 -0
- package/dist/src/utils/rule-generation.js +330 -0
- package/dist/src/utils/rule-generation.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool for ADR suggestions and implicit decision detection
|
|
3
|
+
* Implements prompt-driven ADR recommendation system
|
|
4
|
+
*/
|
|
5
|
+
import { McpAdrError } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Suggest ADRs based on project analysis
|
|
8
|
+
*/
|
|
9
|
+
export async function suggestAdrs(args) {
|
|
10
|
+
const { projectPath = process.cwd(), analysisType = 'comprehensive', beforeCode, afterCode, changeDescription, commitMessages, existingAdrs, } = args;
|
|
11
|
+
try {
|
|
12
|
+
const { analyzeImplicitDecisions, analyzeCodeChanges } = await import('../utils/adr-suggestions.js');
|
|
13
|
+
switch (analysisType) {
|
|
14
|
+
case 'implicit_decisions': {
|
|
15
|
+
const result = await analyzeImplicitDecisions(projectPath, existingAdrs);
|
|
16
|
+
return {
|
|
17
|
+
content: [
|
|
18
|
+
{
|
|
19
|
+
type: 'text',
|
|
20
|
+
text: `# ADR Suggestions: Implicit Decisions Analysis
|
|
21
|
+
|
|
22
|
+
${result.instructions}
|
|
23
|
+
|
|
24
|
+
## AI Analysis Prompt
|
|
25
|
+
|
|
26
|
+
${result.analysisPrompt}
|
|
27
|
+
|
|
28
|
+
## Next Steps
|
|
29
|
+
|
|
30
|
+
1. **Submit the prompt** to an AI agent for comprehensive analysis
|
|
31
|
+
2. **Review the detected decisions** and prioritize based on impact and risk
|
|
32
|
+
3. **Use the \`generate_adr_from_decision\` tool** to create ADRs for high-priority decisions
|
|
33
|
+
4. **Integrate with existing ADR workflow** for review and approval
|
|
34
|
+
|
|
35
|
+
## Expected Output
|
|
36
|
+
|
|
37
|
+
The AI will identify implicit architectural decisions in your codebase and provide:
|
|
38
|
+
- Detailed decision analysis with evidence
|
|
39
|
+
- Priority and risk assessments
|
|
40
|
+
- Suggested ADR titles and content
|
|
41
|
+
- Recommendations for documentation strategy
|
|
42
|
+
`,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
case 'code_changes': {
|
|
48
|
+
if (!beforeCode || !afterCode || !changeDescription) {
|
|
49
|
+
throw new McpAdrError('Code change analysis requires beforeCode, afterCode, and changeDescription', 'INVALID_INPUT');
|
|
50
|
+
}
|
|
51
|
+
const result = await analyzeCodeChanges(beforeCode, afterCode, changeDescription, commitMessages);
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'text',
|
|
56
|
+
text: `# ADR Suggestions: Code Change Analysis
|
|
57
|
+
|
|
58
|
+
${result.instructions}
|
|
59
|
+
|
|
60
|
+
## AI Analysis Prompt
|
|
61
|
+
|
|
62
|
+
${result.analysisPrompt}
|
|
63
|
+
|
|
64
|
+
## Next Steps
|
|
65
|
+
|
|
66
|
+
1. **Submit the prompt** to an AI agent for change analysis
|
|
67
|
+
2. **Review the identified decisions** reflected in the code changes
|
|
68
|
+
3. **Document significant decisions** as ADRs using the generation tool
|
|
69
|
+
4. **Follow up with development team** for any clarification questions
|
|
70
|
+
|
|
71
|
+
## Expected Output
|
|
72
|
+
|
|
73
|
+
The AI will analyze the code changes and provide:
|
|
74
|
+
- Architectural decisions reflected in the changes
|
|
75
|
+
- Change motivation and context analysis
|
|
76
|
+
- Impact and risk assessment
|
|
77
|
+
- Recommendations for documentation
|
|
78
|
+
`,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
case 'comprehensive': {
|
|
84
|
+
const implicitResult = await analyzeImplicitDecisions(projectPath, existingAdrs);
|
|
85
|
+
return {
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: 'text',
|
|
89
|
+
text: `# ADR Suggestions: Comprehensive Analysis
|
|
90
|
+
|
|
91
|
+
This comprehensive analysis will identify all potential ADRs for your project.
|
|
92
|
+
|
|
93
|
+
## Project Analysis
|
|
94
|
+
- **Project Path**: ${projectPath}
|
|
95
|
+
- **Existing ADRs**: ${existingAdrs?.length || 0} ADRs found
|
|
96
|
+
- **Analysis Type**: Comprehensive (implicit decisions + patterns)
|
|
97
|
+
|
|
98
|
+
## Implicit Decisions Analysis
|
|
99
|
+
|
|
100
|
+
${implicitResult.instructions}
|
|
101
|
+
|
|
102
|
+
## AI Analysis Prompt
|
|
103
|
+
|
|
104
|
+
${implicitResult.analysisPrompt}
|
|
105
|
+
|
|
106
|
+
## Recommended Workflow
|
|
107
|
+
|
|
108
|
+
### 1. **Initial Analysis**
|
|
109
|
+
Submit the prompt above to get comprehensive decision detection
|
|
110
|
+
|
|
111
|
+
### 2. **Priority Review**
|
|
112
|
+
- Focus on **high** and **critical** priority decisions first
|
|
113
|
+
- Consider **risk level** and **complexity** for planning
|
|
114
|
+
- Group related decisions using suggested clusters
|
|
115
|
+
|
|
116
|
+
### 3. **ADR Generation**
|
|
117
|
+
Use \`generate_adr_from_decision\` tool for each prioritized decision:
|
|
118
|
+
\`\`\`
|
|
119
|
+
{
|
|
120
|
+
"tool": "generate_adr_from_decision",
|
|
121
|
+
"args": {
|
|
122
|
+
"decisionData": {
|
|
123
|
+
"title": "Decision title from analysis",
|
|
124
|
+
"context": "Context from analysis",
|
|
125
|
+
"decision": "Decision description",
|
|
126
|
+
"consequences": "Consequences from analysis"
|
|
127
|
+
},
|
|
128
|
+
"templateFormat": "nygard",
|
|
129
|
+
"existingAdrs": ["list of existing ADRs"]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
\`\`\`
|
|
133
|
+
|
|
134
|
+
### 4. **Integration**
|
|
135
|
+
- Save generated ADRs to your ADR directory
|
|
136
|
+
- Update ADR index/catalog
|
|
137
|
+
- Schedule team review sessions
|
|
138
|
+
- Plan implementation tasks
|
|
139
|
+
|
|
140
|
+
## Expected Outcomes
|
|
141
|
+
|
|
142
|
+
This analysis will help you:
|
|
143
|
+
- **Identify undocumented decisions** in your architecture
|
|
144
|
+
- **Prioritize documentation efforts** based on impact and risk
|
|
145
|
+
- **Generate high-quality ADRs** using AI assistance
|
|
146
|
+
- **Improve architectural governance** and decision tracking
|
|
147
|
+
`,
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
default:
|
|
153
|
+
throw new McpAdrError(`Unknown analysis type: ${analysisType}`, 'INVALID_INPUT');
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
throw new McpAdrError(`Failed to suggest ADRs: ${error instanceof Error ? error.message : String(error)}`, 'SUGGESTION_ERROR');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Generate ADR from decision data
|
|
162
|
+
*/
|
|
163
|
+
export async function generateAdrFromDecision(args) {
|
|
164
|
+
const { decisionData, templateFormat = 'nygard', existingAdrs = [], adrDirectory = 'docs/adrs', } = args;
|
|
165
|
+
try {
|
|
166
|
+
const { generateAdrFromDecision, generateNextAdrNumber, suggestAdrFilename } = await import('../utils/adr-suggestions.js');
|
|
167
|
+
if (!decisionData.title ||
|
|
168
|
+
!decisionData.context ||
|
|
169
|
+
!decisionData.decision ||
|
|
170
|
+
!decisionData.consequences) {
|
|
171
|
+
throw new McpAdrError('Decision data must include title, context, decision, and consequences', 'INVALID_INPUT');
|
|
172
|
+
}
|
|
173
|
+
const result = await generateAdrFromDecision(decisionData, templateFormat, existingAdrs);
|
|
174
|
+
// Generate suggested metadata
|
|
175
|
+
const adrNumber = generateNextAdrNumber(existingAdrs);
|
|
176
|
+
const filename = suggestAdrFilename(decisionData.title, adrNumber);
|
|
177
|
+
const fullPath = `${adrDirectory}/${filename}`;
|
|
178
|
+
return {
|
|
179
|
+
content: [
|
|
180
|
+
{
|
|
181
|
+
type: 'text',
|
|
182
|
+
text: `# ADR Generation: ${decisionData.title}
|
|
183
|
+
|
|
184
|
+
${result.instructions}
|
|
185
|
+
|
|
186
|
+
## Suggested ADR Metadata
|
|
187
|
+
- **ADR Number**: ${adrNumber}
|
|
188
|
+
- **Filename**: ${filename}
|
|
189
|
+
- **Full Path**: ${fullPath}
|
|
190
|
+
- **Template Format**: ${templateFormat.toUpperCase()}
|
|
191
|
+
|
|
192
|
+
## AI Generation Prompt
|
|
193
|
+
|
|
194
|
+
${result.generationPrompt}
|
|
195
|
+
|
|
196
|
+
## Next Steps
|
|
197
|
+
|
|
198
|
+
1. **Submit the generation prompt** to an AI agent for ADR creation
|
|
199
|
+
2. **Review the generated ADR** for completeness and accuracy
|
|
200
|
+
3. **Save the ADR** to the suggested location: \`${fullPath}\`
|
|
201
|
+
4. **Update ADR index** and notify relevant stakeholders
|
|
202
|
+
5. **Schedule review** with architecture team
|
|
203
|
+
|
|
204
|
+
## Quality Checklist
|
|
205
|
+
|
|
206
|
+
Before finalizing the ADR, ensure:
|
|
207
|
+
- [ ] **Title** is clear and descriptive
|
|
208
|
+
- [ ] **Context** explains the problem and constraints
|
|
209
|
+
- [ ] **Decision** is specific and actionable
|
|
210
|
+
- [ ] **Consequences** cover both positive and negative impacts
|
|
211
|
+
- [ ] **Alternatives** are documented (if applicable)
|
|
212
|
+
- [ ] **Evidence** supports the decision (if applicable)
|
|
213
|
+
- [ ] **Format** follows team standards
|
|
214
|
+
- [ ] **Numbering** is correct and sequential
|
|
215
|
+
|
|
216
|
+
## Integration Tips
|
|
217
|
+
|
|
218
|
+
- Add the ADR to your project's ADR index
|
|
219
|
+
- Link to related ADRs and documentation
|
|
220
|
+
- Include implementation tasks in project planning
|
|
221
|
+
- Schedule follow-up reviews for complex decisions
|
|
222
|
+
`,
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
throw new McpAdrError(`Failed to generate ADR: ${error instanceof Error ? error.message : String(error)}`, 'GENERATION_ERROR');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Discover existing ADRs in the project
|
|
233
|
+
*/
|
|
234
|
+
export async function discoverExistingAdrs(args) {
|
|
235
|
+
const { adrDirectory = 'docs/adrs', includeContent = false } = args;
|
|
236
|
+
try {
|
|
237
|
+
const { findFiles } = await import('../utils/file-system.js');
|
|
238
|
+
// Find all ADR files
|
|
239
|
+
const adrFiles = await findFiles(process.cwd(), [`${adrDirectory}/**/*.md`], {
|
|
240
|
+
includeContent,
|
|
241
|
+
});
|
|
242
|
+
if (adrFiles.length === 0) {
|
|
243
|
+
return {
|
|
244
|
+
content: [
|
|
245
|
+
{
|
|
246
|
+
type: 'text',
|
|
247
|
+
text: `# ADR Discovery Results
|
|
248
|
+
|
|
249
|
+
## No ADRs Found
|
|
250
|
+
No ADR files were found in the directory: \`${adrDirectory}\`
|
|
251
|
+
|
|
252
|
+
## Suggestions
|
|
253
|
+
1. **Check directory path**: Ensure the ADR directory path is correct
|
|
254
|
+
2. **Initialize ADR directory**: Create the directory if it doesn't exist
|
|
255
|
+
3. **Use different pattern**: ADRs might be stored with different naming conventions
|
|
256
|
+
4. **Start fresh**: Begin documenting architectural decisions with new ADRs
|
|
257
|
+
|
|
258
|
+
## Getting Started
|
|
259
|
+
Use the \`suggest_adrs\` tool to identify decisions that should be documented:
|
|
260
|
+
\`\`\`
|
|
261
|
+
{
|
|
262
|
+
"tool": "suggest_adrs",
|
|
263
|
+
"args": {
|
|
264
|
+
"analysisType": "comprehensive"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
\`\`\`
|
|
268
|
+
`,
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
// Extract ADR metadata
|
|
274
|
+
const adrList = adrFiles.map(file => {
|
|
275
|
+
const titleMatch = file.content?.match(/^#\s+(.+)$/m);
|
|
276
|
+
const statusMatch = file.content?.match(/##\s+Status\s*\n\s*(.+)/i);
|
|
277
|
+
const dateMatch = file.content?.match(/\b(\d{4}-\d{2}-\d{2})\b/);
|
|
278
|
+
return {
|
|
279
|
+
filename: file.name,
|
|
280
|
+
path: file.path,
|
|
281
|
+
title: titleMatch?.[1] || file.name.replace(/\.md$/, ''),
|
|
282
|
+
status: statusMatch?.[1] || 'Unknown',
|
|
283
|
+
date: dateMatch?.[1] || 'Unknown',
|
|
284
|
+
size: file.size,
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
return {
|
|
288
|
+
content: [
|
|
289
|
+
{
|
|
290
|
+
type: 'text',
|
|
291
|
+
text: `# ADR Discovery Results
|
|
292
|
+
|
|
293
|
+
## Summary
|
|
294
|
+
- **Directory**: ${adrDirectory}
|
|
295
|
+
- **Total ADRs**: ${adrFiles.length}
|
|
296
|
+
- **Total Size**: ${adrFiles.reduce((sum, f) => sum + (f.size || 0), 0)} bytes
|
|
297
|
+
|
|
298
|
+
## Discovered ADRs
|
|
299
|
+
${adrList
|
|
300
|
+
.map((adr, index) => `
|
|
301
|
+
### ${index + 1}. ${adr.title}
|
|
302
|
+
- **File**: ${adr.filename}
|
|
303
|
+
- **Path**: ${adr.path}
|
|
304
|
+
- **Status**: ${adr.status}
|
|
305
|
+
- **Date**: ${adr.date}
|
|
306
|
+
- **Size**: ${adr.size} bytes
|
|
307
|
+
`)
|
|
308
|
+
.join('')}
|
|
309
|
+
|
|
310
|
+
## ADR Titles (for reference)
|
|
311
|
+
${adrList.map(adr => `- ${adr.title}`).join('\n')}
|
|
312
|
+
|
|
313
|
+
## Next Steps
|
|
314
|
+
1. **Review existing ADRs** for completeness and currency
|
|
315
|
+
2. **Identify gaps** using the \`suggest_adrs\` tool
|
|
316
|
+
3. **Update outdated ADRs** as needed
|
|
317
|
+
4. **Establish ADR workflow** for future decisions
|
|
318
|
+
|
|
319
|
+
## Usage with ADR Tools
|
|
320
|
+
Use the discovered ADR titles with other tools:
|
|
321
|
+
\`\`\`
|
|
322
|
+
{
|
|
323
|
+
"tool": "suggest_adrs",
|
|
324
|
+
"args": {
|
|
325
|
+
"existingAdrs": [${adrList.map(adr => `"${adr.title}"`).join(', ')}]
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
\`\`\`
|
|
329
|
+
`,
|
|
330
|
+
},
|
|
331
|
+
],
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
catch (error) {
|
|
335
|
+
throw new McpAdrError(`Failed to discover ADRs: ${error instanceof Error ? error.message : String(error)}`, 'DISCOVERY_ERROR');
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=adr-suggestion-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adr-suggestion-tool.js","sourceRoot":"","sources":["../../../src/tools/adr-suggestion-tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAQjC;IACC,MAAM,EACJ,WAAW,GAAG,OAAO,CAAC,GAAG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,GAAG,CAAC,IAAI;cACR,GAAG,CAAC,IAAI;CACrB,CACE;yBACA,IAAI,CAAC,EAAE,CAAC;;;EAGT,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;uBAc1B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;CAIrE;iBACQ;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CACnB,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACpF,iBAAiB,CAClB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool for content masking and sensitive information detection
|
|
3
|
+
* Implements prompt-driven security analysis
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Analyze content for sensitive information
|
|
7
|
+
*/
|
|
8
|
+
export declare function analyzeContentSecurity(args: {
|
|
9
|
+
content: string;
|
|
10
|
+
contentType?: 'code' | 'documentation' | 'configuration' | 'logs' | 'general';
|
|
11
|
+
userDefinedPatterns?: string[];
|
|
12
|
+
}): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Generate masking instructions for detected sensitive content
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateContentMasking(args: {
|
|
17
|
+
content: string;
|
|
18
|
+
detectedItems: Array<{
|
|
19
|
+
type: string;
|
|
20
|
+
category?: string;
|
|
21
|
+
content: string;
|
|
22
|
+
startPosition: number;
|
|
23
|
+
endPosition: number;
|
|
24
|
+
confidence?: number;
|
|
25
|
+
reasoning?: string;
|
|
26
|
+
severity: string;
|
|
27
|
+
suggestedMask?: string;
|
|
28
|
+
}>;
|
|
29
|
+
maskingStrategy?: 'full' | 'partial' | 'placeholder' | 'environment';
|
|
30
|
+
}): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Configure custom sensitive patterns for a project
|
|
33
|
+
*/
|
|
34
|
+
export declare function configureCustomPatterns(args: {
|
|
35
|
+
projectPath: string;
|
|
36
|
+
existingPatterns?: string[];
|
|
37
|
+
}): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Apply basic masking (fallback when AI is not available)
|
|
40
|
+
*/
|
|
41
|
+
export declare function applyBasicContentMasking(args: {
|
|
42
|
+
content: string;
|
|
43
|
+
maskingStrategy?: 'full' | 'partial' | 'placeholder';
|
|
44
|
+
}): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Validate that content masking was applied correctly
|
|
47
|
+
*/
|
|
48
|
+
export declare function validateContentMasking(args: {
|
|
49
|
+
originalContent: string;
|
|
50
|
+
maskedContent: string;
|
|
51
|
+
}): Promise<any>;
|
|
52
|
+
//# sourceMappingURL=content-masking-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-masking-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/content-masking-tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9E,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,GAAG,OAAO,CAAC,GAAG,CAAC,CA0Bf;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,KAAK,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,CAAC;CACtE,GAAG,OAAO,CAAC,GAAG,CAAC,CAkDf;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,GAAG,OAAO,CAAC,GAAG,CAAC,CA4Bf;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC;CACtD,GAAG,OAAO,CAAC,GAAG,CAAC,CAuDf;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,GAAG,CAAC,CA2Df"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool for content masking and sensitive information detection
|
|
3
|
+
* Implements prompt-driven security analysis
|
|
4
|
+
*/
|
|
5
|
+
import { McpAdrError } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Analyze content for sensitive information
|
|
8
|
+
*/
|
|
9
|
+
export async function analyzeContentSecurity(args) {
|
|
10
|
+
const { content, contentType = 'general', userDefinedPatterns } = args;
|
|
11
|
+
try {
|
|
12
|
+
const { analyzeSensitiveContent } = await import('../utils/content-masking.js');
|
|
13
|
+
if (!content || content.trim().length === 0) {
|
|
14
|
+
throw new McpAdrError('Content is required for security analysis', 'INVALID_INPUT');
|
|
15
|
+
}
|
|
16
|
+
const result = await analyzeSensitiveContent(content, contentType, userDefinedPatterns);
|
|
17
|
+
return {
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: 'text',
|
|
21
|
+
text: `# Sensitive Content Analysis\n\n${result.instructions}\n\n## AI Analysis Prompt\n\n${result.analysisPrompt}`,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new McpAdrError(`Failed to analyze content security: ${error instanceof Error ? error.message : String(error)}`, 'ANALYSIS_ERROR');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generate masking instructions for detected sensitive content
|
|
32
|
+
*/
|
|
33
|
+
export async function generateContentMasking(args) {
|
|
34
|
+
const { content, detectedItems, maskingStrategy = 'full' } = args;
|
|
35
|
+
try {
|
|
36
|
+
const { generateMaskingInstructions } = await import('../utils/content-masking.js');
|
|
37
|
+
if (!content || content.trim().length === 0) {
|
|
38
|
+
throw new McpAdrError('Content is required for masking', 'INVALID_INPUT');
|
|
39
|
+
}
|
|
40
|
+
if (!detectedItems || detectedItems.length === 0) {
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: 'No sensitive items detected. Content does not require masking.',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// Convert to SensitiveItem format
|
|
51
|
+
const sensitiveItems = detectedItems.map(item => ({
|
|
52
|
+
type: item.type,
|
|
53
|
+
category: item.category || 'unknown',
|
|
54
|
+
content: item.content,
|
|
55
|
+
startPosition: item.startPosition,
|
|
56
|
+
endPosition: item.endPosition,
|
|
57
|
+
confidence: item.confidence || 0.8,
|
|
58
|
+
reasoning: item.reasoning || 'Detected by user input',
|
|
59
|
+
severity: item.severity,
|
|
60
|
+
suggestedMask: item.suggestedMask || '[REDACTED]',
|
|
61
|
+
}));
|
|
62
|
+
const result = await generateMaskingInstructions(content, sensitiveItems, maskingStrategy);
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: 'text',
|
|
67
|
+
text: `# Content Masking Instructions\n\n${result.instructions}\n\n## AI Masking Prompt\n\n${result.maskingPrompt}`,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw new McpAdrError(`Failed to generate masking instructions: ${error instanceof Error ? error.message : String(error)}`, 'MASKING_ERROR');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Configure custom sensitive patterns for a project
|
|
78
|
+
*/
|
|
79
|
+
export async function configureCustomPatterns(args) {
|
|
80
|
+
const { projectPath, existingPatterns } = args;
|
|
81
|
+
try {
|
|
82
|
+
const { analyzeProjectStructure } = await import('../utils/file-system.js');
|
|
83
|
+
const { generateAnalysisContext } = await import('../prompts/analysis-prompts.js');
|
|
84
|
+
const { generateCustomPatternConfiguration } = await import('../utils/content-masking.js');
|
|
85
|
+
// Analyze project structure for context
|
|
86
|
+
const projectStructure = await analyzeProjectStructure(projectPath);
|
|
87
|
+
const projectContext = generateAnalysisContext(projectStructure);
|
|
88
|
+
const result = await generateCustomPatternConfiguration(projectContext, existingPatterns);
|
|
89
|
+
return {
|
|
90
|
+
content: [
|
|
91
|
+
{
|
|
92
|
+
type: 'text',
|
|
93
|
+
text: `# Custom Pattern Configuration\n\n${result.instructions}\n\n## AI Configuration Prompt\n\n${result.configurationPrompt}`,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw new McpAdrError(`Failed to configure custom patterns: ${error instanceof Error ? error.message : String(error)}`, 'CONFIGURATION_ERROR');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Apply basic masking (fallback when AI is not available)
|
|
104
|
+
*/
|
|
105
|
+
export async function applyBasicContentMasking(args) {
|
|
106
|
+
const { content, maskingStrategy = 'full' } = args;
|
|
107
|
+
try {
|
|
108
|
+
const { applyBasicMasking, validateMasking } = await import('../utils/content-masking.js');
|
|
109
|
+
if (!content || content.trim().length === 0) {
|
|
110
|
+
throw new McpAdrError('Content is required for masking', 'INVALID_INPUT');
|
|
111
|
+
}
|
|
112
|
+
const maskedContent = applyBasicMasking(content, maskingStrategy);
|
|
113
|
+
const validation = validateMasking(content, maskedContent);
|
|
114
|
+
return {
|
|
115
|
+
content: [
|
|
116
|
+
{
|
|
117
|
+
type: 'text',
|
|
118
|
+
text: `# Basic Content Masking Applied
|
|
119
|
+
|
|
120
|
+
## Masking Strategy
|
|
121
|
+
${maskingStrategy}
|
|
122
|
+
|
|
123
|
+
## Original Content Length
|
|
124
|
+
${content.length} characters
|
|
125
|
+
|
|
126
|
+
## Masked Content
|
|
127
|
+
\`\`\`
|
|
128
|
+
${maskedContent}
|
|
129
|
+
\`\`\`
|
|
130
|
+
|
|
131
|
+
## Validation Results
|
|
132
|
+
- **Security Score**: ${(validation.securityScore * 100).toFixed(1)}%
|
|
133
|
+
- **Is Valid**: ${validation.isValid ? '✅ Yes' : '❌ No'}
|
|
134
|
+
|
|
135
|
+
${validation.issues.length > 0
|
|
136
|
+
? `## Issues Found
|
|
137
|
+
${validation.issues.map(issue => `- ${issue}`).join('\n')}`
|
|
138
|
+
: '## ✅ No Issues Found'}
|
|
139
|
+
|
|
140
|
+
## Recommendations
|
|
141
|
+
- For better security analysis, use AI-powered detection with \`analyze_content_security\`
|
|
142
|
+
- Consider using custom patterns for project-specific sensitive information
|
|
143
|
+
- Review masked content to ensure it maintains necessary functionality
|
|
144
|
+
`,
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
throw new McpAdrError(`Failed to apply basic masking: ${error instanceof Error ? error.message : String(error)}`, 'MASKING_ERROR');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Validate that content masking was applied correctly
|
|
155
|
+
*/
|
|
156
|
+
export async function validateContentMasking(args) {
|
|
157
|
+
const { originalContent, maskedContent } = args;
|
|
158
|
+
try {
|
|
159
|
+
const { validateMasking } = await import('../utils/content-masking.js');
|
|
160
|
+
if (!originalContent || !maskedContent) {
|
|
161
|
+
throw new McpAdrError('Both original and masked content are required', 'INVALID_INPUT');
|
|
162
|
+
}
|
|
163
|
+
const validation = validateMasking(originalContent, maskedContent);
|
|
164
|
+
return {
|
|
165
|
+
content: [
|
|
166
|
+
{
|
|
167
|
+
type: 'text',
|
|
168
|
+
text: `# Content Masking Validation
|
|
169
|
+
|
|
170
|
+
## Validation Results
|
|
171
|
+
- **Security Score**: ${(validation.securityScore * 100).toFixed(1)}%
|
|
172
|
+
- **Is Valid**: ${validation.isValid ? '✅ Yes' : '❌ No'}
|
|
173
|
+
|
|
174
|
+
## Content Comparison
|
|
175
|
+
- **Original Length**: ${originalContent.length} characters
|
|
176
|
+
- **Masked Length**: ${maskedContent.length} characters
|
|
177
|
+
- **Size Change**: ${((maskedContent.length / originalContent.length - 1) * 100).toFixed(1)}%
|
|
178
|
+
|
|
179
|
+
${validation.issues.length > 0
|
|
180
|
+
? `## ⚠️ Issues Found
|
|
181
|
+
${validation.issues.map(issue => `- ${issue}`).join('\n')}
|
|
182
|
+
|
|
183
|
+
## Recommendations
|
|
184
|
+
- Review the masking process to address identified issues
|
|
185
|
+
- Consider using more comprehensive AI-powered masking
|
|
186
|
+
- Ensure all sensitive patterns are properly detected and masked`
|
|
187
|
+
: '## ✅ Validation Passed'}
|
|
188
|
+
|
|
189
|
+
## Security Assessment
|
|
190
|
+
${validation.securityScore >= 0.9
|
|
191
|
+
? '🟢 **Excellent**: Content appears to be properly masked'
|
|
192
|
+
: validation.securityScore >= 0.7
|
|
193
|
+
? '🟡 **Good**: Minor issues detected, review recommended'
|
|
194
|
+
: validation.securityScore >= 0.5
|
|
195
|
+
? '🟠 **Fair**: Several issues found, masking needs improvement'
|
|
196
|
+
: '🔴 **Poor**: Significant security issues, masking failed'}
|
|
197
|
+
`,
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
throw new McpAdrError(`Failed to validate masking: ${error instanceof Error ? error.message : String(error)}`, 'VALIDATION_ERROR');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=content-masking-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-masking-tool.js","sourceRoot":"","sources":["../../../src/tools/content-masking-tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,IAI5C;IACC,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,SAAS,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC;IAEvE,IAAI,CAAC;QACH,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;QAEhF,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,WAAW,CAAC,2CAA2C,EAAE,eAAe,CAAC,CAAC;QACtF,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC;QAExF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,E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BACtB,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;EAGzF,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;wBAC1B,CAAC,CAAC;EACJ,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;iEAKQ;wBAC7D,CAAC,CAAC,wBACN;;;EAIE,UAAU,CAAC,aAAa,IAAI,GAAG;wBAC7B,CAAC,CAAC,yDAAyD;wBAC3D,CAAC,CAAC,UAAU,CAAC,aAAa,IAAI,GAAG;4BAC/B,CAAC,CAAC,wDAAwD;4BAC1D,CAAC,CAAC,UAAU,CAAC,aAAa,IAAI,GAAG;gCAC/B,CAAC,CAAC,8DAA8D;gCAChE,CAAC,CAAC,0DACV;CACC;iBACQ;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CACnB,+BAA+B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACvF,kBAAkB,CACnB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool for deployment completion analysis
|
|
3
|
+
* Implements prompt-driven deployment progress tracking and completion verification
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Analyze deployment progress and verify completion
|
|
7
|
+
*/
|
|
8
|
+
export declare function analyzeDeploymentProgress(args: {
|
|
9
|
+
analysisType?: 'tasks' | 'cicd' | 'progress' | 'completion' | 'comprehensive';
|
|
10
|
+
adrDirectory?: string;
|
|
11
|
+
todoPath?: string;
|
|
12
|
+
cicdLogs?: string;
|
|
13
|
+
pipelineConfig?: string;
|
|
14
|
+
deploymentTasks?: Array<{
|
|
15
|
+
taskId: string;
|
|
16
|
+
taskName: string;
|
|
17
|
+
status: string;
|
|
18
|
+
progress: number;
|
|
19
|
+
category: string;
|
|
20
|
+
priority: string;
|
|
21
|
+
verificationCriteria: string[];
|
|
22
|
+
expectedOutcome: string;
|
|
23
|
+
}>;
|
|
24
|
+
outcomeRules?: Array<{
|
|
25
|
+
ruleId: string;
|
|
26
|
+
description: string;
|
|
27
|
+
criteria: string[];
|
|
28
|
+
verificationMethod: string;
|
|
29
|
+
}>;
|
|
30
|
+
actualOutcomes?: Array<{
|
|
31
|
+
taskId: string;
|
|
32
|
+
outcome: string;
|
|
33
|
+
evidence: string[];
|
|
34
|
+
timestamp: string;
|
|
35
|
+
}>;
|
|
36
|
+
cicdStatus?: any;
|
|
37
|
+
environmentStatus?: any;
|
|
38
|
+
}): Promise<any>;
|
|
39
|
+
//# sourceMappingURL=deployment-analysis-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-analysis-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/deployment-analysis-tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,eAAe,CAAC;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,KAAK,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,oBAAoB,EAAE,MAAM,EAAE,CAAC;QAC/B,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC,CAAC;IACH,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,iBAAiB,CAAC,EAAE,GAAG,CAAC;CACzB,GAAG,OAAO,CAAC,GAAG,CAAC,CA2Vf"}
|