mcp-adr-analysis-server 2.1.20 → 2.1.22
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/README.md +1 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/config/ai-config.d.ts +54 -6
- package/dist/src/config/ai-config.d.ts.map +1 -1
- package/dist/src/config/ai-config.js +69 -6
- package/dist/src/config/ai-config.js.map +1 -1
- package/dist/src/config/ape-descriptions.d.ts +77 -0
- package/dist/src/config/ape-descriptions.d.ts.map +1 -0
- package/dist/src/config/ape-descriptions.js +177 -0
- package/dist/src/config/ape-descriptions.js.map +1 -0
- package/dist/src/index.d.ts +40 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +564 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/adr-suggestion-prompts.d.ts +5 -0
- package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -1
- package/dist/src/prompts/adr-suggestion-prompts.js +22 -1
- package/dist/src/prompts/adr-suggestion-prompts.js.map +1 -1
- package/dist/src/prompts/prompt-catalog.d.ts +95 -0
- package/dist/src/prompts/prompt-catalog.d.ts.map +1 -0
- package/dist/src/prompts/prompt-catalog.js +300 -0
- package/dist/src/prompts/prompt-catalog.js.map +1 -0
- package/dist/src/resources/adrs-discovered-resource.d.ts +124 -0
- package/dist/src/resources/adrs-discovered-resource.d.ts.map +1 -0
- package/dist/src/resources/adrs-discovered-resource.js +174 -0
- package/dist/src/resources/adrs-discovered-resource.js.map +1 -0
- package/dist/src/resources/adrs-review-resource.d.ts +82 -0
- package/dist/src/resources/adrs-review-resource.d.ts.map +1 -0
- package/dist/src/resources/adrs-review-resource.js +160 -0
- package/dist/src/resources/adrs-review-resource.js.map +1 -0
- package/dist/src/resources/architectural-context-resource.d.ts +95 -0
- package/dist/src/resources/architectural-context-resource.d.ts.map +1 -0
- package/dist/src/resources/architectural-context-resource.js +428 -0
- package/dist/src/resources/architectural-context-resource.js.map +1 -0
- package/dist/src/resources/conversation-snapshot-resource.d.ts +92 -0
- package/dist/src/resources/conversation-snapshot-resource.d.ts.map +1 -0
- package/dist/src/resources/conversation-snapshot-resource.js +122 -0
- package/dist/src/resources/conversation-snapshot-resource.js.map +1 -0
- package/dist/src/resources/deployment-status-resource.js +1 -1
- package/dist/src/resources/deployment-status-resource.js.map +1 -1
- package/dist/src/resources/environment-analysis-resource.js +1 -1
- package/dist/src/resources/environment-analysis-resource.js.map +1 -1
- package/dist/src/resources/knowledge-graph-resource.d.ts +129 -0
- package/dist/src/resources/knowledge-graph-resource.d.ts.map +1 -0
- package/dist/src/resources/knowledge-graph-resource.js +217 -0
- package/dist/src/resources/knowledge-graph-resource.js.map +1 -0
- package/dist/src/resources/memory-expand-resource.d.ts +90 -0
- package/dist/src/resources/memory-expand-resource.d.ts.map +1 -0
- package/dist/src/resources/memory-expand-resource.js +176 -0
- package/dist/src/resources/memory-expand-resource.js.map +1 -0
- package/dist/src/resources/memory-stats-resource.d.ts +77 -0
- package/dist/src/resources/memory-stats-resource.d.ts.map +1 -0
- package/dist/src/resources/memory-stats-resource.js +108 -0
- package/dist/src/resources/memory-stats-resource.js.map +1 -0
- package/dist/src/resources/project-metrics-resource.js +1 -1
- package/dist/src/resources/project-metrics-resource.js.map +1 -1
- package/dist/src/resources/resource-cache.d.ts.map +1 -1
- package/dist/src/resources/resource-cache.js +2 -1
- package/dist/src/resources/resource-cache.js.map +1 -1
- package/dist/src/resources/server-context-resource.d.ts +69 -0
- package/dist/src/resources/server-context-resource.d.ts.map +1 -0
- package/dist/src/resources/server-context-resource.js +104 -0
- package/dist/src/resources/server-context-resource.js.map +1 -0
- package/dist/src/resources/tool-catalog-resource.d.ts +122 -0
- package/dist/src/resources/tool-catalog-resource.d.ts.map +1 -0
- package/dist/src/resources/tool-catalog-resource.js +167 -0
- package/dist/src/resources/tool-catalog-resource.js.map +1 -0
- package/dist/src/tools/adr-bootstrap-validation-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-bootstrap-validation-tool.js +7 -6
- package/dist/src/tools/adr-bootstrap-validation-tool.js.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.d.ts +5 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.js +40 -71
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
- package/dist/src/tools/bootstrap-validation-loop-tool.d.ts +23 -1
- package/dist/src/tools/bootstrap-validation-loop-tool.d.ts.map +1 -1
- package/dist/src/tools/bootstrap-validation-loop-tool.js +15 -5
- package/dist/src/tools/bootstrap-validation-loop-tool.js.map +1 -1
- package/dist/src/tools/ce-mcp-tools.d.ts +291 -0
- package/dist/src/tools/ce-mcp-tools.d.ts.map +1 -0
- package/dist/src/tools/ce-mcp-tools.js +1188 -0
- package/dist/src/tools/ce-mcp-tools.js.map +1 -0
- package/dist/src/tools/content-masking-tool.d.ts +11 -0
- package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
- package/dist/src/tools/content-masking-tool.js +13 -6
- package/dist/src/tools/content-masking-tool.js.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.d.ts +11 -0
- package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.js +10 -4
- package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
- package/dist/src/tools/environment-analysis-tool.d.ts +96 -1
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/environment-analysis-tool.js +38 -46
- package/dist/src/tools/environment-analysis-tool.js.map +1 -1
- package/dist/src/tools/research-question-tool.d.ts.map +1 -1
- package/dist/src/tools/research-question-tool.js +3 -2
- package/dist/src/tools/research-question-tool.js.map +1 -1
- package/dist/src/tools/review-existing-adrs-tool.d.ts +5 -0
- package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -1
- package/dist/src/tools/review-existing-adrs-tool.js +123 -42
- package/dist/src/tools/review-existing-adrs-tool.js.map +1 -1
- package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
- package/dist/src/tools/rule-generation-tool.js +3 -5
- package/dist/src/tools/rule-generation-tool.js.map +1 -1
- package/dist/src/tools/search-codebase-tool.d.ts +148 -0
- package/dist/src/tools/search-codebase-tool.d.ts.map +1 -0
- package/dist/src/tools/search-codebase-tool.js +406 -0
- package/dist/src/tools/search-codebase-tool.js.map +1 -0
- package/dist/src/tools/smart-git-push-tool-v2.js +1 -1
- package/dist/src/tools/smart-git-push-tool-v2.js.map +1 -1
- package/dist/src/tools/tool-catalog.d.ts +134 -0
- package/dist/src/tools/tool-catalog.d.ts.map +1 -0
- package/dist/src/tools/tool-catalog.js +1431 -0
- package/dist/src/tools/tool-catalog.js.map +1 -0
- package/dist/src/tools/tool-chain-orchestrator.d.ts +11 -2
- package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.js +11 -2
- package/dist/src/tools/tool-chain-orchestrator.js.map +1 -1
- package/dist/src/tools/tool-dispatcher.d.ts +98 -0
- package/dist/src/tools/tool-dispatcher.d.ts.map +1 -0
- package/dist/src/tools/tool-dispatcher.js +225 -0
- package/dist/src/tools/tool-dispatcher.js.map +1 -0
- package/dist/src/tools/tree-sitter-code-tools.d.ts +184 -0
- package/dist/src/tools/tree-sitter-code-tools.d.ts.map +1 -0
- package/dist/src/tools/tree-sitter-code-tools.js +642 -0
- package/dist/src/tools/tree-sitter-code-tools.js.map +1 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +22 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js +20 -3
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
- package/dist/src/tools/update-knowledge-tool.d.ts +89 -0
- package/dist/src/tools/update-knowledge-tool.d.ts.map +1 -0
- package/dist/src/tools/update-knowledge-tool.js +222 -0
- package/dist/src/tools/update-knowledge-tool.js.map +1 -0
- package/dist/src/types/ce-mcp.d.ts +248 -0
- package/dist/src/types/ce-mcp.d.ts.map +1 -0
- package/dist/src/types/ce-mcp.js +27 -0
- package/dist/src/types/ce-mcp.js.map +1 -0
- package/dist/src/utils/adr-context-detector.js +1 -1
- package/dist/src/utils/adr-context-detector.js.map +1 -1
- package/dist/src/utils/adr-planning-task-integration.d.ts +260 -0
- package/dist/src/utils/adr-planning-task-integration.d.ts.map +1 -0
- package/dist/src/utils/adr-planning-task-integration.js +466 -0
- package/dist/src/utils/adr-planning-task-integration.js.map +1 -0
- package/dist/src/utils/adr-timeline-extractor.d.ts.map +1 -1
- package/dist/src/utils/adr-timeline-extractor.js +3 -2
- package/dist/src/utils/adr-timeline-extractor.js.map +1 -1
- package/dist/src/utils/ai-executor.d.ts +10 -0
- package/dist/src/utils/ai-executor.d.ts.map +1 -1
- package/dist/src/utils/ai-executor.js +14 -3
- package/dist/src/utils/ai-executor.js.map +1 -1
- package/dist/src/utils/automatic-prompt-engineering.d.ts +5 -0
- package/dist/src/utils/automatic-prompt-engineering.d.ts.map +1 -1
- package/dist/src/utils/automatic-prompt-engineering.js +10 -90
- package/dist/src/utils/automatic-prompt-engineering.js.map +1 -1
- package/dist/src/utils/bootstrap-task-integration.d.ts +214 -0
- package/dist/src/utils/bootstrap-task-integration.d.ts.map +1 -0
- package/dist/src/utils/bootstrap-task-integration.js +365 -0
- package/dist/src/utils/bootstrap-task-integration.js.map +1 -0
- package/dist/src/utils/dag-executor.js +1 -1
- package/dist/src/utils/dag-executor.js.map +1 -1
- package/dist/src/utils/deployment-task-integration.d.ts +260 -0
- package/dist/src/utils/deployment-task-integration.d.ts.map +1 -0
- package/dist/src/utils/deployment-task-integration.js +393 -0
- package/dist/src/utils/deployment-task-integration.js.map +1 -0
- package/dist/src/utils/dynamic-deployment-intelligence.js +1 -1
- package/dist/src/utils/dynamic-deployment-intelligence.js.map +1 -1
- package/dist/src/utils/enhanced-logging.d.ts +3 -0
- package/dist/src/utils/enhanced-logging.d.ts.map +1 -1
- package/dist/src/utils/enhanced-logging.js +9 -30
- package/dist/src/utils/enhanced-logging.js.map +1 -1
- package/dist/src/utils/environment-capability-registry.js +1 -1
- package/dist/src/utils/environment-capability-registry.js.map +1 -1
- package/dist/src/utils/file-system.d.ts.map +1 -1
- package/dist/src/utils/file-system.js +33 -3
- package/dist/src/utils/file-system.js.map +1 -1
- package/dist/src/utils/gitleaks-detector.js +1 -1
- package/dist/src/utils/gitleaks-detector.js.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.d.ts +13 -0
- package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.js +13 -0
- package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
- package/dist/src/utils/prompt-execution.d.ts +29 -1
- package/dist/src/utils/prompt-execution.d.ts.map +1 -1
- package/dist/src/utils/prompt-execution.js +29 -1
- package/dist/src/utils/prompt-execution.js.map +1 -1
- package/dist/src/utils/research-orchestrator.d.ts +87 -1
- package/dist/src/utils/research-orchestrator.d.ts.map +1 -1
- package/dist/src/utils/research-orchestrator.js +121 -17
- package/dist/src/utils/research-orchestrator.js.map +1 -1
- package/dist/src/utils/research-task-integration.d.ts +297 -0
- package/dist/src/utils/research-task-integration.d.ts.map +1 -0
- package/dist/src/utils/research-task-integration.js +449 -0
- package/dist/src/utils/research-task-integration.js.map +1 -0
- package/dist/src/utils/ripgrep-wrapper.d.ts.map +1 -1
- package/dist/src/utils/ripgrep-wrapper.js +17 -3
- package/dist/src/utils/ripgrep-wrapper.js.map +1 -1
- package/dist/src/utils/sandbox-executor.d.ts +145 -0
- package/dist/src/utils/sandbox-executor.d.ts.map +1 -0
- package/dist/src/utils/sandbox-executor.js +642 -0
- package/dist/src/utils/sandbox-executor.js.map +1 -0
- package/dist/src/utils/server-context-generator.d.ts +5 -0
- package/dist/src/utils/server-context-generator.d.ts.map +1 -1
- package/dist/src/utils/server-context-generator.js +38 -0
- package/dist/src/utils/server-context-generator.js.map +1 -1
- package/dist/src/utils/task-manager.d.ts +239 -0
- package/dist/src/utils/task-manager.d.ts.map +1 -0
- package/dist/src/utils/task-manager.js +528 -0
- package/dist/src/utils/task-manager.js.map +1 -0
- package/dist/src/utils/task-persistence.d.ts +82 -0
- package/dist/src/utils/task-persistence.d.ts.map +1 -0
- package/dist/src/utils/task-persistence.js +248 -0
- package/dist/src/utils/task-persistence.js.map +1 -0
- package/dist/src/utils/test-aware-defaults.d.ts +57 -0
- package/dist/src/utils/test-aware-defaults.d.ts.map +1 -0
- package/dist/src/utils/test-aware-defaults.js +71 -0
- package/dist/src/utils/test-aware-defaults.js.map +1 -0
- package/dist/src/utils/tree-sitter-analyzer.d.ts +42 -5
- package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -1
- package/dist/src/utils/tree-sitter-analyzer.js +499 -17
- package/dist/src/utils/tree-sitter-analyzer.js.map +1 -1
- package/package.json +24 -19
- package/dist/src/tools/smart-git-push-tool.d.ts +0 -55
- package/dist/src/tools/smart-git-push-tool.d.ts.map +0 -1
- package/dist/src/tools/smart-git-push-tool.js +0 -1011
- package/dist/src/tools/smart-git-push-tool.js.map +0 -1
|
@@ -11,8 +11,13 @@ export declare function generateImplicitDecisionDetectionPrompt(projectPath: str
|
|
|
11
11
|
* AI prompt for analyzing significant code changes for decision points
|
|
12
12
|
*/
|
|
13
13
|
export declare function generateCodeChangeAnalysisPrompt(beforeCode: string, afterCode: string, changeDescription: string, commitMessages?: string[]): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get the current date in ADR format (YYYY-MM-DD)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getCurrentAdrDate(): string;
|
|
14
18
|
/**
|
|
15
19
|
* AI prompt for ADR template generation (Nygard, MADR formats)
|
|
20
|
+
* Now automatically includes the current date for ADR creation
|
|
16
21
|
*/
|
|
17
22
|
export declare function generateAdrTemplatePrompt(decisionData: {
|
|
18
23
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adr-suggestion-prompts.d.ts","sourceRoot":"","sources":["../../../src/prompts/adr-suggestion-prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAgB,uCAAuC,CACrD,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,MAAM,CA8IR;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EACzB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,MAAM,CAyGR;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,EACD,cAAc,GAAE,QAAQ,GAAG,MAAM,GAAG,QAAmB,EACvD,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"adr-suggestion-prompts.d.ts","sourceRoot":"","sources":["../../../src/prompts/adr-suggestion-prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAgB,uCAAuC,CACrD,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,MAAM,CA8IR;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EACzB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,MAAM,CAyGR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAM1C;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,EACD,cAAc,GAAE,QAAQ,GAAG,MAAM,GAAG,QAAmB,EACvD,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,MAAM,CA6JR"}
|
|
@@ -254,15 +254,30 @@ The following JSON structure provides a template for organizing your analysis (a
|
|
|
254
254
|
Please provide a thorough analysis of the architectural decisions reflected in these code changes.
|
|
255
255
|
`;
|
|
256
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Get the current date in ADR format (YYYY-MM-DD)
|
|
259
|
+
*/
|
|
260
|
+
export function getCurrentAdrDate() {
|
|
261
|
+
const now = new Date();
|
|
262
|
+
const year = now.getFullYear();
|
|
263
|
+
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
264
|
+
const day = String(now.getDate()).padStart(2, '0');
|
|
265
|
+
return `${year}-${month}-${day}`;
|
|
266
|
+
}
|
|
257
267
|
/**
|
|
258
268
|
* AI prompt for ADR template generation (Nygard, MADR formats)
|
|
269
|
+
* Now automatically includes the current date for ADR creation
|
|
259
270
|
*/
|
|
260
271
|
export function generateAdrTemplatePrompt(decisionData, templateFormat = 'nygard', existingAdrs) {
|
|
272
|
+
const currentDate = getCurrentAdrDate();
|
|
261
273
|
return `
|
|
262
274
|
# ADR Template Generation
|
|
263
275
|
|
|
264
276
|
Please generate a complete Architectural Decision Record based on the provided decision data.
|
|
265
277
|
|
|
278
|
+
## Current Date
|
|
279
|
+
**Today's Date (use this for the ADR)**: ${currentDate}
|
|
280
|
+
|
|
266
281
|
## Decision Data
|
|
267
282
|
- **Title**: ${decisionData.title}
|
|
268
283
|
- **Context**: ${decisionData.context}
|
|
@@ -298,6 +313,9 @@ Please generate a complete ADR using the specified format:
|
|
|
298
313
|
\`\`\`markdown
|
|
299
314
|
# ADR-XXXX: [Title]
|
|
300
315
|
|
|
316
|
+
## Date
|
|
317
|
+
${currentDate}
|
|
318
|
+
|
|
301
319
|
## Status
|
|
302
320
|
[Proposed | Accepted | Deprecated | Superseded]
|
|
303
321
|
|
|
@@ -315,6 +333,9 @@ Please generate a complete ADR using the specified format:
|
|
|
315
333
|
\`\`\`markdown
|
|
316
334
|
# [Title]
|
|
317
335
|
|
|
336
|
+
* Status: proposed
|
|
337
|
+
* Date: ${currentDate}
|
|
338
|
+
|
|
318
339
|
## Context and Problem Statement
|
|
319
340
|
[Describe context and problem statement]
|
|
320
341
|
|
|
@@ -354,7 +375,7 @@ Please provide the generated ADR in the following JSON format:
|
|
|
354
375
|
"id": "ADR-XXXX",
|
|
355
376
|
"title": "Complete ADR title",
|
|
356
377
|
"status": "proposed",
|
|
357
|
-
"date": "
|
|
378
|
+
"date": "${currentDate}",
|
|
358
379
|
"format": "${templateFormat}",
|
|
359
380
|
"content": "Complete ADR content in markdown format",
|
|
360
381
|
"filename": "suggested-filename.md",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adr-suggestion-prompts.js","sourceRoot":"","sources":["../../../src/prompts/adr-suggestion-prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAE3F;;GAEG;AACH,MAAM,UAAU,uCAAuC,CACrD,WAAmB,EACnB,YAAuB;IAEvB,MAAM,UAAU,GAAG;;;;;;;;;2BASM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BpC,YAAY;QACV,CAAC,CAAC;EACJ,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CAC/C;QACG,CAAC,CAAC,EACN;;;;;;;;;;;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AC/C;QACG,CAAC,CAAC,EACN;;;EAGE,cAAc,CAAC,WAAW,EAAE;;;;;;;;;;;EAW5B,WAAW;;;;;;;;;;;;;;;;;;;;UAoBH,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAyCN,WAAW;iBACT,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC9B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CE-MCP Prompt Catalog
|
|
3
|
+
*
|
|
4
|
+
* Provides lazy loading of prompts - instead of importing all 6,145 lines
|
|
5
|
+
* of prompt code upfront, this catalog allows on-demand loading of specific
|
|
6
|
+
* prompt sections, reducing token usage by ~96%.
|
|
7
|
+
*
|
|
8
|
+
* @see ADR-014: CE-MCP Architecture
|
|
9
|
+
*/
|
|
10
|
+
import { PromptCatalog, PromptCatalogEntry } from '../types/ce-mcp.js';
|
|
11
|
+
/**
|
|
12
|
+
* Prompt catalog with metadata for lazy loading
|
|
13
|
+
*
|
|
14
|
+
* Token estimates based on ~4 chars per token average
|
|
15
|
+
*/
|
|
16
|
+
export declare const PROMPT_CATALOG: PromptCatalog;
|
|
17
|
+
/**
|
|
18
|
+
* Get total token count if all prompts were loaded
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTotalPromptTokens(): number;
|
|
21
|
+
/**
|
|
22
|
+
* Get prompts by category
|
|
23
|
+
*/
|
|
24
|
+
export declare function getPromptsByCategory(category: PromptCatalogEntry['category']): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Get prompt metadata
|
|
27
|
+
*/
|
|
28
|
+
export declare function getPromptMetadata(promptName: string): PromptCatalogEntry | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Prompt Loader Service
|
|
31
|
+
*
|
|
32
|
+
* Handles lazy loading of prompts with caching
|
|
33
|
+
*/
|
|
34
|
+
export declare class PromptLoader {
|
|
35
|
+
private cache;
|
|
36
|
+
private cacheTTL;
|
|
37
|
+
constructor(cacheTTL?: number);
|
|
38
|
+
/**
|
|
39
|
+
* Load a specific prompt section
|
|
40
|
+
*
|
|
41
|
+
* @param promptName - Name of the prompt (e.g., 'adr-suggestion')
|
|
42
|
+
* @param section - Optional section within the prompt
|
|
43
|
+
* @returns Promise resolving to the prompt content
|
|
44
|
+
*/
|
|
45
|
+
loadPrompt(promptName: string, section?: string): Promise<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Load prompt file content
|
|
48
|
+
*/
|
|
49
|
+
private loadPromptFile;
|
|
50
|
+
/**
|
|
51
|
+
* Parse sections from prompt content
|
|
52
|
+
*/
|
|
53
|
+
private parseSections;
|
|
54
|
+
/**
|
|
55
|
+
* Preload prompts that are commonly used together
|
|
56
|
+
*/
|
|
57
|
+
preloadPromptGroup(promptNames: string[]): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Get estimated tokens for a prompt
|
|
60
|
+
*/
|
|
61
|
+
getEstimatedTokens(promptName: string, section?: string): number;
|
|
62
|
+
/**
|
|
63
|
+
* Get recommendations for which prompts to load
|
|
64
|
+
*/
|
|
65
|
+
getLoadRecommendations(taskType: string): string[];
|
|
66
|
+
/**
|
|
67
|
+
* Clear cache
|
|
68
|
+
*/
|
|
69
|
+
clearCache(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Get cache statistics
|
|
72
|
+
*/
|
|
73
|
+
getCacheStats(): {
|
|
74
|
+
size: number;
|
|
75
|
+
entries: string[];
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get or create the global prompt loader
|
|
80
|
+
*/
|
|
81
|
+
export declare function getPromptLoader(cacheTTL?: number): PromptLoader;
|
|
82
|
+
/**
|
|
83
|
+
* Reset the global prompt loader
|
|
84
|
+
*/
|
|
85
|
+
export declare function resetPromptLoader(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Token savings calculation
|
|
88
|
+
*/
|
|
89
|
+
export declare function calculateTokenSavings(loadedPrompts: string[]): {
|
|
90
|
+
loaded: number;
|
|
91
|
+
total: number;
|
|
92
|
+
saved: number;
|
|
93
|
+
percentage: number;
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=prompt-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-catalog.d.ts","sourceRoot":"","sources":["../../../src/prompts/prompt-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,aAuG5B,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAIvF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAEpF;AAED;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CACD;IACZ,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,GAAE,MAAa;IAInC;;;;;;OAMG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4CvE;;OAEG;YACW,cAAc;IAM5B;;OAEG;IACH,OAAO,CAAC,aAAa;IAiCrB;;OAEG;IACG,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAahE;;OAEG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAYlD;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,aAAa,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;CAMrD;AAOD;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAK/D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAWA"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CE-MCP Prompt Catalog
|
|
3
|
+
*
|
|
4
|
+
* Provides lazy loading of prompts - instead of importing all 6,145 lines
|
|
5
|
+
* of prompt code upfront, this catalog allows on-demand loading of specific
|
|
6
|
+
* prompt sections, reducing token usage by ~96%.
|
|
7
|
+
*
|
|
8
|
+
* @see ADR-014: CE-MCP Architecture
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Prompt catalog with metadata for lazy loading
|
|
12
|
+
*
|
|
13
|
+
* Token estimates based on ~4 chars per token average
|
|
14
|
+
*/
|
|
15
|
+
export const PROMPT_CATALOG = {
|
|
16
|
+
// ADR-related prompts
|
|
17
|
+
'adr-suggestion': {
|
|
18
|
+
file: 'adr-suggestion-prompts.ts',
|
|
19
|
+
tokens: 1830,
|
|
20
|
+
category: 'adr',
|
|
21
|
+
sections: [
|
|
22
|
+
'implicit_decisions',
|
|
23
|
+
'tech_debt',
|
|
24
|
+
'security_decisions',
|
|
25
|
+
'cross_cutting',
|
|
26
|
+
'recommendation_template',
|
|
27
|
+
],
|
|
28
|
+
loadOnDemand: true,
|
|
29
|
+
},
|
|
30
|
+
// Deployment analysis prompts
|
|
31
|
+
'deployment-analysis': {
|
|
32
|
+
file: 'deployment-analysis-prompts.ts',
|
|
33
|
+
tokens: 3150,
|
|
34
|
+
category: 'deployment',
|
|
35
|
+
sections: [
|
|
36
|
+
'readiness_check',
|
|
37
|
+
'validation_criteria',
|
|
38
|
+
'rollback_plan',
|
|
39
|
+
'infrastructure_review',
|
|
40
|
+
'security_scan',
|
|
41
|
+
],
|
|
42
|
+
loadOnDemand: true,
|
|
43
|
+
},
|
|
44
|
+
// Environment analysis prompts
|
|
45
|
+
'environment-analysis': {
|
|
46
|
+
file: 'environment-analysis-prompts.ts',
|
|
47
|
+
tokens: 3050,
|
|
48
|
+
category: 'analysis',
|
|
49
|
+
sections: ['dependency_scan', 'config_validation', 'compliance_check', 'resource_assessment'],
|
|
50
|
+
loadOnDemand: true,
|
|
51
|
+
},
|
|
52
|
+
// Research question prompts
|
|
53
|
+
'research-question': {
|
|
54
|
+
file: 'research-question-prompts.ts',
|
|
55
|
+
tokens: 3120,
|
|
56
|
+
category: 'research',
|
|
57
|
+
sections: ['question_generation', 'research_plan', 'source_evaluation', 'synthesis_template'],
|
|
58
|
+
loadOnDemand: true,
|
|
59
|
+
},
|
|
60
|
+
// Rule generation prompts
|
|
61
|
+
'rule-generation': {
|
|
62
|
+
file: 'rule-generation-prompts.ts',
|
|
63
|
+
tokens: 2850,
|
|
64
|
+
category: 'rules',
|
|
65
|
+
sections: ['rule_template', 'validation_rules', 'enforcement_policy', 'exception_handling'],
|
|
66
|
+
loadOnDemand: true,
|
|
67
|
+
},
|
|
68
|
+
// General analysis prompts
|
|
69
|
+
analysis: {
|
|
70
|
+
file: 'analysis-prompts.ts',
|
|
71
|
+
tokens: 2310,
|
|
72
|
+
category: 'analysis',
|
|
73
|
+
sections: ['project_analysis', 'code_review', 'architecture_assessment', 'quality_metrics'],
|
|
74
|
+
loadOnDemand: true,
|
|
75
|
+
},
|
|
76
|
+
// Research integration prompts
|
|
77
|
+
'research-integration': {
|
|
78
|
+
file: 'research-integration-prompts.ts',
|
|
79
|
+
tokens: 1785,
|
|
80
|
+
category: 'research',
|
|
81
|
+
sections: ['integration_strategy', 'synthesis_plan', 'recommendation_format'],
|
|
82
|
+
loadOnDemand: true,
|
|
83
|
+
},
|
|
84
|
+
// Validated pattern prompts
|
|
85
|
+
'validated-pattern': {
|
|
86
|
+
file: 'validated-pattern-prompts.ts',
|
|
87
|
+
tokens: 1565,
|
|
88
|
+
category: 'deployment',
|
|
89
|
+
sections: ['pattern_detection', 'validation_criteria', 'deployment_guidance'],
|
|
90
|
+
loadOnDemand: true,
|
|
91
|
+
},
|
|
92
|
+
// Security prompts
|
|
93
|
+
security: {
|
|
94
|
+
file: 'security-prompts.ts',
|
|
95
|
+
tokens: 1270,
|
|
96
|
+
category: 'security',
|
|
97
|
+
sections: ['vulnerability_scan', 'masking_rules', 'compliance_check'],
|
|
98
|
+
loadOnDemand: true,
|
|
99
|
+
},
|
|
100
|
+
// Main index (orchestration)
|
|
101
|
+
index: {
|
|
102
|
+
file: 'index.ts',
|
|
103
|
+
tokens: 3700,
|
|
104
|
+
category: 'analysis',
|
|
105
|
+
sections: ['orchestration', 'execution_flow', 'error_handling'],
|
|
106
|
+
dependencies: ['adr-suggestion', 'deployment-analysis', 'analysis'],
|
|
107
|
+
loadOnDemand: false, // Core orchestration loaded at startup
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Get total token count if all prompts were loaded
|
|
112
|
+
*/
|
|
113
|
+
export function getTotalPromptTokens() {
|
|
114
|
+
return Object.values(PROMPT_CATALOG).reduce((sum, entry) => sum + entry.tokens, 0);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get prompts by category
|
|
118
|
+
*/
|
|
119
|
+
export function getPromptsByCategory(category) {
|
|
120
|
+
return Object.entries(PROMPT_CATALOG)
|
|
121
|
+
.filter(([_, entry]) => entry.category === category)
|
|
122
|
+
.map(([name]) => name);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get prompt metadata
|
|
126
|
+
*/
|
|
127
|
+
export function getPromptMetadata(promptName) {
|
|
128
|
+
return PROMPT_CATALOG[promptName];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Prompt Loader Service
|
|
132
|
+
*
|
|
133
|
+
* Handles lazy loading of prompts with caching
|
|
134
|
+
*/
|
|
135
|
+
export class PromptLoader {
|
|
136
|
+
cache = new Map();
|
|
137
|
+
cacheTTL;
|
|
138
|
+
constructor(cacheTTL = 3600) {
|
|
139
|
+
this.cacheTTL = cacheTTL;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Load a specific prompt section
|
|
143
|
+
*
|
|
144
|
+
* @param promptName - Name of the prompt (e.g., 'adr-suggestion')
|
|
145
|
+
* @param section - Optional section within the prompt
|
|
146
|
+
* @returns Promise resolving to the prompt content
|
|
147
|
+
*/
|
|
148
|
+
async loadPrompt(promptName, section) {
|
|
149
|
+
const metadata = PROMPT_CATALOG[promptName];
|
|
150
|
+
if (!metadata) {
|
|
151
|
+
throw new Error(`Unknown prompt: ${promptName}`);
|
|
152
|
+
}
|
|
153
|
+
// Check cache
|
|
154
|
+
const cacheKey = promptName;
|
|
155
|
+
const cached = this.cache.get(cacheKey);
|
|
156
|
+
if (cached && Date.now() < cached.expiry) {
|
|
157
|
+
if (section) {
|
|
158
|
+
const sectionContent = cached.sections.get(section);
|
|
159
|
+
if (sectionContent) {
|
|
160
|
+
return sectionContent;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return cached.content;
|
|
164
|
+
}
|
|
165
|
+
// Load prompt dynamically
|
|
166
|
+
const content = await this.loadPromptFile(metadata.file);
|
|
167
|
+
// Parse sections if needed
|
|
168
|
+
const sections = this.parseSections(content, metadata.sections);
|
|
169
|
+
// Cache the result
|
|
170
|
+
this.cache.set(cacheKey, {
|
|
171
|
+
content,
|
|
172
|
+
sections,
|
|
173
|
+
expiry: Date.now() + this.cacheTTL * 1000,
|
|
174
|
+
});
|
|
175
|
+
if (section) {
|
|
176
|
+
const sectionContent = sections.get(section);
|
|
177
|
+
if (sectionContent) {
|
|
178
|
+
return sectionContent;
|
|
179
|
+
}
|
|
180
|
+
throw new Error(`Section '${section}' not found in prompt '${promptName}'`);
|
|
181
|
+
}
|
|
182
|
+
return content;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Load prompt file content
|
|
186
|
+
*/
|
|
187
|
+
async loadPromptFile(fileName) {
|
|
188
|
+
// In production, this would use dynamic import or file system read
|
|
189
|
+
// For now, return a placeholder that indicates which file should be loaded
|
|
190
|
+
return `[PROMPT_FILE: ${fileName}]`;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Parse sections from prompt content
|
|
194
|
+
*/
|
|
195
|
+
parseSections(content, sectionNames) {
|
|
196
|
+
const sections = new Map();
|
|
197
|
+
// Basic section parsing - looks for patterns like:
|
|
198
|
+
// // SECTION: section_name
|
|
199
|
+
// or
|
|
200
|
+
// export const SECTION_NAME = ...
|
|
201
|
+
for (const sectionName of sectionNames) {
|
|
202
|
+
// Try to find section marker
|
|
203
|
+
const markerRegex = new RegExp(`(?:\\/\\/ SECTION: ${sectionName}|export const ${sectionName.toUpperCase().replace(/-/g, '_')})`, 'i');
|
|
204
|
+
const match = content.match(markerRegex);
|
|
205
|
+
if (match && match.index !== undefined) {
|
|
206
|
+
// Extract content until next section or end
|
|
207
|
+
const startIndex = match.index;
|
|
208
|
+
const nextSectionMatch = content
|
|
209
|
+
.slice(startIndex + 1)
|
|
210
|
+
.match(/(?:\/\/ SECTION:|export const [A-Z_]+)/);
|
|
211
|
+
const endIndex = nextSectionMatch
|
|
212
|
+
? startIndex + 1 + (nextSectionMatch.index || content.length)
|
|
213
|
+
: content.length;
|
|
214
|
+
sections.set(sectionName, content.slice(startIndex, endIndex).trim());
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return sections;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Preload prompts that are commonly used together
|
|
221
|
+
*/
|
|
222
|
+
async preloadPromptGroup(promptNames) {
|
|
223
|
+
await Promise.all(promptNames.map(name => this.loadPrompt(name)));
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get estimated tokens for a prompt
|
|
227
|
+
*/
|
|
228
|
+
getEstimatedTokens(promptName, section) {
|
|
229
|
+
const metadata = PROMPT_CATALOG[promptName];
|
|
230
|
+
if (!metadata)
|
|
231
|
+
return 0;
|
|
232
|
+
if (section) {
|
|
233
|
+
// Estimate section as portion of total
|
|
234
|
+
const sectionCount = metadata.sections.length;
|
|
235
|
+
return Math.ceil(metadata.tokens / sectionCount);
|
|
236
|
+
}
|
|
237
|
+
return metadata.tokens;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get recommendations for which prompts to load
|
|
241
|
+
*/
|
|
242
|
+
getLoadRecommendations(taskType) {
|
|
243
|
+
const recommendations = {
|
|
244
|
+
adr_analysis: ['adr-suggestion', 'analysis'],
|
|
245
|
+
deployment: ['deployment-analysis', 'validated-pattern', 'environment-analysis'],
|
|
246
|
+
security: ['security', 'analysis'],
|
|
247
|
+
research: ['research-question', 'research-integration'],
|
|
248
|
+
rules: ['rule-generation', 'analysis'],
|
|
249
|
+
};
|
|
250
|
+
return recommendations[taskType] || ['analysis'];
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Clear cache
|
|
254
|
+
*/
|
|
255
|
+
clearCache() {
|
|
256
|
+
this.cache.clear();
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Get cache statistics
|
|
260
|
+
*/
|
|
261
|
+
getCacheStats() {
|
|
262
|
+
return {
|
|
263
|
+
size: this.cache.size,
|
|
264
|
+
entries: Array.from(this.cache.keys()),
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Global prompt loader instance
|
|
270
|
+
*/
|
|
271
|
+
let globalPromptLoader = null;
|
|
272
|
+
/**
|
|
273
|
+
* Get or create the global prompt loader
|
|
274
|
+
*/
|
|
275
|
+
export function getPromptLoader(cacheTTL) {
|
|
276
|
+
if (!globalPromptLoader) {
|
|
277
|
+
globalPromptLoader = new PromptLoader(cacheTTL);
|
|
278
|
+
}
|
|
279
|
+
return globalPromptLoader;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Reset the global prompt loader
|
|
283
|
+
*/
|
|
284
|
+
export function resetPromptLoader() {
|
|
285
|
+
globalPromptLoader = null;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Token savings calculation
|
|
289
|
+
*/
|
|
290
|
+
export function calculateTokenSavings(loadedPrompts) {
|
|
291
|
+
const total = getTotalPromptTokens();
|
|
292
|
+
const loaded = loadedPrompts.reduce((sum, name) => {
|
|
293
|
+
const metadata = PROMPT_CATALOG[name];
|
|
294
|
+
return sum + (metadata?.tokens || 0);
|
|
295
|
+
}, 0);
|
|
296
|
+
const saved = total - loaded;
|
|
297
|
+
const percentage = Math.round((saved / total) * 100);
|
|
298
|
+
return { loaded, total, saved, percentage };
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=prompt-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-catalog.js","sourceRoot":"","sources":["../../../src/prompts/prompt-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,sBAAsB;IACtB,gBAAgB,EAAE;QAChB,IAAI,EAAE,2BAA2B;QACjC,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE;YACR,oBAAoB;YACpB,WAAW;YACX,oBAAoB;YACpB,eAAe;YACf,yBAAyB;SAC1B;QACD,YAAY,EAAE,IAAI;KACnB;IAED,8BAA8B;IAC9B,qBAAqB,EAAE;QACrB,IAAI,EAAE,gCAAgC;QACtC,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M,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;IAErD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADRs Discovered Resource - ADR discovery and summary
|
|
3
|
+
* URI Pattern: adr://adrs/discovered
|
|
4
|
+
*/
|
|
5
|
+
import { URLSearchParams } from 'url';
|
|
6
|
+
import { ResourceGenerationResult } from './index.js';
|
|
7
|
+
export interface AdrsDiscoveredData {
|
|
8
|
+
directory: string;
|
|
9
|
+
totalAdrs: number;
|
|
10
|
+
adrs: Array<{
|
|
11
|
+
filename: string;
|
|
12
|
+
title: string;
|
|
13
|
+
status: string;
|
|
14
|
+
date?: string;
|
|
15
|
+
path: string;
|
|
16
|
+
number?: string;
|
|
17
|
+
category?: string;
|
|
18
|
+
tags?: string[];
|
|
19
|
+
}>;
|
|
20
|
+
summary: {
|
|
21
|
+
byStatus: Record<string, number>;
|
|
22
|
+
byCategory: Record<string, number>;
|
|
23
|
+
};
|
|
24
|
+
recommendations: string[];
|
|
25
|
+
timestamp: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Generate ADRs discovered resource with discovery results and summary.
|
|
29
|
+
*
|
|
30
|
+
* Discovers and catalogs all Architectural Decision Records (ADRs) in a project:
|
|
31
|
+
* - Scans configured ADR directory for decision records
|
|
32
|
+
* - Extracts metadata (title, status, date, category)
|
|
33
|
+
* - Generates summary statistics by status and category
|
|
34
|
+
* - Provides recommendations for ADR management
|
|
35
|
+
*
|
|
36
|
+
* **URI Pattern:** `adr://adrs/discovered`
|
|
37
|
+
*
|
|
38
|
+
* **Query Parameters:**
|
|
39
|
+
* - `projectPath`: Override project root path (default: process.cwd())
|
|
40
|
+
* - `adrDirectory`: Override ADR directory (default: docs/adrs)
|
|
41
|
+
* - `includeContent`: Include full ADR content (default: false)
|
|
42
|
+
* - `includeTimeline`: Include timeline analysis (default: false)
|
|
43
|
+
*
|
|
44
|
+
* @param params - URL path parameters (none for this resource)
|
|
45
|
+
* @param searchParams - URL query parameters for customization
|
|
46
|
+
*
|
|
47
|
+
* @returns Promise resolving to resource generation result containing:
|
|
48
|
+
* - data: ADR discovery results with summaries
|
|
49
|
+
* - contentType: "application/json"
|
|
50
|
+
* - lastModified: ISO timestamp of generation
|
|
51
|
+
* - cacheKey: Unique identifier "adrs-discovered" or "adrs-discovered:{projectPath}"
|
|
52
|
+
* - ttl: Cache duration (120 seconds / 2 minutes)
|
|
53
|
+
* - etag: Entity tag for cache validation
|
|
54
|
+
*
|
|
55
|
+
* @throws {McpAdrError} When:
|
|
56
|
+
* - RESOURCE_NOT_FOUND: ADR directory not found or inaccessible
|
|
57
|
+
* - RESOURCE_GENERATION_ERROR: ADR discovery or parsing fails
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* // Discover ADRs in default location
|
|
62
|
+
* const discovered = await generateAdrsDiscoveredResource(
|
|
63
|
+
* {},
|
|
64
|
+
* new URLSearchParams()
|
|
65
|
+
* );
|
|
66
|
+
*
|
|
67
|
+
* console.log(`Found ${discovered.data.totalAdrs} ADRs`);
|
|
68
|
+
* console.log(`Accepted: ${discovered.data.summary.byStatus.accepted}`);
|
|
69
|
+
* console.log(`Proposed: ${discovered.data.summary.byStatus.proposed}`);
|
|
70
|
+
*
|
|
71
|
+
* // Discover ADRs in custom location
|
|
72
|
+
* const custom = await generateAdrsDiscoveredResource(
|
|
73
|
+
* {},
|
|
74
|
+
* new URLSearchParams('projectPath=/custom/path&adrDirectory=decisions')
|
|
75
|
+
* );
|
|
76
|
+
*
|
|
77
|
+
* // Expected output structure:
|
|
78
|
+
* {
|
|
79
|
+
* data: {
|
|
80
|
+
* directory: "/project/docs/adrs",
|
|
81
|
+
* totalAdrs: 25,
|
|
82
|
+
* adrs: [
|
|
83
|
+
* {
|
|
84
|
+
* filename: "001-use-postgresql.md",
|
|
85
|
+
* title: "Use PostgreSQL for primary database",
|
|
86
|
+
* status: "accepted",
|
|
87
|
+
* date: "2025-01-15",
|
|
88
|
+
* path: "/project/docs/adrs/001-use-postgresql.md",
|
|
89
|
+
* number: "001",
|
|
90
|
+
* category: "database",
|
|
91
|
+
* tags: ["postgresql", "database"]
|
|
92
|
+
* },
|
|
93
|
+
* ...
|
|
94
|
+
* ],
|
|
95
|
+
* summary: {
|
|
96
|
+
* byStatus: {
|
|
97
|
+
* accepted: 20,
|
|
98
|
+
* proposed: 3,
|
|
99
|
+
* deprecated: 2
|
|
100
|
+
* },
|
|
101
|
+
* byCategory: {
|
|
102
|
+
* database: 5,
|
|
103
|
+
* api: 8,
|
|
104
|
+
* infrastructure: 7,
|
|
105
|
+
* security: 5
|
|
106
|
+
* }
|
|
107
|
+
* },
|
|
108
|
+
* recommendations: [
|
|
109
|
+
* "Consider reviewing deprecated ADRs",
|
|
110
|
+
* "3 proposed ADRs need decisions"
|
|
111
|
+
* ],
|
|
112
|
+
* timestamp: "2025-12-16T04:30:00.000Z"
|
|
113
|
+
* },
|
|
114
|
+
* contentType: "application/json",
|
|
115
|
+
* cacheKey: "adrs-discovered",
|
|
116
|
+
* ttl: 120
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @since v2.2.0
|
|
121
|
+
* @see {@link discoverAdrsInDirectory} for ADR discovery logic
|
|
122
|
+
*/
|
|
123
|
+
export declare function generateAdrsDiscoveredResource(_params: Record<string, string>, searchParams: URLSearchParams): Promise<ResourceGenerationResult>;
|
|
124
|
+
//# sourceMappingURL=adrs-discovered-resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adrs-discovered-resource.d.ts","sourceRoot":"","sources":["../../../src/resources/adrs-discovered-resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAItC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAGtD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC;QACV,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC,CAAC;IACH,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC,CAAC;IACF,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AACH,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,YAAY,EAAE,eAAe,GAC5B,OAAO,CAAC,wBAAwB,CAAC,CAyFnC"}
|