mcp-adr-analysis-server 1.1.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +367 -150
  2. package/dist/src/config/ai-config.d.ts +81 -0
  3. package/dist/src/config/ai-config.d.ts.map +1 -0
  4. package/dist/src/config/ai-config.js +134 -0
  5. package/dist/src/config/ai-config.js.map +1 -0
  6. package/dist/src/index.d.ts +97 -1
  7. package/dist/src/index.d.ts.map +1 -1
  8. package/dist/src/index.js +2430 -186
  9. package/dist/src/index.js.map +1 -1
  10. package/dist/src/prompts/adr-suggestion-prompts.d.ts +2 -2
  11. package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -1
  12. package/dist/src/prompts/adr-suggestion-prompts.js +25 -17
  13. package/dist/src/prompts/adr-suggestion-prompts.js.map +1 -1
  14. package/dist/src/prompts/analysis-prompts.js +1 -1
  15. package/dist/src/prompts/analysis-prompts.js.map +1 -1
  16. package/dist/src/resources/index.d.ts +1 -1
  17. package/dist/src/resources/index.d.ts.map +1 -1
  18. package/dist/src/resources/index.js +52 -44
  19. package/dist/src/resources/index.js.map +1 -1
  20. package/dist/src/templates/domain-knowledge-templates.d.ts +36 -0
  21. package/dist/src/templates/domain-knowledge-templates.d.ts.map +1 -0
  22. package/dist/src/templates/domain-knowledge-templates.js +376 -0
  23. package/dist/src/templates/domain-knowledge-templates.js.map +1 -0
  24. package/dist/src/tools/adr-suggestion-tool.d.ts +8 -3
  25. package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
  26. package/dist/src/tools/adr-suggestion-tool.js +561 -172
  27. package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
  28. package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
  29. package/dist/src/tools/content-masking-tool.js +168 -22
  30. package/dist/src/tools/content-masking-tool.js.map +1 -1
  31. package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -1
  32. package/dist/src/tools/deployment-analysis-tool.js +64 -27
  33. package/dist/src/tools/deployment-analysis-tool.js.map +1 -1
  34. package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
  35. package/dist/src/tools/environment-analysis-tool.js +65 -29
  36. package/dist/src/tools/environment-analysis-tool.js.map +1 -1
  37. package/dist/src/tools/research-question-tool.d.ts.map +1 -1
  38. package/dist/src/tools/research-question-tool.js +150 -49
  39. package/dist/src/tools/research-question-tool.js.map +1 -1
  40. package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
  41. package/dist/src/tools/rule-generation-tool.js +328 -143
  42. package/dist/src/tools/rule-generation-tool.js.map +1 -1
  43. package/dist/src/types/ape-framework.d.ts +566 -0
  44. package/dist/src/types/ape-framework.d.ts.map +1 -0
  45. package/dist/src/types/ape-framework.js +98 -0
  46. package/dist/src/types/ape-framework.js.map +1 -0
  47. package/dist/src/types/index.d.ts +96 -93
  48. package/dist/src/types/index.d.ts.map +1 -1
  49. package/dist/src/types/knowledge-generation.d.ts +671 -0
  50. package/dist/src/types/knowledge-generation.d.ts.map +1 -0
  51. package/dist/src/types/knowledge-generation.js +107 -0
  52. package/dist/src/types/knowledge-generation.js.map +1 -0
  53. package/dist/src/types/reflexion-framework.d.ts +652 -0
  54. package/dist/src/types/reflexion-framework.d.ts.map +1 -0
  55. package/dist/src/types/reflexion-framework.js +85 -0
  56. package/dist/src/types/reflexion-framework.js.map +1 -0
  57. package/dist/src/utils/adr-suggestions.d.ts +1 -1
  58. package/dist/src/utils/adr-suggestions.d.ts.map +1 -1
  59. package/dist/src/utils/adr-suggestions.js +8 -50
  60. package/dist/src/utils/adr-suggestions.js.map +1 -1
  61. package/dist/src/utils/ai-executor.d.ts +125 -0
  62. package/dist/src/utils/ai-executor.d.ts.map +1 -0
  63. package/dist/src/utils/ai-executor.js +292 -0
  64. package/dist/src/utils/ai-executor.js.map +1 -0
  65. package/dist/src/utils/automatic-prompt-engineering.d.ts +72 -0
  66. package/dist/src/utils/automatic-prompt-engineering.d.ts.map +1 -0
  67. package/dist/src/utils/automatic-prompt-engineering.js +820 -0
  68. package/dist/src/utils/automatic-prompt-engineering.js.map +1 -0
  69. package/dist/src/utils/cache.d.ts +54 -22
  70. package/dist/src/utils/cache.d.ts.map +1 -1
  71. package/dist/src/utils/cache.js +1234 -143
  72. package/dist/src/utils/cache.js.map +1 -1
  73. package/dist/src/utils/config.d.ts +2 -2
  74. package/dist/src/utils/config.js +3 -3
  75. package/dist/src/utils/config.js.map +1 -1
  76. package/dist/src/utils/deployment-analysis.d.ts.map +1 -1
  77. package/dist/src/utils/deployment-analysis.js +57 -38
  78. package/dist/src/utils/deployment-analysis.js.map +1 -1
  79. package/dist/src/utils/environment-analysis.d.ts.map +1 -1
  80. package/dist/src/utils/environment-analysis.js +113 -100
  81. package/dist/src/utils/environment-analysis.js.map +1 -1
  82. package/dist/src/utils/file-system.d.ts +42 -13
  83. package/dist/src/utils/file-system.d.ts.map +1 -1
  84. package/dist/src/utils/file-system.js +795 -89
  85. package/dist/src/utils/file-system.js.map +1 -1
  86. package/dist/src/utils/index.d.ts +9 -0
  87. package/dist/src/utils/index.d.ts.map +1 -0
  88. package/dist/src/utils/index.js +13 -0
  89. package/dist/src/utils/index.js.map +1 -0
  90. package/dist/src/utils/knowledge-generation.d.ts +79 -0
  91. package/dist/src/utils/knowledge-generation.d.ts.map +1 -0
  92. package/dist/src/utils/knowledge-generation.js +646 -0
  93. package/dist/src/utils/knowledge-generation.js.map +1 -0
  94. package/dist/src/utils/output-masking.d.ts.map +1 -1
  95. package/dist/src/utils/output-masking.js +2 -1
  96. package/dist/src/utils/output-masking.js.map +1 -1
  97. package/dist/src/utils/prompt-composition.d.ts +234 -0
  98. package/dist/src/utils/prompt-composition.d.ts.map +1 -0
  99. package/dist/src/utils/prompt-composition.js +379 -0
  100. package/dist/src/utils/prompt-composition.js.map +1 -0
  101. package/dist/src/utils/prompt-execution.d.ts +88 -0
  102. package/dist/src/utils/prompt-execution.d.ts.map +1 -0
  103. package/dist/src/utils/prompt-execution.js +227 -0
  104. package/dist/src/utils/prompt-execution.js.map +1 -0
  105. package/dist/src/utils/reflexion.d.ts +92 -0
  106. package/dist/src/utils/reflexion.d.ts.map +1 -0
  107. package/dist/src/utils/reflexion.js +1100 -0
  108. package/dist/src/utils/reflexion.js.map +1 -0
  109. package/dist/src/utils/research-integration.d.ts.map +1 -1
  110. package/dist/src/utils/research-integration.js +156 -100
  111. package/dist/src/utils/research-integration.js.map +1 -1
  112. package/dist/src/utils/research-questions.d.ts.map +1 -1
  113. package/dist/src/utils/research-questions.js +85 -24
  114. package/dist/src/utils/research-questions.js.map +1 -1
  115. package/dist/src/utils/rule-generation.d.ts.map +1 -1
  116. package/dist/src/utils/rule-generation.js +92 -108
  117. package/dist/src/utils/rule-generation.js.map +1 -1
  118. package/package.json +9 -3
