mcp-adr-analysis-server 2.1.9 → 2.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/README.md +55 -8
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/src/index.d.ts +78 -2
  4. package/dist/src/index.d.ts.map +1 -1
  5. package/dist/src/index.js +1793 -577
  6. package/dist/src/index.js.map +1 -1
  7. package/dist/src/prompts/index.d.ts.map +1 -1
  8. package/dist/src/prompts/index.js +23 -6
  9. package/dist/src/prompts/index.js.map +1 -1
  10. package/dist/src/prompts/validated-pattern-prompts.d.ts +33 -0
  11. package/dist/src/prompts/validated-pattern-prompts.d.ts.map +1 -0
  12. package/dist/src/prompts/validated-pattern-prompts.js +337 -0
  13. package/dist/src/prompts/validated-pattern-prompts.js.map +1 -0
  14. package/dist/src/resources/adr-by-id-resource.d.ts +116 -0
  15. package/dist/src/resources/adr-by-id-resource.d.ts.map +1 -0
  16. package/dist/src/resources/adr-by-id-resource.js +213 -0
  17. package/dist/src/resources/adr-by-id-resource.js.map +1 -0
  18. package/dist/src/resources/code-quality-resource.d.ts +105 -0
  19. package/dist/src/resources/code-quality-resource.d.ts.map +1 -0
  20. package/dist/src/resources/code-quality-resource.js +282 -0
  21. package/dist/src/resources/code-quality-resource.js.map +1 -0
  22. package/dist/src/resources/deployment-history-resource.d.ts +214 -0
  23. package/dist/src/resources/deployment-history-resource.d.ts.map +1 -0
  24. package/dist/src/resources/deployment-history-resource.js +308 -0
  25. package/dist/src/resources/deployment-history-resource.js.map +1 -0
  26. package/dist/src/resources/deployment-status-resource.d.ts +256 -0
  27. package/dist/src/resources/deployment-status-resource.d.ts.map +1 -0
  28. package/dist/src/resources/deployment-status-resource.js +665 -0
  29. package/dist/src/resources/deployment-status-resource.js.map +1 -0
  30. package/dist/src/resources/environment-analysis-resource.d.ts +237 -0
  31. package/dist/src/resources/environment-analysis-resource.d.ts.map +1 -0
  32. package/dist/src/resources/environment-analysis-resource.js +646 -0
  33. package/dist/src/resources/environment-analysis-resource.js.map +1 -0
  34. package/dist/src/resources/index.d.ts +6 -2
  35. package/dist/src/resources/index.d.ts.map +1 -1
  36. package/dist/src/resources/index.js +247 -492
  37. package/dist/src/resources/index.js.map +1 -1
  38. package/dist/src/resources/memory-snapshots-resource.d.ts +180 -0
  39. package/dist/src/resources/memory-snapshots-resource.d.ts.map +1 -0
  40. package/dist/src/resources/memory-snapshots-resource.js +847 -0
  41. package/dist/src/resources/memory-snapshots-resource.js.map +1 -0
  42. package/dist/src/resources/pattern-base-code-by-platform-resource.d.ts +35 -0
  43. package/dist/src/resources/pattern-base-code-by-platform-resource.d.ts.map +1 -0
  44. package/dist/src/resources/pattern-base-code-by-platform-resource.js +72 -0
  45. package/dist/src/resources/pattern-base-code-by-platform-resource.js.map +1 -0
  46. package/dist/src/resources/pattern-by-name-resource.d.ts +53 -0
  47. package/dist/src/resources/pattern-by-name-resource.d.ts.map +1 -0
  48. package/dist/src/resources/pattern-by-name-resource.js +200 -0
  49. package/dist/src/resources/pattern-by-name-resource.js.map +1 -0
  50. package/dist/src/resources/pattern-sources-by-platform-resource.d.ts +26 -0
  51. package/dist/src/resources/pattern-sources-by-platform-resource.d.ts.map +1 -0
  52. package/dist/src/resources/pattern-sources-by-platform-resource.js +59 -0
  53. package/dist/src/resources/pattern-sources-by-platform-resource.js.map +1 -0
  54. package/dist/src/resources/project-metrics-resource.d.ts +180 -0
  55. package/dist/src/resources/project-metrics-resource.d.ts.map +1 -0
  56. package/dist/src/resources/project-metrics-resource.js +487 -0
  57. package/dist/src/resources/project-metrics-resource.js.map +1 -0
  58. package/dist/src/resources/project-status-resource.d.ts +75 -0
  59. package/dist/src/resources/project-status-resource.d.ts.map +1 -0
  60. package/dist/src/resources/project-status-resource.js +189 -0
  61. package/dist/src/resources/project-status-resource.js.map +1 -0
  62. package/dist/src/resources/research-by-topic-resource.d.ts +21 -0
  63. package/dist/src/resources/research-by-topic-resource.d.ts.map +1 -0
  64. package/dist/src/resources/research-by-topic-resource.js +125 -0
  65. package/dist/src/resources/research-by-topic-resource.js.map +1 -0
  66. package/dist/src/resources/research-index-resource.d.ts +100 -0
  67. package/dist/src/resources/research-index-resource.d.ts.map +1 -0
  68. package/dist/src/resources/research-index-resource.js +200 -0
  69. package/dist/src/resources/research-index-resource.js.map +1 -0
  70. package/dist/src/resources/resource-cache.d.ts +144 -0
  71. package/dist/src/resources/resource-cache.d.ts.map +1 -0
  72. package/dist/src/resources/resource-cache.js +316 -0
  73. package/dist/src/resources/resource-cache.js.map +1 -0
  74. package/dist/src/resources/resource-router.d.ts +45 -0
  75. package/dist/src/resources/resource-router.d.ts.map +1 -0
  76. package/dist/src/resources/resource-router.js +96 -0
  77. package/dist/src/resources/resource-router.js.map +1 -0
  78. package/dist/src/resources/rule-by-id-resource.d.ts +38 -0
  79. package/dist/src/resources/rule-by-id-resource.d.ts.map +1 -0
  80. package/dist/src/resources/rule-by-id-resource.js +104 -0
  81. package/dist/src/resources/rule-by-id-resource.js.map +1 -0
  82. package/dist/src/resources/rule-catalog-resource.d.ts +126 -0
  83. package/dist/src/resources/rule-catalog-resource.d.ts.map +1 -0
  84. package/dist/src/resources/rule-catalog-resource.js +224 -0
  85. package/dist/src/resources/rule-catalog-resource.js.map +1 -0
  86. package/dist/src/resources/rule-generation-resource.d.ts +80 -0
  87. package/dist/src/resources/rule-generation-resource.d.ts.map +1 -0
  88. package/dist/src/resources/rule-generation-resource.js +282 -0
  89. package/dist/src/resources/rule-generation-resource.js.map +1 -0
  90. package/dist/src/resources/technology-by-name-resource.d.ts +43 -0
  91. package/dist/src/resources/technology-by-name-resource.d.ts.map +1 -0
  92. package/dist/src/resources/technology-by-name-resource.js +176 -0
  93. package/dist/src/resources/technology-by-name-resource.js.map +1 -0
  94. package/dist/src/resources/todo-by-id-resource.d.ts +46 -0
  95. package/dist/src/resources/todo-by-id-resource.d.ts.map +1 -0
  96. package/dist/src/resources/todo-by-id-resource.js +192 -0
  97. package/dist/src/resources/todo-by-id-resource.js.map +1 -0
  98. package/dist/src/resources/todo-list-resource.d.ts +96 -0
  99. package/dist/src/resources/todo-list-resource.d.ts.map +1 -0
  100. package/dist/src/resources/todo-list-resource.js +209 -0
  101. package/dist/src/resources/todo-list-resource.js.map +1 -0
  102. package/dist/src/resources/validated-pattern-by-platform-resource.d.ts +14 -0
  103. package/dist/src/resources/validated-pattern-by-platform-resource.d.ts.map +1 -0
  104. package/dist/src/resources/validated-pattern-by-platform-resource.js +45 -0
  105. package/dist/src/resources/validated-pattern-by-platform-resource.js.map +1 -0
  106. package/dist/src/resources/validated-patterns-catalog-resource.d.ts +36 -0
  107. package/dist/src/resources/validated-patterns-catalog-resource.d.ts.map +1 -0
  108. package/dist/src/resources/validated-patterns-catalog-resource.js +57 -0
  109. package/dist/src/resources/validated-patterns-catalog-resource.js.map +1 -0
  110. package/dist/src/templates/domain-knowledge-templates.d.ts.map +1 -1
  111. package/dist/src/templates/domain-knowledge-templates.js +49 -49
  112. package/dist/src/templates/domain-knowledge-templates.js.map +1 -1
  113. package/dist/src/tools/adr-bootstrap-validation-tool.d.ts.map +1 -1
  114. package/dist/src/tools/adr-bootstrap-validation-tool.js +214 -4
  115. package/dist/src/tools/adr-bootstrap-validation-tool.js.map +1 -1
  116. package/dist/src/tools/adr-suggestion-tool.d.ts +2 -2
  117. package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
  118. package/dist/src/tools/adr-suggestion-tool.js +129 -12
  119. package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
  120. package/dist/src/tools/adr-validation-tool.d.ts +98 -0
  121. package/dist/src/tools/adr-validation-tool.d.ts.map +1 -0
  122. package/dist/src/tools/adr-validation-tool.js +372 -0
  123. package/dist/src/tools/adr-validation-tool.js.map +1 -0
  124. package/dist/src/tools/bootstrap-validation-loop-tool.d.ts +262 -0
  125. package/dist/src/tools/bootstrap-validation-loop-tool.d.ts.map +1 -0
  126. package/dist/src/tools/bootstrap-validation-loop-tool.js +1934 -0
  127. package/dist/src/tools/bootstrap-validation-loop-tool.js.map +1 -0
  128. package/dist/src/tools/conversation-memory-tool.d.ts +48 -0
  129. package/dist/src/tools/conversation-memory-tool.d.ts.map +1 -0
  130. package/dist/src/tools/conversation-memory-tool.js +254 -0
  131. package/dist/src/tools/conversation-memory-tool.js.map +1 -0
  132. package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -1
  133. package/dist/src/tools/deployment-analysis-tool.js +82 -6
  134. package/dist/src/tools/deployment-analysis-tool.js.map +1 -1
  135. package/dist/src/tools/deployment-guidance-tool.d.ts.map +1 -1
  136. package/dist/src/tools/deployment-guidance-tool.js +126 -25
  137. package/dist/src/tools/deployment-guidance-tool.js.map +1 -1
  138. package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
  139. package/dist/src/tools/deployment-readiness-tool.js +166 -5
  140. package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
  141. package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
  142. package/dist/src/tools/environment-analysis-tool.js +36 -1
  143. package/dist/src/tools/environment-analysis-tool.js.map +1 -1
  144. package/dist/src/tools/expand-analysis-tool.d.ts +23 -0
  145. package/dist/src/tools/expand-analysis-tool.d.ts.map +1 -0
  146. package/dist/src/tools/expand-analysis-tool.js +107 -0
  147. package/dist/src/tools/expand-analysis-tool.js.map +1 -0
  148. package/dist/src/tools/get-server-context-tool.d.ts +67 -0
  149. package/dist/src/tools/get-server-context-tool.d.ts.map +1 -0
  150. package/dist/src/tools/get-server-context-tool.js +75 -0
  151. package/dist/src/tools/get-server-context-tool.js.map +1 -0
  152. package/dist/src/tools/interactive-adr-planning-tool.d.ts.map +1 -1
  153. package/dist/src/tools/interactive-adr-planning-tool.js +82 -9
  154. package/dist/src/tools/interactive-adr-planning-tool.js.map +1 -1
  155. package/dist/src/tools/llm-cloud-management-tool.d.ts +62 -0
  156. package/dist/src/tools/llm-cloud-management-tool.d.ts.map +1 -0
  157. package/dist/src/tools/llm-cloud-management-tool.js +202 -0
  158. package/dist/src/tools/llm-cloud-management-tool.js.map +1 -0
  159. package/dist/src/tools/llm-database-management-tool.d.ts +62 -0
  160. package/dist/src/tools/llm-database-management-tool.d.ts.map +1 -0
  161. package/dist/src/tools/llm-database-management-tool.js +203 -0
  162. package/dist/src/tools/llm-database-management-tool.js.map +1 -0
  163. package/dist/src/tools/llm-web-search-tool.d.ts +59 -0
  164. package/dist/src/tools/llm-web-search-tool.d.ts.map +1 -0
  165. package/dist/src/tools/llm-web-search-tool.js +165 -0
  166. package/dist/src/tools/llm-web-search-tool.js.map +1 -0
  167. package/dist/src/tools/mcp-planning-tool.d.ts.map +1 -1
  168. package/dist/src/tools/mcp-planning-tool.js +10 -3
  169. package/dist/src/tools/mcp-planning-tool.js.map +1 -1
  170. package/dist/src/tools/memory-loading-tool.d.ts.map +1 -1
  171. package/dist/src/tools/memory-loading-tool.js +4 -2
  172. package/dist/src/tools/memory-loading-tool.js.map +1 -1
  173. package/dist/src/tools/perform-research-tool.d.ts +61 -0
  174. package/dist/src/tools/perform-research-tool.d.ts.map +1 -0
  175. package/dist/src/tools/perform-research-tool.js +324 -0
  176. package/dist/src/tools/perform-research-tool.js.map +1 -0
  177. package/dist/src/tools/research-question-tool.d.ts.map +1 -1
  178. package/dist/src/tools/research-question-tool.js +11 -9
  179. package/dist/src/tools/research-question-tool.js.map +1 -1
  180. package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -1
  181. package/dist/src/tools/review-existing-adrs-tool.js +42 -3
  182. package/dist/src/tools/review-existing-adrs-tool.js.map +1 -1
  183. package/dist/src/tools/tool-chain-orchestrator.d.ts +15 -94
  184. package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -1
  185. package/dist/src/tools/tool-chain-orchestrator.js +2 -2
  186. package/dist/src/tools/tool-chain-orchestrator.js.map +1 -1
  187. package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +25 -120
  188. package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
  189. package/dist/src/tools/troubleshoot-guided-workflow-tool.js +91 -2
  190. package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
  191. package/dist/src/types/ape-framework.d.ts +50 -283
  192. package/dist/src/types/ape-framework.d.ts.map +1 -1
  193. package/dist/src/types/conversation-context.d.ts.map +1 -1
  194. package/dist/src/types/conversation-context.js +12 -12
  195. package/dist/src/types/conversation-context.js.map +1 -1
  196. package/dist/src/types/conversation-memory.d.ts +184 -0
  197. package/dist/src/types/conversation-memory.d.ts.map +1 -0
  198. package/dist/src/types/conversation-memory.js +8 -0
  199. package/dist/src/types/conversation-memory.js.map +1 -0
  200. package/dist/src/types/index.d.ts +112 -339
  201. package/dist/src/types/index.d.ts.map +1 -1
  202. package/dist/src/types/knowledge-generation.d.ts +96 -401
  203. package/dist/src/types/knowledge-generation.d.ts.map +1 -1
  204. package/dist/src/types/knowledge-graph-schemas.d.ts +77 -715
  205. package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -1
  206. package/dist/src/types/knowledge-graph-schemas.js +8 -8
  207. package/dist/src/types/knowledge-graph-schemas.js.map +1 -1
  208. package/dist/src/types/memory-entities.d.ts +1230 -6164
  209. package/dist/src/types/memory-entities.d.ts.map +1 -1
  210. package/dist/src/types/memory-entities.js +8 -8
  211. package/dist/src/types/memory-entities.js.map +1 -1
  212. package/dist/src/types/reflexion-framework.d.ts +35 -264
  213. package/dist/src/types/reflexion-framework.d.ts.map +1 -1
  214. package/dist/src/types/reflexion-framework.js +1 -1
  215. package/dist/src/types/reflexion-framework.js.map +1 -1
  216. package/dist/src/types/state-reinforcement.d.ts +87 -0
  217. package/dist/src/types/state-reinforcement.d.ts.map +1 -0
  218. package/dist/src/types/state-reinforcement.js +5 -0
  219. package/dist/src/types/state-reinforcement.js.map +1 -0
  220. package/dist/src/types/tiered-response.d.ts +61 -0
  221. package/dist/src/types/tiered-response.d.ts.map +1 -0
  222. package/dist/src/types/tiered-response.js +8 -0
  223. package/dist/src/types/tiered-response.js.map +1 -0
  224. package/dist/src/types/tool-context.d.ts +50 -0
  225. package/dist/src/types/tool-context.d.ts.map +1 -0
  226. package/dist/src/types/tool-context.js +20 -0
  227. package/dist/src/types/tool-context.js.map +1 -0
  228. package/dist/src/utils/adr-action-analyzer.d.ts +23 -0
  229. package/dist/src/utils/adr-action-analyzer.d.ts.map +1 -0
  230. package/dist/src/utils/adr-action-analyzer.js +323 -0
  231. package/dist/src/utils/adr-action-analyzer.js.map +1 -0
  232. package/dist/src/utils/adr-context-detector.d.ts +33 -0
  233. package/dist/src/utils/adr-context-detector.d.ts.map +1 -0
  234. package/dist/src/utils/adr-context-detector.js +279 -0
  235. package/dist/src/utils/adr-context-detector.js.map +1 -0
  236. package/dist/src/utils/adr-discovery.d.ts +28 -2
  237. package/dist/src/utils/adr-discovery.d.ts.map +1 -1
  238. package/dist/src/utils/adr-discovery.js +91 -7
  239. package/dist/src/utils/adr-discovery.js.map +1 -1
  240. package/dist/src/utils/adr-knowledge-initializer.d.ts +54 -0
  241. package/dist/src/utils/adr-knowledge-initializer.d.ts.map +1 -0
  242. package/dist/src/utils/adr-knowledge-initializer.js +240 -0
  243. package/dist/src/utils/adr-knowledge-initializer.js.map +1 -0
  244. package/dist/src/utils/adr-timeline-extractor.d.ts +21 -0
  245. package/dist/src/utils/adr-timeline-extractor.d.ts.map +1 -0
  246. package/dist/src/utils/adr-timeline-extractor.js +294 -0
  247. package/dist/src/utils/adr-timeline-extractor.js.map +1 -0
  248. package/dist/src/utils/adr-timeline-types.d.ts +234 -0
  249. package/dist/src/utils/adr-timeline-types.d.ts.map +1 -0
  250. package/dist/src/utils/adr-timeline-types.js +7 -0
  251. package/dist/src/utils/adr-timeline-types.js.map +1 -0
  252. package/dist/src/utils/ai-executor.d.ts +36 -0
  253. package/dist/src/utils/ai-executor.d.ts.map +1 -1
  254. package/dist/src/utils/ai-executor.js +39 -3
  255. package/dist/src/utils/ai-executor.js.map +1 -1
  256. package/dist/src/utils/apply-cot-enhancement.d.ts.map +1 -1
  257. package/dist/src/utils/apply-cot-enhancement.js +15 -15
  258. package/dist/src/utils/apply-cot-enhancement.js.map +1 -1
  259. package/dist/src/utils/automatic-prompt-engineering.d.ts.map +1 -1
  260. package/dist/src/utils/automatic-prompt-engineering.js +68 -58
  261. package/dist/src/utils/automatic-prompt-engineering.js.map +1 -1
  262. package/dist/src/utils/conditional-request.d.ts +105 -0
  263. package/dist/src/utils/conditional-request.d.ts.map +1 -0
  264. package/dist/src/utils/conditional-request.js +186 -0
  265. package/dist/src/utils/conditional-request.js.map +1 -0
  266. package/dist/src/utils/config.d.ts +72 -18
  267. package/dist/src/utils/config.d.ts.map +1 -1
  268. package/dist/src/utils/config.js +75 -0
  269. package/dist/src/utils/config.js.map +1 -1
  270. package/dist/src/utils/context-document-manager.d.ts +112 -0
  271. package/dist/src/utils/context-document-manager.d.ts.map +1 -0
  272. package/dist/src/utils/context-document-manager.js +351 -0
  273. package/dist/src/utils/context-document-manager.js.map +1 -0
  274. package/dist/src/utils/conversation-memory-manager.d.ts +86 -0
  275. package/dist/src/utils/conversation-memory-manager.d.ts.map +1 -0
  276. package/dist/src/utils/conversation-memory-manager.js +443 -0
  277. package/dist/src/utils/conversation-memory-manager.js.map +1 -0
  278. package/dist/src/utils/dag-executor.d.ts +106 -0
  279. package/dist/src/utils/dag-executor.d.ts.map +1 -0
  280. package/dist/src/utils/dag-executor.js +420 -0
  281. package/dist/src/utils/dag-executor.js.map +1 -0
  282. package/dist/src/utils/deployment-analysis.d.ts.map +1 -1
  283. package/dist/src/utils/deployment-analysis.js +17 -9
  284. package/dist/src/utils/deployment-analysis.js.map +1 -1
  285. package/dist/src/utils/deployment-type-registry.d.ts +52 -0
  286. package/dist/src/utils/deployment-type-registry.d.ts.map +1 -0
  287. package/dist/src/utils/deployment-type-registry.js +543 -0
  288. package/dist/src/utils/deployment-type-registry.js.map +1 -0
  289. package/dist/src/utils/dynamic-deployment-intelligence.d.ts +117 -0
  290. package/dist/src/utils/dynamic-deployment-intelligence.d.ts.map +1 -0
  291. package/dist/src/utils/dynamic-deployment-intelligence.js +445 -0
  292. package/dist/src/utils/dynamic-deployment-intelligence.js.map +1 -0
  293. package/dist/src/utils/environment-analysis.d.ts.map +1 -1
  294. package/dist/src/utils/environment-analysis.js +63 -44
  295. package/dist/src/utils/environment-analysis.js.map +1 -1
  296. package/dist/src/utils/environment-capability-registry.d.ts +101 -0
  297. package/dist/src/utils/environment-capability-registry.d.ts.map +1 -0
  298. package/dist/src/utils/environment-capability-registry.js +489 -0
  299. package/dist/src/utils/environment-capability-registry.js.map +1 -0
  300. package/dist/src/utils/index.d.ts +3 -3
  301. package/dist/src/utils/index.d.ts.map +1 -1
  302. package/dist/src/utils/index.js +3 -3
  303. package/dist/src/utils/index.js.map +1 -1
  304. package/dist/src/utils/knowledge-generation.d.ts.map +1 -1
  305. package/dist/src/utils/knowledge-generation.js +61 -35
  306. package/dist/src/utils/knowledge-generation.js.map +1 -1
  307. package/dist/src/utils/knowledge-graph-manager.d.ts +19 -0
  308. package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
  309. package/dist/src/utils/knowledge-graph-manager.js +165 -1
  310. package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
  311. package/dist/src/utils/llm-artifact-detector.d.ts.map +1 -1
  312. package/dist/src/utils/llm-artifact-detector.js +28 -24
  313. package/dist/src/utils/llm-artifact-detector.js.map +1 -1
  314. package/dist/src/utils/mermaid-diagrams.d.ts +101 -0
  315. package/dist/src/utils/mermaid-diagrams.d.ts.map +1 -0
  316. package/dist/src/utils/mermaid-diagrams.js +445 -0
  317. package/dist/src/utils/mermaid-diagrams.js.map +1 -0
  318. package/dist/src/utils/monitoring.d.ts +249 -0
  319. package/dist/src/utils/monitoring.d.ts.map +1 -0
  320. package/dist/src/utils/monitoring.js +513 -0
  321. package/dist/src/utils/monitoring.js.map +1 -0
  322. package/dist/src/utils/pattern-contribution-helper.d.ts +60 -0
  323. package/dist/src/utils/pattern-contribution-helper.d.ts.map +1 -0
  324. package/dist/src/utils/pattern-contribution-helper.js +308 -0
  325. package/dist/src/utils/pattern-contribution-helper.js.map +1 -0
  326. package/dist/src/utils/pattern-loader.d.ts +183 -0
  327. package/dist/src/utils/pattern-loader.d.ts.map +1 -0
  328. package/dist/src/utils/pattern-loader.js +200 -0
  329. package/dist/src/utils/pattern-loader.js.map +1 -0
  330. package/dist/src/utils/pattern-research-utility.d.ts +107 -0
  331. package/dist/src/utils/pattern-research-utility.d.ts.map +1 -0
  332. package/dist/src/utils/pattern-research-utility.js +360 -0
  333. package/dist/src/utils/pattern-research-utility.js.map +1 -0
  334. package/dist/src/utils/pattern-to-dag-converter.d.ts +62 -0
  335. package/dist/src/utils/pattern-to-dag-converter.d.ts.map +1 -0
  336. package/dist/src/utils/pattern-to-dag-converter.js +265 -0
  337. package/dist/src/utils/pattern-to-dag-converter.js.map +1 -0
  338. package/dist/src/utils/platform-detector.d.ts +86 -0
  339. package/dist/src/utils/platform-detector.d.ts.map +1 -0
  340. package/dist/src/utils/platform-detector.js +509 -0
  341. package/dist/src/utils/platform-detector.js.map +1 -0
  342. package/dist/src/utils/prompt-composition.d.ts.map +1 -1
  343. package/dist/src/utils/prompt-composition.js +1 -4
  344. package/dist/src/utils/prompt-composition.js.map +1 -1
  345. package/dist/src/utils/reflexion.d.ts.map +1 -1
  346. package/dist/src/utils/reflexion.js +51 -42
  347. package/dist/src/utils/reflexion.js.map +1 -1
  348. package/dist/src/utils/research-integration.d.ts.map +1 -1
  349. package/dist/src/utils/research-integration.js +8 -2
  350. package/dist/src/utils/research-integration.js.map +1 -1
  351. package/dist/src/utils/research-orchestrator.d.ts +209 -0
  352. package/dist/src/utils/research-orchestrator.d.ts.map +1 -0
  353. package/dist/src/utils/research-orchestrator.js +863 -0
  354. package/dist/src/utils/research-orchestrator.js.map +1 -0
  355. package/dist/src/utils/research-questions.d.ts.map +1 -1
  356. package/dist/src/utils/research-questions.js +4 -1
  357. package/dist/src/utils/research-questions.js.map +1 -1
  358. package/dist/src/utils/resource-extractor.d.ts +57 -0
  359. package/dist/src/utils/resource-extractor.d.ts.map +1 -0
  360. package/dist/src/utils/resource-extractor.js +323 -0
  361. package/dist/src/utils/resource-extractor.js.map +1 -0
  362. package/dist/src/utils/resource-versioning.d.ts +124 -0
  363. package/dist/src/utils/resource-versioning.d.ts.map +1 -0
  364. package/dist/src/utils/resource-versioning.js +272 -0
  365. package/dist/src/utils/resource-versioning.js.map +1 -0
  366. package/dist/src/utils/root-manager.d.ts +118 -0
  367. package/dist/src/utils/root-manager.d.ts.map +1 -0
  368. package/dist/src/utils/root-manager.js +154 -0
  369. package/dist/src/utils/root-manager.js.map +1 -0
  370. package/dist/src/utils/rule-generation.d.ts.map +1 -1
  371. package/dist/src/utils/rule-generation.js +4 -1
  372. package/dist/src/utils/rule-generation.js.map +1 -1
  373. package/dist/src/utils/server-context-generator.d.ts +47 -0
  374. package/dist/src/utils/server-context-generator.d.ts.map +1 -0
  375. package/dist/src/utils/server-context-generator.js +666 -0
  376. package/dist/src/utils/server-context-generator.js.map +1 -0
  377. package/dist/src/utils/state-reinforcement-manager.d.ts +60 -0
  378. package/dist/src/utils/state-reinforcement-manager.d.ts.map +1 -0
  379. package/dist/src/utils/state-reinforcement-manager.js +200 -0
  380. package/dist/src/utils/state-reinforcement-manager.js.map +1 -0
  381. package/dist/src/utils/system-card-manager.d.ts +194 -0
  382. package/dist/src/utils/system-card-manager.d.ts.map +1 -0
  383. package/dist/src/utils/system-card-manager.js +336 -0
  384. package/dist/src/utils/system-card-manager.js.map +1 -0
  385. package/dist/src/utils/tiered-response-manager.d.ts +40 -0
  386. package/dist/src/utils/tiered-response-manager.d.ts.map +1 -0
  387. package/dist/src/utils/tiered-response-manager.js +243 -0
  388. package/dist/src/utils/tiered-response-manager.js.map +1 -0
  389. package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -1
  390. package/dist/src/utils/tree-sitter-analyzer.js +83 -11
  391. package/dist/src/utils/tree-sitter-analyzer.js.map +1 -1
  392. package/dist/src/utils/validated-pattern-definitions.d.ts +219 -0
  393. package/dist/src/utils/validated-pattern-definitions.d.ts.map +1 -0
  394. package/dist/src/utils/validated-pattern-definitions.js +1511 -0
  395. package/dist/src/utils/validated-pattern-definitions.js.map +1 -0
  396. package/package.json +21 -12
  397. package/dist/src/prompts/todo-prompts.d.ts +0 -49
  398. package/dist/src/prompts/todo-prompts.d.ts.map +0 -1
  399. package/dist/src/prompts/todo-prompts.js +0 -824
  400. package/dist/src/prompts/todo-prompts.js.map +0 -1
  401. package/dist/src/types/todo-json-schemas.d.ts +0 -17
  402. package/dist/src/types/todo-json-schemas.d.ts.map +0 -1
  403. package/dist/src/types/todo-json-schemas.js +0 -9
  404. package/dist/src/types/todo-json-schemas.js.map +0 -1
  405. package/dist/src/utils/todo-file-watcher.d.ts +0 -14
  406. package/dist/src/utils/todo-file-watcher.d.ts.map +0 -1
  407. package/dist/src/utils/todo-file-watcher.js +0 -25
  408. package/dist/src/utils/todo-file-watcher.js.map +0 -1
