mcp-wordpress 2.4.2 → 2.5.1

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 (653) hide show
  1. package/README.md +124 -54
  2. package/bin/status.js +1 -1
  3. package/dist/cache/CacheInvalidation.d.ts +3 -1
  4. package/dist/cache/CacheInvalidation.d.ts.map +1 -1
  5. package/dist/cache/CacheInvalidation.js +10 -4
  6. package/dist/cache/CacheInvalidation.js.map +1 -1
  7. package/dist/cache/CacheManager.d.ts +3 -2
  8. package/dist/cache/CacheManager.d.ts.map +1 -1
  9. package/dist/cache/CacheManager.js +11 -3
  10. package/dist/cache/CacheManager.js.map +1 -1
  11. package/dist/cache/HttpCacheWrapper.d.ts +7 -6
  12. package/dist/cache/HttpCacheWrapper.d.ts.map +1 -1
  13. package/dist/cache/HttpCacheWrapper.js +8 -5
  14. package/dist/cache/HttpCacheWrapper.js.map +1 -1
  15. package/dist/cache/index.d.ts +3 -3
  16. package/dist/cache/index.d.ts.map +1 -1
  17. package/dist/cache/index.js +1 -1
  18. package/dist/cache/index.js.map +1 -1
  19. package/dist/client/CachedWordPressClient.d.ts +23 -9
  20. package/dist/client/CachedWordPressClient.d.ts.map +1 -1
  21. package/dist/client/CachedWordPressClient.js +4 -1
  22. package/dist/client/CachedWordPressClient.js.map +1 -1
  23. package/dist/client/MockWordPressClient.d.ts +2 -1
  24. package/dist/client/MockWordPressClient.d.ts.map +1 -1
  25. package/dist/client/MockWordPressClient.js +3 -1
  26. package/dist/client/MockWordPressClient.js.map +1 -1
  27. package/dist/client/api.d.ts +17 -13
  28. package/dist/client/api.d.ts.map +1 -1
  29. package/dist/client/api.js +135 -30
  30. package/dist/client/api.js.map +1 -1
  31. package/dist/client/auth.d.ts.map +1 -1
  32. package/dist/client/auth.js +2 -3
  33. package/dist/client/auth.js.map +1 -1
  34. package/dist/client/managers/AuthenticationManager.d.ts +55 -2
  35. package/dist/client/managers/AuthenticationManager.d.ts.map +1 -1
  36. package/dist/client/managers/AuthenticationManager.js +269 -71
  37. package/dist/client/managers/AuthenticationManager.js.map +1 -1
  38. package/dist/client/managers/BaseManager.d.ts +3 -3
  39. package/dist/client/managers/BaseManager.d.ts.map +1 -1
  40. package/dist/client/managers/BaseManager.js +11 -5
  41. package/dist/client/managers/BaseManager.js.map +1 -1
  42. package/dist/client/managers/RequestManager.d.ts +2 -2
  43. package/dist/client/managers/RequestManager.d.ts.map +1 -1
  44. package/dist/client/managers/RequestManager.js +25 -12
  45. package/dist/client/managers/RequestManager.js.map +1 -1
  46. package/dist/config/Config.d.ts +155 -0
  47. package/dist/config/Config.d.ts.map +1 -0
  48. package/dist/config/Config.js +215 -0
  49. package/dist/config/Config.js.map +1 -0
  50. package/dist/config/ConfigurationSchema.d.ts +21 -21
  51. package/dist/config/ConfigurationSchema.d.ts.map +1 -1
  52. package/dist/config/ConfigurationSchema.js +19 -2
  53. package/dist/config/ConfigurationSchema.js.map +1 -1
  54. package/dist/config/ServerConfiguration.d.ts +2 -1
  55. package/dist/config/ServerConfiguration.d.ts.map +1 -1
  56. package/dist/config/ServerConfiguration.js +73 -43
  57. package/dist/config/ServerConfiguration.js.map +1 -1
  58. package/dist/docs/DocumentationGenerator.d.ts +9 -8
  59. package/dist/docs/DocumentationGenerator.d.ts.map +1 -1
  60. package/dist/docs/DocumentationGenerator.js +10 -7
  61. package/dist/docs/DocumentationGenerator.js.map +1 -1
  62. package/dist/docs/MarkdownFormatter.d.ts.map +1 -1
  63. package/dist/docs/MarkdownFormatter.js +3 -2
  64. package/dist/docs/MarkdownFormatter.js.map +1 -1
  65. package/dist/dxt-entry.js +15 -14
  66. package/dist/dxt-entry.js.map +1 -1
  67. package/dist/index.d.ts +3 -1
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +37 -21
  70. package/dist/index.js.map +1 -1
  71. package/dist/performance/MetricsCollector.d.ts +13 -7
  72. package/dist/performance/MetricsCollector.d.ts.map +1 -1
  73. package/dist/performance/MetricsCollector.js +69 -27
  74. package/dist/performance/MetricsCollector.js.map +1 -1
  75. package/dist/performance/PerformanceAnalytics.d.ts +8 -2
  76. package/dist/performance/PerformanceAnalytics.d.ts.map +1 -1
  77. package/dist/performance/PerformanceAnalytics.js +17 -47
  78. package/dist/performance/PerformanceAnalytics.js.map +1 -1
  79. package/dist/performance/PerformanceMonitor.d.ts +2 -1
  80. package/dist/performance/PerformanceMonitor.d.ts.map +1 -1
  81. package/dist/performance/PerformanceMonitor.js +12 -13
  82. package/dist/performance/PerformanceMonitor.js.map +1 -1
  83. package/dist/performance/index.d.ts +2 -2
  84. package/dist/performance/index.d.ts.map +1 -1
  85. package/dist/security/AISecurityScanner.d.ts +1 -0
  86. package/dist/security/AISecurityScanner.d.ts.map +1 -1
  87. package/dist/security/AISecurityScanner.js +22 -12
  88. package/dist/security/AISecurityScanner.js.map +1 -1
  89. package/dist/security/AutomatedRemediation.d.ts +4 -3
  90. package/dist/security/AutomatedRemediation.d.ts.map +1 -1
  91. package/dist/security/AutomatedRemediation.js +46 -15
  92. package/dist/security/AutomatedRemediation.js.map +1 -1
  93. package/dist/security/InputValidator.d.ts +13 -9
  94. package/dist/security/InputValidator.d.ts.map +1 -1
  95. package/dist/security/InputValidator.js +4 -2
  96. package/dist/security/InputValidator.js.map +1 -1
  97. package/dist/security/SecurityCIPipeline.d.ts +1 -1
  98. package/dist/security/SecurityCIPipeline.d.ts.map +1 -1
  99. package/dist/security/SecurityCIPipeline.js +38 -29
  100. package/dist/security/SecurityCIPipeline.js.map +1 -1
  101. package/dist/security/SecurityConfig.d.ts +3 -3
  102. package/dist/security/SecurityConfig.d.ts.map +1 -1
  103. package/dist/security/SecurityConfig.js +13 -9
  104. package/dist/security/SecurityConfig.js.map +1 -1
  105. package/dist/security/SecurityConfigManager.d.ts +2 -2
  106. package/dist/security/SecurityConfigManager.d.ts.map +1 -1
  107. package/dist/security/SecurityConfigManager.js +20 -15
  108. package/dist/security/SecurityConfigManager.js.map +1 -1
  109. package/dist/security/SecurityMonitoring.d.ts +2 -2
  110. package/dist/security/SecurityMonitoring.d.ts.map +1 -1
  111. package/dist/security/SecurityMonitoring.js +19 -17
  112. package/dist/security/SecurityMonitoring.js.map +1 -1
  113. package/dist/security/SecurityReviewer.d.ts.map +1 -1
  114. package/dist/security/SecurityReviewer.js +10 -7
  115. package/dist/security/SecurityReviewer.js.map +1 -1
  116. package/dist/security/index.d.ts +24 -23
  117. package/dist/security/index.d.ts.map +1 -1
  118. package/dist/security/index.js +52 -23
  119. package/dist/security/index.js.map +1 -1
  120. package/dist/server/ConnectionTester.d.ts +12 -4
  121. package/dist/server/ConnectionTester.d.ts.map +1 -1
  122. package/dist/server/ConnectionTester.js +96 -22
  123. package/dist/server/ConnectionTester.js.map +1 -1
  124. package/dist/server/ToolRegistry.d.ts +2 -2
  125. package/dist/server/ToolRegistry.d.ts.map +1 -1
  126. package/dist/server/ToolRegistry.js +10 -5
  127. package/dist/server/ToolRegistry.js.map +1 -1
  128. package/dist/src/cache/CacheInvalidation.d.ts +120 -0
  129. package/dist/src/cache/CacheInvalidation.d.ts.map +1 -0
  130. package/dist/src/cache/CacheInvalidation.js +355 -0
  131. package/dist/src/cache/CacheInvalidation.js.map +1 -0
  132. package/dist/src/cache/CacheManager.d.ts +149 -0
  133. package/dist/src/cache/CacheManager.d.ts.map +1 -0
  134. package/dist/src/cache/CacheManager.js +326 -0
  135. package/dist/src/cache/CacheManager.js.map +1 -0
  136. package/dist/src/cache/HttpCacheWrapper.d.ts +122 -0
  137. package/dist/src/cache/HttpCacheWrapper.d.ts.map +1 -0
  138. package/dist/src/cache/HttpCacheWrapper.js +283 -0
  139. package/dist/src/cache/HttpCacheWrapper.js.map +1 -0
  140. package/dist/src/cache/index.d.ts +12 -0
  141. package/dist/src/cache/index.d.ts.map +1 -0
  142. package/dist/src/cache/index.js +9 -0
  143. package/dist/src/cache/index.js.map +1 -0
  144. package/dist/src/client/CachedWordPressClient.d.ts +174 -0
  145. package/dist/src/client/CachedWordPressClient.d.ts.map +1 -0
  146. package/dist/src/client/CachedWordPressClient.js +345 -0
  147. package/dist/src/client/CachedWordPressClient.js.map +1 -0
  148. package/dist/src/client/MockWordPressClient.d.ts +56 -0
  149. package/dist/src/client/MockWordPressClient.d.ts.map +1 -0
  150. package/dist/src/client/MockWordPressClient.js +371 -0
  151. package/dist/src/client/MockWordPressClient.js.map +1 -0
  152. package/dist/src/client/api.d.ts +235 -0
  153. package/dist/src/client/api.d.ts.map +1 -0
  154. package/dist/src/client/api.js +896 -0
  155. package/dist/src/client/api.js.map +1 -0
  156. package/dist/src/client/auth.d.ts +121 -0
  157. package/dist/src/client/auth.d.ts.map +1 -0
  158. package/dist/src/client/auth.js +429 -0
  159. package/dist/src/client/auth.js.map +1 -0
  160. package/dist/src/client/managers/AuthenticationManager.d.ts +92 -0
  161. package/dist/src/client/managers/AuthenticationManager.d.ts.map +1 -0
  162. package/dist/src/client/managers/AuthenticationManager.js +369 -0
  163. package/dist/src/client/managers/AuthenticationManager.js.map +1 -0
  164. package/dist/src/client/managers/BaseManager.d.ts +22 -0
  165. package/dist/src/client/managers/BaseManager.d.ts.map +1 -0
  166. package/dist/src/client/managers/BaseManager.js +53 -0
  167. package/dist/src/client/managers/BaseManager.js.map +1 -0
  168. package/dist/src/client/managers/RequestManager.d.ts +47 -0
  169. package/dist/src/client/managers/RequestManager.d.ts.map +1 -0
  170. package/dist/src/client/managers/RequestManager.js +193 -0
  171. package/dist/src/client/managers/RequestManager.js.map +1 -0
  172. package/dist/src/client/managers/index.d.ts +8 -0
  173. package/dist/src/client/managers/index.d.ts.map +1 -0
  174. package/dist/src/client/managers/index.js +8 -0
  175. package/dist/src/client/managers/index.js.map +1 -0
  176. package/dist/src/config/Config.d.ts +155 -0
  177. package/dist/src/config/Config.d.ts.map +1 -0
  178. package/dist/src/config/Config.js +215 -0
  179. package/dist/src/config/Config.js.map +1 -0
  180. package/dist/src/config/ConfigurationSchema.d.ts +281 -0
  181. package/dist/src/config/ConfigurationSchema.d.ts.map +1 -0
  182. package/dist/src/config/ConfigurationSchema.js +205 -0
  183. package/dist/src/config/ConfigurationSchema.js.map +1 -0
  184. package/dist/src/config/ServerConfiguration.d.ts +47 -0
  185. package/dist/src/config/ServerConfiguration.d.ts.map +1 -0
  186. package/dist/src/config/ServerConfiguration.js +255 -0
  187. package/dist/src/config/ServerConfiguration.js.map +1 -0
  188. package/dist/src/docs/DocumentationGenerator.d.ts +185 -0
  189. package/dist/src/docs/DocumentationGenerator.d.ts.map +1 -0
  190. package/dist/src/docs/DocumentationGenerator.js +777 -0
  191. package/dist/src/docs/DocumentationGenerator.js.map +1 -0
  192. package/dist/src/docs/MarkdownFormatter.d.ts +84 -0
  193. package/dist/src/docs/MarkdownFormatter.d.ts.map +1 -0
  194. package/dist/src/docs/MarkdownFormatter.js +458 -0
  195. package/dist/src/docs/MarkdownFormatter.js.map +1 -0
  196. package/dist/src/docs/index.d.ts +8 -0
  197. package/dist/src/docs/index.d.ts.map +1 -0
  198. package/dist/src/docs/index.js +7 -0
  199. package/dist/src/docs/index.js.map +1 -0
  200. package/dist/src/dxt-entry.d.ts +6 -0
  201. package/dist/src/dxt-entry.d.ts.map +1 -0
  202. package/dist/src/dxt-entry.js +39 -0
  203. package/dist/src/dxt-entry.js.map +1 -0
  204. package/dist/src/index.d.ts +18 -0
  205. package/dist/src/index.d.ts.map +1 -0
  206. package/dist/src/index.js +143 -0
  207. package/dist/src/index.js.map +1 -0
  208. package/dist/src/performance/MetricsCollector.d.ts +145 -0
  209. package/dist/src/performance/MetricsCollector.d.ts.map +1 -0
  210. package/dist/src/performance/MetricsCollector.js +368 -0
  211. package/dist/src/performance/MetricsCollector.js.map +1 -0
  212. package/dist/src/performance/PerformanceAnalytics.d.ts +168 -0
  213. package/dist/src/performance/PerformanceAnalytics.d.ts.map +1 -0
  214. package/dist/src/performance/PerformanceAnalytics.js +570 -0
  215. package/dist/src/performance/PerformanceAnalytics.js.map +1 -0
  216. package/dist/src/performance/PerformanceMonitor.d.ts +203 -0
  217. package/dist/src/performance/PerformanceMonitor.d.ts.map +1 -0
  218. package/dist/src/performance/PerformanceMonitor.js +478 -0
  219. package/dist/src/performance/PerformanceMonitor.js.map +1 -0
  220. package/dist/src/performance/index.d.ts +11 -0
  221. package/dist/src/performance/index.d.ts.map +1 -0
  222. package/dist/src/performance/index.js +8 -0
  223. package/dist/src/performance/index.js.map +1 -0
  224. package/dist/src/security/AISecurityScanner.d.ts +176 -0
  225. package/dist/src/security/AISecurityScanner.d.ts.map +1 -0
  226. package/dist/src/security/AISecurityScanner.js +655 -0
  227. package/dist/src/security/AISecurityScanner.js.map +1 -0
  228. package/dist/src/security/AutomatedRemediation.d.ts +146 -0
  229. package/dist/src/security/AutomatedRemediation.d.ts.map +1 -0
  230. package/dist/src/security/AutomatedRemediation.js +566 -0
  231. package/dist/src/security/AutomatedRemediation.js.map +1 -0
  232. package/dist/src/security/InputValidator.d.ts +219 -0
  233. package/dist/src/security/InputValidator.d.ts.map +1 -0
  234. package/dist/src/security/InputValidator.js +295 -0
  235. package/dist/src/security/InputValidator.js.map +1 -0
  236. package/dist/src/security/SecurityCIPipeline.d.ts +213 -0
  237. package/dist/src/security/SecurityCIPipeline.d.ts.map +1 -0
  238. package/dist/src/security/SecurityCIPipeline.js +693 -0
  239. package/dist/src/security/SecurityCIPipeline.js.map +1 -0
  240. package/dist/src/security/SecurityConfig.d.ts +129 -0
  241. package/dist/src/security/SecurityConfig.d.ts.map +1 -0
  242. package/dist/src/security/SecurityConfig.js +266 -0
  243. package/dist/src/security/SecurityConfig.js.map +1 -0
  244. package/dist/src/security/SecurityConfigManager.d.ts +294 -0
  245. package/dist/src/security/SecurityConfigManager.d.ts.map +1 -0
  246. package/dist/src/security/SecurityConfigManager.js +558 -0
  247. package/dist/src/security/SecurityConfigManager.js.map +1 -0
  248. package/dist/src/security/SecurityMonitoring.d.ts +245 -0
  249. package/dist/src/security/SecurityMonitoring.d.ts.map +1 -0
  250. package/dist/src/security/SecurityMonitoring.js +598 -0
  251. package/dist/src/security/SecurityMonitoring.js.map +1 -0
  252. package/dist/src/security/SecurityReviewer.d.ts +168 -0
  253. package/dist/src/security/SecurityReviewer.d.ts.map +1 -0
  254. package/dist/src/security/SecurityReviewer.js +686 -0
  255. package/dist/src/security/SecurityReviewer.js.map +1 -0
  256. package/dist/src/security/index.d.ts +183 -0
  257. package/dist/src/security/index.d.ts.map +1 -0
  258. package/dist/src/security/index.js +218 -0
  259. package/dist/src/security/index.js.map +1 -0
  260. package/dist/src/server/ConnectionTester.d.ts +32 -0
  261. package/dist/src/server/ConnectionTester.d.ts.map +1 -0
  262. package/dist/src/server/ConnectionTester.js +135 -0
  263. package/dist/src/server/ConnectionTester.js.map +1 -0
  264. package/dist/src/server/ToolRegistry.d.ts +50 -0
  265. package/dist/src/server/ToolRegistry.d.ts.map +1 -0
  266. package/dist/src/server/ToolRegistry.js +219 -0
  267. package/dist/src/server/ToolRegistry.js.map +1 -0
  268. package/dist/src/server.d.ts +7 -0
  269. package/dist/src/server.d.ts.map +1 -0
  270. package/dist/src/server.js +7 -0
  271. package/dist/src/server.js.map +1 -0
  272. package/dist/src/tools/BaseToolManager.d.ts +62 -0
  273. package/dist/src/tools/BaseToolManager.d.ts.map +1 -0
  274. package/dist/src/tools/BaseToolManager.js +195 -0
  275. package/dist/src/tools/BaseToolManager.js.map +1 -0
  276. package/dist/src/tools/auth.d.ts +50 -0
  277. package/dist/src/tools/auth.d.ts.map +1 -0
  278. package/dist/src/tools/auth.js +133 -0
  279. package/dist/src/tools/auth.js.map +1 -0
  280. package/dist/src/tools/cache.d.ts +260 -0
  281. package/dist/src/tools/cache.d.ts.map +1 -0
  282. package/dist/src/tools/cache.js +232 -0
  283. package/dist/src/tools/cache.js.map +1 -0
  284. package/dist/src/tools/comments.d.ts +33 -0
  285. package/dist/src/tools/comments.d.ts.map +1 -0
  286. package/dist/src/tools/comments.js +235 -0
  287. package/dist/src/tools/comments.js.map +1 -0
  288. package/dist/src/tools/index.d.ts +11 -0
  289. package/dist/src/tools/index.d.ts.map +1 -0
  290. package/dist/src/tools/index.js +11 -0
  291. package/dist/src/tools/index.js.map +1 -0
  292. package/dist/src/tools/media.d.ts +70 -0
  293. package/dist/src/tools/media.d.ts.map +1 -0
  294. package/dist/src/tools/media.js +248 -0
  295. package/dist/src/tools/media.js.map +1 -0
  296. package/dist/src/tools/pages.d.ts +32 -0
  297. package/dist/src/tools/pages.d.ts.map +1 -0
  298. package/dist/src/tools/pages.js +215 -0
  299. package/dist/src/tools/pages.js.map +1 -0
  300. package/dist/src/tools/performance.d.ts +73 -0
  301. package/dist/src/tools/performance.d.ts.map +1 -0
  302. package/dist/src/tools/performance.js +922 -0
  303. package/dist/src/tools/performance.js.map +1 -0
  304. package/dist/src/tools/posts/PostHandlers.d.ts +46 -0
  305. package/dist/src/tools/posts/PostHandlers.d.ts.map +1 -0
  306. package/dist/src/tools/posts/PostHandlers.js +400 -0
  307. package/dist/src/tools/posts/PostHandlers.js.map +1 -0
  308. package/dist/src/tools/posts/PostToolDefinitions.d.ts +37 -0
  309. package/dist/src/tools/posts/PostToolDefinitions.d.ts.map +1 -0
  310. package/dist/src/tools/posts/PostToolDefinitions.js +236 -0
  311. package/dist/src/tools/posts/PostToolDefinitions.js.map +1 -0
  312. package/dist/src/tools/posts/index.d.ts +138 -0
  313. package/dist/src/tools/posts/index.d.ts.map +1 -0
  314. package/dist/src/tools/posts/index.js +163 -0
  315. package/dist/src/tools/posts/index.js.map +1 -0
  316. package/dist/src/tools/posts.d.ts +15 -0
  317. package/dist/src/tools/posts.d.ts.map +1 -0
  318. package/dist/src/tools/posts.js +16 -0
  319. package/dist/src/tools/posts.js.map +1 -0
  320. package/dist/src/tools/site.d.ts +32 -0
  321. package/dist/src/tools/site.d.ts.map +1 -0
  322. package/dist/src/tools/site.js +234 -0
  323. package/dist/src/tools/site.js.map +1 -0
  324. package/dist/src/tools/taxonomies.d.ts +36 -0
  325. package/dist/src/tools/taxonomies.d.ts.map +1 -0
  326. package/dist/src/tools/taxonomies.js +286 -0
  327. package/dist/src/tools/taxonomies.js.map +1 -0
  328. package/dist/src/tools/users.d.ts +33 -0
  329. package/dist/src/tools/users.d.ts.map +1 -0
  330. package/dist/src/tools/users.js +308 -0
  331. package/dist/src/tools/users.js.map +1 -0
  332. package/dist/src/types/client.d.ts +223 -0
  333. package/dist/src/types/client.d.ts.map +1 -0
  334. package/dist/src/types/client.js +97 -0
  335. package/dist/src/types/client.js.map +1 -0
  336. package/dist/src/types/enhanced.d.ts +237 -0
  337. package/dist/src/types/enhanced.d.ts.map +1 -0
  338. package/dist/src/types/enhanced.js +49 -0
  339. package/dist/src/types/enhanced.js.map +1 -0
  340. package/dist/src/types/index.d.ts +160 -0
  341. package/dist/src/types/index.d.ts.map +1 -0
  342. package/dist/src/types/index.js +14 -0
  343. package/dist/src/types/index.js.map +1 -0
  344. package/dist/src/types/mcp.d.ts +178 -0
  345. package/dist/src/types/mcp.d.ts.map +1 -0
  346. package/dist/src/types/mcp.js +7 -0
  347. package/dist/src/types/mcp.js.map +1 -0
  348. package/dist/src/types/requests.d.ts +322 -0
  349. package/dist/src/types/requests.d.ts.map +1 -0
  350. package/dist/src/types/requests.js +8 -0
  351. package/dist/src/types/requests.js.map +1 -0
  352. package/dist/src/types/tools.d.ts +506 -0
  353. package/dist/src/types/tools.d.ts.map +1 -0
  354. package/dist/src/types/tools.js +8 -0
  355. package/dist/src/types/tools.js.map +1 -0
  356. package/dist/src/types/wordpress.d.ts +471 -0
  357. package/dist/src/types/wordpress.d.ts.map +1 -0
  358. package/dist/src/types/wordpress.js +14 -0
  359. package/dist/src/types/wordpress.js.map +1 -0
  360. package/dist/src/utils/debug.d.ts +71 -0
  361. package/dist/src/utils/debug.d.ts.map +1 -0
  362. package/dist/src/utils/debug.js +235 -0
  363. package/dist/src/utils/debug.js.map +1 -0
  364. package/dist/src/utils/enhancedError.d.ts +61 -0
  365. package/dist/src/utils/enhancedError.d.ts.map +1 -0
  366. package/dist/src/utils/enhancedError.js +221 -0
  367. package/dist/src/utils/enhancedError.js.map +1 -0
  368. package/dist/src/utils/error.d.ts +17 -0
  369. package/dist/src/utils/error.d.ts.map +1 -0
  370. package/dist/src/utils/error.js +108 -0
  371. package/dist/src/utils/error.js.map +1 -0
  372. package/dist/src/utils/logger.d.ts +106 -0
  373. package/dist/src/utils/logger.d.ts.map +1 -0
  374. package/dist/src/utils/logger.js +280 -0
  375. package/dist/src/utils/logger.js.map +1 -0
  376. package/dist/src/utils/streaming.d.ts +104 -0
  377. package/dist/src/utils/streaming.d.ts.map +1 -0
  378. package/dist/src/utils/streaming.js +331 -0
  379. package/dist/src/utils/streaming.js.map +1 -0
  380. package/dist/src/utils/toolWrapper.d.ts +42 -0
  381. package/dist/src/utils/toolWrapper.d.ts.map +1 -0
  382. package/dist/src/utils/toolWrapper.js +101 -0
  383. package/dist/src/utils/toolWrapper.js.map +1 -0
  384. package/dist/src/utils/validation/core.d.ts +21 -0
  385. package/dist/src/utils/validation/core.d.ts.map +1 -0
  386. package/dist/src/utils/validation/core.js +71 -0
  387. package/dist/src/utils/validation/core.js.map +1 -0
  388. package/dist/src/utils/validation/index.d.ts +25 -0
  389. package/dist/src/utils/validation/index.d.ts.map +1 -0
  390. package/dist/src/utils/validation/index.js +29 -0
  391. package/dist/src/utils/validation/index.js.map +1 -0
  392. package/dist/src/utils/validation/network.d.ts +19 -0
  393. package/dist/src/utils/validation/network.d.ts.map +1 -0
  394. package/dist/src/utils/validation/network.js +93 -0
  395. package/dist/src/utils/validation/network.js.map +1 -0
  396. package/dist/src/utils/validation/rateLimit.d.ts +21 -0
  397. package/dist/src/utils/validation/rateLimit.d.ts.map +1 -0
  398. package/dist/src/utils/validation/rateLimit.js +43 -0
  399. package/dist/src/utils/validation/rateLimit.js.map +1 -0
  400. package/dist/src/utils/validation/security.d.ts +29 -0
  401. package/dist/src/utils/validation/security.d.ts.map +1 -0
  402. package/dist/src/utils/validation/security.js +327 -0
  403. package/dist/src/utils/validation/security.js.map +1 -0
  404. package/dist/src/utils/validation/wordpress.d.ts +31 -0
  405. package/dist/src/utils/validation/wordpress.d.ts.map +1 -0
  406. package/dist/src/utils/validation/wordpress.js +146 -0
  407. package/dist/src/utils/validation/wordpress.js.map +1 -0
  408. package/dist/src/utils/validation.d.ts +15 -0
  409. package/dist/src/utils/validation.d.ts.map +1 -0
  410. package/dist/src/utils/validation.js +27 -0
  411. package/dist/src/utils/validation.js.map +1 -0
  412. package/dist/tests/vitest.setup.d.ts +6 -0
  413. package/dist/tests/vitest.setup.d.ts.map +1 -0
  414. package/dist/tests/vitest.setup.js +39 -0
  415. package/dist/tests/vitest.setup.js.map +1 -0
  416. package/dist/tools/BaseToolManager.d.ts +47 -11
  417. package/dist/tools/BaseToolManager.d.ts.map +1 -1
  418. package/dist/tools/BaseToolManager.js +168 -29
  419. package/dist/tools/BaseToolManager.js.map +1 -1
  420. package/dist/tools/auth.d.ts +16 -10
  421. package/dist/tools/auth.d.ts.map +1 -1
  422. package/dist/tools/auth.js +3 -2
  423. package/dist/tools/auth.js.map +1 -1
  424. package/dist/tools/cache.d.ts +30 -30
  425. package/dist/tools/cache.d.ts.map +1 -1
  426. package/dist/tools/cache.js +1 -6
  427. package/dist/tools/cache.js.map +1 -1
  428. package/dist/tools/comments.d.ts +20 -20
  429. package/dist/tools/comments.d.ts.map +1 -1
  430. package/dist/tools/comments.js +16 -9
  431. package/dist/tools/comments.js.map +1 -1
  432. package/dist/tools/media.d.ts +18 -16
  433. package/dist/tools/media.d.ts.map +1 -1
  434. package/dist/tools/media.js +16 -15
  435. package/dist/tools/media.js.map +1 -1
  436. package/dist/tools/pages.d.ts +19 -17
  437. package/dist/tools/pages.d.ts.map +1 -1
  438. package/dist/tools/pages.js +16 -12
  439. package/dist/tools/pages.js.map +1 -1
  440. package/dist/tools/performance.d.ts +11 -1
  441. package/dist/tools/performance.d.ts.map +1 -1
  442. package/dist/tools/performance.js +67 -34
  443. package/dist/tools/performance.js.map +1 -1
  444. package/dist/tools/posts/PostHandlers.d.ts +46 -0
  445. package/dist/tools/posts/PostHandlers.d.ts.map +1 -0
  446. package/dist/tools/posts/PostHandlers.js +400 -0
  447. package/dist/tools/posts/PostHandlers.js.map +1 -0
  448. package/dist/tools/posts/PostToolDefinitions.d.ts +37 -0
  449. package/dist/tools/posts/PostToolDefinitions.d.ts.map +1 -0
  450. package/dist/tools/posts/PostToolDefinitions.js +236 -0
  451. package/dist/tools/posts/PostToolDefinitions.js.map +1 -0
  452. package/dist/tools/posts/index.d.ts +138 -0
  453. package/dist/tools/posts/index.d.ts.map +1 -0
  454. package/dist/tools/posts/index.js +163 -0
  455. package/dist/tools/posts/index.js.map +1 -0
  456. package/dist/tools/posts.d.ts +10 -246
  457. package/dist/tools/posts.d.ts.map +1 -1
  458. package/dist/tools/posts.js +11 -723
  459. package/dist/tools/posts.js.map +1 -1
  460. package/dist/tools/site.d.ts +19 -18
  461. package/dist/tools/site.d.ts.map +1 -1
  462. package/dist/tools/site.js +14 -10
  463. package/dist/tools/site.js.map +1 -1
  464. package/dist/tools/taxonomies.d.ts +23 -24
  465. package/dist/tools/taxonomies.d.ts.map +1 -1
  466. package/dist/tools/taxonomies.js +24 -18
  467. package/dist/tools/taxonomies.js.map +1 -1
  468. package/dist/tools/users.d.ts +20 -15
  469. package/dist/tools/users.d.ts.map +1 -1
  470. package/dist/tools/users.js +12 -8
  471. package/dist/tools/users.js.map +1 -1
  472. package/dist/types/client.d.ts +48 -41
  473. package/dist/types/client.d.ts.map +1 -1
  474. package/dist/types/client.js +30 -5
  475. package/dist/types/client.js.map +1 -1
  476. package/dist/types/enhanced.d.ts +237 -0
  477. package/dist/types/enhanced.d.ts.map +1 -0
  478. package/dist/types/enhanced.js +49 -0
  479. package/dist/types/enhanced.js.map +1 -0
  480. package/dist/types/index.d.ts +15 -12
  481. package/dist/types/index.d.ts.map +1 -1
  482. package/dist/types/index.js +2 -0
  483. package/dist/types/index.js.map +1 -1
  484. package/dist/types/mcp.d.ts +12 -12
  485. package/dist/types/mcp.d.ts.map +1 -1
  486. package/dist/types/requests.d.ts +322 -0
  487. package/dist/types/requests.d.ts.map +1 -0
  488. package/dist/types/requests.js +8 -0
  489. package/dist/types/requests.js.map +1 -0
  490. package/dist/types/tools.d.ts +506 -0
  491. package/dist/types/tools.d.ts.map +1 -0
  492. package/dist/types/tools.js +8 -0
  493. package/dist/types/tools.js.map +1 -0
  494. package/dist/types/wordpress.d.ts +43 -15
  495. package/dist/types/wordpress.d.ts.map +1 -1
  496. package/dist/types/wordpress.js +8 -1
  497. package/dist/types/wordpress.js.map +1 -1
  498. package/dist/utils/debug.d.ts +19 -11
  499. package/dist/utils/debug.d.ts.map +1 -1
  500. package/dist/utils/debug.js +46 -10
  501. package/dist/utils/debug.js.map +1 -1
  502. package/dist/utils/enhancedError.d.ts +8 -8
  503. package/dist/utils/enhancedError.d.ts.map +1 -1
  504. package/dist/utils/enhancedError.js.map +1 -1
  505. package/dist/utils/error.d.ts +2 -4
  506. package/dist/utils/error.d.ts.map +1 -1
  507. package/dist/utils/error.js +42 -5
  508. package/dist/utils/error.js.map +1 -1
  509. package/dist/utils/logger.d.ts +106 -0
  510. package/dist/utils/logger.d.ts.map +1 -0
  511. package/dist/utils/logger.js +280 -0
  512. package/dist/utils/logger.js.map +1 -0
  513. package/dist/utils/streaming.d.ts +9 -9
  514. package/dist/utils/streaming.d.ts.map +1 -1
  515. package/dist/utils/streaming.js +71 -52
  516. package/dist/utils/streaming.js.map +1 -1
  517. package/dist/utils/toolWrapper.d.ts +9 -7
  518. package/dist/utils/toolWrapper.d.ts.map +1 -1
  519. package/dist/utils/toolWrapper.js.map +1 -1
  520. package/dist/utils/validation/core.d.ts +21 -0
  521. package/dist/utils/validation/core.d.ts.map +1 -0
  522. package/dist/utils/validation/core.js +71 -0
  523. package/dist/utils/validation/core.js.map +1 -0
  524. package/dist/utils/validation/index.d.ts +25 -0
  525. package/dist/utils/validation/index.d.ts.map +1 -0
  526. package/dist/utils/validation/index.js +29 -0
  527. package/dist/utils/validation/index.js.map +1 -0
  528. package/dist/utils/validation/network.d.ts +19 -0
  529. package/dist/utils/validation/network.d.ts.map +1 -0
  530. package/dist/utils/validation/network.js +93 -0
  531. package/dist/utils/validation/network.js.map +1 -0
  532. package/dist/utils/validation/rateLimit.d.ts +21 -0
  533. package/dist/utils/validation/rateLimit.d.ts.map +1 -0
  534. package/dist/utils/validation/rateLimit.js +43 -0
  535. package/dist/utils/validation/rateLimit.js.map +1 -0
  536. package/dist/utils/validation/security.d.ts +29 -0
  537. package/dist/utils/validation/security.d.ts.map +1 -0
  538. package/dist/utils/validation/security.js +327 -0
  539. package/dist/utils/validation/security.js.map +1 -0
  540. package/dist/utils/validation/wordpress.d.ts +31 -0
  541. package/dist/utils/validation/wordpress.d.ts.map +1 -0
  542. package/dist/utils/validation/wordpress.js +146 -0
  543. package/dist/utils/validation/wordpress.js.map +1 -0
  544. package/dist/utils/validation.d.ts +13 -82
  545. package/dist/utils/validation.d.ts.map +1 -1
  546. package/dist/utils/validation.js +25 -343
  547. package/dist/utils/validation.js.map +1 -1
  548. package/docs/BADGE_UPDATES.md +132 -0
  549. package/docs/CI_CD_IMPROVEMENTS.md +191 -0
  550. package/docs/INCREMENTAL_COVERAGE.md +183 -0
  551. package/docs/INSTALLATION.md +4 -2
  552. package/docs/TROUBLESHOOTING.md +2 -1
  553. package/docs/api/README.md +3 -1
  554. package/docs/api/openapi.json +5 -1
  555. package/docs/api/summary.json +1 -1
  556. package/docs/api/tools/wp_create_post.md +12 -14
  557. package/docs/developer/TESTING.md +24 -19
  558. package/docs/examples/claude-desktop-config.md +1 -1
  559. package/docs/examples/docker-production.md +100 -93
  560. package/docs/examples/multi-site-setup.md +5 -4
  561. package/docs/examples/single-site-setup.md +3 -4
  562. package/docs/examples/use-case-workflows.md +4 -5
  563. package/docs/integrations/claude-desktop.md +39 -34
  564. package/docs/integrations/cline.md +4 -4
  565. package/docs/integrations/vs-code.md +9 -8
  566. package/docs/user-guides/DXT_INSTALLATION.md +2 -1
  567. package/docs/user-guides/SMITHERY_SETUP.md +10 -10
  568. package/package.json +57 -39
  569. package/src/cache/CacheInvalidation.ts +12 -5
  570. package/src/cache/CacheManager.ts +18 -15
  571. package/src/cache/HttpCacheWrapper.ts +30 -59
  572. package/src/cache/__tests__/HttpCacheWrapper.test.ts +6 -5
  573. package/src/cache/index.ts +3 -14
  574. package/src/client/CachedWordPressClient.ts +32 -30
  575. package/src/client/MockWordPressClient.ts +4 -2
  576. package/src/client/api.ts +186 -64
  577. package/src/client/auth.ts +15 -40
  578. package/src/client/managers/AuthenticationManager.ts +337 -77
  579. package/src/client/managers/BaseManager.ts +18 -30
  580. package/src/client/managers/RequestManager.ts +39 -44
  581. package/src/config/Config.ts +308 -0
  582. package/src/config/ConfigurationSchema.ts +23 -2
  583. package/src/config/ServerConfiguration.ts +73 -49
  584. package/src/docs/DocumentationGenerator.ts +50 -39
  585. package/src/docs/MarkdownFormatter.ts +19 -29
  586. package/src/dxt-entry.cjs +26 -16
  587. package/src/dxt-entry.ts +17 -27
  588. package/src/index.ts +42 -28
  589. package/src/performance/MetricsCollector.ts +108 -86
  590. package/src/performance/PerformanceAnalytics.ts +69 -164
  591. package/src/performance/PerformanceMonitor.ts +32 -47
  592. package/src/performance/index.ts +2 -10
  593. package/src/security/AISecurityScanner.ts +22 -12
  594. package/src/security/AutomatedRemediation.ts +49 -18
  595. package/src/security/InputValidator.ts +9 -6
  596. package/src/security/SecurityCIPipeline.ts +53 -37
  597. package/src/security/SecurityConfig.ts +22 -22
  598. package/src/security/SecurityConfigManager.ts +23 -19
  599. package/src/security/SecurityMonitoring.ts +24 -21
  600. package/src/security/SecurityReviewer.ts +10 -7
  601. package/src/security/index.ts +64 -29
  602. package/src/server/ConnectionTester.ts +120 -31
  603. package/src/server/ToolRegistry.ts +31 -21
  604. package/src/tools/BaseToolManager.ts +286 -33
  605. package/src/tools/auth.ts +20 -8
  606. package/src/tools/cache.ts +5 -15
  607. package/src/tools/comments.ts +34 -48
  608. package/src/tools/media.ts +41 -53
  609. package/src/tools/pages.ts +32 -54
  610. package/src/tools/performance.ts +141 -176
  611. package/src/tools/posts/PostHandlers.ts +474 -0
  612. package/src/tools/posts/PostToolDefinitions.ts +250 -0
  613. package/src/tools/posts/index.ts +192 -0
  614. package/src/tools/posts.ts +24 -780
  615. package/src/tools/site.ts +34 -19
  616. package/src/tools/taxonomies.ts +41 -57
  617. package/src/tools/users.ts +28 -16
  618. package/src/types/client.ts +114 -138
  619. package/src/types/enhanced.ts +318 -0
  620. package/src/types/index.ts +51 -30
  621. package/src/types/mcp.ts +20 -42
  622. package/src/types/requests.ts +378 -0
  623. package/src/types/tools.ts +608 -0
  624. package/src/types/wordpress.ts +56 -34
  625. package/src/utils/debug.ts +77 -59
  626. package/src/utils/enhancedError.ts +8 -8
  627. package/src/utils/error.ts +53 -31
  628. package/src/utils/logger.ts +351 -0
  629. package/src/utils/streaming.ts +86 -68
  630. package/src/utils/toolWrapper.ts +10 -12
  631. package/src/utils/validation/core.ts +108 -0
  632. package/src/utils/validation/index.ts +36 -0
  633. package/src/utils/validation/network.ts +132 -0
  634. package/src/utils/validation/rateLimit.ts +54 -0
  635. package/src/utils/validation/security.ts +361 -0
  636. package/src/utils/validation/wordpress.ts +180 -0
  637. package/src/utils/validation.ts +47 -470
  638. package/dist/cache/__tests__/CacheInvalidation.test.d.ts +0 -5
  639. package/dist/cache/__tests__/CacheInvalidation.test.d.ts.map +0 -1
  640. package/dist/cache/__tests__/CacheInvalidation.test.js +0 -238
  641. package/dist/cache/__tests__/CacheInvalidation.test.js.map +0 -1
  642. package/dist/cache/__tests__/CacheManager.test.d.ts +0 -5
  643. package/dist/cache/__tests__/CacheManager.test.d.ts.map +0 -1
  644. package/dist/cache/__tests__/CacheManager.test.js +0 -233
  645. package/dist/cache/__tests__/CacheManager.test.js.map +0 -1
  646. package/dist/cache/__tests__/CachedWordPressClient.test.d.ts +0 -5
  647. package/dist/cache/__tests__/CachedWordPressClient.test.d.ts.map +0 -1
  648. package/dist/cache/__tests__/CachedWordPressClient.test.js +0 -231
  649. package/dist/cache/__tests__/CachedWordPressClient.test.js.map +0 -1
  650. package/dist/cache/__tests__/HttpCacheWrapper.test.d.ts +0 -5
  651. package/dist/cache/__tests__/HttpCacheWrapper.test.d.ts.map +0 -1
  652. package/dist/cache/__tests__/HttpCacheWrapper.test.js +0 -299
  653. package/dist/cache/__tests__/HttpCacheWrapper.test.js.map +0 -1