@@ -75,7 +75,8 @@ async function maskContent(content, config) {
75
75
  }
76
76
  catch (error) {
77
77
  // If masking fails, return original content with warning
78
- console.warn('Content masking failed:', error);
78
+ // Log to stderr to avoid corrupting MCP protocol
79
+ console.error('[WARN] Content masking failed:', error);
79
80
  return content;
80
81
  }
81
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"output-masking.js","sourceRoot":"","sources":["../../../src/utils/output-masking.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;GAEG;AACH,MAAM,sBAAsB,GAAkB;IAC5C,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,SAAS;IACnB,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE;QACZ,YAAY;QACZ,oBAAoB;QACpB,qBAAqB;QACrB,kBAAkB;QAClB,uBAAuB;KACxB;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAAa,EACb,SAAwB,sBAAsB;IAE9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,QAAQ,CAAC;IAClB,CA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AE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,MAAM,gBAAgB,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAE/F,MAAM,YAAY,GAAG;QACnB,gCAAgC,EAAE,SAAS;QAC3C,8BAA8B,EAAE,eAAe;QAC/C,oBAAoB,EAAE,wBAAwB;KAC/C,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAE7E,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC5D,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC1D,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Prompt Composition Utilities for 100% Prompt-Driven Architecture
3
+ *
4
+ * This module provides standardized utilities for composing prompts and implementing
5
+ * AI delegation patterns across the MCP ADR Analysis Server.
6
+ */
7
+ export interface PromptObject {
8
+ prompt: string;
9
+ instructions: string;
10
+ context: any;
11
+ }
12
+ export interface CombinedPrompt {
13
+ prompt: string;
14
+ instructions: string;
15
+ context: any;
16
+ metadata: {
17
+ sourcePrompts: number;
18
+ combinedAt: string;
19
+ totalLength: number;
20
+ };
21
+ }
22
+ export interface AIDelegationPrompt {
23
+ task: string;
24
+ instructions: string;
25
+ requirements: string[];
26
+ outputFormat: string;
27
+ context?: any;
28
+ }
29
+ export interface JSONSchemaSpec {
30
+ type: 'object' | 'array' | 'string' | 'number' | 'boolean';
31
+ properties?: Record<string, any>;
32
+ items?: any;
33
+ required?: string[];
34
+ description?: string;
35
+ }
36
+ export interface PromptValidationResult {
37
+ isValid: boolean;
38
+ errors: string[];
39
+ warnings: string[];
40
+ suggestions: string[];
41
+ }
42
+ /**
43
+ * Combine multiple prompt objects into a single comprehensive prompt
44
+ */
45
+ export declare function combinePrompts(...prompts: PromptObject[]): CombinedPrompt;
46
+ /**
47
+ * Create a standardized AI delegation prompt for specific tasks
48
+ */
49
+ export declare function createAIDelegationPrompt(task: string, requirements: string[], outputFormat: string, context?: any): AIDelegationPrompt;
50
+ /**
51
+ * Add JSON schema specification to a prompt for structured responses
52
+ */
53
+ export declare function addJSONSchema(prompt: string, schema: JSONSchemaSpec): string;
54
+ /**
55
+ * Validate AI response against expected format and requirements
56
+ */
57
+ export declare function validatePromptResponse(response: string, expectedFormat: 'json' | 'markdown' | 'text', requirements?: string[]): PromptValidationResult;
58
+ /**
59
+ * Create a file analysis prompt with standardized structure
60
+ */
61
+ export declare function createFileAnalysisPrompt(filePaths: string[], analysisType: string, outputSchema?: JSONSchemaSpec): string;
62
+ /**
63
+ * Create a project structure analysis prompt
64
+ */
65
+ export declare function createProjectStructurePrompt(projectPath: string, includePatterns?: string[], excludePatterns?: string[]): string;
66
+ /**
67
+ * Escape special characters in prompts for safe processing
68
+ */
69
+ export declare function escapePromptContent(content: string): string;
70
+ /**
71
+ * Truncate prompt content to specified length while preserving structure
72
+ */
73
+ export declare function truncatePrompt(prompt: string, maxLength: number): string;
74
+ /**
75
+ * Extract metadata from prompt responses
76
+ */
77
+ export declare function extractResponseMetadata(response: string): {
78
+ wordCount: number;
79
+ lineCount: number;
80
+ hasCodeBlocks: boolean;
81
+ hasLists: boolean;
82
+ estimatedReadingTime: number;
83
+ };
84
+ /**
85
+ * Example: Combining multiple prompts for comprehensive analysis
86
+ */
87
+ export declare function createComprehensiveAnalysisPrompt(projectPrompt: PromptObject, filePrompt: PromptObject, additionalRequirements?: string[]): CombinedPrompt;
88
+ /**
89
+ * Example: Creating a standardized ADR analysis prompt
90
+ */
91
+ export declare function createADRAnalysisPrompt(adrDirectory: string, analysisType: 'structure' | 'content' | 'relationships' | 'compliance'): AIDelegationPrompt;
92
+ /**
93
+ * Common JSON schemas for MCP responses
94
+ */
95
+ export declare const CommonSchemas: {
96
+ readonly adrList: {
97
+ readonly type: "object";
98
+ readonly properties: {
99
+ readonly adrs: {
100
+ readonly type: "array";
101
+ readonly items: {
102
+ readonly type: "object";
103
+ readonly properties: {
104
+ readonly id: {
105
+ readonly type: "string";
106
+ };
107
+ readonly title: {
108
+ readonly type: "string";
109
+ };
110
+ readonly status: {
111
+ readonly type: "string";
112
+ };
113
+ readonly date: {
114
+ readonly type: "string";
115
+ };
116
+ readonly filePath: {
117
+ readonly type: "string";
118
+ };
119
+ };
120
+ readonly required: readonly ["id", "title", "status", "date", "filePath"];
121
+ };
122
+ };
123
+ readonly summary: {
124
+ readonly type: "object";
125
+ readonly properties: {
126
+ readonly total: {
127
+ readonly type: "number";
128
+ };
129
+ readonly byStatus: {
130
+ readonly type: "object";
131
+ };
132
+ };
133
+ };
134
+ };
135
+ readonly required: readonly ["adrs", "summary"];
136
+ };
137
+ readonly fileAnalysis: {
138
+ readonly type: "object";
139
+ readonly properties: {
140
+ readonly files: {
141
+ readonly type: "array";
142
+ readonly items: {
143
+ readonly type: "object";
144
+ readonly properties: {
145
+ readonly path: {
146
+ readonly type: "string";
147
+ };
148
+ readonly type: {
149
+ readonly type: "string";
150
+ };
151
+ readonly size: {
152
+ readonly type: "number";
153
+ };
154
+ readonly analysis: {
155
+ readonly type: "object";
156
+ };
157
+ };
158
+ readonly required: readonly ["path", "type", "analysis"];
159
+ };
160
+ };
161
+ readonly summary: {
162
+ readonly type: "object";
163
+ readonly properties: {
164
+ readonly totalFiles: {
165
+ readonly type: "number";
166
+ };
167
+ readonly fileTypes: {
168
+ readonly type: "object";
169
+ };
170
+ readonly insights: {
171
+ readonly type: "array";
172
+ readonly items: {
173
+ readonly type: "string";
174
+ };
175
+ };
176
+ };
177
+ };
178
+ };
179
+ readonly required: readonly ["files", "summary"];
180
+ };
181
+ readonly projectStructure: {
182
+ readonly type: "object";
183
+ readonly properties: {
184
+ readonly structure: {
185
+ readonly type: "object";
186
+ readonly properties: {
187
+ readonly directories: {
188
+ readonly type: "array";
189
+ readonly items: {
190
+ readonly type: "string";
191
+ };
192
+ };
193
+ readonly files: {
194
+ readonly type: "array";
195
+ readonly items: {
196
+ readonly type: "string";
197
+ };
198
+ };
199
+ readonly totalFiles: {
200
+ readonly type: "number";
201
+ };
202
+ readonly totalDirectories: {
203
+ readonly type: "number";
204
+ };
205
+ };
206
+ };
207
+ readonly analysis: {
208
+ readonly type: "object";
209
+ readonly properties: {
210
+ readonly patterns: {
211
+ readonly type: "array";
212
+ readonly items: {
213
+ readonly type: "string";
214
+ };
215
+ };
216
+ readonly technologies: {
217
+ readonly type: "array";
218
+ readonly items: {
219
+ readonly type: "string";
220
+ };
221
+ };
222
+ readonly recommendations: {
223
+ readonly type: "array";
224
+ readonly items: {
225
+ readonly type: "string";
226
+ };
227
+ };
228
+ };
229
+ };
230
+ };
231
+ readonly required: readonly ["structure", "analysis"];
232
+ };
233
+ };
234
+ //# sourceMappingURL=prompt-composition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-composition.d.ts","sourceRoot":"","sources":["../../../src/utils/prompt-composition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,GAAG,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFhB,CAAC"}
@@ -0,0 +1,379 @@
1
+ /**
2
+ * Prompt Composition Utilities for 100% Prompt-Driven Architecture
3
+ *
4
+ * This module provides standardized utilities for composing prompts and implementing
5
+ * AI delegation patterns across the MCP ADR Analysis Server.
6
+ */
7
+ // ============================================================================
8
+ // Core Prompt Composition Functions
9
+ // ============================================================================
10
+ /**
11
+ * Combine multiple prompt objects into a single comprehensive prompt
12
+ */
13
+ export function combinePrompts(...prompts) {
14
+ if (prompts.length === 0) {
15
+ throw new Error('At least one prompt is required for combination');
16
+ }
17
+ const combinedPrompt = prompts.map(p => p.prompt).join('\n\n---\n\n');
18
+ const combinedInstructions = prompts.map(p => p.instructions).join('\n\n');
19
+ // Merge context objects
20
+ const combinedContext = prompts.reduce((acc, p) => ({ ...acc, ...p.context }), {});
21
+ return {
22
+ prompt: combinedPrompt,
23
+ instructions: combinedInstructions,
24
+ context: combinedContext,
25
+ metadata: {
26
+ sourcePrompts: prompts.length,
27
+ combinedAt: new Date().toISOString(),
28
+ totalLength: combinedPrompt.length + combinedInstructions.length,
29
+ },
30
+ };
31
+ }
32
+ /**
33
+ * Create a standardized AI delegation prompt for specific tasks
34
+ */
35
+ export function createAIDelegationPrompt(task, requirements, outputFormat, context) {
36
+ const instructions = `
37
+ # AI Task Delegation
38
+
39
+ Please complete the following task with precision and attention to detail.
40
+
41
+ ## Task Description
42
+ ${task}
43
+
44
+ ## Requirements
45
+ ${requirements.map((req, index) => `${index + 1}. ${req}`).join('\n')}
46
+
47
+ ## Expected Output Format
48
+ ${outputFormat}
49
+
50
+ ${context ? `## Additional Context\n${JSON.stringify(context, null, 2)}` : ''}
51
+
52
+ ## Quality Standards
53
+ - Ensure all requirements are met
54
+ - Follow the specified output format exactly
55
+ - Provide clear and actionable results
56
+ - Include relevant details and explanations
57
+ `;
58
+ return {
59
+ task,
60
+ instructions,
61
+ requirements,
62
+ outputFormat,
63
+ context,
64
+ };
65
+ }
66
+ /**
67
+ * Add JSON schema specification to a prompt for structured responses
68
+ */
69
+ export function addJSONSchema(prompt, schema) {
70
+ const schemaSection = `
71
+ ## Required JSON Response Format
72
+
73
+ Please respond with valid JSON that conforms to the following schema:
74
+
75
+ \`\`\`json
76
+ ${JSON.stringify(schema, null, 2)}
77
+ \`\`\`
78
+
79
+ ### Schema Requirements:
80
+ - **Type**: ${schema.type}
81
+ ${schema.description ? `- **Description**: ${schema.description}` : ''}
82
+ ${schema.required ? `- **Required Fields**: ${schema.required.join(', ')}` : ''}
83
+
84
+ ### Response Validation:
85
+ - Ensure the response is valid JSON
86
+ - All required fields must be present
87
+ - Field types must match the schema
88
+ - Follow naming conventions consistently
89
+ `;
90
+ return `${prompt}\n\n${schemaSection}`;
91
+ }
92
+ /**
93
+ * Validate AI response against expected format and requirements
94
+ */
95
+ export function validatePromptResponse(response, expectedFormat, requirements) {
96
+ const result = {
97
+ isValid: true,
98
+ errors: [],
99
+ warnings: [],
100
+ suggestions: [],
101
+ };
102
+ // Basic validation
103
+ if (!response || response.trim().length === 0) {
104
+ result.isValid = false;
105
+ result.errors.push('Response is empty or contains only whitespace');
106
+ return result;
107
+ }
108
+ // Format-specific validation
109
+ switch (expectedFormat) {
110
+ case 'json':
111
+ try {
112
+ JSON.parse(response);
113
+ }
114
+ catch (error) {
115
+ result.isValid = false;
116
+ result.errors.push(`Invalid JSON format: ${error instanceof Error ? error.message : 'Unknown error'}`);
117
+ }
118
+ break;
119
+ case 'markdown':
120
+ if (!response.includes('#') && !response.includes('*') && !response.includes('-')) {
121
+ result.warnings.push('Response may not be properly formatted Markdown');
122
+ }
123
+ break;
124
+ case 'text':
125
+ if (response.length < 10) {
126
+ result.warnings.push('Response seems unusually short for text format');
127
+ }
128
+ break;
129
+ }
130
+ // Requirements validation
131
+ if (requirements) {
132
+ const missingRequirements = requirements.filter(req => !response.toLowerCase().includes(req.toLowerCase()));
133
+ if (missingRequirements.length > 0) {
134
+ result.warnings.push(`Response may not address: ${missingRequirements.join(', ')}`);
135
+ }
136
+ }
137
+ // Quality suggestions
138
+ if (response.length > 10000) {
139
+ result.suggestions.push('Consider breaking down the response into smaller sections');
140
+ }
141
+ if (response.split('\n').length < 3) {
142
+ result.suggestions.push('Consider adding more structure with line breaks and sections');
143
+ }
144
+ return result;
145
+ }
146
+ // ============================================================================
147
+ // Specialized Prompt Builders
148
+ // ============================================================================
149
+ /**
150
+ * Create a file analysis prompt with standardized structure
151
+ */
152
+ export function createFileAnalysisPrompt(filePaths, analysisType, outputSchema) {
153
+ let prompt = `
154
+ # File Analysis Request
155
+
156
+ Please analyze the following files for ${analysisType}.
157
+
158
+ ## Files to Analyze
159
+ ${filePaths.map((path, index) => `${index + 1}. ${path}`).join('\n')}
160
+
161
+ ## Analysis Requirements
162
+ 1. Read and examine each file thoroughly
163
+ 2. Extract relevant information based on the analysis type
164
+ 3. Identify patterns, structures, and key elements
165
+ 4. Provide comprehensive insights and findings
166
+ 5. Ensure accuracy and completeness in the analysis
167
+
168
+ ## Analysis Focus: ${analysisType}
169
+
170
+ Please provide detailed analysis results with clear explanations and evidence.
171
+ `;
172
+ if (outputSchema) {
173
+ prompt = addJSONSchema(prompt, outputSchema);
174
+ }
175
+ return prompt;
176
+ }
177
+ /**
178
+ * Create a project structure analysis prompt
179
+ */
180
+ export function createProjectStructurePrompt(projectPath, includePatterns = [], excludePatterns = []) {
181
+ return `
182
+ # Project Structure Analysis
183
+
184
+ Please analyze the project structure and provide comprehensive insights.
185
+
186
+ ## Project Information
187
+ - **Path**: ${projectPath}
188
+ - **Include Patterns**: ${includePatterns.length > 0 ? includePatterns.join(', ') : 'All files'}
189
+ - **Exclude Patterns**: ${excludePatterns.length > 0 ? excludePatterns.join(', ') : 'Standard exclusions (node_modules, .git, etc.)'}
190
+
191
+ ## Analysis Requirements
192
+ 1. **Directory Structure**: Map the overall project organization
193
+ 2. **File Types**: Identify and categorize different file types
194
+ 3. **Dependencies**: Analyze package files and dependency structures
195
+ 4. **Architecture Patterns**: Identify architectural patterns and conventions
196
+ 5. **Code Organization**: Assess code organization and module structure
197
+ 6. **Configuration Files**: Examine configuration and setup files
198
+
199
+ ## Expected Deliverables
200
+ - Complete directory tree structure
201
+ - File type distribution and statistics
202
+ - Dependency analysis and recommendations
203
+ - Architecture pattern identification
204
+ - Code quality and organization assessment
205
+ - Configuration and setup analysis
206
+
207
+ Please provide thorough analysis with actionable insights.
208
+ `;
209
+ }
210
+ // ============================================================================
211
+ // Utility Functions
212
+ // ============================================================================
213
+ /**
214
+ * Escape special characters in prompts for safe processing
215
+ */
216
+ export function escapePromptContent(content) {
217
+ return content
218
+ .replace(/\\/g, '\\\\')
219
+ .replace(/`/g, '\\`')
220
+ .replace(/\${/g, '\\${');
221
+ }
222
+ /**
223
+ * Truncate prompt content to specified length while preserving structure
224
+ */
225
+ export function truncatePrompt(prompt, maxLength) {
226
+ if (prompt.length <= maxLength) {
227
+ return prompt;
228
+ }
229
+ const truncated = prompt.substring(0, maxLength - 3);
230
+ const lastNewline = truncated.lastIndexOf('\n');
231
+ if (lastNewline > maxLength * 0.8) {
232
+ return truncated.substring(0, lastNewline) + '\n...';
233
+ }
234
+ return truncated + '...';
235
+ }
236
+ /**
237
+ * Extract metadata from prompt responses
238
+ */
239
+ export function extractResponseMetadata(response) {
240
+ const wordCount = response.split(/\s+/).length;
241
+ const lineCount = response.split('\n').length;
242
+ const hasCodeBlocks = /```/.test(response);
243
+ const hasLists = /^[\s]*[-*+]\s/.test(response) || /^[\s]*\d+\.\s/.test(response);
244
+ const estimatedReadingTime = Math.ceil(wordCount / 200); // 200 words per minute
245
+ return {
246
+ wordCount,
247
+ lineCount,
248
+ hasCodeBlocks,
249
+ hasLists,
250
+ estimatedReadingTime,
251
+ };
252
+ }
253
+ // ============================================================================
254
+ // Example Usage and Templates
255
+ // ============================================================================
256
+ /**
257
+ * Example: Combining multiple prompts for comprehensive analysis
258
+ */
259
+ export function createComprehensiveAnalysisPrompt(projectPrompt, filePrompt, additionalRequirements = []) {
260
+ const combined = combinePrompts(projectPrompt, filePrompt);
261
+ if (additionalRequirements.length > 0) {
262
+ combined.prompt += `\n\n## Additional Requirements\n${additionalRequirements.map((req, i) => `${i + 1}. ${req}`).join('\n')}`;
263
+ }
264
+ return combined;
265
+ }
266
+ /**
267
+ * Example: Creating a standardized ADR analysis prompt
268
+ */
269
+ export function createADRAnalysisPrompt(adrDirectory, analysisType) {
270
+ const requirements = [
271
+ 'Scan all ADR files in the specified directory',
272
+ 'Extract metadata and content from each ADR',
273
+ 'Analyze according to the specified analysis type',
274
+ 'Provide structured results with clear categorization',
275
+ 'Include recommendations for improvements',
276
+ ];
277
+ const outputFormat = `
278
+ JSON object with the following structure:
279
+ {
280
+ "summary": {
281
+ "totalAdrs": number,
282
+ "analysisType": string,
283
+ "completedAt": string
284
+ },
285
+ "findings": [
286
+ {
287
+ "adrId": string,
288
+ "title": string,
289
+ "analysis": object,
290
+ "recommendations": string[]
291
+ }
292
+ ],
293
+ "overallRecommendations": string[]
294
+ }`;
295
+ return createAIDelegationPrompt(`Analyze ADRs in ${adrDirectory} for ${analysisType}`, requirements, outputFormat, { adrDirectory, analysisType });
296
+ }
297
+ /**
298
+ * Common JSON schemas for MCP responses
299
+ */
300
+ export const CommonSchemas = {
301
+ adrList: {
302
+ type: 'object',
303
+ properties: {
304
+ adrs: {
305
+ type: 'array',
306
+ items: {
307
+ type: 'object',
308
+ properties: {
309
+ id: { type: 'string' },
310
+ title: { type: 'string' },
311
+ status: { type: 'string' },
312
+ date: { type: 'string' },
313
+ filePath: { type: 'string' },
314
+ },
315
+ required: ['id', 'title', 'status', 'date', 'filePath'],
316
+ },
317
+ },
318
+ summary: {
319
+ type: 'object',
320
+ properties: {
321
+ total: { type: 'number' },
322
+ byStatus: { type: 'object' },
323
+ },
324
+ },
325
+ },
326
+ required: ['adrs', 'summary'],
327
+ },
328
+ fileAnalysis: {
329
+ type: 'object',
330
+ properties: {
331
+ files: {
332
+ type: 'array',
333
+ items: {
334
+ type: 'object',
335
+ properties: {
336
+ path: { type: 'string' },
337
+ type: { type: 'string' },
338
+ size: { type: 'number' },
339
+ analysis: { type: 'object' },
340
+ },
341
+ required: ['path', 'type', 'analysis'],
342
+ },
343
+ },
344
+ summary: {
345
+ type: 'object',
346
+ properties: {
347
+ totalFiles: { type: 'number' },
348
+ fileTypes: { type: 'object' },
349
+ insights: { type: 'array', items: { type: 'string' } },
350
+ },
351
+ },
352
+ },
353
+ required: ['files', 'summary'],
354
+ },
355
+ projectStructure: {
356
+ type: 'object',
357
+ properties: {
358
+ structure: {
359
+ type: 'object',
360
+ properties: {
361
+ directories: { type: 'array', items: { type: 'string' } },
362
+ files: { type: 'array', items: { type: 'string' } },
363
+ totalFiles: { type: 'number' },
364
+ totalDirectories: { type: 'number' },
365
+ },
366
+ },
367
+ analysis: {
368
+ type: 'object',
369
+ properties: {
370
+ patterns: { type: 'array', items: { type: 'string' } },
371
+ technologies: { type: 'array', items: { type: 'string' } },
372
+ recommendations: { type: 'array', items: { type: 'string' } },
373
+ },
374
+ },
375
+ },
376
+ required: ['structure', 'analysis'],
377
+ },
378
+ };
379
+ //# sourceMappingURL=prompt-composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-composition.js","sourceRoot":"","sources":["../../../src/utils/prompt-composition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8CH,+EAA+E;AAC/E,oCAAoC;AACpC,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAG,OAAuB;IACvD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACtE,MAAM,oBAAoB,G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