@@ -0,0 +1,666 @@
1
+ /**
2
+ * Server Context Generator
3
+ *
4
+ * Generates a human-readable context file that LLMs can @ reference
5
+ * to instantly understand the server's state, memory, and capabilities.
6
+ *
7
+ * This bridges the gap between internal memory systems (JSON in /tmp)
8
+ * and LLM working context by creating a markdown file that can be
9
+ * @ mentioned in conversations.
10
+ */
11
+ import * as fs from 'fs/promises';
12
+ import * as path from 'path';
13
+ import { loadConfig } from './config.js';
14
+ import { EnhancedLogger } from './enhanced-logging.js';
15
+ import { listAllPatterns } from './validated-pattern-definitions.js';
16
+ export class ServerContextGenerator {
17
+ logger;
18
+ config;
19
+ constructor() {
20
+ this.logger = new EnhancedLogger();
21
+ this.config = loadConfig();
22
+ }
23
+ /**
24
+ * Generate the complete server context markdown file
25
+ */
26
+ async generateContext(kgManager, memoryManager, conversationManager, options = {}) {
27
+ const { maxRecentItems = 5 } = options;
28
+ const sections = [];
29
+ // Header
30
+ sections.push(this.generateHeader());
31
+ // Server Quick Reference
32
+ sections.push(this.generateServerInfo());
33
+ // Validated Deployment Patterns
34
+ sections.push(this.generateValidatedPatternsSection());
35
+ // MCP Resources
36
+ sections.push(this.generateMcpResourcesSection());
37
+ // Memory & Knowledge Graph Status
38
+ sections.push(await this.generateMemoryStatus(kgManager, memoryManager, conversationManager, maxRecentItems));
39
+ // Analytics
40
+ sections.push(await this.generateAnalytics(kgManager));
41
+ // Recent Deployment Activity
42
+ sections.push(await this.generateDeploymentActivitySection(kgManager));
43
+ // Patterns
44
+ sections.push(await this.generatePatterns(memoryManager));
45
+ // Recommendations
46
+ sections.push(await this.generateRecommendations(memoryManager));
47
+ // Usage guide
48
+ sections.push(this.generateUsageGuide());
49
+ // Footer
50
+ sections.push(this.generateFooter());
51
+ return sections.join('\n\n---\n\n');
52
+ }
53
+ /**
54
+ * Write context to file
55
+ */
56
+ async writeContextFile(kgManager, memoryManager, conversationManager, filePath) {
57
+ const outputPath = filePath || path.join(this.config.projectPath, '.mcp-server-context.md');
58
+ const content = await this.generateContext(kgManager, memoryManager, conversationManager);
59
+ await fs.writeFile(outputPath, content, 'utf-8');
60
+ this.logger.info('Server context file updated', 'ServerContextGenerator', {
61
+ path: outputPath,
62
+ size: content.length,
63
+ });
64
+ }
65
+ generateHeader() {
66
+ return `# MCP Server Context & Memory
67
+
68
+ > **Purpose**: \`@\` reference this file to give LLMs instant context about the MCP ADR Analysis Server's state, capabilities, and recent activity.
69
+ >
70
+ > **Auto-generated**: This file is automatically updated by the server's memory systems.
71
+ >
72
+ > **Last Updated**: ${new Date().toISOString()}`;
73
+ }
74
+ generateServerInfo(toolList) {
75
+ // Generate tool list from actual registered tools or use complete default list
76
+ const tools = toolList || [
77
+ // ADR Management (14 tools)
78
+ {
79
+ name: 'analyze_project_ecosystem',
80
+ description: 'Analyze complete project ecosystem including dependencies, technologies, and architecture',
81
+ },
82
+ {
83
+ name: 'get_architectural_context',
84
+ description: 'Retrieve architectural context and decisions for a project',
85
+ },
86
+ {
87
+ name: 'generate_adrs_from_prd',
88
+ description: 'Generate ADRs from Product Requirements Document',
89
+ },
90
+ {
91
+ name: 'compare_adr_progress',
92
+ description: 'Compare ADR implementation progress against requirements',
93
+ },
94
+ {
95
+ name: 'suggest_adrs',
96
+ description: 'Suggest new ADRs based on project context and analysis',
97
+ },
98
+ {
99
+ name: 'generate_adr_from_decision',
100
+ description: 'Generate ADR from a specific architectural decision',
101
+ },
102
+ { name: 'generate_adr_bootstrap', description: 'Bootstrap ADR structure for a project' },
103
+ {
104
+ name: 'discover_existing_adrs',
105
+ description: 'Discover and index existing ADRs in project',
106
+ },
107
+ { name: 'validate_adr', description: 'Validate individual ADR content and structure' },
108
+ { name: 'validate_all_adrs', description: 'Validate all ADRs in project' },
109
+ {
110
+ name: 'review_existing_adrs',
111
+ description: 'Review and analyze existing ADRs for quality and completeness',
112
+ },
113
+ {
114
+ name: 'interactive_adr_planning',
115
+ description: 'Interactive ADR creation with guided workflow',
116
+ },
117
+ {
118
+ name: 'generate_rules',
119
+ description: 'Generate architectural rules from ADRs and code patterns',
120
+ },
121
+ { name: 'create_rule_set', description: 'Create comprehensive rule set for validation' },
122
+ // Content Security (6 tools)
123
+ {
124
+ name: 'analyze_content_security',
125
+ description: 'Analyze content for security vulnerabilities and sensitive data',
126
+ },
127
+ {
128
+ name: 'generate_content_masking',
129
+ description: 'Generate content masking for detected sensitive information',
130
+ },
131
+ {
132
+ name: 'configure_custom_patterns',
133
+ description: 'Configure custom security patterns for content analysis',
134
+ },
135
+ {
136
+ name: 'apply_basic_content_masking',
137
+ description: 'Apply basic content masking to protect sensitive data',
138
+ },
139
+ {
140
+ name: 'validate_content_masking',
141
+ description: 'Validate effectiveness of content masking',
142
+ },
143
+ {
144
+ name: 'configure_output_masking',
145
+ description: 'Configure masking patterns for tool outputs',
146
+ },
147
+ // Research & Analysis (6 tools)
148
+ {
149
+ name: 'perform_research',
150
+ description: 'Perform comprehensive architectural research on specific questions',
151
+ },
152
+ {
153
+ name: 'generate_research_questions',
154
+ description: 'Generate context-aware research questions from project analysis',
155
+ },
156
+ {
157
+ name: 'incorporate_research',
158
+ description: 'Incorporate research findings into ADRs and documentation',
159
+ },
160
+ {
161
+ name: 'create_research_template',
162
+ description: 'Create structured research templates for investigations',
163
+ },
164
+ {
165
+ name: 'expand_analysis_section',
166
+ description: 'Retrieve and expand tiered analysis sections from memory',
167
+ },
168
+ {
169
+ name: 'request_action_confirmation',
170
+ description: 'Request user confirmation for critical actions',
171
+ },
172
+ // Deployment & Infrastructure (6 tools)
173
+ {
174
+ name: 'deployment_readiness',
175
+ description: 'Assess deployment readiness with zero-tolerance validation',
176
+ },
177
+ {
178
+ name: 'generate_deployment_guidance',
179
+ description: 'Generate deployment guidance and recommendations',
180
+ },
181
+ {
182
+ name: 'analyze_deployment_progress',
183
+ description: 'Analyze deployment progress and identify blockers',
184
+ },
185
+ {
186
+ name: 'check_ai_execution_status',
187
+ description: 'Check AI execution mode and capabilities',
188
+ },
189
+ {
190
+ name: 'analyze_environment',
191
+ description: 'Analyze project environment and system configuration',
192
+ },
193
+ {
194
+ name: 'bootstrap_validation_loop',
195
+ description: 'Bootstrap self-learning validation and deployment workflow',
196
+ },
197
+ // Development Workflow (4 tools)
198
+ {
199
+ name: 'smart_git_push',
200
+ description: 'Intelligent git operations with validation and safety checks',
201
+ },
202
+ {
203
+ name: 'troubleshoot_guided_workflow',
204
+ description: 'Guided troubleshooting for deployment and validation issues',
205
+ },
206
+ {
207
+ name: 'get_workflow_guidance',
208
+ description: 'Get workflow guidance for specific development tasks',
209
+ },
210
+ {
211
+ name: 'get_development_guidance',
212
+ description: 'Get development guidance and best practices',
213
+ },
214
+ // File System Operations (5 tools)
215
+ { name: 'list_roots', description: 'List available filesystem roots for operations' },
216
+ { name: 'read_directory', description: 'Read directory contents and metadata' },
217
+ { name: 'read_file', description: 'Read file contents from filesystem' },
218
+ { name: 'write_file', description: 'Write content to filesystem' },
219
+ { name: 'list_directory', description: 'List directory contents with filtering' },
220
+ // Memory & Context (8 tools)
221
+ {
222
+ name: 'memory_loading',
223
+ description: 'Load and manage memory entities from various sources',
224
+ },
225
+ {
226
+ name: 'expand_memory',
227
+ description: 'Retrieve and expand stored content from tiered responses',
228
+ },
229
+ {
230
+ name: 'query_conversation_history',
231
+ description: 'Search and retrieve conversation sessions',
232
+ },
233
+ {
234
+ name: 'get_conversation_snapshot',
235
+ description: 'Get current conversation context snapshot',
236
+ },
237
+ { name: 'get_memory_stats', description: 'Get statistics about stored conversation memory' },
238
+ {
239
+ name: 'get_server_context',
240
+ description: 'Generate comprehensive server context for LLM awareness',
241
+ },
242
+ { name: 'validate_rules', description: 'Validate architectural rules against code' },
243
+ { name: 'manage_cache', description: 'Manage multi-level caching system' },
244
+ // Cloud & Database (3 tools)
245
+ { name: 'llm_web_search', description: 'Search web for contextual information using LLM' },
246
+ { name: 'llm_cloud_management', description: 'Manage cloud resources and infrastructure' },
247
+ { name: 'llm_database_management', description: 'Manage database operations and queries' },
248
+ // Other (3 tools)
249
+ {
250
+ name: 'smart_score',
251
+ description: 'Score code quality and architecture (0-100) with detailed analysis',
252
+ },
253
+ {
254
+ name: 'tool_chain_orchestrator',
255
+ description: 'AI-powered dynamic tool sequencing and workflow coordination',
256
+ },
257
+ { name: 'mcp_planning', description: 'Plan and manage MCP workflows and project phases' },
258
+ ];
259
+ // Group tools by category for better organization
260
+ const categories = this.categorizeTools(tools);
261
+ let toolsSection = '### Available Tools by Category\n\n';
262
+ for (const [category, categoryTools] of Object.entries(categories)) {
263
+ toolsSection += `**${category}**\n`;
264
+ categoryTools.forEach((tool, idx) => {
265
+ toolsSection += `${idx + 1}. \`${tool.name}\` - ${tool.description}\n`;
266
+ });
267
+ toolsSection += '\n';
268
+ }
269
+ return `## 🎯 Server Quick Reference
270
+
271
+ **Name**: mcp-adr-analysis-server
272
+ **Purpose**: AI-powered architectural decision analysis and ADR management
273
+ **Project Path**: \`${this.config.projectPath}\`
274
+ **ADR Directory**: \`${this.config.adrDirectory}\`
275
+
276
+ ${toolsSection}
277
+ 📖 Full tool schemas available via MCP protocol • Total: ${tools.length} tools`;
278
+ }
279
+ /**
280
+ * Categorize tools for better organization
281
+ */
282
+ categorizeTools(tools) {
283
+ const categories = {
284
+ 'ADR Management': [],
285
+ 'Content Security': [],
286
+ 'Research & Analysis': [],
287
+ 'Deployment & Infrastructure': [],
288
+ 'Development Workflow': [],
289
+ 'File System Operations': [],
290
+ 'Memory & Context': [],
291
+ 'Cloud & Database': [],
292
+ Other: [],
293
+ };
294
+ tools.forEach(tool => {
295
+ const name = tool.name.toLowerCase();
296
+ if (name.includes('adr') ||
297
+ name.includes('rule') ||
298
+ name.includes('ecosystem') ||
299
+ name.includes('architectural')) {
300
+ categories['ADR Management']?.push(tool);
301
+ }
302
+ else if (name.includes('security') ||
303
+ name.includes('masking') ||
304
+ name.includes('content_masking')) {
305
+ categories['Content Security']?.push(tool);
306
+ }
307
+ else if (name.includes('research') ||
308
+ name.includes('expand_analysis') ||
309
+ name.includes('confirmation')) {
310
+ categories['Research & Analysis']?.push(tool);
311
+ }
312
+ else if (name.includes('deploy') ||
313
+ name.includes('environment') ||
314
+ name.includes('readiness')) {
315
+ categories['Deployment & Infrastructure']?.push(tool);
316
+ }
317
+ else if (name.includes('git') ||
318
+ name.includes('todo') ||
319
+ name.includes('troubleshoot') ||
320
+ name.includes('bootstrap') ||
321
+ name.includes('workflow') ||
322
+ name.includes('guidance')) {
323
+ categories['Development Workflow']?.push(tool);
324
+ }
325
+ else if (name.includes('file') ||
326
+ name.includes('directory') ||
327
+ name.includes('list_roots') ||
328
+ name.includes('read_file') ||
329
+ name.includes('write_file')) {
330
+ categories['File System Operations']?.push(tool);
331
+ }
332
+ else if (name.includes('memory') ||
333
+ name.includes('conversation') ||
334
+ name.includes('context') ||
335
+ name.includes('cache')) {
336
+ categories['Memory & Context']?.push(tool);
337
+ }
338
+ else if (name.includes('cloud') || name.includes('database') || name.includes('llm')) {
339
+ categories['Cloud & Database']?.push(tool);
340
+ }
341
+ else {
342
+ categories['Other']?.push(tool);
343
+ }
344
+ });
345
+ // Remove empty categories
346
+ Object.keys(categories).forEach(key => {
347
+ if (categories[key]?.length === 0) {
348
+ delete categories[key];
349
+ }
350
+ });
351
+ return categories;
352
+ }
353
+ async generateMemoryStatus(kgManager, memoryManager, conversationManager, maxRecent) {
354
+ // Get knowledge graph data
355
+ const kg = await kgManager.loadKnowledgeGraph();
356
+ const activeIntents = await kgManager.getActiveIntents();
357
+ const completedIntents = await kgManager.getIntentsByStatus('completed');
358
+ // Get memory entity data
359
+ const entityQuery = await memoryManager.queryEntities({ limit: 1000 });
360
+ const intelligence = await memoryManager.getIntelligence();
361
+ // Get conversation data
362
+ let sessionInfo = 'None';
363
+ let turnCount = 0;
364
+ let sessionDuration = '0m';
365
+ try {
366
+ const stats = await conversationManager.getStats();
367
+ if (stats.activeSessions > 0) {
368
+ sessionInfo = `${stats.activeSessions} active`;
369
+ turnCount = stats.totalTurns;
370
+ // Use average session duration if available
371
+ sessionDuration =
372
+ stats.activeSessions > 0
373
+ ? `${Math.floor(stats.totalTurns / stats.activeSessions)}t`
374
+ : '0m';
375
+ }
376
+ }
377
+ catch {
378
+ // Conversation manager not initialized
379
+ }
380
+ // Recent intents
381
+ const recentIntents = kg.intents
382
+ .slice(-maxRecent)
383
+ .reverse()
384
+ .map(intent => `- **${intent.humanRequest.substring(0, 60)}...** - ${intent.currentStatus} - ${new Date(intent.timestamp).toLocaleString()}`)
385
+ .join('\n');
386
+ // Entity breakdown
387
+ const entityBreakdown = Object.entries(entityQuery.aggregations?.byType || {})
388
+ .map(([type, count]) => `- ${type}: ${count}`)
389
+ .join('\n');
390
+ const avgConfidence = Math.round((entityQuery.entities.reduce((sum, e) => sum + e.confidence, 0) /
391
+ (entityQuery.entities.length || 1)) *
392
+ 100);
393
+ return `## 🧠 Memory & Knowledge Graph Status
394
+
395
+ ### Active Intents
396
+
397
+ **Total Intents**: ${kg.intents.length}
398
+ **Active**: ${activeIntents.length} | **Completed**: ${completedIntents.length}
399
+
400
+ **Recent Intents** (Last ${maxRecent}):
401
+ ${recentIntents || '- No recent intents'}
402
+
403
+ ### Memory Entities
404
+
405
+ **Total Entities**: ${entityQuery.totalCount}
406
+ **Relationships**: ${entityQuery.relationships.length}
407
+ **Average Confidence**: ${avgConfidence}%
408
+
409
+ **Entity Breakdown**:
410
+ ${entityBreakdown || '- No entities yet'}
411
+
412
+ **Recent Activity** (Last 24h):
413
+ - Knowledge Gaps: ${intelligence.adaptiveRecommendations.knowledgeGaps.length} identified
414
+
415
+ ### Conversation Context
416
+
417
+ **Active Session**: ${sessionInfo}
418
+ **Conversation Turns**: ${turnCount}
419
+ **Session Duration**: ${sessionDuration}`;
420
+ }
421
+ async generateAnalytics(kgManager) {
422
+ const kg = await kgManager.loadKnowledgeGraph();
423
+ const trends = await kgManager.getProjectScoreTrends();
424
+ // Tool usage from analytics
425
+ const toolUsage = kg.analytics.mostUsedTools
426
+ .slice(0, 5)
427
+ .map((t, i) => `${i + 1}. **${t.toolName}**: ${t.usageCount} calls`)
428
+ .join('\n');
429
+ return `## 📊 Recent Analytics
430
+
431
+ ### Tool Usage (Most Used)
432
+ ${toolUsage || '- No tool usage yet'}
433
+
434
+ ### Score Trends
435
+ - **Current Project Score**: ${Math.round(trends.currentScore)}/100
436
+ - **Average Improvement per Intent**: ${Math.round(trends.averageImprovement)}
437
+
438
+ ### Top Impacting Intents
439
+ ${trends.topImpactingIntents
440
+ .slice(0, 3)
441
+ .map(i => `- **${i.humanRequest.substring(0, 50)}...**: ${i.scoreImprovement > 0 ? '+' : ''}${Math.round(i.scoreImprovement)} points`)
442
+ .join('\n')}`;
443
+ }
444
+ async generatePatterns(memoryManager) {
445
+ const intelligence = await memoryManager.getIntelligence();
446
+ const patterns = intelligence.patternRecognition.discoveredPatterns
447
+ .slice(0, 5)
448
+ .map(p => `- **${p.pattern}**: ${Math.round((p.confidence || 0) * 100)}% confidence`)
449
+ .join('\n');
450
+ const suggestions = intelligence.relationshipInference.suggestedRelationships
451
+ .slice(0, 3)
452
+ .map(s => `- ${s.sourceId.substring(0, 8)} → ${s.targetId.substring(0, 8)}: **${s.type}** (${Math.round((s.confidence || 0) * 100)}%)`)
453
+ .join('\n');
454
+ return `## 🔍 Discovered Patterns
455
+
456
+ ### Architectural Patterns
457
+ ${patterns || '- No patterns discovered yet'}
458
+
459
+ ### Suggested Relationships
460
+ ${suggestions || '- No relationship suggestions yet'}
461
+
462
+ **Emergent Behaviors**: ${intelligence.patternRecognition.emergentBehaviors.length} detected`;
463
+ }
464
+ async generateRecommendations(memoryManager) {
465
+ const intelligence = await memoryManager.getIntelligence();
466
+ const nextActions = intelligence.adaptiveRecommendations.nextActions
467
+ .slice(0, 3)
468
+ .map(a => `${a.priority}. **${a.action}** - ${a.reasoning}`)
469
+ .join('\n');
470
+ const knowledgeGaps = intelligence.adaptiveRecommendations.knowledgeGaps
471
+ .slice(0, 3)
472
+ .map(gap => `- ${gap}`)
473
+ .join('\n');
474
+ const opportunities = intelligence.adaptiveRecommendations.optimizationOpportunities
475
+ .slice(0, 3)
476
+ .map(opp => `- ${opp}`)
477
+ .join('\n');
478
+ return `## 🎯 Recommendations for This Session
479
+
480
+ ### Next Actions
481
+ ${nextActions || '- No specific actions recommended'}
482
+
483
+ ### Knowledge Gaps
484
+ ${knowledgeGaps || '- No knowledge gaps identified'}
485
+
486
+ ### Optimization Opportunities
487
+ ${opportunities || '- No optimization opportunities identified'}`;
488
+ }
489
+ generateValidatedPatternsSection() {
490
+ const patterns = listAllPatterns();
491
+ const patternList = patterns
492
+ .map(p => `- **${p.name}** (${p.platformType})
493
+ - Version: ${p.version}
494
+ - Dependencies: ${p.billOfMaterials.dependencies.filter(d => d.required).length} required
495
+ - Deployment Phases: ${p.deploymentPhases.length}
496
+ - Validation Checks: ${p.validationChecks.filter(v => v.severity === 'critical').length} critical
497
+ - Base Code: ${p.baseCodeRepository.url}`)
498
+ .join('\n\n');
499
+ return `## 🚀 Validated Deployment Patterns
500
+
501
+ The server provides ${patterns.length} pre-validated deployment patterns for different platforms.
502
+ Each pattern includes bill of materials, deployment phases, validation checks, and authoritative sources.
503
+
504
+ ### Available Patterns
505
+
506
+ ${patternList}
507
+
508
+ ### How to Access
509
+
510
+ Use MCP resources to get pattern details:
511
+ - \`adr://validated_patterns\` - Complete catalog
512
+ - \`adr://validated_pattern/{platform}\` - Specific pattern (openshift, kubernetes, docker, nodejs, python, mcp, a2a)
513
+ - \`adr://pattern_sources/{platform}\` - Authoritative documentation sources
514
+ - \`adr://pattern_base_code/{platform}\` - Base code repository integration
515
+
516
+ ### Related Tools
517
+
518
+ - \`bootstrap_validation_loop\` - Deploy with DAG-based infrastructure automation
519
+ - \`deployment_readiness\` - Validate deployment readiness
520
+ - \`generate_deployment_guidance\` - Get platform-specific deployment recommendations`;
521
+ }
522
+ generateMcpResourcesSection() {
523
+ const resources = [
524
+ {
525
+ uri: 'adr://validated_patterns',
526
+ name: 'Validated Patterns Catalog',
527
+ description: 'Complete catalog of all deployment patterns',
528
+ },
529
+ {
530
+ uri: 'adr://validated_pattern/{platform}',
531
+ name: 'Pattern by Platform',
532
+ description: 'Individual pattern with BOM, phases, validations',
533
+ },
534
+ {
535
+ uri: 'adr://pattern_sources/{platform}',
536
+ name: 'Authoritative Sources',
537
+ description: 'Prioritized documentation sources for LLM research',
538
+ },
539
+ {
540
+ uri: 'adr://pattern_base_code/{platform}',
541
+ name: 'Base Code Repository',
542
+ description: 'Framework code integration instructions',
543
+ },
544
+ {
545
+ uri: 'adr://architectural_knowledge_graph',
546
+ name: 'Knowledge Graph',
547
+ description: 'Complete architectural relationships and decisions',
548
+ },
549
+ {
550
+ uri: 'adr://deployment_status',
551
+ name: 'Deployment Status',
552
+ description: 'Current deployment state and health checks',
553
+ },
554
+ {
555
+ uri: 'adr://project_metrics',
556
+ name: 'Project Metrics',
557
+ description: 'Code metrics and quality scores',
558
+ },
559
+ ];
560
+ const resourceList = resources
561
+ .map(r => `- **${r.uri}**\n ${r.name}: ${r.description}`)
562
+ .join('\n\n');
563
+ return `## 📦 MCP Resources
564
+
565
+ The server exposes ${resources.length} key resources (+ 16 more) for read-only access.
566
+
567
+ ### Featured Resources
568
+
569
+ ${resourceList}
570
+
571
+ **Total**: 23 resources available via MCP protocol
572
+ See full list with \`ListResources\` MCP request`;
573
+ }
574
+ async generateDeploymentActivitySection(kgManager) {
575
+ try {
576
+ const kg = await kgManager.loadKnowledgeGraph();
577
+ // Find deployment-related intents
578
+ const deploymentIntents = kg.intents.filter(intent => {
579
+ const toolNames = intent.toolChain.map(tc => tc.toolName);
580
+ return (intent.humanRequest.toLowerCase().includes('deploy') ||
581
+ intent.humanRequest.toLowerCase().includes('bootstrap') ||
582
+ intent.humanRequest.toLowerCase().includes('infrastructure') ||
583
+ toolNames.some(name => [
584
+ 'bootstrap_validation_loop',
585
+ 'deployment_readiness',
586
+ 'generate_deployment_guidance',
587
+ ].includes(name)));
588
+ });
589
+ const recentDeployments = deploymentIntents
590
+ .slice(-3)
591
+ .reverse()
592
+ .map(intent => {
593
+ const toolNames = intent.toolChain.map(tc => tc.toolName).join(', ');
594
+ return `- **${intent.humanRequest.substring(0, 60)}...**
595
+ - Status: ${intent.currentStatus}
596
+ - Tools: ${toolNames || 'None'}
597
+ - Time: ${new Date(intent.timestamp).toLocaleString()}`;
598
+ })
599
+ .join('\n\n');
600
+ // Check for bootstrap loop executions
601
+ const bootstrapExecutions = deploymentIntents.filter(intent => intent.toolChain.some(tc => tc.toolName === 'bootstrap_validation_loop'));
602
+ const dagExecutions = bootstrapExecutions.length;
603
+ const successfulDeployments = deploymentIntents.filter(intent => intent.currentStatus === 'completed').length;
604
+ return `## 🏗️ Recent Deployment Activity
605
+
606
+ **Deployment Intents**: ${deploymentIntents.length}
607
+ **DAG Executions**: ${dagExecutions}
608
+ **Successful Deployments**: ${successfulDeployments}
609
+
610
+ ### Recent Activity (Last 3)
611
+
612
+ ${recentDeployments || '- No recent deployment activity'}
613
+
614
+ ### Deployment Capabilities
615
+
616
+ - **Hybrid DAG Architecture**: Infrastructure deployment runs once, application iterates with auto-fix
617
+ - **Platform Support**: OpenShift, Kubernetes, Docker, Node.js, Python, MCP, A2A
618
+ - **Validation**: Zero-tolerance validation with automatic remediation
619
+ - **Cleanup**: Full teardown support via \`deploymentCleanupRequested\` parameter`;
620
+ }
621
+ catch {
622
+ return `## 🏗️ Recent Deployment Activity
623
+
624
+ _Deployment activity tracking unavailable_`;
625
+ }
626
+ }
627
+ generateUsageGuide() {
628
+ return `## 📝 How to Use This Context
629
+
630
+ **When starting a conversation**:
631
+ \`\`\`
632
+ @.mcp-server-context.md I need to understand our current architectural decisions
633
+ \`\`\`
634
+
635
+ **When resuming work**:
636
+ \`\`\`
637
+ @.mcp-server-context.md What were we working on? Show me the active intents
638
+ \`\`\`
639
+
640
+ **When making decisions**:
641
+ \`\`\`
642
+ @.mcp-server-context.md What patterns have we discovered that relate to [topic]?
643
+ \`\`\`
644
+
645
+ **When checking progress**:
646
+ \`\`\`
647
+ @.mcp-server-context.md How has our architecture score changed recently?
648
+ \`\`\``;
649
+ }
650
+ generateFooter() {
651
+ return `## 🔄 Context Refresh
652
+
653
+ This file is automatically updated:
654
+ - After every tool execution
655
+ - When memory entities change
656
+ - When conversation sessions start/end
657
+ - On server restart
658
+
659
+ To manually refresh: Use the MCP tool \`get_server_context\` or restart the server
660
+
661
+ ---
662
+
663
+ _This context file bridges the gap between the server's persistent memory systems and your working conversation context._`;
664
+ }
665
+ }
666
+ //# sourceMappingURL=server-context-generator.js.map