@@ -0,0 +1,693 @@
1
+ /**
2
+ * Security CI/CD Pipeline Integration
3
+ * Provides security checks and gates for continuous integration and deployment
4
+ */
5
+ import { AISecurityScanner } from "./AISecurityScanner.js";
6
+ import { AutomatedRemediation } from "./AutomatedRemediation.js";
7
+ import { SecurityReviewer } from "./SecurityReviewer.js";
8
+ import { SecurityConfigManager } from "./SecurityConfigManager.js";
9
+ import { SecurityUtils } from "./SecurityConfig.js";
10
+ import { SecurityValidationError } from "./InputValidator.js";
11
+ import { LoggerFactory } from "../utils/logger.js";
12
+ const logger = LoggerFactory.security();
13
+ /**
14
+ * Security CI/CD Pipeline Manager
15
+ */
16
+ export class SecurityCIPipeline {
17
+ scanner;
18
+ remediation;
19
+ reviewer;
20
+ configManager;
21
+ gates = new Map();
22
+ reports = [];
23
+ constructor() {
24
+ this.scanner = new AISecurityScanner();
25
+ this.remediation = new AutomatedRemediation();
26
+ this.reviewer = new SecurityReviewer();
27
+ this.configManager = new SecurityConfigManager();
28
+ this.initializeDefaultGates();
29
+ }
30
+ /**
31
+ * Initialize the security pipeline
32
+ */
33
+ async initialize() {
34
+ logger.info("Initializing security CI/CD pipeline");
35
+ await this.configManager.initialize();
36
+ logger.info("Security pipeline ready");
37
+ }
38
+ /**
39
+ * Execute security gates for a pipeline stage
40
+ */
41
+ async executeSecurityGates(stage, context, options = {}) {
42
+ const reportId = SecurityUtils.generateSecureToken(16);
43
+ const startTime = Date.now();
44
+ logger.info(`Executing ${stage} security gates`, {
45
+ stage,
46
+ branch: context.branch,
47
+ commit: context.commit
48
+ });
49
+ const applicableGates = Array.from(this.gates.values()).filter((gate) => gate.stage === stage && gate.enabled);
50
+ if (applicableGates.length === 0) {
51
+ logger.warn(`No security gates configured for stage: ${stage}`, { stage });
52
+ return this.createEmptyReport(reportId, stage, startTime);
53
+ }
54
+ const gateResults = [];
55
+ let overallStatus = "passed";
56
+ for (const gate of applicableGates) {
57
+ logger.info(`Executing gate: ${gate.name}`, { gateName: gate.name });
58
+ try {
59
+ const gateResult = await this.executeSecurityGate(gate, context, options);
60
+ gateResults.push(gateResult);
61
+ // Update overall status
62
+ if (gateResult.status === "failed" && gate.blocking) {
63
+ overallStatus = "failed";
64
+ }
65
+ else if (gateResult.status === "warning" && overallStatus === "passed") {
66
+ overallStatus = "warning";
67
+ }
68
+ // Stop on blocking failure unless continuing on failure
69
+ if (gateResult.status === "failed" && gate.blocking && !options.continueOnFailure) {
70
+ logger.error(`Stopping pipeline due to blocking gate failure: ${gate.name}`, { gateName: gate.name });
71
+ break;
72
+ }
73
+ }
74
+ catch (error) {
75
+ logger.error(`Gate execution error: ${gate.name}`, { gateName: gate.name, error });
76
+ const errorResult = {
77
+ gateId: gate.id,
78
+ gateName: gate.name,
79
+ status: "failed",
80
+ duration: Date.now() - startTime,
81
+ checks: [],
82
+ blocking: gate.blocking,
83
+ message: `Gate execution failed: ${error instanceof Error ? error.message : String(error)}`,
84
+ };
85
+ gateResults.push(errorResult);
86
+ if (gate.blocking && !options.continueOnFailure) {
87
+ overallStatus = "failed";
88
+ break;
89
+ }
90
+ }
91
+ }
92
+ const report = this.generatePipelineReport(reportId, stage, startTime, overallStatus, gateResults, context);
93
+ this.reports.push(report);
94
+ logger.info(`${stage} gates completed`, { stage, status: overallStatus });
95
+ return report;
96
+ }
97
+ /**
98
+ * Execute a single security gate
99
+ */
100
+ async executeSecurityGate(gate, context, options = {}) {
101
+ const startTime = Date.now();
102
+ const checkResults = [];
103
+ for (const check of gate.checks) {
104
+ if (!check.enabled) {
105
+ continue;
106
+ }
107
+ logger.info(`Running check: ${check.name}`, { checkName: check.name });
108
+ try {
109
+ const checkResult = await this.executeSecurityCheck(check, context, options);
110
+ checkResults.push(checkResult);
111
+ }
112
+ catch (error) {
113
+ logger.error(`Check execution error: ${check.name}`, { checkName: check.name, error });
114
+ checkResults.push({
115
+ checkId: check.id,
116
+ checkName: check.name,
117
+ status: "error",
118
+ duration: Date.now() - startTime,
119
+ findings: [],
120
+ details: `Check execution failed: ${error instanceof Error ? error.message : String(error)}`,
121
+ score: 0,
122
+ });
123
+ }
124
+ }
125
+ // Evaluate gate status based on check results and thresholds
126
+ const gateStatus = this.evaluateGateStatus(gate, checkResults);
127
+ return {
128
+ gateId: gate.id,
129
+ gateName: gate.name,
130
+ status: gateStatus.status,
131
+ duration: Date.now() - startTime,
132
+ checks: checkResults,
133
+ blocking: gate.blocking,
134
+ message: gateStatus.message,
135
+ };
136
+ }
137
+ /**
138
+ * Execute a single security check
139
+ */
140
+ async executeSecurityCheck(check, context, options = {}) {
141
+ const startTime = Date.now();
142
+ const findings = [];
143
+ let score = 100; // Initialize with safe default
144
+ let details = "";
145
+ if (options.dryRun) {
146
+ return {
147
+ checkId: check.id,
148
+ checkName: check.name,
149
+ status: "passed",
150
+ duration: Date.now() - startTime,
151
+ findings: [],
152
+ details: "Dry run - no actual checks performed",
153
+ score: 100,
154
+ };
155
+ }
156
+ try {
157
+ switch (check.type) {
158
+ case "scan":
159
+ const scanResults = await this.executeScanCheck(check, context);
160
+ findings.push(...scanResults.findings);
161
+ score = scanResults.score;
162
+ details = scanResults.details;
163
+ break;
164
+ case "review":
165
+ const reviewResults = await this.executeReviewCheck(check, context);
166
+ findings.push(...reviewResults.findings);
167
+ score = reviewResults.score;
168
+ details = reviewResults.details;
169
+ break;
170
+ case "dependency":
171
+ const depResults = await this.executeDependencyCheck(check, context);
172
+ findings.push(...depResults.findings);
173
+ score = depResults.score;
174
+ details = depResults.details;
175
+ break;
176
+ case "configuration":
177
+ const configResults = await this.executeConfigurationCheck(check, context);
178
+ findings.push(...configResults.findings);
179
+ score = configResults.score;
180
+ details = configResults.details;
181
+ break;
182
+ case "secrets":
183
+ const secretResults = await this.executeSecretsCheck(check, context);
184
+ findings.push(...secretResults.findings);
185
+ score = secretResults.score;
186
+ details = secretResults.details;
187
+ break;
188
+ case "compliance":
189
+ const complianceResults = await this.executeComplianceCheck(check, context);
190
+ findings.push(...complianceResults.findings);
191
+ score = complianceResults.score;
192
+ details = complianceResults.details;
193
+ break;
194
+ default:
195
+ throw new Error(`Unknown check type: ${check.type}`);
196
+ }
197
+ // Determine check status based on findings
198
+ const criticalCount = findings.filter((f) => f.severity === "critical").length;
199
+ const highCount = findings.filter((f) => f.severity === "high").length;
200
+ let status;
201
+ if (criticalCount > 0) {
202
+ status = "failed";
203
+ }
204
+ else if (highCount > 0) {
205
+ status = "warning";
206
+ }
207
+ else {
208
+ status = "passed";
209
+ }
210
+ return {
211
+ checkId: check.id,
212
+ checkName: check.name,
213
+ status,
214
+ duration: Date.now() - startTime,
215
+ findings,
216
+ details,
217
+ score,
218
+ };
219
+ }
220
+ catch (error) {
221
+ throw new SecurityValidationError(`Check ${check.name} failed`, [{ message: String(error) }]);
222
+ }
223
+ }
224
+ /**
225
+ * Execute security scan check
226
+ */
227
+ async executeScanCheck(check, context) {
228
+ const scanParams = check.parameters;
229
+ const scanResult = await this.scanner.performScan({
230
+ targets: scanParams.targets ?? ["src/"],
231
+ depth: scanParams.depth ?? "deep",
232
+ includeRuntime: scanParams.includeRuntime ?? false,
233
+ includeFileSystem: scanParams.includeFileSystem ?? true,
234
+ });
235
+ const findings = scanResult.vulnerabilities.map((vuln) => ({
236
+ id: vuln.id,
237
+ severity: vuln.severity,
238
+ type: vuln.type,
239
+ description: vuln.description,
240
+ file: vuln.location.file,
241
+ line: vuln.location.line,
242
+ remediation: vuln.remediation.suggested,
243
+ }));
244
+ const score = Math.max(0, 100 - (scanResult.summary.critical * 10 + scanResult.summary.high * 5 + scanResult.summary.medium * 2));
245
+ return {
246
+ findings,
247
+ score,
248
+ details: `Scanned codebase: ${scanResult.summary.total} vulnerabilities found`,
249
+ };
250
+ }
251
+ /**
252
+ * Execute code review check
253
+ */
254
+ async executeReviewCheck(check, context) {
255
+ const reviewParams = check.parameters;
256
+ const reviewResults = await this.reviewer.reviewDirectory("src/", {
257
+ recursive: true,
258
+ rules: reviewParams.rules ?? [],
259
+ excludeRules: reviewParams.excludeRules ?? [],
260
+ aiAnalysis: reviewParams.aiAnalysis ?? false,
261
+ });
262
+ const allFindings = [];
263
+ let totalScore = 0;
264
+ for (const result of reviewResults) {
265
+ const resultFindings = result.findings.map((finding) => ({
266
+ id: finding.id,
267
+ severity: finding.severity,
268
+ type: finding.category,
269
+ description: finding.message,
270
+ file: result.file,
271
+ line: finding.line,
272
+ remediation: finding.recommendation,
273
+ }));
274
+ allFindings.push(...resultFindings);
275
+ totalScore += this.calculateFileScore(result.findings);
276
+ }
277
+ const averageScore = reviewResults.length > 0 ? totalScore / reviewResults.length : 100;
278
+ return {
279
+ findings: allFindings,
280
+ score: averageScore,
281
+ details: `Reviewed ${reviewResults.length} files: ${allFindings.length} security issues found`,
282
+ };
283
+ }
284
+ /**
285
+ * Execute dependency check
286
+ */
287
+ async executeDependencyCheck(check, context) {
288
+ // This would integrate with npm audit, Snyk, or similar tools
289
+ logger.info("Dependency check - integration with external tools required");
290
+ return {
291
+ findings: [],
292
+ score: 100,
293
+ details: "Dependency check completed - no vulnerabilities found",
294
+ };
295
+ }
296
+ /**
297
+ * Execute configuration check
298
+ */
299
+ async executeConfigurationCheck(check, context) {
300
+ const compliance = await this.configManager.validateCompliance(context.environment);
301
+ const findings = compliance.violations.map((violation, index) => ({
302
+ id: `config-${index}`,
303
+ severity: "medium",
304
+ type: "Configuration",
305
+ description: violation,
306
+ remediation: "Review security configuration",
307
+ }));
308
+ const score = compliance.compliant ? 100 : Math.max(0, 100 - compliance.violations.length * 10);
309
+ return {
310
+ findings,
311
+ score,
312
+ details: `Configuration compliance: ${compliance.compliant ? "compliant" : "non-compliant"}`,
313
+ };
314
+ }
315
+ /**
316
+ * Execute secrets check
317
+ */
318
+ async executeSecretsCheck(check, context) {
319
+ // This would integrate with tools like TruffleHog, GitLeaks, etc.
320
+ logger.info("Secrets check - integration with secret scanning tools required");
321
+ return {
322
+ findings: [],
323
+ score: 100,
324
+ details: "Secrets scan completed - no exposed secrets found",
325
+ };
326
+ }
327
+ /**
328
+ * Execute compliance check
329
+ */
330
+ async executeComplianceCheck(check, context) {
331
+ const complianceParams = check.parameters;
332
+ const frameworks = complianceParams.frameworks ?? ["OWASP", "CWE"];
333
+ const findings = [];
334
+ // Check for compliance with security frameworks
335
+ for (const framework of frameworks) {
336
+ // This would integrate with compliance checking tools
337
+ logger.info(`Checking ${framework} compliance`, { framework });
338
+ }
339
+ return {
340
+ findings,
341
+ score: 100,
342
+ details: `Compliance check completed for frameworks: ${frameworks.join(", ")}`,
343
+ };
344
+ }
345
+ /**
346
+ * Calculate security score for file findings
347
+ */
348
+ calculateFileScore(findings) {
349
+ const severityWeights = { critical: 20, high: 10, medium: 5, low: 2, info: 1 };
350
+ const penalty = findings.reduce((sum, finding) => {
351
+ return sum + (severityWeights[finding.severity] || 0);
352
+ }, 0);
353
+ return Math.max(0, 100 - penalty);
354
+ }
355
+ /**
356
+ * Evaluate gate status based on check results and thresholds
357
+ */
358
+ evaluateGateStatus(gate, checkResults) {
359
+ const allFindings = checkResults.flatMap((result) => result.findings);
360
+ const criticalCount = allFindings.filter((f) => f.severity === "critical").length;
361
+ const highCount = allFindings.filter((f) => f.severity === "high").length;
362
+ const mediumCount = allFindings.filter((f) => f.severity === "medium").length;
363
+ const averageScore = checkResults.length > 0 ? checkResults.reduce((sum, result) => sum + result.score, 0) / checkResults.length : 100;
364
+ // Check thresholds
365
+ if (criticalCount > gate.thresholds.maxCritical) {
366
+ return {
367
+ status: "failed",
368
+ message: `Critical vulnerabilities (${criticalCount}) exceed threshold (${gate.thresholds.maxCritical})`,
369
+ };
370
+ }
371
+ if (highCount > gate.thresholds.maxHigh) {
372
+ return {
373
+ status: "failed",
374
+ message: `High-severity vulnerabilities (${highCount}) exceed threshold (${gate.thresholds.maxHigh})`,
375
+ };
376
+ }
377
+ if (averageScore < gate.thresholds.minSecurityScore) {
378
+ return {
379
+ status: "failed",
380
+ message: `Security score (${averageScore.toFixed(1)}) below threshold (${gate.thresholds.minSecurityScore})`,
381
+ };
382
+ }
383
+ if (mediumCount > gate.thresholds.maxMedium) {
384
+ return {
385
+ status: "warning",
386
+ message: `Medium-severity vulnerabilities (${mediumCount}) exceed threshold (${gate.thresholds.maxMedium})`,
387
+ };
388
+ }
389
+ return {
390
+ status: "passed",
391
+ message: "All security checks passed",
392
+ };
393
+ }
394
+ /**
395
+ * Generate pipeline security report
396
+ */
397
+ generatePipelineReport(reportId, stage, startTime, status, gateResults, context) {
398
+ const allFindings = gateResults.flatMap((gate) => gate.checks.flatMap((check) => check.findings));
399
+ const summary = {
400
+ totalIssues: allFindings.length,
401
+ criticalIssues: allFindings.filter((f) => f.severity === "critical").length,
402
+ highIssues: allFindings.filter((f) => f.severity === "high").length,
403
+ mediumIssues: allFindings.filter((f) => f.severity === "medium").length,
404
+ lowIssues: allFindings.filter((f) => f.severity === "low").length,
405
+ securityScore: this.calculateOverallSecurityScore(gateResults),
406
+ compliance: status === "passed",
407
+ };
408
+ const recommendations = this.generateRecommendations(gateResults, summary);
409
+ return {
410
+ reportId,
411
+ timestamp: new Date(),
412
+ stage,
413
+ status,
414
+ duration: Date.now() - startTime,
415
+ gates: gateResults,
416
+ summary,
417
+ recommendations,
418
+ artifacts: this.generateArtifacts(reportId, gateResults),
419
+ };
420
+ }
421
+ /**
422
+ * Calculate overall security score
423
+ */
424
+ calculateOverallSecurityScore(gateResults) {
425
+ const allChecks = gateResults.flatMap((gate) => gate.checks);
426
+ if (allChecks.length === 0) {
427
+ return 100;
428
+ }
429
+ const totalScore = allChecks.reduce((sum, check) => sum + check.score, 0);
430
+ return totalScore / allChecks.length;
431
+ }
432
+ /**
433
+ * Generate recommendations based on results
434
+ */
435
+ generateRecommendations(gateResults, summary) {
436
+ const recommendations = [];
437
+ if (summary.criticalIssues > 0) {
438
+ recommendations.push("Address critical security vulnerabilities immediately before deployment");
439
+ }
440
+ if (summary.highIssues > 5) {
441
+ recommendations.push("Review and remediate high-severity security issues");
442
+ }
443
+ if (summary.securityScore < 80) {
444
+ recommendations.push("Improve overall security posture through code review and security training");
445
+ }
446
+ const failedGates = gateResults.filter((gate) => gate.status === "failed");
447
+ if (failedGates.length > 0) {
448
+ recommendations.push(`Review failed security gates: ${failedGates.map((g) => g.gateName).join(", ")}`);
449
+ }
450
+ return recommendations;
451
+ }
452
+ /**
453
+ * Generate artifacts for the security report
454
+ */
455
+ generateArtifacts(reportId, gateResults) {
456
+ // In a real implementation, this would generate SARIF files, security reports, etc.
457
+ return [`security-report-${reportId}.json`, `security-findings-${reportId}.sarif`];
458
+ }
459
+ /**
460
+ * Create empty report for stages with no gates
461
+ */
462
+ createEmptyReport(reportId, stage, startTime) {
463
+ return {
464
+ reportId,
465
+ timestamp: new Date(),
466
+ stage,
467
+ status: "passed",
468
+ duration: Date.now() - startTime,
469
+ gates: [],
470
+ summary: {
471
+ totalIssues: 0,
472
+ criticalIssues: 0,
473
+ highIssues: 0,
474
+ mediumIssues: 0,
475
+ lowIssues: 0,
476
+ securityScore: 100,
477
+ compliance: true,
478
+ },
479
+ recommendations: [],
480
+ artifacts: [],
481
+ };
482
+ }
483
+ /**
484
+ * Initialize default security gates
485
+ */
486
+ initializeDefaultGates() {
487
+ // Pre-commit gate
488
+ this.gates.set("pre-commit", {
489
+ id: "pre-commit",
490
+ name: "Pre-commit Security Gate",
491
+ stage: "pre-commit",
492
+ enabled: true,
493
+ blocking: true,
494
+ checks: [
495
+ {
496
+ id: "secrets-scan",
497
+ name: "Secrets Scan",
498
+ type: "secrets",
499
+ enabled: true,
500
+ timeout: 60000,
501
+ retries: 1,
502
+ parameters: {},
503
+ },
504
+ {
505
+ id: "basic-review",
506
+ name: "Basic Security Review",
507
+ type: "review",
508
+ enabled: true,
509
+ timeout: 120000,
510
+ retries: 1,
511
+ parameters: { rules: ["auth-001", "input-001", "crypto-001"] },
512
+ },
513
+ ],
514
+ thresholds: {
515
+ maxCritical: 0,
516
+ maxHigh: 2,
517
+ maxMedium: 10,
518
+ minSecurityScore: 80,
519
+ },
520
+ exceptions: [],
521
+ });
522
+ // Pre-build gate
523
+ this.gates.set("pre-build", {
524
+ id: "pre-build",
525
+ name: "Pre-build Security Gate",
526
+ stage: "pre-build",
527
+ enabled: true,
528
+ blocking: true,
529
+ checks: [
530
+ {
531
+ id: "full-scan",
532
+ name: "Full Security Scan",
533
+ type: "scan",
534
+ enabled: true,
535
+ timeout: 300000,
536
+ retries: 1,
537
+ parameters: { depth: "comprehensive", includeRuntime: true },
538
+ },
539
+ {
540
+ id: "dependency-check",
541
+ name: "Dependency Vulnerability Check",
542
+ type: "dependency",
543
+ enabled: true,
544
+ timeout: 180000,
545
+ retries: 2,
546
+ parameters: {},
547
+ },
548
+ {
549
+ id: "config-review",
550
+ name: "Configuration Review",
551
+ type: "configuration",
552
+ enabled: true,
553
+ timeout: 60000,
554
+ retries: 1,
555
+ parameters: {},
556
+ },
557
+ ],
558
+ thresholds: {
559
+ maxCritical: 0,
560
+ maxHigh: 5,
561
+ maxMedium: 20,
562
+ minSecurityScore: 75,
563
+ },
564
+ exceptions: [],
565
+ });
566
+ // Pre-deploy gate
567
+ this.gates.set("pre-deploy", {
568
+ id: "pre-deploy",
569
+ name: "Pre-deployment Security Gate",
570
+ stage: "pre-deploy",
571
+ enabled: true,
572
+ blocking: true,
573
+ checks: [
574
+ {
575
+ id: "compliance-check",
576
+ name: "Compliance Validation",
577
+ type: "compliance",
578
+ enabled: true,
579
+ timeout: 120000,
580
+ retries: 1,
581
+ parameters: { frameworks: ["OWASP", "CWE"] },
582
+ },
583
+ {
584
+ id: "final-review",
585
+ name: "Final Security Review",
586
+ type: "review",
587
+ enabled: true,
588
+ timeout: 240000,
589
+ retries: 1,
590
+ parameters: { aiAnalysis: true },
591
+ },
592
+ ],
593
+ thresholds: {
594
+ maxCritical: 0,
595
+ maxHigh: 1,
596
+ maxMedium: 5,
597
+ minSecurityScore: 85,
598
+ },
599
+ exceptions: [],
600
+ });
601
+ }
602
+ /**
603
+ * Get security gate configuration
604
+ */
605
+ getSecurityGate(gateId) {
606
+ return this.gates.get(gateId) || null;
607
+ }
608
+ /**
609
+ * Update security gate configuration
610
+ */
611
+ updateSecurityGate(gateId, updates) {
612
+ const gate = this.gates.get(gateId);
613
+ if (!gate) {
614
+ return false;
615
+ }
616
+ const updatedGate = { ...gate, ...updates, id: gateId };
617
+ this.gates.set(gateId, updatedGate);
618
+ logger.info(`Updated security gate: ${updatedGate.name}`, { gateName: updatedGate.name });
619
+ return true;
620
+ }
621
+ /**
622
+ * Get pipeline reports
623
+ */
624
+ getReports(options = {}) {
625
+ let reports = [...this.reports];
626
+ if (options.stage) {
627
+ reports = reports.filter((r) => r.stage === options.stage);
628
+ }
629
+ if (options.status) {
630
+ reports = reports.filter((r) => r.status === options.status);
631
+ }
632
+ if (options.since) {
633
+ reports = reports.filter((r) => r.timestamp >= options.since);
634
+ }
635
+ // Sort by timestamp (newest first)
636
+ reports.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime());
637
+ if (options.limit) {
638
+ reports = reports.slice(0, options.limit);
639
+ }
640
+ return reports;
641
+ }
642
+ /**
643
+ * Get pipeline statistics
644
+ */
645
+ getStatistics() {
646
+ const totalReports = this.reports.length;
647
+ const passedReports = this.reports.filter((r) => r.status === "passed").length;
648
+ const passRate = totalReports > 0 ? passedReports / totalReports : 1;
649
+ const averageSecurityScore = totalReports > 0 ? this.reports.reduce((sum, r) => sum + r.summary.securityScore, 0) / totalReports : 100;
650
+ // Count issue types
651
+ const issueTypes = {};
652
+ this.reports.forEach((report) => {
653
+ report.gates.forEach((gate) => {
654
+ gate.checks.forEach((check) => {
655
+ check.findings.forEach((finding) => {
656
+ issueTypes[finding.type] = (issueTypes[finding.type] || 0) + 1;
657
+ });
658
+ });
659
+ });
660
+ });
661
+ const mostCommonIssues = Object.entries(issueTypes)
662
+ .map(([type, count]) => ({ type, count }))
663
+ .sort((a, b) => b.count - a.count)
664
+ .slice(0, 5);
665
+ // Calculate gate performance
666
+ const gateStats = {};
667
+ this.reports.forEach((report) => {
668
+ report.gates.forEach((gate) => {
669
+ if (!gateStats[gate.gateId]) {
670
+ gateStats[gate.gateId] = { total: 0, passed: 0, totalDuration: 0 };
671
+ }
672
+ gateStats[gate.gateId].total++;
673
+ gateStats[gate.gateId].totalDuration += gate.duration;
674
+ if (gate.status === "passed") {
675
+ gateStats[gate.gateId].passed++;
676
+ }
677
+ });
678
+ });
679
+ const gatePerformance = Object.entries(gateStats).map(([gateId, stats]) => ({
680
+ gateId,
681
+ successRate: stats.total > 0 ? stats.passed / stats.total : 0,
682
+ averageDuration: stats.total > 0 ? stats.totalDuration / stats.total : 0,
683
+ }));
684
+ return {
685
+ totalReports,
686
+ passRate,
687
+ averageSecurityScore,
688
+ mostCommonIssues,
689
+ gatePerformance,
690
+ };
691
+ }
692
+ }
693
+ //# sourceMappingURL=SecurityCIPipeline.js.map