mcp-adr-analysis-server 2.1.9 → 2.1.20
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 +55 -8
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/index.d.ts +78 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1793 -577
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/index.d.ts.map +1 -1
- package/dist/src/prompts/index.js +23 -6
- package/dist/src/prompts/index.js.map +1 -1
- package/dist/src/prompts/validated-pattern-prompts.d.ts +33 -0
- package/dist/src/prompts/validated-pattern-prompts.d.ts.map +1 -0
- package/dist/src/prompts/validated-pattern-prompts.js +337 -0
- package/dist/src/prompts/validated-pattern-prompts.js.map +1 -0
- package/dist/src/resources/adr-by-id-resource.d.ts +116 -0
- package/dist/src/resources/adr-by-id-resource.d.ts.map +1 -0
- package/dist/src/resources/adr-by-id-resource.js +213 -0
- package/dist/src/resources/adr-by-id-resource.js.map +1 -0
- package/dist/src/resources/code-quality-resource.d.ts +105 -0
- package/dist/src/resources/code-quality-resource.d.ts.map +1 -0
- package/dist/src/resources/code-quality-resource.js +282 -0
- package/dist/src/resources/code-quality-resource.js.map +1 -0
- package/dist/src/resources/deployment-history-resource.d.ts +214 -0
- package/dist/src/resources/deployment-history-resource.d.ts.map +1 -0
- package/dist/src/resources/deployment-history-resource.js +308 -0
- package/dist/src/resources/deployment-history-resource.js.map +1 -0
- package/dist/src/resources/deployment-status-resource.d.ts +256 -0
- package/dist/src/resources/deployment-status-resource.d.ts.map +1 -0
- package/dist/src/resources/deployment-status-resource.js +665 -0
- package/dist/src/resources/deployment-status-resource.js.map +1 -0
- package/dist/src/resources/environment-analysis-resource.d.ts +237 -0
- package/dist/src/resources/environment-analysis-resource.d.ts.map +1 -0
- package/dist/src/resources/environment-analysis-resource.js +646 -0
- package/dist/src/resources/environment-analysis-resource.js.map +1 -0
- package/dist/src/resources/index.d.ts +6 -2
- package/dist/src/resources/index.d.ts.map +1 -1
- package/dist/src/resources/index.js +247 -492
- package/dist/src/resources/index.js.map +1 -1
- package/dist/src/resources/memory-snapshots-resource.d.ts +180 -0
- package/dist/src/resources/memory-snapshots-resource.d.ts.map +1 -0
- package/dist/src/resources/memory-snapshots-resource.js +847 -0
- package/dist/src/resources/memory-snapshots-resource.js.map +1 -0
- package/dist/src/resources/pattern-base-code-by-platform-resource.d.ts +35 -0
- package/dist/src/resources/pattern-base-code-by-platform-resource.d.ts.map +1 -0
- package/dist/src/resources/pattern-base-code-by-platform-resource.js +72 -0
- package/dist/src/resources/pattern-base-code-by-platform-resource.js.map +1 -0
- package/dist/src/resources/pattern-by-name-resource.d.ts +53 -0
- package/dist/src/resources/pattern-by-name-resource.d.ts.map +1 -0
- package/dist/src/resources/pattern-by-name-resource.js +200 -0
- package/dist/src/resources/pattern-by-name-resource.js.map +1 -0
- package/dist/src/resources/pattern-sources-by-platform-resource.d.ts +26 -0
- package/dist/src/resources/pattern-sources-by-platform-resource.d.ts.map +1 -0
- package/dist/src/resources/pattern-sources-by-platform-resource.js +59 -0
- package/dist/src/resources/pattern-sources-by-platform-resource.js.map +1 -0
- package/dist/src/resources/project-metrics-resource.d.ts +180 -0
- package/dist/src/resources/project-metrics-resource.d.ts.map +1 -0
- package/dist/src/resources/project-metrics-resource.js +487 -0
- package/dist/src/resources/project-metrics-resource.js.map +1 -0
- package/dist/src/resources/project-status-resource.d.ts +75 -0
- package/dist/src/resources/project-status-resource.d.ts.map +1 -0
- package/dist/src/resources/project-status-resource.js +189 -0
- package/dist/src/resources/project-status-resource.js.map +1 -0
- package/dist/src/resources/research-by-topic-resource.d.ts +21 -0
- package/dist/src/resources/research-by-topic-resource.d.ts.map +1 -0
- package/dist/src/resources/research-by-topic-resource.js +125 -0
- package/dist/src/resources/research-by-topic-resource.js.map +1 -0
- package/dist/src/resources/research-index-resource.d.ts +100 -0
- package/dist/src/resources/research-index-resource.d.ts.map +1 -0
- package/dist/src/resources/research-index-resource.js +200 -0
- package/dist/src/resources/research-index-resource.js.map +1 -0
- package/dist/src/resources/resource-cache.d.ts +144 -0
- package/dist/src/resources/resource-cache.d.ts.map +1 -0
- package/dist/src/resources/resource-cache.js +316 -0
- package/dist/src/resources/resource-cache.js.map +1 -0
- package/dist/src/resources/resource-router.d.ts +45 -0
- package/dist/src/resources/resource-router.d.ts.map +1 -0
- package/dist/src/resources/resource-router.js +96 -0
- package/dist/src/resources/resource-router.js.map +1 -0
- package/dist/src/resources/rule-by-id-resource.d.ts +38 -0
- package/dist/src/resources/rule-by-id-resource.d.ts.map +1 -0
- package/dist/src/resources/rule-by-id-resource.js +104 -0
- package/dist/src/resources/rule-by-id-resource.js.map +1 -0
- package/dist/src/resources/rule-catalog-resource.d.ts +126 -0
- package/dist/src/resources/rule-catalog-resource.d.ts.map +1 -0
- package/dist/src/resources/rule-catalog-resource.js +224 -0
- package/dist/src/resources/rule-catalog-resource.js.map +1 -0
- package/dist/src/resources/rule-generation-resource.d.ts +80 -0
- package/dist/src/resources/rule-generation-resource.d.ts.map +1 -0
- package/dist/src/resources/rule-generation-resource.js +282 -0
- package/dist/src/resources/rule-generation-resource.js.map +1 -0
- package/dist/src/resources/technology-by-name-resource.d.ts +43 -0
- package/dist/src/resources/technology-by-name-resource.d.ts.map +1 -0
- package/dist/src/resources/technology-by-name-resource.js +176 -0
- package/dist/src/resources/technology-by-name-resource.js.map +1 -0
- package/dist/src/resources/todo-by-id-resource.d.ts +46 -0
- package/dist/src/resources/todo-by-id-resource.d.ts.map +1 -0
- package/dist/src/resources/todo-by-id-resource.js +192 -0
- package/dist/src/resources/todo-by-id-resource.js.map +1 -0
- package/dist/src/resources/todo-list-resource.d.ts +96 -0
- package/dist/src/resources/todo-list-resource.d.ts.map +1 -0
- package/dist/src/resources/todo-list-resource.js +209 -0
- package/dist/src/resources/todo-list-resource.js.map +1 -0
- package/dist/src/resources/validated-pattern-by-platform-resource.d.ts +14 -0
- package/dist/src/resources/validated-pattern-by-platform-resource.d.ts.map +1 -0
- package/dist/src/resources/validated-pattern-by-platform-resource.js +45 -0
- package/dist/src/resources/validated-pattern-by-platform-resource.js.map +1 -0
- package/dist/src/resources/validated-patterns-catalog-resource.d.ts +36 -0
- package/dist/src/resources/validated-patterns-catalog-resource.d.ts.map +1 -0
- package/dist/src/resources/validated-patterns-catalog-resource.js +57 -0
- package/dist/src/resources/validated-patterns-catalog-resource.js.map +1 -0
- package/dist/src/templates/domain-knowledge-templates.d.ts.map +1 -1
- package/dist/src/templates/domain-knowledge-templates.js +49 -49
- package/dist/src/templates/domain-knowledge-templates.js.map +1 -1
- package/dist/src/tools/adr-bootstrap-validation-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-bootstrap-validation-tool.js +214 -4
- package/dist/src/tools/adr-bootstrap-validation-tool.js.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.d.ts +2 -2
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.js +129 -12
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
- package/dist/src/tools/adr-validation-tool.d.ts +98 -0
- package/dist/src/tools/adr-validation-tool.d.ts.map +1 -0
- package/dist/src/tools/adr-validation-tool.js +372 -0
- package/dist/src/tools/adr-validation-tool.js.map +1 -0
- package/dist/src/tools/bootstrap-validation-loop-tool.d.ts +262 -0
- package/dist/src/tools/bootstrap-validation-loop-tool.d.ts.map +1 -0
- package/dist/src/tools/bootstrap-validation-loop-tool.js +1934 -0
- package/dist/src/tools/bootstrap-validation-loop-tool.js.map +1 -0
- package/dist/src/tools/conversation-memory-tool.d.ts +48 -0
- package/dist/src/tools/conversation-memory-tool.d.ts.map +1 -0
- package/dist/src/tools/conversation-memory-tool.js +254 -0
- package/dist/src/tools/conversation-memory-tool.js.map +1 -0
- package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-analysis-tool.js +82 -6
- package/dist/src/tools/deployment-analysis-tool.js.map +1 -1
- package/dist/src/tools/deployment-guidance-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-guidance-tool.js +126 -25
- package/dist/src/tools/deployment-guidance-tool.js.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.js +166 -5
- package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/environment-analysis-tool.js +36 -1
- package/dist/src/tools/environment-analysis-tool.js.map +1 -1
- package/dist/src/tools/expand-analysis-tool.d.ts +23 -0
- package/dist/src/tools/expand-analysis-tool.d.ts.map +1 -0
- package/dist/src/tools/expand-analysis-tool.js +107 -0
- package/dist/src/tools/expand-analysis-tool.js.map +1 -0
- package/dist/src/tools/get-server-context-tool.d.ts +67 -0
- package/dist/src/tools/get-server-context-tool.d.ts.map +1 -0
- package/dist/src/tools/get-server-context-tool.js +75 -0
- package/dist/src/tools/get-server-context-tool.js.map +1 -0
- package/dist/src/tools/interactive-adr-planning-tool.d.ts.map +1 -1
- package/dist/src/tools/interactive-adr-planning-tool.js +82 -9
- package/dist/src/tools/interactive-adr-planning-tool.js.map +1 -1
- package/dist/src/tools/llm-cloud-management-tool.d.ts +62 -0
- package/dist/src/tools/llm-cloud-management-tool.d.ts.map +1 -0
- package/dist/src/tools/llm-cloud-management-tool.js +202 -0
- package/dist/src/tools/llm-cloud-management-tool.js.map +1 -0
- package/dist/src/tools/llm-database-management-tool.d.ts +62 -0
- package/dist/src/tools/llm-database-management-tool.d.ts.map +1 -0
- package/dist/src/tools/llm-database-management-tool.js +203 -0
- package/dist/src/tools/llm-database-management-tool.js.map +1 -0
- package/dist/src/tools/llm-web-search-tool.d.ts +59 -0
- package/dist/src/tools/llm-web-search-tool.d.ts.map +1 -0
- package/dist/src/tools/llm-web-search-tool.js +165 -0
- package/dist/src/tools/llm-web-search-tool.js.map +1 -0
- package/dist/src/tools/mcp-planning-tool.d.ts.map +1 -1
- package/dist/src/tools/mcp-planning-tool.js +10 -3
- package/dist/src/tools/mcp-planning-tool.js.map +1 -1
- package/dist/src/tools/memory-loading-tool.d.ts.map +1 -1
- package/dist/src/tools/memory-loading-tool.js +4 -2
- package/dist/src/tools/memory-loading-tool.js.map +1 -1
- package/dist/src/tools/perform-research-tool.d.ts +61 -0
- package/dist/src/tools/perform-research-tool.d.ts.map +1 -0
- package/dist/src/tools/perform-research-tool.js +324 -0
- package/dist/src/tools/perform-research-tool.js.map +1 -0
- package/dist/src/tools/research-question-tool.d.ts.map +1 -1
- package/dist/src/tools/research-question-tool.js +11 -9
- package/dist/src/tools/research-question-tool.js.map +1 -1
- package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -1
- package/dist/src/tools/review-existing-adrs-tool.js +42 -3
- package/dist/src/tools/review-existing-adrs-tool.js.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.d.ts +15 -94
- package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.js +2 -2
- package/dist/src/tools/tool-chain-orchestrator.js.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +25 -120
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js +91 -2
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
- package/dist/src/types/ape-framework.d.ts +50 -283
- package/dist/src/types/ape-framework.d.ts.map +1 -1
- package/dist/src/types/conversation-context.d.ts.map +1 -1
- package/dist/src/types/conversation-context.js +12 -12
- package/dist/src/types/conversation-context.js.map +1 -1
- package/dist/src/types/conversation-memory.d.ts +184 -0
- package/dist/src/types/conversation-memory.d.ts.map +1 -0
- package/dist/src/types/conversation-memory.js +8 -0
- package/dist/src/types/conversation-memory.js.map +1 -0
- package/dist/src/types/index.d.ts +112 -339
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/knowledge-generation.d.ts +96 -401
- package/dist/src/types/knowledge-generation.d.ts.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.d.ts +77 -715
- package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.js +8 -8
- package/dist/src/types/knowledge-graph-schemas.js.map +1 -1
- package/dist/src/types/memory-entities.d.ts +1230 -6164
- package/dist/src/types/memory-entities.d.ts.map +1 -1
- package/dist/src/types/memory-entities.js +8 -8
- package/dist/src/types/memory-entities.js.map +1 -1
- package/dist/src/types/reflexion-framework.d.ts +35 -264
- package/dist/src/types/reflexion-framework.d.ts.map +1 -1
- package/dist/src/types/reflexion-framework.js +1 -1
- package/dist/src/types/reflexion-framework.js.map +1 -1
- package/dist/src/types/state-reinforcement.d.ts +87 -0
- package/dist/src/types/state-reinforcement.d.ts.map +1 -0
- package/dist/src/types/state-reinforcement.js +5 -0
- package/dist/src/types/state-reinforcement.js.map +1 -0
- package/dist/src/types/tiered-response.d.ts +61 -0
- package/dist/src/types/tiered-response.d.ts.map +1 -0
- package/dist/src/types/tiered-response.js +8 -0
- package/dist/src/types/tiered-response.js.map +1 -0
- package/dist/src/types/tool-context.d.ts +50 -0
- package/dist/src/types/tool-context.d.ts.map +1 -0
- package/dist/src/types/tool-context.js +20 -0
- package/dist/src/types/tool-context.js.map +1 -0
- package/dist/src/utils/adr-action-analyzer.d.ts +23 -0
- package/dist/src/utils/adr-action-analyzer.d.ts.map +1 -0
- package/dist/src/utils/adr-action-analyzer.js +323 -0
- package/dist/src/utils/adr-action-analyzer.js.map +1 -0
- package/dist/src/utils/adr-context-detector.d.ts +33 -0
- package/dist/src/utils/adr-context-detector.d.ts.map +1 -0
- package/dist/src/utils/adr-context-detector.js +279 -0
- package/dist/src/utils/adr-context-detector.js.map +1 -0
- package/dist/src/utils/adr-discovery.d.ts +28 -2
- package/dist/src/utils/adr-discovery.d.ts.map +1 -1
- package/dist/src/utils/adr-discovery.js +91 -7
- package/dist/src/utils/adr-discovery.js.map +1 -1
- package/dist/src/utils/adr-knowledge-initializer.d.ts +54 -0
- package/dist/src/utils/adr-knowledge-initializer.d.ts.map +1 -0
- package/dist/src/utils/adr-knowledge-initializer.js +240 -0
- package/dist/src/utils/adr-knowledge-initializer.js.map +1 -0
- package/dist/src/utils/adr-timeline-extractor.d.ts +21 -0
- package/dist/src/utils/adr-timeline-extractor.d.ts.map +1 -0
- package/dist/src/utils/adr-timeline-extractor.js +294 -0
- package/dist/src/utils/adr-timeline-extractor.js.map +1 -0
- package/dist/src/utils/adr-timeline-types.d.ts +234 -0
- package/dist/src/utils/adr-timeline-types.d.ts.map +1 -0
- package/dist/src/utils/adr-timeline-types.js +7 -0
- package/dist/src/utils/adr-timeline-types.js.map +1 -0
- package/dist/src/utils/ai-executor.d.ts +36 -0
- package/dist/src/utils/ai-executor.d.ts.map +1 -1
- package/dist/src/utils/ai-executor.js +39 -3
- package/dist/src/utils/ai-executor.js.map +1 -1
- package/dist/src/utils/apply-cot-enhancement.d.ts.map +1 -1
- package/dist/src/utils/apply-cot-enhancement.js +15 -15
- package/dist/src/utils/apply-cot-enhancement.js.map +1 -1
- package/dist/src/utils/automatic-prompt-engineering.d.ts.map +1 -1
- package/dist/src/utils/automatic-prompt-engineering.js +68 -58
- package/dist/src/utils/automatic-prompt-engineering.js.map +1 -1
- package/dist/src/utils/conditional-request.d.ts +105 -0
- package/dist/src/utils/conditional-request.d.ts.map +1 -0
- package/dist/src/utils/conditional-request.js +186 -0
- package/dist/src/utils/conditional-request.js.map +1 -0
- package/dist/src/utils/config.d.ts +72 -18
- package/dist/src/utils/config.d.ts.map +1 -1
- package/dist/src/utils/config.js +75 -0
- package/dist/src/utils/config.js.map +1 -1
- package/dist/src/utils/context-document-manager.d.ts +112 -0
- package/dist/src/utils/context-document-manager.d.ts.map +1 -0
- package/dist/src/utils/context-document-manager.js +351 -0
- package/dist/src/utils/context-document-manager.js.map +1 -0
- package/dist/src/utils/conversation-memory-manager.d.ts +86 -0
- package/dist/src/utils/conversation-memory-manager.d.ts.map +1 -0
- package/dist/src/utils/conversation-memory-manager.js +443 -0
- package/dist/src/utils/conversation-memory-manager.js.map +1 -0
- package/dist/src/utils/dag-executor.d.ts +106 -0
- package/dist/src/utils/dag-executor.d.ts.map +1 -0
- package/dist/src/utils/dag-executor.js +453 -0
- package/dist/src/utils/dag-executor.js.map +1 -0
- package/dist/src/utils/deployment-analysis.d.ts.map +1 -1
- package/dist/src/utils/deployment-analysis.js +17 -9
- package/dist/src/utils/deployment-analysis.js.map +1 -1
- package/dist/src/utils/deployment-type-registry.d.ts +52 -0
- package/dist/src/utils/deployment-type-registry.d.ts.map +1 -0
- package/dist/src/utils/deployment-type-registry.js +543 -0
- package/dist/src/utils/deployment-type-registry.js.map +1 -0
- package/dist/src/utils/dynamic-deployment-intelligence.d.ts +117 -0
- package/dist/src/utils/dynamic-deployment-intelligence.d.ts.map +1 -0
- package/dist/src/utils/dynamic-deployment-intelligence.js +445 -0
- package/dist/src/utils/dynamic-deployment-intelligence.js.map +1 -0
- package/dist/src/utils/environment-analysis.d.ts.map +1 -1
- package/dist/src/utils/environment-analysis.js +63 -44
- package/dist/src/utils/environment-analysis.js.map +1 -1
- package/dist/src/utils/environment-capability-registry.d.ts +101 -0
- package/dist/src/utils/environment-capability-registry.d.ts.map +1 -0
- package/dist/src/utils/environment-capability-registry.js +489 -0
- package/dist/src/utils/environment-capability-registry.js.map +1 -0
- package/dist/src/utils/index.d.ts +3 -3
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +3 -3
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/knowledge-generation.d.ts.map +1 -1
- package/dist/src/utils/knowledge-generation.js +61 -35
- package/dist/src/utils/knowledge-generation.js.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.d.ts +19 -0
- package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.js +165 -1
- package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
- package/dist/src/utils/llm-artifact-detector.d.ts.map +1 -1
- package/dist/src/utils/llm-artifact-detector.js +28 -24
- package/dist/src/utils/llm-artifact-detector.js.map +1 -1
- package/dist/src/utils/mermaid-diagrams.d.ts +101 -0
- package/dist/src/utils/mermaid-diagrams.d.ts.map +1 -0
- package/dist/src/utils/mermaid-diagrams.js +445 -0
- package/dist/src/utils/mermaid-diagrams.js.map +1 -0
- package/dist/src/utils/monitoring.d.ts +249 -0
- package/dist/src/utils/monitoring.d.ts.map +1 -0
- package/dist/src/utils/monitoring.js +513 -0
- package/dist/src/utils/monitoring.js.map +1 -0
- package/dist/src/utils/pattern-contribution-helper.d.ts +60 -0
- package/dist/src/utils/pattern-contribution-helper.d.ts.map +1 -0
- package/dist/src/utils/pattern-contribution-helper.js +308 -0
- package/dist/src/utils/pattern-contribution-helper.js.map +1 -0
- package/dist/src/utils/pattern-loader.d.ts +183 -0
- package/dist/src/utils/pattern-loader.d.ts.map +1 -0
- package/dist/src/utils/pattern-loader.js +200 -0
- package/dist/src/utils/pattern-loader.js.map +1 -0
- package/dist/src/utils/pattern-research-utility.d.ts +107 -0
- package/dist/src/utils/pattern-research-utility.d.ts.map +1 -0
- package/dist/src/utils/pattern-research-utility.js +360 -0
- package/dist/src/utils/pattern-research-utility.js.map +1 -0
- package/dist/src/utils/pattern-to-dag-converter.d.ts +62 -0
- package/dist/src/utils/pattern-to-dag-converter.d.ts.map +1 -0
- package/dist/src/utils/pattern-to-dag-converter.js +265 -0
- package/dist/src/utils/pattern-to-dag-converter.js.map +1 -0
- package/dist/src/utils/platform-detector.d.ts +86 -0
- package/dist/src/utils/platform-detector.d.ts.map +1 -0
- package/dist/src/utils/platform-detector.js +509 -0
- package/dist/src/utils/platform-detector.js.map +1 -0
- package/dist/src/utils/prompt-composition.d.ts.map +1 -1
- package/dist/src/utils/prompt-composition.js +1 -4
- package/dist/src/utils/prompt-composition.js.map +1 -1
- package/dist/src/utils/reflexion.d.ts.map +1 -1
- package/dist/src/utils/reflexion.js +51 -42
- package/dist/src/utils/reflexion.js.map +1 -1
- package/dist/src/utils/research-integration.d.ts.map +1 -1
- package/dist/src/utils/research-integration.js +8 -2
- package/dist/src/utils/research-integration.js.map +1 -1
- package/dist/src/utils/research-orchestrator.d.ts +209 -0
- package/dist/src/utils/research-orchestrator.d.ts.map +1 -0
- package/dist/src/utils/research-orchestrator.js +863 -0
- package/dist/src/utils/research-orchestrator.js.map +1 -0
- package/dist/src/utils/research-questions.d.ts.map +1 -1
- package/dist/src/utils/research-questions.js +4 -1
- package/dist/src/utils/research-questions.js.map +1 -1
- package/dist/src/utils/resource-extractor.d.ts +57 -0
- package/dist/src/utils/resource-extractor.d.ts.map +1 -0
- package/dist/src/utils/resource-extractor.js +323 -0
- package/dist/src/utils/resource-extractor.js.map +1 -0
- package/dist/src/utils/resource-versioning.d.ts +124 -0
- package/dist/src/utils/resource-versioning.d.ts.map +1 -0
- package/dist/src/utils/resource-versioning.js +272 -0
- package/dist/src/utils/resource-versioning.js.map +1 -0
- package/dist/src/utils/root-manager.d.ts +118 -0
- package/dist/src/utils/root-manager.d.ts.map +1 -0
- package/dist/src/utils/root-manager.js +154 -0
- package/dist/src/utils/root-manager.js.map +1 -0
- package/dist/src/utils/rule-generation.d.ts.map +1 -1
- package/dist/src/utils/rule-generation.js +4 -1
- package/dist/src/utils/rule-generation.js.map +1 -1
- package/dist/src/utils/server-context-generator.d.ts +47 -0
- package/dist/src/utils/server-context-generator.d.ts.map +1 -0
- package/dist/src/utils/server-context-generator.js +666 -0
- package/dist/src/utils/server-context-generator.js.map +1 -0
- package/dist/src/utils/state-reinforcement-manager.d.ts +60 -0
- package/dist/src/utils/state-reinforcement-manager.d.ts.map +1 -0
- package/dist/src/utils/state-reinforcement-manager.js +200 -0
- package/dist/src/utils/state-reinforcement-manager.js.map +1 -0
- package/dist/src/utils/system-card-manager.d.ts +194 -0
- package/dist/src/utils/system-card-manager.d.ts.map +1 -0
- package/dist/src/utils/system-card-manager.js +336 -0
- package/dist/src/utils/system-card-manager.js.map +1 -0
- package/dist/src/utils/tiered-response-manager.d.ts +40 -0
- package/dist/src/utils/tiered-response-manager.d.ts.map +1 -0
- package/dist/src/utils/tiered-response-manager.js +243 -0
- package/dist/src/utils/tiered-response-manager.js.map +1 -0
- package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -1
- package/dist/src/utils/tree-sitter-analyzer.js +83 -11
- package/dist/src/utils/tree-sitter-analyzer.js.map +1 -1
- package/dist/src/utils/validated-pattern-definitions.d.ts +219 -0
- package/dist/src/utils/validated-pattern-definitions.d.ts.map +1 -0
- package/dist/src/utils/validated-pattern-definitions.js +1511 -0
- package/dist/src/utils/validated-pattern-definitions.js.map +1 -0
- package/package.json +22 -13
- package/dist/src/prompts/todo-prompts.d.ts +0 -49
- package/dist/src/prompts/todo-prompts.d.ts.map +0 -1
- package/dist/src/prompts/todo-prompts.js +0 -824
- package/dist/src/prompts/todo-prompts.js.map +0 -1
- package/dist/src/types/todo-json-schemas.d.ts +0 -17
- package/dist/src/types/todo-json-schemas.d.ts.map +0 -1
- package/dist/src/types/todo-json-schemas.js +0 -9
- package/dist/src/types/todo-json-schemas.js.map +0 -1
- package/dist/src/utils/todo-file-watcher.d.ts +0 -14
- package/dist/src/utils/todo-file-watcher.d.ts.map +0 -1
- package/dist/src/utils/todo-file-watcher.js +0 -25
- package/dist/src/utils/todo-file-watcher.js.map +0 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as yaml from 'js-yaml';
|
|
4
|
+
import { EnhancedLogger } from './enhanced-logging.js';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { dirname } from 'path';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
/**
|
|
10
|
+
* Loads and manages dynamic patterns from YAML files
|
|
11
|
+
*/
|
|
12
|
+
export class PatternLoader {
|
|
13
|
+
logger;
|
|
14
|
+
patternsDir;
|
|
15
|
+
cache = new Map();
|
|
16
|
+
constructor(patternsDir) {
|
|
17
|
+
this.logger = new EnhancedLogger();
|
|
18
|
+
// Default to patterns/ directory at project root
|
|
19
|
+
this.patternsDir = patternsDir || path.join(__dirname, '../../patterns');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Load a pattern from YAML file by ID
|
|
23
|
+
* @param patternId - Pattern identifier (filename without .yaml)
|
|
24
|
+
* @returns Loaded pattern or null if not found
|
|
25
|
+
*/
|
|
26
|
+
async loadPattern(patternId) {
|
|
27
|
+
// Check cache first
|
|
28
|
+
if (this.cache.has(patternId)) {
|
|
29
|
+
this.logger.info(`Loading pattern from cache: ${patternId}`, 'PatternLoader');
|
|
30
|
+
return this.cache.get(patternId);
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
// Search in different directories
|
|
34
|
+
const directories = ['composite', 'infrastructure', 'runtime', 'protocol'];
|
|
35
|
+
for (const dir of directories) {
|
|
36
|
+
const filePath = path.join(this.patternsDir, dir, `${patternId}.yaml`);
|
|
37
|
+
try {
|
|
38
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
39
|
+
const pattern = yaml.load(content);
|
|
40
|
+
// Validate pattern
|
|
41
|
+
this.validatePattern(pattern);
|
|
42
|
+
// Cache it
|
|
43
|
+
this.cache.set(patternId, pattern);
|
|
44
|
+
this.logger.info(`Loaded pattern: ${patternId} (${pattern.name})`, 'PatternLoader');
|
|
45
|
+
return pattern;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (error.code === 'ENOENT') {
|
|
49
|
+
// File not found in this directory, continue to next
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
// Other error, re-throw
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
this.logger.warn(`Pattern not found: ${patternId}`, 'PatternLoader');
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
this.logger.error(`Failed to load pattern: ${patternId}`, 'PatternLoader', error);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Load pattern by composition (infrastructure + runtime)
|
|
66
|
+
* @param infrastructure - Infrastructure platform
|
|
67
|
+
* @param runtime - Runtime environment (optional)
|
|
68
|
+
* @returns Loaded pattern or null if not found
|
|
69
|
+
*/
|
|
70
|
+
async loadPatternByComposition(infrastructure, runtime) {
|
|
71
|
+
// Try composite pattern first (infrastructure-runtime)
|
|
72
|
+
if (runtime) {
|
|
73
|
+
const compositeId = `${infrastructure}-${runtime}`;
|
|
74
|
+
const pattern = await this.loadPattern(compositeId);
|
|
75
|
+
if (pattern) {
|
|
76
|
+
return pattern;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Fallback to infrastructure-only pattern
|
|
80
|
+
const infrastructurePattern = await this.loadPattern(infrastructure);
|
|
81
|
+
if (infrastructurePattern) {
|
|
82
|
+
return infrastructurePattern;
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* List all available patterns
|
|
88
|
+
* @returns Array of pattern IDs
|
|
89
|
+
*/
|
|
90
|
+
async listPatterns() {
|
|
91
|
+
const patterns = [];
|
|
92
|
+
const directories = ['composite', 'infrastructure', 'runtime', 'protocol'];
|
|
93
|
+
for (const dir of directories) {
|
|
94
|
+
const dirPath = path.join(this.patternsDir, dir);
|
|
95
|
+
try {
|
|
96
|
+
const files = await fs.readdir(dirPath);
|
|
97
|
+
const yamlFiles = files.filter(f => f.endsWith('.yaml') || f.endsWith('.yml'));
|
|
98
|
+
for (const file of yamlFiles) {
|
|
99
|
+
const patternId = file.replace(/\.(yaml|yml)$/, '');
|
|
100
|
+
patterns.push(patternId);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (error.code === 'ENOENT') {
|
|
105
|
+
// Directory doesn't exist, skip
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return patterns;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* List patterns by category
|
|
115
|
+
* @param category - Pattern category (composite, infrastructure, runtime, protocol)
|
|
116
|
+
* @returns Array of pattern IDs in that category
|
|
117
|
+
*/
|
|
118
|
+
async listPatternsByCategory(category) {
|
|
119
|
+
const dirPath = path.join(this.patternsDir, category);
|
|
120
|
+
const patterns = [];
|
|
121
|
+
try {
|
|
122
|
+
const files = await fs.readdir(dirPath);
|
|
123
|
+
const yamlFiles = files.filter(f => f.endsWith('.yaml') || f.endsWith('.yml'));
|
|
124
|
+
for (const file of yamlFiles) {
|
|
125
|
+
const patternId = file.replace(/\.(yaml|yml)$/, '');
|
|
126
|
+
patterns.push(patternId);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
if (error.code === 'ENOENT') {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
return patterns;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Validate pattern structure
|
|
139
|
+
* @param pattern - Pattern to validate
|
|
140
|
+
* @throws Error if validation fails
|
|
141
|
+
*/
|
|
142
|
+
validatePattern(pattern) {
|
|
143
|
+
// Check required fields
|
|
144
|
+
if (!pattern.id || !pattern.name || !pattern.version) {
|
|
145
|
+
throw new Error('Pattern missing required fields: id, name, version');
|
|
146
|
+
}
|
|
147
|
+
// Check authoritative sources
|
|
148
|
+
if (!pattern.authoritativeSources || pattern.authoritativeSources.length === 0) {
|
|
149
|
+
throw new Error(`Pattern ${pattern.id} must have at least one authoritative source`);
|
|
150
|
+
}
|
|
151
|
+
// Check deployment phases
|
|
152
|
+
if (!pattern.deploymentPhases || pattern.deploymentPhases.length === 0) {
|
|
153
|
+
throw new Error(`Pattern ${pattern.id} must have at least one deployment phase`);
|
|
154
|
+
}
|
|
155
|
+
// Validate URLs in authoritative sources
|
|
156
|
+
for (const source of pattern.authoritativeSources) {
|
|
157
|
+
try {
|
|
158
|
+
new globalThis.URL(source.url);
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
throw new Error(`Invalid URL in pattern ${pattern.id}: ${source.url}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Validate base repository URL if present
|
|
165
|
+
if (pattern.baseCodeRepository?.url) {
|
|
166
|
+
try {
|
|
167
|
+
new globalThis.URL(pattern.baseCodeRepository.url);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
throw new Error(`Invalid base repository URL in pattern ${pattern.id}: ${pattern.baseCodeRepository.url}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
this.logger.info(`Pattern validation passed: ${pattern.id}`, 'PatternLoader');
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Clear pattern cache
|
|
177
|
+
* Useful for testing or reloading patterns
|
|
178
|
+
*/
|
|
179
|
+
clearCache() {
|
|
180
|
+
this.cache.clear();
|
|
181
|
+
this.logger.info('Pattern cache cleared', 'PatternLoader');
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get pattern from cache
|
|
185
|
+
* @param patternId - Pattern identifier
|
|
186
|
+
* @returns Cached pattern or null
|
|
187
|
+
*/
|
|
188
|
+
getCachedPattern(patternId) {
|
|
189
|
+
return this.cache.get(patternId) || null;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Check if a pattern is cached
|
|
193
|
+
* @param patternId - Pattern identifier
|
|
194
|
+
* @returns True if cached
|
|
195
|
+
*/
|
|
196
|
+
isCached(patternId) {
|
|
197
|
+
return this.cache.has(patternId);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=patt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ACH,UAAU;QACR,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,SAAiB;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,SAAiB;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Research Utility
|
|
3
|
+
*
|
|
4
|
+
* This utility enables LLMs to query authoritative pattern sources
|
|
5
|
+
* for live, up-to-date information before applying deployment patterns.
|
|
6
|
+
*
|
|
7
|
+
* The system uses WebFetch to retrieve current best practices from
|
|
8
|
+
* official documentation, repositories, and community resources.
|
|
9
|
+
*/
|
|
10
|
+
import { PatternSource, PlatformType } from './validated-pattern-definitions.js';
|
|
11
|
+
/**
|
|
12
|
+
* Research result from a pattern source
|
|
13
|
+
*/
|
|
14
|
+
export interface PatternResearchResult {
|
|
15
|
+
source: PatternSource;
|
|
16
|
+
findings: string;
|
|
17
|
+
confidence: number;
|
|
18
|
+
timestamp: string;
|
|
19
|
+
success: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Aggregated research for a pattern
|
|
24
|
+
*/
|
|
25
|
+
export interface AggregatedPatternResearch {
|
|
26
|
+
platformType: PlatformType;
|
|
27
|
+
patternVersion: string;
|
|
28
|
+
requiredSourcesQueried: number;
|
|
29
|
+
totalSourcesQueried: number;
|
|
30
|
+
overallConfidence: number;
|
|
31
|
+
results: PatternResearchResult[];
|
|
32
|
+
summary: string;
|
|
33
|
+
recommendations: string[];
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Pattern Research Utility
|
|
38
|
+
*
|
|
39
|
+
* Queries authoritative sources to get the latest pattern information.
|
|
40
|
+
* LLMs should use this before applying patterns to ensure they follow
|
|
41
|
+
* current best practices.
|
|
42
|
+
*/
|
|
43
|
+
export declare class PatternResearchUtility {
|
|
44
|
+
private logger;
|
|
45
|
+
private researchCache;
|
|
46
|
+
private cacheTTL;
|
|
47
|
+
constructor();
|
|
48
|
+
/**
|
|
49
|
+
* Research a pattern by querying all its authoritative sources
|
|
50
|
+
*
|
|
51
|
+
* This method should be called by LLMs before applying a deployment pattern.
|
|
52
|
+
* It fetches the latest information from official documentation, repositories,
|
|
53
|
+
* and community resources to ensure the pattern follows current best practices.
|
|
54
|
+
*
|
|
55
|
+
* @param platformType - The platform to research
|
|
56
|
+
* @param queryRequired - If true, only query required sources
|
|
57
|
+
* @param useCache - Whether to use cached research if available
|
|
58
|
+
* @returns Aggregated research results
|
|
59
|
+
*/
|
|
60
|
+
researchPattern(platformType: PlatformType, queryRequired?: boolean, useCache?: boolean): Promise<AggregatedPatternResearch>;
|
|
61
|
+
/**
|
|
62
|
+
* Query a single pattern source
|
|
63
|
+
*
|
|
64
|
+
* This method constructs a prompt to guide the LLM in extracting
|
|
65
|
+
* relevant information from the authoritative source.
|
|
66
|
+
*
|
|
67
|
+
* NOTE: This method returns instructions for the LLM rather than
|
|
68
|
+
* actually fetching content, since WebFetch must be called by the LLM itself.
|
|
69
|
+
*/
|
|
70
|
+
private querySource;
|
|
71
|
+
/**
|
|
72
|
+
* Generate instructions for the LLM to query a source
|
|
73
|
+
*/
|
|
74
|
+
private generateQueryInstructions;
|
|
75
|
+
/**
|
|
76
|
+
* Aggregate results from multiple sources
|
|
77
|
+
*/
|
|
78
|
+
private aggregateResults;
|
|
79
|
+
/**
|
|
80
|
+
* Generate a summary of research findings
|
|
81
|
+
*/
|
|
82
|
+
private generateSummary;
|
|
83
|
+
/**
|
|
84
|
+
* Generate recommendations based on research
|
|
85
|
+
*/
|
|
86
|
+
private generateRecommendations;
|
|
87
|
+
/**
|
|
88
|
+
* Generate a research report for the LLM
|
|
89
|
+
*
|
|
90
|
+
* This creates a formatted report that the LLM can read to understand
|
|
91
|
+
* what research needs to be done before applying a pattern.
|
|
92
|
+
*/
|
|
93
|
+
generateResearchReport(platformType: PlatformType): string;
|
|
94
|
+
/**
|
|
95
|
+
* Clear research cache
|
|
96
|
+
*/
|
|
97
|
+
clearCache(): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to research a pattern
|
|
101
|
+
*/
|
|
102
|
+
export declare function researchPattern(platformType: PlatformType, queryRequired?: boolean): Promise<AggregatedPatternResearch>;
|
|
103
|
+
/**
|
|
104
|
+
* Helper function to generate a research report
|
|
105
|
+
*/
|
|
106
|
+
export declare function generatePatternResearchReport(platformType: PlatformType): string;
|
|
107
|
+
//# sourceMappingURL=pattern-research-utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-research-utility.d.ts","sourceRoot":"","sources":["../../../src/utils/pattern-research-utility.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,aAAa,EACb,YAAY,EAEb,MAAM,oCAAoC,CAAC;AAG5C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CAAmB;;IAOnC;;;;;;;;;;;OAWG;IACG,eAAe,CACnB,YAAY,EAAE,YAAY,EAC1B,aAAa,GAAE,OAAe,EAC9B,QAAQ,GAAE,OAAc,GACvB,OAAO,CAAC,yBAAyB,CAAC;IAiFrC;;;;;;;;OAQG;YACW,WAAW;IAkBzB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA2BjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAiCxB;;OAEG;IACH,OAAO,CAAC,eAAe;IA4BvB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAoE/B;;;;;OAKG;IACH,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM;IA0G1D;;OAEG;IACH,UAAU,IAAI,IAAI;CAInB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,YAAY,EAC1B,aAAa,GAAE,OAAe,GAC7B,OAAO,CAAC,yBAAyB,CAAC,CAGpC;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,CAGhF"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Research Utility
|
|
3
|
+
*
|
|
4
|
+
* This utility enables LLMs to query authoritative pattern sources
|
|
5
|
+
* for live, up-to-date information before applying deployment patterns.
|
|
6
|
+
*
|
|
7
|
+
* The system uses WebFetch to retrieve current best practices from
|
|
8
|
+
* official documentation, repositories, and community resources.
|
|
9
|
+
*/
|
|
10
|
+
import { getPattern, } from './validated-pattern-definitions.js';
|
|
11
|
+
import { EnhancedLogger } from './enhanced-logging.js';
|
|
12
|
+
/**
|
|
13
|
+
* Pattern Research Utility
|
|
14
|
+
*
|
|
15
|
+
* Queries authoritative sources to get the latest pattern information.
|
|
16
|
+
* LLMs should use this before applying patterns to ensure they follow
|
|
17
|
+
* current best practices.
|
|
18
|
+
*/
|
|
19
|
+
export class PatternResearchUtility {
|
|
20
|
+
logger;
|
|
21
|
+
researchCache;
|
|
22
|
+
cacheTTL = 3600000; // 1 hour cache
|
|
23
|
+
constructor() {
|
|
24
|
+
this.logger = new EnhancedLogger();
|
|
25
|
+
this.researchCache = new Map();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Research a pattern by querying all its authoritative sources
|
|
29
|
+
*
|
|
30
|
+
* This method should be called by LLMs before applying a deployment pattern.
|
|
31
|
+
* It fetches the latest information from official documentation, repositories,
|
|
32
|
+
* and community resources to ensure the pattern follows current best practices.
|
|
33
|
+
*
|
|
34
|
+
* @param platformType - The platform to research
|
|
35
|
+
* @param queryRequired - If true, only query required sources
|
|
36
|
+
* @param useCache - Whether to use cached research if available
|
|
37
|
+
* @returns Aggregated research results
|
|
38
|
+
*/
|
|
39
|
+
async researchPattern(platformType, queryRequired = false, useCache = true) {
|
|
40
|
+
this.logger.info(`Researching pattern for ${platformType}`, 'PatternResearchUtility');
|
|
41
|
+
// Check cache
|
|
42
|
+
const cacheKey = `${platformType}_${queryRequired}`;
|
|
43
|
+
if (useCache && this.researchCache.has(cacheKey)) {
|
|
44
|
+
const cached = this.researchCache.get(cacheKey);
|
|
45
|
+
const age = Date.now() - new Date(cached.updatedAt).getTime();
|
|
46
|
+
if (age < this.cacheTTL) {
|
|
47
|
+
this.logger.info(`Using cached research for ${platformType} (age: ${Math.round(age / 1000)}s)`, 'PatternResearchUtility');
|
|
48
|
+
return cached;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Get the pattern
|
|
52
|
+
const pattern = getPattern(platformType);
|
|
53
|
+
if (!pattern) {
|
|
54
|
+
throw new Error(`No pattern found for platform type: ${platformType}`);
|
|
55
|
+
}
|
|
56
|
+
// Determine which sources to query
|
|
57
|
+
const sourcesToQuery = queryRequired
|
|
58
|
+
? pattern.authoritativeSources.filter(s => s.requiredForDeployment)
|
|
59
|
+
: pattern.authoritativeSources;
|
|
60
|
+
// Sort by priority (highest first)
|
|
61
|
+
const sortedSources = [...sourcesToQuery].sort((a, b) => b.priority - a.priority);
|
|
62
|
+
this.logger.info(`Querying ${sortedSources.length} sources for ${platformType}`, 'PatternResearchUtility', {
|
|
63
|
+
required: sortedSources.filter(s => s.requiredForDeployment).length,
|
|
64
|
+
optional: sortedSources.filter(s => !s.requiredForDeployment).length,
|
|
65
|
+
});
|
|
66
|
+
// Query each source
|
|
67
|
+
const results = [];
|
|
68
|
+
for (const source of sortedSources) {
|
|
69
|
+
try {
|
|
70
|
+
const result = await this.querySource(source, pattern);
|
|
71
|
+
results.push(result);
|
|
72
|
+
// Log progress
|
|
73
|
+
this.logger.info(`Queried ${source.type} source: ${source.url} (confidence: ${result.confidence})`, 'PatternResearchUtility');
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
this.logger.error(`Failed to query source: ${source.url}`, 'PatternResearchUtility', error);
|
|
77
|
+
results.push({
|
|
78
|
+
source,
|
|
79
|
+
findings: '',
|
|
80
|
+
confidence: 0,
|
|
81
|
+
timestamp: new Date().toISOString(),
|
|
82
|
+
success: false,
|
|
83
|
+
error: error.message,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Aggregate results
|
|
88
|
+
const aggregated = this.aggregateResults(platformType, pattern, results);
|
|
89
|
+
// Cache results
|
|
90
|
+
this.researchCache.set(cacheKey, aggregated);
|
|
91
|
+
return aggregated;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Query a single pattern source
|
|
95
|
+
*
|
|
96
|
+
* This method constructs a prompt to guide the LLM in extracting
|
|
97
|
+
* relevant information from the authoritative source.
|
|
98
|
+
*
|
|
99
|
+
* NOTE: This method returns instructions for the LLM rather than
|
|
100
|
+
* actually fetching content, since WebFetch must be called by the LLM itself.
|
|
101
|
+
*/
|
|
102
|
+
async querySource(source, pattern) {
|
|
103
|
+
// In a real implementation with WebFetch access, this would make the actual request
|
|
104
|
+
// For now, we return a structured instruction for the LLM to follow
|
|
105
|
+
const instruction = this.generateQueryInstructions(source, pattern);
|
|
106
|
+
return {
|
|
107
|
+
source,
|
|
108
|
+
findings: instruction,
|
|
109
|
+
confidence: source.requiredForDeployment ? 1.0 : 0.8,
|
|
110
|
+
timestamp: new Date().toISOString(),
|
|
111
|
+
success: true,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Generate instructions for the LLM to query a source
|
|
116
|
+
*/
|
|
117
|
+
generateQueryInstructions(source, pattern) {
|
|
118
|
+
return `
|
|
119
|
+
## Query Instructions for ${source.url}
|
|
120
|
+
|
|
121
|
+
**Source Type**: ${source.type}
|
|
122
|
+
**Priority**: ${source.priority}/10
|
|
123
|
+
**Required for Deployment**: ${source.requiredForDeployment ? 'YES' : 'No'}
|
|
124
|
+
|
|
125
|
+
**Purpose**: ${source.purpose}
|
|
126
|
+
|
|
127
|
+
**How to Query**:
|
|
128
|
+
${source.queryInstructions}
|
|
129
|
+
|
|
130
|
+
**What to Extract**:
|
|
131
|
+
1. Latest deployment best practices for ${pattern.platformType}
|
|
132
|
+
2. Any breaking changes or deprecations since ${pattern.metadata.lastUpdated}
|
|
133
|
+
3. New features or patterns introduced recently
|
|
134
|
+
4. Security updates or vulnerabilities
|
|
135
|
+
5. Configuration examples and templates
|
|
136
|
+
6. Common pitfalls and troubleshooting steps
|
|
137
|
+
|
|
138
|
+
**Context**: You are researching this source to ensure the validated pattern for ${pattern.platformType} follows the absolute latest best practices. Pay special attention to any differences from the static pattern definition dated ${pattern.metadata.lastUpdated}.
|
|
139
|
+
|
|
140
|
+
**Action**: Use WebFetch to retrieve content from this URL and extract the above information according to the query instructions.
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Aggregate results from multiple sources
|
|
145
|
+
*/
|
|
146
|
+
aggregateResults(platformType, pattern, results) {
|
|
147
|
+
const successfulResults = results.filter(r => r.success);
|
|
148
|
+
const requiredResults = successfulResults.filter(r => r.source.requiredForDeployment);
|
|
149
|
+
// Calculate overall confidence
|
|
150
|
+
const overallConfidence = successfulResults.length > 0
|
|
151
|
+
? successfulResults.reduce((sum, r) => sum + r.confidence, 0) / successfulResults.length
|
|
152
|
+
: 0;
|
|
153
|
+
// Generate summary
|
|
154
|
+
const summary = this.generateSummary(platformType, pattern, successfulResults);
|
|
155
|
+
// Generate recommendations
|
|
156
|
+
const recommendations = this.generateRecommendations(platformType, pattern, results);
|
|
157
|
+
return {
|
|
158
|
+
platformType,
|
|
159
|
+
patternVersion: pattern.version,
|
|
160
|
+
requiredSourcesQueried: requiredResults.length,
|
|
161
|
+
totalSourcesQueried: successfulResults.length,
|
|
162
|
+
overallConfidence,
|
|
163
|
+
results,
|
|
164
|
+
summary,
|
|
165
|
+
recommendations,
|
|
166
|
+
updatedAt: new Date().toISOString(),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Generate a summary of research findings
|
|
171
|
+
*/
|
|
172
|
+
generateSummary(platformType, pattern, results) {
|
|
173
|
+
if (results.length === 0) {
|
|
174
|
+
return `No research results available for ${platformType}. Using static pattern definition from ${pattern.metadata.lastUpdated}.`;
|
|
175
|
+
}
|
|
176
|
+
const sourceTypes = new Set(results.map(r => r.source.type));
|
|
177
|
+
const prioritySources = results.filter(r => r.source.priority >= 9);
|
|
178
|
+
return `
|
|
179
|
+
Researched ${platformType} deployment pattern using ${results.length} authoritative sources (${Array.from(sourceTypes).join(', ')}).
|
|
180
|
+
|
|
181
|
+
**Key Findings**:
|
|
182
|
+
- ${prioritySources.length} high-priority sources confirmed pattern validity
|
|
183
|
+
- Pattern last updated: ${pattern.metadata.lastUpdated}
|
|
184
|
+
- Research conducted: ${new Date().toISOString()}
|
|
185
|
+
- Overall confidence: ${((results.reduce((sum, r) => sum + r.confidence, 0) / results.length) * 100).toFixed(0)}%
|
|
186
|
+
|
|
187
|
+
**Sources Consulted**:
|
|
188
|
+
${results.map((r, i) => `${i + 1}. ${r.source.url} (${r.source.type}, priority: ${r.source.priority})`).join('\n')}
|
|
189
|
+
|
|
190
|
+
**Recommended Action**: Review the query instructions for each source above and use WebFetch to retrieve the latest information before deployment. Pay special attention to required sources (${results.filter(r => r.source.requiredForDeployment).length} total).
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Generate recommendations based on research
|
|
195
|
+
*/
|
|
196
|
+
generateRecommendations(platformType, pattern, results) {
|
|
197
|
+
const recommendations = [];
|
|
198
|
+
// Check if all required sources were queried successfully
|
|
199
|
+
const requiredSources = pattern.authoritativeSources.filter(s => s.requiredForDeployment);
|
|
200
|
+
const successfulRequired = results.filter(r => r.success && r.source.requiredForDeployment);
|
|
201
|
+
if (successfulRequired.length < requiredSources.length) {
|
|
202
|
+
recommendations.push(`⚠️ WARNING: Only ${successfulRequired.length}/${requiredSources.length} required sources were queried successfully. Deployment may not follow latest best practices.`);
|
|
203
|
+
}
|
|
204
|
+
// Recommend querying specific sources based on priority
|
|
205
|
+
const highPrioritySources = pattern.authoritativeSources
|
|
206
|
+
.filter(s => s.priority >= 9)
|
|
207
|
+
.slice(0, 3);
|
|
208
|
+
if (highPrioritySources.length > 0) {
|
|
209
|
+
recommendations.push(`🔍 CRITICAL: Before deployment, use WebFetch to query these high-priority sources:\n${highPrioritySources.map((s, i) => ` ${i + 1}. ${s.url} - ${s.purpose}`).join('\n')}`);
|
|
210
|
+
}
|
|
211
|
+
// Pattern age check
|
|
212
|
+
const patternAge = Date.now() - new Date(pattern.metadata.lastUpdated).getTime();
|
|
213
|
+
const daysOld = Math.floor(patternAge / (1000 * 60 * 60 * 24));
|
|
214
|
+
if (daysOld > 30) {
|
|
215
|
+
recommendations.push(`⏰ Pattern definition is ${daysOld} days old. Strongly recommend querying authoritative sources for updates.`);
|
|
216
|
+
}
|
|
217
|
+
// Specific platform recommendations
|
|
218
|
+
switch (platformType) {
|
|
219
|
+
case 'openshift':
|
|
220
|
+
recommendations.push('📘 For OpenShift: Review https://play.validatedpatterns.io/ for latest pattern framework updates');
|
|
221
|
+
recommendations.push('📘 Check https://github.com/validatedpatterns/common for updated Helm charts and ArgoCD configs');
|
|
222
|
+
break;
|
|
223
|
+
case 'kubernetes':
|
|
224
|
+
recommendations.push('📘 For Kubernetes: Check https://kubernetes.io/docs/ for latest API versions and deprecations');
|
|
225
|
+
break;
|
|
226
|
+
case 'mcp':
|
|
227
|
+
recommendations.push('📘 For MCP: Review https://modelcontextprotocol.io/ for protocol spec updates');
|
|
228
|
+
break;
|
|
229
|
+
case 'a2a':
|
|
230
|
+
recommendations.push('📘 For A2A: Check https://a2aprotocol.ai/ for latest protocol changes (project is actively evolving)');
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
return recommendations;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Generate a research report for the LLM
|
|
237
|
+
*
|
|
238
|
+
* This creates a formatted report that the LLM can read to understand
|
|
239
|
+
* what research needs to be done before applying a pattern.
|
|
240
|
+
*/
|
|
241
|
+
generateResearchReport(platformType) {
|
|
242
|
+
const pattern = getPattern(platformType);
|
|
243
|
+
if (!pattern) {
|
|
244
|
+
return `No pattern found for ${platformType}`;
|
|
245
|
+
}
|
|
246
|
+
const requiredSources = pattern.authoritativeSources.filter(s => s.requiredForDeployment);
|
|
247
|
+
const optionalSources = pattern.authoritativeSources.filter(s => !s.requiredForDeployment);
|
|
248
|
+
return `
|
|
249
|
+
# ${platformType.toUpperCase()} Pattern Research Report
|
|
250
|
+
|
|
251
|
+
## Pattern Information
|
|
252
|
+
- **Pattern ID**: ${pattern.id}
|
|
253
|
+
- **Version**: ${pattern.version}
|
|
254
|
+
- **Last Updated**: ${pattern.metadata.lastUpdated}
|
|
255
|
+
- **Maintainer**: ${pattern.metadata.maintainer}
|
|
256
|
+
|
|
257
|
+
## ⭐ BASE CODE REPOSITORY (CRITICAL - MERGE FIRST)
|
|
258
|
+
|
|
259
|
+
**Repository**: ${pattern.baseCodeRepository.url}
|
|
260
|
+
**Purpose**: ${pattern.baseCodeRepository.purpose}
|
|
261
|
+
|
|
262
|
+
### Integration Steps:
|
|
263
|
+
${pattern.baseCodeRepository.integrationInstructions}
|
|
264
|
+
|
|
265
|
+
### Required Files to Integrate:
|
|
266
|
+
${pattern.baseCodeRepository.requiredFiles.map((file, i) => `${i + 1}. \`${file}\``).join('\n')}
|
|
267
|
+
|
|
268
|
+
${pattern.baseCodeRepository.scriptEntrypoint
|
|
269
|
+
? `### Script Entrypoint:
|
|
270
|
+
Your \`bootstrap.sh\` should call: \`${pattern.baseCodeRepository.scriptEntrypoint}\`
|
|
271
|
+
`
|
|
272
|
+
: ''}
|
|
273
|
+
|
|
274
|
+
**⚠️ DEPLOYMENT STRATEGY**: Do NOT generate scripts from scratch. Instead:
|
|
275
|
+
1. **Clone/merge** the base repository into your project
|
|
276
|
+
2. **Customize** configuration files for your specific use case
|
|
277
|
+
3. **Call** the validated pattern's scripts from your bootstrap.sh
|
|
278
|
+
4. This ensures you follow tested, production-ready patterns
|
|
279
|
+
|
|
280
|
+
## Research Requirements
|
|
281
|
+
|
|
282
|
+
### REQUIRED Sources (Must Query Before Deployment)
|
|
283
|
+
${requiredSources.length === 0 ? 'None' : ''}
|
|
284
|
+
${requiredSources
|
|
285
|
+
.map((s, i) => `
|
|
286
|
+
#### ${i + 1}. ${s.url}
|
|
287
|
+
- **Type**: ${s.type}
|
|
288
|
+
- **Priority**: ${s.priority}/10
|
|
289
|
+
- **Purpose**: ${s.purpose}
|
|
290
|
+
- **Query Instructions**: ${s.queryInstructions}
|
|
291
|
+
`)
|
|
292
|
+
.join('\n')}
|
|
293
|
+
|
|
294
|
+
### OPTIONAL Sources (Recommended for Production)
|
|
295
|
+
${optionalSources.length === 0 ? 'None' : ''}
|
|
296
|
+
${optionalSources
|
|
297
|
+
.map((s, i) => `
|
|
298
|
+
#### ${i + 1}. ${s.url}
|
|
299
|
+
- **Type**: ${s.type}
|
|
300
|
+
- **Priority**: ${s.priority}/10
|
|
301
|
+
- **Purpose**: ${s.purpose}
|
|
302
|
+
- **Query Instructions**: ${s.queryInstructions}
|
|
303
|
+
`)
|
|
304
|
+
.join('\n')}
|
|
305
|
+
|
|
306
|
+
## How to Use This Report
|
|
307
|
+
|
|
308
|
+
1. **Read Each Source's Query Instructions**: Understand what to look for
|
|
309
|
+
2. **Use WebFetch**: Query each required source using WebFetch tool
|
|
310
|
+
3. **Extract Key Information**: Focus on deployment steps, configurations, validation
|
|
311
|
+
4. **Compare with Static Pattern**: Note any differences from the pattern dated ${pattern.metadata.lastUpdated}
|
|
312
|
+
5. **Update Deployment Plan**: Incorporate latest best practices into your deployment
|
|
313
|
+
|
|
314
|
+
## Example WebFetch Usage
|
|
315
|
+
|
|
316
|
+
For the first required source, you would call:
|
|
317
|
+
|
|
318
|
+
\`\`\`
|
|
319
|
+
WebFetch({
|
|
320
|
+
url: "${requiredSources[0]?.url || 'source-url'}",
|
|
321
|
+
prompt: "${requiredSources[0]?.queryInstructions.substring(0, 200) || 'Extract deployment information'}..."
|
|
322
|
+
})
|
|
323
|
+
\`\`\`
|
|
324
|
+
|
|
325
|
+
## Critical Notes
|
|
326
|
+
|
|
327
|
+
⚠️ **DO NOT SKIP REQUIRED SOURCES** - These contain critical information that may differ from the static pattern definition.
|
|
328
|
+
|
|
329
|
+
⚠️ **SECURITY UPDATES** - Always check for recent security advisories and best practices.
|
|
330
|
+
|
|
331
|
+
⚠️ **BREAKING CHANGES** - Look for any breaking changes or deprecations since ${pattern.metadata.lastUpdated}.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
*This research report was generated by the Pattern Research Utility. It provides instructions for LLMs to query authoritative sources and ensure deployments follow the latest best practices.*
|
|
336
|
+
`;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Clear research cache
|
|
340
|
+
*/
|
|
341
|
+
clearCache() {
|
|
342
|
+
this.researchCache.clear();
|
|
343
|
+
this.logger.info('Research cache cleared', 'PatternResearchUtility');
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Helper function to research a pattern
|
|
348
|
+
*/
|
|
349
|
+
export async function researchPattern(platformType, queryRequired = false) {
|
|
350
|
+
const utility = new PatternResearchUtility();
|
|
351
|
+
return await utility.researchPattern(platformType, queryRequired);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Helper function to generate a research report
|
|
355
|
+
*/
|
|
356
|
+
export function generatePatternResearchReport(platformType) {
|
|
357
|
+
const utility = new PatternResearchUtility();
|
|
358
|
+
return utility.generateResearchReport(platformType);
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=pattern-research-utility.js.map
|