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,665 @@
1
+ /**
2
+ * Deployment Status Resource - Current deployment state
3
+ * URI Pattern: adr://deployment_status
4
+ */
5
+ import * as fs from 'fs/promises';
6
+ import * as path from 'path';
7
+ import { exec } from 'child_process';
8
+ import { promisify } from 'util';
9
+ import { resourceCache, generateETag } from './resource-cache.js';
10
+ const execAsync = promisify(exec);
11
+ /**
12
+ * Get current git information
13
+ */
14
+ async function getGitInfo() {
15
+ try {
16
+ const [branchResult, commitResult, messageResult] = await Promise.all([
17
+ execAsync('git rev-parse --abbrev-ref HEAD'),
18
+ execAsync('git rev-parse --short HEAD'),
19
+ execAsync('git log -1 --pretty=%B'),
20
+ ]);
21
+ return {
22
+ branch: branchResult.stdout.trim(),
23
+ commit: commitResult.stdout.trim(),
24
+ commitMessage: messageResult.stdout.trim(),
25
+ };
26
+ }
27
+ catch {
28
+ return {
29
+ branch: 'unknown',
30
+ commit: 'unknown',
31
+ commitMessage: 'Git information unavailable',
32
+ };
33
+ }
34
+ }
35
+ /**
36
+ * Get package version from package.json
37
+ */
38
+ async function getPackageVersion() {
39
+ try {
40
+ const packagePath = path.resolve(process.cwd(), 'package.json');
41
+ const packageContent = await fs.readFile(packagePath, 'utf-8');
42
+ const packageJson = JSON.parse(packageContent);
43
+ return packageJson.version || '0.0.0';
44
+ }
45
+ catch {
46
+ return '0.0.0';
47
+ }
48
+ }
49
+ /**
50
+ * Run deployment checks
51
+ */
52
+ async function runDeploymentChecks() {
53
+ const checks = [];
54
+ const timestamp = new Date().toISOString();
55
+ // Check 1: TypeScript compilation
56
+ try {
57
+ await execAsync('npm run typecheck', { timeout: 30000 });
58
+ checks.push({
59
+ name: 'TypeScript Compilation',
60
+ status: 'passed',
61
+ message: 'All type checks passed',
62
+ timestamp,
63
+ });
64
+ }
65
+ catch {
66
+ checks.push({
67
+ name: 'TypeScript Compilation',
68
+ status: 'failed',
69
+ message: 'Type check failures detected',
70
+ timestamp,
71
+ });
72
+ }
73
+ // Check 2: Build status
74
+ try {
75
+ await execAsync('npm run build', { timeout: 60000 });
76
+ checks.push({
77
+ name: 'Build Process',
78
+ status: 'passed',
79
+ message: 'Build completed successfully',
80
+ timestamp,
81
+ });
82
+ }
83
+ catch {
84
+ checks.push({
85
+ name: 'Build Process',
86
+ status: 'failed',
87
+ message: 'Build failed',
88
+ timestamp,
89
+ });
90
+ }
91
+ // Check 3: Test suite
92
+ try {
93
+ await execAsync('npm test -- --passWithNoTests', { timeout: 120000 });
94
+ checks.push({
95
+ name: 'Test Suite',
96
+ status: 'passed',
97
+ message: 'All tests passed',
98
+ timestamp,
99
+ });
100
+ }
101
+ catch {
102
+ checks.push({
103
+ name: 'Test Suite',
104
+ status: 'warning',
105
+ message: 'Some tests failed or no tests found',
106
+ timestamp,
107
+ });
108
+ }
109
+ return checks;
110
+ }
111
+ /**
112
+ * Check dependency status
113
+ */
114
+ async function checkDependencies() {
115
+ let total = 0;
116
+ let outdated = 0;
117
+ let vulnerable = 0;
118
+ try {
119
+ const packagePath = path.resolve(process.cwd(), 'package.json');
120
+ const packageContent = await fs.readFile(packagePath, 'utf-8');
121
+ const packageJson = JSON.parse(packageContent);
122
+ total = Object.keys(packageJson.dependencies || {}).length;
123
+ // Check for outdated packages
124
+ try {
125
+ const outdatedResult = await execAsync('npm outdated --json', { timeout: 30000 });
126
+ const outdatedData = JSON.parse(outdatedResult.stdout);
127
+ outdated = Object.keys(outdatedData).length;
128
+ }
129
+ catch (error) {
130
+ // npm outdated returns exit code 1 when there are outdated packages
131
+ if (error.stdout) {
132
+ try {
133
+ const outdatedData = JSON.parse(error.stdout);
134
+ outdated = Object.keys(outdatedData).length;
135
+ }
136
+ catch {
137
+ outdated = 0;
138
+ }
139
+ }
140
+ }
141
+ // Check for vulnerabilities
142
+ try {
143
+ const auditResult = await execAsync('npm audit --json', { timeout: 30000 });
144
+ const auditData = JSON.parse(auditResult.stdout);
145
+ vulnerable = auditData.metadata?.vulnerabilities?.total || 0;
146
+ }
147
+ catch (error) {
148
+ if (error.stdout) {
149
+ try {
150
+ const auditData = JSON.parse(error.stdout);
151
+ vulnerable = auditData.metadata?.vulnerabilities?.total || 0;
152
+ }
153
+ catch {
154
+ vulnerable = 0;
155
+ }
156
+ }
157
+ }
158
+ }
159
+ catch {
160
+ // Unable to check dependencies
161
+ }
162
+ return { total, outdated, vulnerable };
163
+ }
164
+ /**
165
+ * Get build information
166
+ */
167
+ async function getBuildInfo() {
168
+ try {
169
+ const distPath = path.resolve(process.cwd(), 'dist');
170
+ const stats = await fs.stat(distPath);
171
+ return {
172
+ lastBuild: stats.mtime.toISOString(),
173
+ buildStatus: 'success',
174
+ };
175
+ }
176
+ catch {
177
+ return {
178
+ lastBuild: 'Never',
179
+ buildStatus: 'unknown',
180
+ };
181
+ }
182
+ }
183
+ /**
184
+ * Calculate deployment readiness
185
+ */
186
+ function calculateDeploymentReadiness(checks, dependencies) {
187
+ const blockers = [];
188
+ const warnings = [];
189
+ const recommendations = [];
190
+ let score = 100;
191
+ // Failed checks are blockers
192
+ const failedChecks = checks.filter(c => c.status === 'failed');
193
+ if (failedChecks.length > 0) {
194
+ blockers.push(...failedChecks.map(c => `${c.name}: ${c.message}`));
195
+ score -= failedChecks.length * 30;
196
+ }
197
+ // Warning checks
198
+ const warningChecks = checks.filter(c => c.status === 'warning');
199
+ if (warningChecks.length > 0) {
200
+ warnings.push(...warningChecks.map(c => `${c.name}: ${c.message}`));
201
+ score -= warningChecks.length * 10;
202
+ }
203
+ // Vulnerable dependencies are blockers
204
+ if (dependencies.vulnerable > 0) {
205
+ blockers.push(`${dependencies.vulnerable} vulnerable dependencies detected`);
206
+ score -= Math.min(dependencies.vulnerable * 5, 30);
207
+ }
208
+ // Outdated dependencies are warnings
209
+ if (dependencies.outdated > 5) {
210
+ warnings.push(`${dependencies.outdated} outdated dependencies`);
211
+ score -= Math.min(dependencies.outdated, 20);
212
+ }
213
+ // Recommendations
214
+ if (dependencies.outdated > 0) {
215
+ recommendations.push('Update outdated dependencies');
216
+ }
217
+ if (score < 80) {
218
+ recommendations.push('Address all blockers and warnings before deployment');
219
+ }
220
+ if (blockers.length === 0 && warnings.length === 0) {
221
+ recommendations.push('System is ready for deployment');
222
+ }
223
+ return {
224
+ score: Math.max(0, score),
225
+ blockers,
226
+ warnings,
227
+ recommendations,
228
+ };
229
+ }
230
+ /**
231
+ * Extract structured data from deployment-readiness-tool output
232
+ */
233
+ function extractDeploymentDataFromToolOutput(toolOutput) {
234
+ const extracted = {};
235
+ // Extract code quality analysis
236
+ if (toolOutput.includes('Code Quality') || toolOutput.includes('quality')) {
237
+ const scoreMatch = toolOutput.match(/(?:quality|overall)[\s\S]*?score[:\s]+(\d+)/i);
238
+ const productionMatch = toolOutput.match(/production[\s\S]*?code[:\s]+(\d+)/i);
239
+ const mockMatch = toolOutput.match(/mock[:\s]+(\d+)/i);
240
+ if (scoreMatch || productionMatch) {
241
+ extracted.codeQualityAnalysis = {
242
+ overallScore: scoreMatch && scoreMatch[1] ? parseInt(scoreMatch[1]) : 0,
243
+ productionCodeScore: productionMatch && productionMatch[1] ? parseInt(productionMatch[1]) : 0,
244
+ mockCodeIndicators: mockMatch && mockMatch[1] ? parseInt(mockMatch[1]) : 0,
245
+ productionCodeThreshold: 80,
246
+ qualityGates: [],
247
+ };
248
+ // Extract quality gates
249
+ const gateMatches = toolOutput.matchAll(/(?:gate|check)[:\s]+([\w\s]+)[\s-]+(passed|failed)/gi);
250
+ for (const match of gateMatches) {
251
+ if (extracted.codeQualityAnalysis && match[1] && match[2]) {
252
+ extracted.codeQualityAnalysis.qualityGates.push({
253
+ gate: match[1].trim(),
254
+ passed: match[2].toLowerCase() === 'passed',
255
+ });
256
+ }
257
+ }
258
+ }
259
+ }
260
+ // Extract test validation
261
+ if (toolOutput.includes('test') || toolOutput.includes('Test')) {
262
+ const totalMatch = toolOutput.match(/(\d+)\s+total[\s\S]*?tests?/i);
263
+ const passedMatch = toolOutput.match(/(\d+)\s+passed/i);
264
+ const failedMatch = toolOutput.match(/(\d+)\s+failed/i);
265
+ const coverageMatch = toolOutput.match(/coverage[:\s]+(\d+)%/i);
266
+ const totalTests = totalMatch && totalMatch[1] ? parseInt(totalMatch[1]) : 0;
267
+ const passedTests = passedMatch && passedMatch[1] ? parseInt(passedMatch[1]) : 0;
268
+ const failedTests = failedMatch && failedMatch[1] ? parseInt(failedMatch[1]) : 0;
269
+ extracted.testValidation = {
270
+ testExecutionResult: failedTests > 0 ? 'failed' : passedTests > 0 ? 'passed' : 'unknown',
271
+ totalTests,
272
+ passedTests,
273
+ failedTests,
274
+ skippedTests: totalTests - passedTests - failedTests,
275
+ coverage: coverageMatch && coverageMatch[1] ? parseInt(coverageMatch[1]) : 0,
276
+ zeroToleranceEnforced: toolOutput.includes('zero tolerance') || toolOutput.includes('strict'),
277
+ failureDetails: [],
278
+ };
279
+ // Extract test failures
280
+ const failureMatches = toolOutput.matchAll(/(?:FAIL|failed)[:\s]+([\w/.-]+)\s*(?:›\s*)?(.*)/gi);
281
+ for (const match of failureMatches) {
282
+ if (extracted.testValidation && match[1]) {
283
+ extracted.testValidation.failureDetails.push({
284
+ suite: match[1].trim(),
285
+ test: match[2] ? match[2].trim() : 'Test failed',
286
+ error: 'Test execution failed',
287
+ });
288
+ }
289
+ }
290
+ }
291
+ // Extract deployment history
292
+ if (toolOutput.includes('deployment') &&
293
+ (toolOutput.includes('history') || toolOutput.includes('previous'))) {
294
+ const totalMatch = toolOutput.match(/(\d+)\s+(?:total\s+)?deployments?/i);
295
+ const successMatch = toolOutput.match(/(\d+)\s+successful/i);
296
+ const failedMatch = toolOutput.match(/(\d+)\s+failed/i);
297
+ const successRateMatch = toolOutput.match(/success\s+rate[:\s]+(\d+)%/i);
298
+ const rollbackMatch = toolOutput.match(/(\d+)\s+rollbacks?/i);
299
+ const totalDeployments = totalMatch && totalMatch[1] ? parseInt(totalMatch[1]) : 0;
300
+ const successfulDeployments = successMatch && successMatch[1] ? parseInt(successMatch[1]) : 0;
301
+ const failedDeployments = failedMatch && failedMatch[1] ? parseInt(failedMatch[1]) : 0;
302
+ extracted.deploymentHistory = {
303
+ totalDeployments,
304
+ successfulDeployments,
305
+ failedDeployments,
306
+ successRate: successRateMatch && successRateMatch[1]
307
+ ? parseInt(successRateMatch[1])
308
+ : totalDeployments > 0
309
+ ? Math.round((successfulDeployments / totalDeployments) * 100)
310
+ : 0,
311
+ recentFailures: failedMatch && failedMatch[1] ? parseInt(failedMatch[1]) : 0,
312
+ rollbackFrequency: rollbackMatch && rollbackMatch[1] ? parseInt(rollbackMatch[1]) : 0,
313
+ averageDeploymentTime: '5 minutes',
314
+ trends: [],
315
+ };
316
+ }
317
+ // Extract ADR compliance
318
+ if (toolOutput.includes('ADR') || toolOutput.includes('compliance')) {
319
+ const totalReqMatch = toolOutput.match(/(\d+)\s+(?:total\s+)?requirements?/i);
320
+ const metMatch = toolOutput.match(/(\d+)\s+met/i);
321
+ const complianceMatch = toolOutput.match(/compliance[:\s]+(\d+)%/i);
322
+ const totalRequirements = totalReqMatch && totalReqMatch[1] ? parseInt(totalReqMatch[1]) : 0;
323
+ const metRequirements = metMatch && metMatch[1] ? parseInt(metMatch[1]) : 0;
324
+ extracted.adrCompliance = {
325
+ totalRequirements,
326
+ metRequirements,
327
+ unmetRequirements: totalRequirements - metRequirements,
328
+ complianceScore: complianceMatch && complianceMatch[1]
329
+ ? parseInt(complianceMatch[1])
330
+ : totalRequirements > 0
331
+ ? Math.round((metRequirements / totalRequirements) * 100)
332
+ : 100,
333
+ violations: [],
334
+ };
335
+ // Extract violations
336
+ const violationMatches = toolOutput.matchAll(/violation[:\s]+([\w\s]+)(?:\(([A-Z0-9-]+)\))?/gi);
337
+ for (const match of violationMatches) {
338
+ if (extracted.adrCompliance && match[1]) {
339
+ extracted.adrCompliance.violations.push({
340
+ requirement: match[1].trim(),
341
+ adrId: match[2] ? match[2].trim() : 'UNKNOWN',
342
+ severity: 'medium',
343
+ description: `Requirement not met: ${match[1].trim()}`,
344
+ });
345
+ }
346
+ }
347
+ }
348
+ // Extract critical blockers
349
+ const blockerMatches = toolOutput.matchAll(/(?:blocker|critical|error)[:\s]+(.*?)(?:\n|$)/gi);
350
+ const blockers = [];
351
+ for (const match of blockerMatches) {
352
+ if (match[1]) {
353
+ const text = match[1].trim();
354
+ let category = 'tests';
355
+ if (text.toLowerCase().includes('test'))
356
+ category = 'tests';
357
+ else if (text.toLowerCase().includes('quality') || text.toLowerCase().includes('code'))
358
+ category = 'code_quality';
359
+ else if (text.toLowerCase().includes('dependen'))
360
+ category = 'dependencies';
361
+ else if (text.toLowerCase().includes('adr') || text.toLowerCase().includes('compliance'))
362
+ category = 'adr_compliance';
363
+ else if (text.toLowerCase().includes('deploy'))
364
+ category = 'deployment_history';
365
+ blockers.push({
366
+ category,
367
+ title: text,
368
+ description: text,
369
+ severity: 'critical',
370
+ resolutionSteps: [],
371
+ autoFixable: false,
372
+ });
373
+ }
374
+ }
375
+ if (blockers.length > 0) {
376
+ extracted.criticalBlockers = blockers;
377
+ }
378
+ // Extract memory integration info
379
+ if (toolOutput.includes('memory') || toolOutput.includes('Memory')) {
380
+ const assessmentMatch = toolOutput.match(/assessment[\s\S]*?id[:\s]+([a-f0-9-]+)/i);
381
+ const previousScoreMatch = toolOutput.match(/previous[\s\S]*?score[:\s]+(\d+)/i);
382
+ const currentScoreMatch = toolOutput.match(/current[\s\S]*?score[:\s]+(\d+)/i);
383
+ extracted.memoryIntegration = {
384
+ enabled: true,
385
+ };
386
+ if (assessmentMatch && assessmentMatch[1]) {
387
+ extracted.memoryIntegration.assessmentId = assessmentMatch[1];
388
+ }
389
+ if (previousScoreMatch && previousScoreMatch[1] && currentScoreMatch && currentScoreMatch[1]) {
390
+ const previousScore = parseInt(previousScoreMatch[1]);
391
+ const currentScore = parseInt(currentScoreMatch[1]);
392
+ extracted.memoryIntegration.historicalComparison = {
393
+ previousScore,
394
+ currentScore,
395
+ trend: currentScore > previousScore
396
+ ? 'improving'
397
+ : currentScore < previousScore
398
+ ? 'degrading'
399
+ : 'stable',
400
+ improvement: currentScore - previousScore,
401
+ };
402
+ }
403
+ // Extract insights
404
+ const insightMatches = toolOutput.matchAll(/(?:insight|recommendation|pattern)[:\s]+(.*?)(?:\n|$)/gi);
405
+ const insights = [];
406
+ for (const match of insightMatches) {
407
+ if (match[1]) {
408
+ insights.push(match[1].trim());
409
+ }
410
+ }
411
+ if (insights.length > 0) {
412
+ extracted.memoryIntegration.insights = insights;
413
+ }
414
+ }
415
+ // Extract git push status
416
+ if (toolOutput.includes('git push') || toolOutput.includes('deployment allowed')) {
417
+ const allowedMatch = toolOutput.match(/(?:push|deployment)\s+(?:is\s+)?(allowed|blocked|conditional)/i);
418
+ extracted.gitPushStatus = {
419
+ allowed: allowedMatch && allowedMatch[1] ? allowedMatch[1].toLowerCase() === 'allowed' : false,
420
+ decision: allowedMatch && allowedMatch[1]
421
+ ? allowedMatch[1].toLowerCase()
422
+ : 'blocked',
423
+ reason: allowedMatch && allowedMatch[1] ? `Deployment is ${allowedMatch[1]}` : 'Status unknown',
424
+ };
425
+ }
426
+ // Extract emergency override
427
+ if (toolOutput.includes('override') || toolOutput.includes('emergency')) {
428
+ const activeMatch = toolOutput.match(/override[:\s]+(active|enabled|true)/i);
429
+ const justificationMatch = toolOutput.match(/justification[:\s]+(.*?)(?:\n|$)/i);
430
+ extracted.emergencyOverride = {
431
+ active: activeMatch ? true : false,
432
+ };
433
+ if (justificationMatch && justificationMatch[1]) {
434
+ extracted.emergencyOverride.justification = justificationMatch[1].trim();
435
+ }
436
+ }
437
+ return extracted;
438
+ }
439
+ /**
440
+ * Generate basic deployment status (fallback)
441
+ */
442
+ async function generateBasicDeploymentStatus() {
443
+ // Gather deployment information
444
+ const [gitInfo, version, checks, dependencies, buildInfo] = await Promise.all([
445
+ getGitInfo(),
446
+ getPackageVersion(),
447
+ runDeploymentChecks(),
448
+ checkDependencies(),
449
+ getBuildInfo(),
450
+ ]);
451
+ const deploymentReadiness = calculateDeploymentReadiness(checks, dependencies);
452
+ // Determine overall status
453
+ let status = 'unknown';
454
+ if (deploymentReadiness.blockers.length > 0) {
455
+ status = 'failed';
456
+ }
457
+ else if (deploymentReadiness.warnings.length > 0) {
458
+ status = 'degraded';
459
+ }
460
+ else if (checks.every(c => c.status === 'passed')) {
461
+ status = 'healthy';
462
+ }
463
+ return {
464
+ environment: process.env['NODE_ENV'] || 'development',
465
+ version,
466
+ branch: gitInfo.branch,
467
+ commit: gitInfo.commit,
468
+ commitMessage: gitInfo.commitMessage,
469
+ lastDeploy: new Date().toISOString(),
470
+ status,
471
+ checks,
472
+ dependencies,
473
+ buildInfo,
474
+ deploymentReadiness,
475
+ };
476
+ }
477
+ /**
478
+ * Generate comprehensive deployment status using deployment-readiness-tool
479
+ */
480
+ async function generateComprehensiveDeploymentStatus(operation, targetEnvironment, enableMemory, strictMode) {
481
+ try {
482
+ // Import the comprehensive tool
483
+ const { deploymentReadiness } = await import('../tools/deployment-readiness-tool.js');
484
+ // Call the tool with appropriate parameters
485
+ const toolResult = await deploymentReadiness({
486
+ operation,
487
+ projectPath: process.cwd(),
488
+ targetEnvironment,
489
+ strictMode,
490
+ enableMemoryIntegration: enableMemory,
491
+ autoCreateTodos: false, // Don't create todos from resource calls
492
+ integrateSandboxing: false,
493
+ blockGitPush: false, // Resource is read-only, don't block operations
494
+ });
495
+ // Extract text content from tool result
496
+ let toolOutputText = '';
497
+ if (toolResult.content && Array.isArray(toolResult.content)) {
498
+ for (const item of toolResult.content) {
499
+ if (item.type === 'text' && item.text) {
500
+ toolOutputText += item.text + '\n';
501
+ }
502
+ }
503
+ }
504
+ // Get basic data
505
+ const basicStatus = await generateBasicDeploymentStatus();
506
+ // Extract enhanced data from tool output
507
+ const enhancedData = extractDeploymentDataFromToolOutput(toolOutputText);
508
+ // Merge basic and enhanced data
509
+ const comprehensiveStatus = {
510
+ ...basicStatus,
511
+ ...enhancedData,
512
+ analysisMetadata: {
513
+ operation,
514
+ timestamp: new Date().toISOString(),
515
+ confidence: 0.95,
516
+ source: 'comprehensive-tool',
517
+ memoryIntegration: enableMemory,
518
+ strictMode,
519
+ },
520
+ };
521
+ return comprehensiveStatus;
522
+ }
523
+ catch (error) {
524
+ console.error('[deployment-status-resource] Tool execution failed, falling back to basic status:', error);
525
+ return generateBasicDeploymentStatus();
526
+ }
527
+ }
528
+ /**
529
+ * Generate comprehensive deployment status resource with readiness analysis and quality gates.
530
+ *
531
+ * Performs multi-dimensional deployment readiness assessment including code quality validation,
532
+ * test execution, dependency health, ADR compliance, deployment history analysis, and optional
533
+ * memory-based pattern recognition for predictive insights.
534
+ *
535
+ * **Query Parameters:**
536
+ * - `operation`: Operation type (default: "check_readiness")
537
+ * - `environment`: Target deployment environment (default: process.env.NODE_ENV || "production")
538
+ * - `memory`: Enable memory integration for historical analysis (default: true)
539
+ * - `strict`: Enable strict zero-tolerance mode (default: true)
540
+ * - `comprehensive`: Use comprehensive analysis vs basic (default: true)
541
+ *
542
+ * **Comprehensive Mode includes:**
543
+ * - TreeSitter AST-based code quality analysis with production code scoring
544
+ * - Zero-tolerance test validation with detailed failure tracking
545
+ * - Deployment history analysis with trend detection
546
+ * - ADR compliance validation
547
+ * - Memory-based pattern analysis and insights
548
+ * - Critical blocker identification with auto-fix suggestions
549
+ * - Git push allow/block decision logic
550
+ *
551
+ * @param _params - URL path parameters (currently unused, reserved for future routing)
552
+ * @param searchParams - URL query parameters controlling analysis behavior
553
+ *
554
+ * @returns Promise resolving to resource generation result containing:
555
+ * - data: Complete deployment status with health metrics and quality gates
556
+ * - contentType: "application/json"
557
+ * - lastModified: ISO timestamp of generation
558
+ * - cacheKey: Unique identifier based on operation/environment/options
559
+ * - ttl: Cache duration (180 seconds / 3 minutes)
560
+ * - etag: Entity tag for cache validation
561
+ *
562
+ * @throws {McpAdrError} When deployment status generation fails due to:
563
+ * - Invalid operation or environment parameters
564
+ * - Deployment-readiness-tool execution failure
565
+ * - Test execution failures (in strict mode)
566
+ * - Cache operation errors
567
+ *
568
+ * @example
569
+ * ```typescript
570
+ * // Basic usage with comprehensive analysis
571
+ * const status = await generateDeploymentStatusResource(
572
+ * {},
573
+ * new URLSearchParams('operation=check_readiness&environment=production')
574
+ * );
575
+ *
576
+ * console.log(`Status: ${status.data.status}`);
577
+ * console.log(`Readiness score: ${status.data.deploymentReadiness.score}`);
578
+ * console.log(`Blockers: ${status.data.deploymentReadiness.blockers.length}`);
579
+ *
580
+ * // Check if deployment is allowed
581
+ * if (status.data.gitPushStatus?.decision === 'blocked') {
582
+ * console.error(`Deployment blocked: ${status.data.gitPushStatus.reason}`);
583
+ * process.exit(1);
584
+ * }
585
+ *
586
+ * // Example with basic mode (faster, less detailed)
587
+ * const basicStatus = await generateDeploymentStatusResource(
588
+ * {},
589
+ * new URLSearchParams('comprehensive=false&memory=false')
590
+ * );
591
+ *
592
+ * // Expected output structure:
593
+ * {
594
+ * data: {
595
+ * environment: "production",
596
+ * status: "healthy",
597
+ * version: "2.0.22",
598
+ * deploymentReadiness: {
599
+ * score: 95,
600
+ * blockers: [],
601
+ * warnings: ["Minor test coverage gaps"],
602
+ * recommendations: ["Increase integration test coverage"]
603
+ * },
604
+ * codeQualityAnalysis: {
605
+ * overallScore: 92,
606
+ * productionCodeScore: 95,
607
+ * qualityGates: [...]
608
+ * },
609
+ * testValidation: {
610
+ * testExecutionResult: "passed",
611
+ * totalTests: 150,
612
+ * passedTests: 150,
613
+ * failedTests: 0,
614
+ * coverage: 85
615
+ * },
616
+ * gitPushStatus: {
617
+ * allowed: true,
618
+ * decision: "allowed",
619
+ * reason: "All quality gates passed"
620
+ * }
621
+ * },
622
+ * contentType: "application/json",
623
+ * cacheKey: "deployment-status:check_readiness:production:true:true:true",
624
+ * ttl: 180
625
+ * }
626
+ * ```
627
+ *
628
+ * @since v2.0.0
629
+ * @see {@link deploymentReadiness} tool for underlying analysis engine
630
+ * @see {@link generateDeploymentHistoryResource} for historical deployment data
631
+ */
632
+ export async function generateDeploymentStatusResource(_params, searchParams) {
633
+ // Extract query parameters
634
+ const operation = searchParams?.get('operation') || 'check_readiness';
635
+ const targetEnvironment = searchParams?.get('environment') || process.env['NODE_ENV'] || 'production';
636
+ const enableMemory = searchParams?.get('memory') !== 'false';
637
+ const strictMode = searchParams?.get('strict') !== 'false';
638
+ const useComprehensive = searchParams?.get('comprehensive') !== 'false';
639
+ const cacheKey = `deployment-status:${operation}:${targetEnvironment}:${enableMemory}:${strictMode}:${useComprehensive}`;
640
+ // Check cache
641
+ const cached = await resourceCache.get(cacheKey);
642
+ if (cached) {
643
+ return cached;
644
+ }
645
+ // Generate deployment status (comprehensive or basic)
646
+ let deploymentStatus;
647
+ if (useComprehensive) {
648
+ deploymentStatus = await generateComprehensiveDeploymentStatus(operation, targetEnvironment, enableMemory, strictMode);
649
+ }
650
+ else {
651
+ deploymentStatus = await generateBasicDeploymentStatus();
652
+ }
653
+ const result = {
654
+ data: deploymentStatus,
655
+ contentType: 'application/json',
656
+ lastModified: new Date().toISOString(),
657
+ cacheKey,
658
+ ttl: 60, // 1 minute cache (deployment status changes frequently)
659
+ etag: generateETag(deploymentStatus),
660
+ };
661
+ // Cache result
662
+ resourceCache.set(cacheKey, result, result.ttl);
663
+ return result;
664
+ }
665
+ //# sourceMappingURL=deployment-status-resource.js.map