agentic-qe 1.2.0 → 1.3.0

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 (338) hide show
  1. package/.claude/settings.json +44 -6
  2. package/.claude/skills/accessibility-testing/SKILL.md +777 -0
  3. package/.claude/skills/chaos-engineering-resilience/SKILL.md +109 -0
  4. package/.claude/skills/compatibility-testing/SKILL.md +101 -0
  5. package/.claude/skills/compliance-testing/SKILL.md +162 -0
  6. package/.claude/skills/contract-testing/SKILL.md +193 -0
  7. package/.claude/skills/database-testing/SKILL.md +243 -0
  8. package/.claude/skills/localization-testing/SKILL.md +115 -0
  9. package/.claude/skills/mobile-testing/SKILL.md +548 -0
  10. package/.claude/skills/mutation-testing/SKILL.md +129 -0
  11. package/.claude/skills/regression-testing/SKILL.md +1045 -0
  12. package/.claude/skills/shift-left-testing/SKILL.md +535 -0
  13. package/.claude/skills/shift-right-testing/SKILL.md +591 -0
  14. package/.claude/skills/test-data-management/SKILL.md +1067 -0
  15. package/.claude/skills/test-design-techniques/SKILL.md +160 -0
  16. package/.claude/skills/test-environment-management/SKILL.md +204 -0
  17. package/.claude/skills/test-reporting-analytics/SKILL.md +143 -0
  18. package/.claude/skills/visual-testing-advanced/SKILL.md +148 -0
  19. package/CHANGELOG.md +88 -6
  20. package/README.md +15 -8
  21. package/dist/agents/BaseAgent.d.ts.map +1 -1
  22. package/dist/agents/BaseAgent.js +5 -4
  23. package/dist/agents/BaseAgent.js.map +1 -1
  24. package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
  25. package/dist/agents/CoverageAnalyzerAgent.js +9 -8
  26. package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
  27. package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
  28. package/dist/agents/FlakyTestHunterAgent.js +3 -2
  29. package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
  30. package/dist/agents/FleetCommanderAgent.d.ts.map +1 -1
  31. package/dist/agents/FleetCommanderAgent.js +2 -1
  32. package/dist/agents/FleetCommanderAgent.js.map +1 -1
  33. package/dist/agents/PerformanceTesterAgent.d.ts.map +1 -1
  34. package/dist/agents/PerformanceTesterAgent.js +7 -6
  35. package/dist/agents/PerformanceTesterAgent.js.map +1 -1
  36. package/dist/agents/ProductionIntelligenceAgent.d.ts.map +1 -1
  37. package/dist/agents/ProductionIntelligenceAgent.js +7 -6
  38. package/dist/agents/ProductionIntelligenceAgent.js.map +1 -1
  39. package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -1
  40. package/dist/agents/QualityAnalyzerAgent.js +37 -36
  41. package/dist/agents/QualityAnalyzerAgent.js.map +1 -1
  42. package/dist/agents/QualityGateAgent.d.ts.map +1 -1
  43. package/dist/agents/QualityGateAgent.js +2 -1
  44. package/dist/agents/QualityGateAgent.js.map +1 -1
  45. package/dist/agents/RegressionRiskAnalyzerAgent.d.ts.map +1 -1
  46. package/dist/agents/RegressionRiskAnalyzerAgent.js +15 -14
  47. package/dist/agents/RegressionRiskAnalyzerAgent.js.map +1 -1
  48. package/dist/agents/SecurityScannerAgent.d.ts.map +1 -1
  49. package/dist/agents/SecurityScannerAgent.js +2 -1
  50. package/dist/agents/SecurityScannerAgent.js.map +1 -1
  51. package/dist/agents/TestDataArchitectAgent.d.ts.map +1 -1
  52. package/dist/agents/TestDataArchitectAgent.js +12 -11
  53. package/dist/agents/TestDataArchitectAgent.js.map +1 -1
  54. package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
  55. package/dist/agents/TestExecutorAgent.js +17 -16
  56. package/dist/agents/TestExecutorAgent.js.map +1 -1
  57. package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
  58. package/dist/agents/TestGeneratorAgent.js +10 -9
  59. package/dist/agents/TestGeneratorAgent.js.map +1 -1
  60. package/dist/agents/index.d.ts.map +1 -1
  61. package/dist/agents/index.js +2 -1
  62. package/dist/agents/index.js.map +1 -1
  63. package/dist/cli/commands/agent/benchmark.d.ts.map +1 -1
  64. package/dist/cli/commands/agent/benchmark.js +2 -1
  65. package/dist/cli/commands/agent/benchmark.js.map +1 -1
  66. package/dist/cli/commands/agent/spawn.d.ts.map +1 -1
  67. package/dist/cli/commands/agent/spawn.js +2 -1
  68. package/dist/cli/commands/agent/spawn.js.map +1 -1
  69. package/dist/cli/commands/analyze.d.ts.map +1 -1
  70. package/dist/cli/commands/analyze.js +2 -1
  71. package/dist/cli/commands/analyze.js.map +1 -1
  72. package/dist/cli/commands/config/list.d.ts.map +1 -1
  73. package/dist/cli/commands/config/list.js +2 -1
  74. package/dist/cli/commands/config/list.js.map +1 -1
  75. package/dist/cli/commands/config/set.d.ts +7 -0
  76. package/dist/cli/commands/config/set.d.ts.map +1 -1
  77. package/dist/cli/commands/config/set.js +35 -4
  78. package/dist/cli/commands/config/set.js.map +1 -1
  79. package/dist/cli/commands/fleet/logs.d.ts.map +1 -1
  80. package/dist/cli/commands/fleet/logs.js +2 -1
  81. package/dist/cli/commands/fleet/logs.js.map +1 -1
  82. package/dist/cli/commands/fleet/metrics.d.ts.map +1 -1
  83. package/dist/cli/commands/fleet/metrics.js +2 -1
  84. package/dist/cli/commands/fleet/metrics.js.map +1 -1
  85. package/dist/cli/commands/fleet/monitor.d.ts.map +1 -1
  86. package/dist/cli/commands/fleet/monitor.js +7 -5
  87. package/dist/cli/commands/fleet/monitor.js.map +1 -1
  88. package/dist/cli/commands/fleet.d.ts.map +1 -1
  89. package/dist/cli/commands/fleet.js +2 -1
  90. package/dist/cli/commands/fleet.js.map +1 -1
  91. package/dist/cli/commands/generate.d.ts.map +1 -1
  92. package/dist/cli/commands/generate.js +2 -1
  93. package/dist/cli/commands/generate.js.map +1 -1
  94. package/dist/cli/commands/improve/index.d.ts.map +1 -1
  95. package/dist/cli/commands/improve/index.js +12 -11
  96. package/dist/cli/commands/improve/index.js.map +1 -1
  97. package/dist/cli/commands/init.d.ts +1 -1
  98. package/dist/cli/commands/init.d.ts.map +1 -1
  99. package/dist/cli/commands/init.js +40 -16
  100. package/dist/cli/commands/init.js.map +1 -1
  101. package/dist/cli/commands/learn/index.d.ts.map +1 -1
  102. package/dist/cli/commands/learn/index.js +13 -12
  103. package/dist/cli/commands/learn/index.js.map +1 -1
  104. package/dist/cli/commands/monitor/alerts.d.ts.map +1 -1
  105. package/dist/cli/commands/monitor/alerts.js +2 -1
  106. package/dist/cli/commands/monitor/alerts.js.map +1 -1
  107. package/dist/cli/commands/patterns/index.d.ts.map +1 -1
  108. package/dist/cli/commands/patterns/index.js +20 -19
  109. package/dist/cli/commands/patterns/index.js.map +1 -1
  110. package/dist/cli/commands/quality/decision.d.ts.map +1 -1
  111. package/dist/cli/commands/quality/decision.js +9 -7
  112. package/dist/cli/commands/quality/decision.js.map +1 -1
  113. package/dist/cli/commands/quality/gate.d.ts.map +1 -1
  114. package/dist/cli/commands/quality/gate.js +10 -8
  115. package/dist/cli/commands/quality/gate.js.map +1 -1
  116. package/dist/cli/commands/quality/policy.d.ts.map +1 -1
  117. package/dist/cli/commands/quality/policy.js +10 -8
  118. package/dist/cli/commands/quality/policy.js.map +1 -1
  119. package/dist/cli/commands/quality/risk.d.ts.map +1 -1
  120. package/dist/cli/commands/quality/risk.js +5 -3
  121. package/dist/cli/commands/quality/risk.js.map +1 -1
  122. package/dist/cli/commands/quality/validate.d.ts.map +1 -1
  123. package/dist/cli/commands/quality/validate.js +10 -8
  124. package/dist/cli/commands/quality/validate.js.map +1 -1
  125. package/dist/cli/commands/quantization.d.ts +6 -0
  126. package/dist/cli/commands/quantization.d.ts.map +1 -0
  127. package/dist/cli/commands/quantization.js +188 -0
  128. package/dist/cli/commands/quantization.js.map +1 -0
  129. package/dist/cli/commands/routing/index.d.ts +0 -6
  130. package/dist/cli/commands/routing/index.d.ts.map +1 -1
  131. package/dist/cli/commands/routing/index.js +17 -16
  132. package/dist/cli/commands/routing/index.js.map +1 -1
  133. package/dist/cli/commands/run.d.ts.map +1 -1
  134. package/dist/cli/commands/run.js +2 -1
  135. package/dist/cli/commands/run.js.map +1 -1
  136. package/dist/cli/commands/skills/index.d.ts.map +1 -1
  137. package/dist/cli/commands/skills/index.js +10 -9
  138. package/dist/cli/commands/skills/index.js.map +1 -1
  139. package/dist/cli/commands/test/debug.d.ts.map +1 -1
  140. package/dist/cli/commands/test/debug.js +2 -1
  141. package/dist/cli/commands/test/debug.js.map +1 -1
  142. package/dist/cli/commands/test/mutate.d.ts.map +1 -1
  143. package/dist/cli/commands/test/mutate.js +2 -1
  144. package/dist/cli/commands/test/mutate.js.map +1 -1
  145. package/dist/cli/commands/test/parallel.d.ts.map +1 -1
  146. package/dist/cli/commands/test/parallel.js +6 -4
  147. package/dist/cli/commands/test/parallel.js.map +1 -1
  148. package/dist/cli/commands/test/profile.d.ts.map +1 -1
  149. package/dist/cli/commands/test/profile.js +3 -2
  150. package/dist/cli/commands/test/profile.js.map +1 -1
  151. package/dist/cli/commands/test/queue.d.ts.map +1 -1
  152. package/dist/cli/commands/test/queue.js +2 -1
  153. package/dist/cli/commands/test/queue.js.map +1 -1
  154. package/dist/cli/commands/test/retry.d.ts.map +1 -1
  155. package/dist/cli/commands/test/retry.js +6 -4
  156. package/dist/cli/commands/test/retry.js.map +1 -1
  157. package/dist/cli/commands/test/trace.d.ts.map +1 -1
  158. package/dist/cli/commands/test/trace.js +2 -1
  159. package/dist/cli/commands/test/trace.js.map +1 -1
  160. package/dist/cli/commands/test/watch.d.ts.map +1 -1
  161. package/dist/cli/commands/test/watch.js +3 -2
  162. package/dist/cli/commands/test/watch.js.map +1 -1
  163. package/dist/cli/commands/workflow/cancel.d.ts.map +1 -1
  164. package/dist/cli/commands/workflow/cancel.js +2 -1
  165. package/dist/cli/commands/workflow/cancel.js.map +1 -1
  166. package/dist/cli/index-working.js +9 -8
  167. package/dist/cli/index-working.js.map +1 -1
  168. package/dist/cli/index.js +5 -0
  169. package/dist/cli/index.js.map +1 -1
  170. package/dist/core/coordination/OODACoordination.d.ts.map +1 -1
  171. package/dist/core/coordination/OODACoordination.js +2 -1
  172. package/dist/core/coordination/OODACoordination.js.map +1 -1
  173. package/dist/core/memory/AgentDBManager.d.ts.map +1 -1
  174. package/dist/core/memory/AgentDBManager.js +2 -19
  175. package/dist/core/memory/AgentDBManager.js.map +1 -1
  176. package/dist/core/memory/RealAgentDBAdapter.d.ts.map +1 -1
  177. package/dist/core/memory/RealAgentDBAdapter.js +4 -3
  178. package/dist/core/memory/RealAgentDBAdapter.js.map +1 -1
  179. package/dist/core/memory/ReasoningBankAdapter.d.ts.map +1 -1
  180. package/dist/core/memory/ReasoningBankAdapter.js +2 -5
  181. package/dist/core/memory/ReasoningBankAdapter.js.map +1 -1
  182. package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
  183. package/dist/core/memory/SwarmMemoryManager.js +4 -3
  184. package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
  185. package/dist/core/neural/NeuralTrainer.d.ts.map +1 -1
  186. package/dist/core/neural/NeuralTrainer.js +3 -2
  187. package/dist/core/neural/NeuralTrainer.js.map +1 -1
  188. package/dist/core/quantization/QuantizationManager.d.ts +83 -0
  189. package/dist/core/quantization/QuantizationManager.d.ts.map +1 -0
  190. package/dist/core/quantization/QuantizationManager.js +264 -0
  191. package/dist/core/quantization/QuantizationManager.js.map +1 -0
  192. package/dist/core/quantization/index.d.ts +5 -0
  193. package/dist/core/quantization/index.d.ts.map +1 -0
  194. package/dist/core/quantization/index.js +9 -0
  195. package/dist/core/quantization/index.js.map +1 -0
  196. package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts +3 -3
  197. package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts.map +1 -1
  198. package/dist/mcp/handlers/advanced/mutation-test-execute.js +5 -4
  199. package/dist/mcp/handlers/advanced/mutation-test-execute.js.map +1 -1
  200. package/dist/mcp/handlers/agent-spawn.d.ts.map +1 -1
  201. package/dist/mcp/handlers/agent-spawn.js +2 -1
  202. package/dist/mcp/handlers/agent-spawn.js.map +1 -1
  203. package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.d.ts.map +1 -1
  204. package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js +9 -8
  205. package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js.map +1 -1
  206. package/dist/mcp/handlers/analysis/coverageGapsDetect.d.ts.map +1 -1
  207. package/dist/mcp/handlers/analysis/coverageGapsDetect.js +6 -5
  208. package/dist/mcp/handlers/analysis/coverageGapsDetect.js.map +1 -1
  209. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.d.ts.map +1 -1
  210. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js +5 -4
  211. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js.map +1 -1
  212. package/dist/mcp/handlers/analysis/performanceBenchmarkRun.d.ts.map +1 -1
  213. package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js +8 -7
  214. package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js.map +1 -1
  215. package/dist/mcp/handlers/analysis/performanceMonitorRealtime.d.ts.map +1 -1
  216. package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js +7 -6
  217. package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js.map +1 -1
  218. package/dist/mcp/handlers/analysis/securityScanComprehensive.d.ts.map +1 -1
  219. package/dist/mcp/handlers/analysis/securityScanComprehensive.js +18 -21
  220. package/dist/mcp/handlers/analysis/securityScanComprehensive.js.map +1 -1
  221. package/dist/mcp/handlers/base-handler.d.ts.map +1 -1
  222. package/dist/mcp/handlers/base-handler.js +2 -9
  223. package/dist/mcp/handlers/base-handler.js.map +1 -1
  224. package/dist/mcp/handlers/chaos/chaos-inject-failure.d.ts.map +1 -1
  225. package/dist/mcp/handlers/chaos/chaos-inject-failure.js +4 -3
  226. package/dist/mcp/handlers/chaos/chaos-inject-failure.js.map +1 -1
  227. package/dist/mcp/handlers/chaos/chaos-inject-latency.d.ts.map +1 -1
  228. package/dist/mcp/handlers/chaos/chaos-inject-latency.js +6 -5
  229. package/dist/mcp/handlers/chaos/chaos-inject-latency.js.map +1 -1
  230. package/dist/mcp/handlers/coordination/event-emit.d.ts.map +1 -1
  231. package/dist/mcp/handlers/coordination/event-emit.js +2 -1
  232. package/dist/mcp/handlers/coordination/event-emit.js.map +1 -1
  233. package/dist/mcp/handlers/coordination/event-subscribe.d.ts.map +1 -1
  234. package/dist/mcp/handlers/coordination/event-subscribe.js +2 -1
  235. package/dist/mcp/handlers/coordination/event-subscribe.js.map +1 -1
  236. package/dist/mcp/handlers/coordination/workflow-checkpoint.d.ts.map +1 -1
  237. package/dist/mcp/handlers/coordination/workflow-checkpoint.js +2 -1
  238. package/dist/mcp/handlers/coordination/workflow-checkpoint.js.map +1 -1
  239. package/dist/mcp/handlers/coordination/workflow-create.d.ts.map +1 -1
  240. package/dist/mcp/handlers/coordination/workflow-create.js +2 -1
  241. package/dist/mcp/handlers/coordination/workflow-create.js.map +1 -1
  242. package/dist/mcp/handlers/coordination/workflow-execute.d.ts.map +1 -1
  243. package/dist/mcp/handlers/coordination/workflow-execute.js +2 -1
  244. package/dist/mcp/handlers/coordination/workflow-execute.js.map +1 -1
  245. package/dist/mcp/handlers/coordination/workflow-resume.d.ts.map +1 -1
  246. package/dist/mcp/handlers/coordination/workflow-resume.js +2 -1
  247. package/dist/mcp/handlers/coordination/workflow-resume.js.map +1 -1
  248. package/dist/mcp/handlers/fleet-init.d.ts.map +1 -1
  249. package/dist/mcp/handlers/fleet-init.js +2 -1
  250. package/dist/mcp/handlers/fleet-init.js.map +1 -1
  251. package/dist/mcp/handlers/fleet-status.d.ts.map +1 -1
  252. package/dist/mcp/handlers/fleet-status.js +31 -30
  253. package/dist/mcp/handlers/fleet-status.js.map +1 -1
  254. package/dist/mcp/handlers/integration/dependency-check.d.ts.map +1 -1
  255. package/dist/mcp/handlers/integration/dependency-check.js +3 -2
  256. package/dist/mcp/handlers/integration/dependency-check.js.map +1 -1
  257. package/dist/mcp/handlers/integration/integration-test-orchestrate.d.ts.map +1 -1
  258. package/dist/mcp/handlers/integration/integration-test-orchestrate.js +2 -1
  259. package/dist/mcp/handlers/integration/integration-test-orchestrate.js.map +1 -1
  260. package/dist/mcp/handlers/optimize-tests.d.ts.map +1 -1
  261. package/dist/mcp/handlers/optimize-tests.js +33 -32
  262. package/dist/mcp/handlers/optimize-tests.js.map +1 -1
  263. package/dist/mcp/handlers/predict-defects.d.ts.map +1 -1
  264. package/dist/mcp/handlers/predict-defects.js +46 -45
  265. package/dist/mcp/handlers/predict-defects.js.map +1 -1
  266. package/dist/mcp/handlers/prediction/deployment-readiness-check.d.ts.map +1 -1
  267. package/dist/mcp/handlers/prediction/deployment-readiness-check.js +24 -23
  268. package/dist/mcp/handlers/prediction/deployment-readiness-check.js.map +1 -1
  269. package/dist/mcp/handlers/prediction/predict-defects-ai.d.ts.map +1 -1
  270. package/dist/mcp/handlers/prediction/predict-defects-ai.js +10 -9
  271. package/dist/mcp/handlers/prediction/predict-defects-ai.js.map +1 -1
  272. package/dist/mcp/handlers/prediction/regression-risk-analyze.d.ts.map +1 -1
  273. package/dist/mcp/handlers/prediction/regression-risk-analyze.js +10 -9
  274. package/dist/mcp/handlers/prediction/regression-risk-analyze.js.map +1 -1
  275. package/dist/mcp/handlers/prediction/visual-test-regression.d.ts.map +1 -1
  276. package/dist/mcp/handlers/prediction/visual-test-regression.js +7 -6
  277. package/dist/mcp/handlers/prediction/visual-test-regression.js.map +1 -1
  278. package/dist/mcp/handlers/quality-analyze.d.ts.map +1 -1
  279. package/dist/mcp/handlers/quality-analyze.js +53 -52
  280. package/dist/mcp/handlers/quality-analyze.js.map +1 -1
  281. package/dist/mcp/handlers/task-orchestrate.d.ts.map +1 -1
  282. package/dist/mcp/handlers/task-orchestrate.js +19 -18
  283. package/dist/mcp/handlers/task-orchestrate.js.map +1 -1
  284. package/dist/mcp/handlers/test/test-execute-parallel.d.ts.map +1 -1
  285. package/dist/mcp/handlers/test/test-execute-parallel.js +7 -6
  286. package/dist/mcp/handlers/test/test-execute-parallel.js.map +1 -1
  287. package/dist/mcp/handlers/test/test-generate-enhanced.d.ts.map +1 -1
  288. package/dist/mcp/handlers/test/test-generate-enhanced.js +2 -1
  289. package/dist/mcp/handlers/test/test-generate-enhanced.js.map +1 -1
  290. package/dist/mcp/handlers/test/test-optimize-sublinear.d.ts.map +1 -1
  291. package/dist/mcp/handlers/test/test-optimize-sublinear.js +3 -2
  292. package/dist/mcp/handlers/test/test-optimize-sublinear.js.map +1 -1
  293. package/dist/mcp/handlers/test-execute.d.ts.map +1 -1
  294. package/dist/mcp/handlers/test-execute.js +11 -10
  295. package/dist/mcp/handlers/test-execute.js.map +1 -1
  296. package/dist/mcp/handlers/test-generate.d.ts.map +1 -1
  297. package/dist/mcp/handlers/test-generate.js +4 -3
  298. package/dist/mcp/handlers/test-generate.js.map +1 -1
  299. package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
  300. package/dist/mcp/services/AgentRegistry.js +2 -1
  301. package/dist/mcp/services/AgentRegistry.js.map +1 -1
  302. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts.map +1 -1
  303. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js +10 -9
  304. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js.map +1 -1
  305. package/dist/mcp/streaming/StreamingMCPTool.d.ts.map +1 -1
  306. package/dist/mcp/streaming/StreamingMCPTool.js +2 -1
  307. package/dist/mcp/streaming/StreamingMCPTool.js.map +1 -1
  308. package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts.map +1 -1
  309. package/dist/mcp/streaming/TestExecuteStreamHandler.js +6 -5
  310. package/dist/mcp/streaming/TestExecuteStreamHandler.js.map +1 -1
  311. package/dist/reasoning/TestTemplateCreator.d.ts +10 -2
  312. package/dist/reasoning/TestTemplateCreator.d.ts.map +1 -1
  313. package/dist/reasoning/TestTemplateCreator.js +81 -21
  314. package/dist/reasoning/TestTemplateCreator.js.map +1 -1
  315. package/dist/types/pattern.types.d.ts +39 -3
  316. package/dist/types/pattern.types.d.ts.map +1 -1
  317. package/dist/utils/Config.js +2 -2
  318. package/dist/utils/Config.js.map +1 -1
  319. package/dist/utils/ProcessExit.d.ts +23 -0
  320. package/dist/utils/ProcessExit.d.ts.map +1 -0
  321. package/dist/utils/ProcessExit.js +40 -0
  322. package/dist/utils/ProcessExit.js.map +1 -0
  323. package/dist/utils/SecureRandom.d.ts +171 -0
  324. package/dist/utils/SecureRandom.d.ts.map +1 -0
  325. package/dist/utils/SecureRandom.js +229 -0
  326. package/dist/utils/SecureRandom.js.map +1 -0
  327. package/dist/utils/SecureUrlValidator.d.ts +167 -0
  328. package/dist/utils/SecureUrlValidator.d.ts.map +1 -0
  329. package/dist/utils/SecureUrlValidator.js +306 -0
  330. package/dist/utils/SecureUrlValidator.js.map +1 -0
  331. package/dist/utils/SecureValidation.d.ts +131 -0
  332. package/dist/utils/SecureValidation.d.ts.map +1 -0
  333. package/dist/utils/SecureValidation.js +265 -0
  334. package/dist/utils/SecureValidation.js.map +1 -0
  335. package/dist/utils/validation.d.ts.map +1 -1
  336. package/dist/utils/validation.js +5 -4
  337. package/dist/utils/validation.js.map +1 -1
  338. package/package.json +3 -3
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+ /**
3
+ * Secure URL Validator - Native TypeScript Implementation
4
+ *
5
+ * A secure, zero-dependency URL validation utility using the WHATWG URL API
6
+ * to replace validator.js isURL() and avoid CVE-2025-56200.
7
+ *
8
+ * @module SecureUrlValidator
9
+ * @see CVE-2025-56200 - validator.js URL validation bypass vulnerability
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.UrlValidationPresets = void 0;
13
+ exports.validateUrl = validateUrl;
14
+ exports.isValidUrl = isValidUrl;
15
+ exports.sanitizeUrl = sanitizeUrl;
16
+ exports.extractHostname = extractHostname;
17
+ exports.isHttps = isHttps;
18
+ /**
19
+ * Default validation options
20
+ */
21
+ const DEFAULT_OPTIONS = {
22
+ allowedProtocols: ['http:', 'https:'],
23
+ allowAuthentication: false,
24
+ requireTld: true,
25
+ allowLocalhost: false,
26
+ allowIpAddress: true,
27
+ maxLength: 2048,
28
+ };
29
+ /**
30
+ * Dangerous URL protocols that should always be blocked for security
31
+ */
32
+ const DANGEROUS_PROTOCOLS = [
33
+ 'javascript:',
34
+ 'data:',
35
+ 'vbscript:',
36
+ 'file:',
37
+ 'blob:',
38
+ 'about:',
39
+ ];
40
+ /**
41
+ * TLD validation regex (common TLDs)
42
+ * Note: This is not exhaustive but covers most cases
43
+ */
44
+ const TLD_REGEX = /\.[a-z]{2,}$/i;
45
+ /**
46
+ * IPv4 address regex
47
+ */
48
+ const IPV4_REGEX = /^(\d{1,3}\.){3}\d{1,3}$/;
49
+ /**
50
+ * IPv6 address regex (simplified)
51
+ */
52
+ const IPV6_REGEX = /^\[?[0-9a-f:]+\]?$/i;
53
+ /**
54
+ * Validates a URL string using the WHATWG URL API
55
+ *
56
+ * This is the secure replacement for validator.js isURL() function.
57
+ * It uses the native URL constructor which properly handles all edge cases
58
+ * and prevents the CVE-2025-56200 vulnerability.
59
+ *
60
+ * @param urlString - The URL string to validate
61
+ * @param options - Validation options
62
+ * @returns Validation result with details
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * // Basic validation
67
+ * const result = validateUrl('https://example.com');
68
+ * if (result.valid) {
69
+ * console.log('Valid URL:', result.url?.href);
70
+ * }
71
+ *
72
+ * // Strict validation for user input
73
+ * const strictResult = validateUrl(userInput, {
74
+ * allowedProtocols: ['https:'],
75
+ * requireTld: true,
76
+ * allowLocalhost: false,
77
+ * allowAuthentication: false,
78
+ * });
79
+ *
80
+ * // Custom domain allowlist
81
+ * const allowlistResult = validateUrl(url, {
82
+ * allowedDomains: ['example.com', 'trusted-site.org'],
83
+ * });
84
+ * ```
85
+ */
86
+ function validateUrl(urlString, options = {}) {
87
+ const opts = { ...DEFAULT_OPTIONS, ...options };
88
+ const warnings = [];
89
+ // Step 1: Length validation
90
+ if (urlString.length > opts.maxLength) {
91
+ return {
92
+ valid: false,
93
+ error: `URL exceeds maximum length of ${opts.maxLength} characters`,
94
+ };
95
+ }
96
+ // Step 2: Check for dangerous protocols BEFORE URL parsing
97
+ // This prevents the CVE-2025-56200 vulnerability
98
+ const lowerUrl = urlString.toLowerCase();
99
+ for (const dangerousProto of DANGEROUS_PROTOCOLS) {
100
+ if (lowerUrl.startsWith(dangerousProto)) {
101
+ return {
102
+ valid: false,
103
+ error: `Dangerous protocol detected: ${dangerousProto}`,
104
+ };
105
+ }
106
+ }
107
+ // Step 3: WHATWG URL parsing (the secure way)
108
+ let url;
109
+ try {
110
+ url = new URL(urlString);
111
+ }
112
+ catch (error) {
113
+ return {
114
+ valid: false,
115
+ error: `Invalid URL format: ${error instanceof Error ? error.message : 'Unknown error'}`,
116
+ };
117
+ }
118
+ // Step 4: Protocol validation
119
+ if (!opts.allowedProtocols.includes(url.protocol)) {
120
+ return {
121
+ valid: false,
122
+ error: `Protocol '${url.protocol}' is not allowed. Allowed protocols: ${opts.allowedProtocols.join(', ')}`,
123
+ };
124
+ }
125
+ // Step 5: Authentication validation
126
+ if (!opts.allowAuthentication && (url.username || url.password)) {
127
+ return {
128
+ valid: false,
129
+ error: 'URLs with authentication (username:password) are not allowed',
130
+ };
131
+ }
132
+ // Step 6: Hostname validation
133
+ if (!url.hostname) {
134
+ return {
135
+ valid: false,
136
+ error: 'URL must have a valid hostname',
137
+ };
138
+ }
139
+ // Step 7: Localhost validation
140
+ const isLocalhost = url.hostname === 'localhost' ||
141
+ url.hostname === '127.0.0.1' ||
142
+ url.hostname === '[::1]';
143
+ if (isLocalhost && !opts.allowLocalhost) {
144
+ return {
145
+ valid: false,
146
+ error: 'Localhost URLs are not allowed',
147
+ };
148
+ }
149
+ // Step 8: IP address validation
150
+ const isIpv4 = IPV4_REGEX.test(url.hostname);
151
+ const isIpv6 = IPV6_REGEX.test(url.hostname);
152
+ const isIpAddress = isIpv4 || isIpv6;
153
+ if (isIpAddress && !opts.allowIpAddress) {
154
+ return {
155
+ valid: false,
156
+ error: 'IP addresses are not allowed',
157
+ };
158
+ }
159
+ // Step 9: TLD validation (for non-IP, non-localhost hosts)
160
+ if (opts.requireTld && !isIpAddress && !isLocalhost) {
161
+ if (!TLD_REGEX.test(url.hostname)) {
162
+ return {
163
+ valid: false,
164
+ error: 'URL must have a valid top-level domain (TLD)',
165
+ };
166
+ }
167
+ }
168
+ // Step 10: Domain allowlist validation
169
+ if (options.allowedDomains && options.allowedDomains.length > 0) {
170
+ const isAllowed = options.allowedDomains.some(domain => {
171
+ return url.hostname === domain || url.hostname.endsWith('.' + domain);
172
+ });
173
+ if (!isAllowed) {
174
+ return {
175
+ valid: false,
176
+ error: `Domain '${url.hostname}' is not in the allowlist`,
177
+ };
178
+ }
179
+ }
180
+ // Step 11: Domain blocklist validation
181
+ if (options.blockedDomains && options.blockedDomains.length > 0) {
182
+ const isBlocked = options.blockedDomains.some(domain => {
183
+ return url.hostname === domain || url.hostname.endsWith('.' + domain);
184
+ });
185
+ if (isBlocked) {
186
+ return {
187
+ valid: false,
188
+ error: `Domain '${url.hostname}' is blocked`,
189
+ };
190
+ }
191
+ }
192
+ // Step 12: Security warnings (non-fatal)
193
+ if (url.protocol === 'http:' && opts.allowedProtocols.includes('https:')) {
194
+ warnings.push('Using HTTP instead of HTTPS (insecure)');
195
+ }
196
+ if (url.username || url.password) {
197
+ warnings.push('URL contains authentication credentials');
198
+ }
199
+ // Success!
200
+ return {
201
+ valid: true,
202
+ url,
203
+ warnings: warnings.length > 0 ? warnings : undefined,
204
+ };
205
+ }
206
+ /**
207
+ * Simple boolean validation (for drop-in replacement of validator.isURL)
208
+ *
209
+ * @param urlString - The URL string to validate
210
+ * @param options - Validation options
211
+ * @returns true if valid, false otherwise
212
+ *
213
+ * @example
214
+ * ```typescript
215
+ * if (isValidUrl('https://example.com')) {
216
+ * // URL is valid
217
+ * }
218
+ * ```
219
+ */
220
+ function isValidUrl(urlString, options = {}) {
221
+ return validateUrl(urlString, options).valid;
222
+ }
223
+ /**
224
+ * Sanitize URL by parsing and reconstructing it
225
+ * This ensures the URL is properly formatted and safe
226
+ *
227
+ * @param urlString - The URL string to sanitize
228
+ * @param options - Validation options
229
+ * @returns Sanitized URL string or null if invalid
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * const clean = sanitizeUrl('HTTP://EXAMPLE.COM/path');
234
+ * // Returns: 'http://example.com/path'
235
+ * ```
236
+ */
237
+ function sanitizeUrl(urlString, options = {}) {
238
+ const result = validateUrl(urlString, options);
239
+ return result.valid ? result.url.href : null;
240
+ }
241
+ /**
242
+ * Extract and validate hostname from URL
243
+ *
244
+ * @param urlString - The URL string
245
+ * @returns Hostname or null if invalid
246
+ */
247
+ function extractHostname(urlString) {
248
+ const result = validateUrl(urlString);
249
+ return result.valid ? result.url.hostname : null;
250
+ }
251
+ /**
252
+ * Check if URL is HTTPS
253
+ *
254
+ * @param urlString - The URL string
255
+ * @returns true if HTTPS, false otherwise
256
+ */
257
+ function isHttps(urlString) {
258
+ const result = validateUrl(urlString);
259
+ return result.valid && result.url.protocol === 'https:';
260
+ }
261
+ /**
262
+ * Preset validation configurations for common use cases
263
+ */
264
+ exports.UrlValidationPresets = {
265
+ /**
266
+ * Strict validation for production user input
267
+ */
268
+ STRICT: {
269
+ allowedProtocols: ['https:'],
270
+ allowAuthentication: false,
271
+ requireTld: true,
272
+ allowLocalhost: false,
273
+ allowIpAddress: false,
274
+ },
275
+ /**
276
+ * Standard web URLs (HTTP/HTTPS)
277
+ */
278
+ WEB: {
279
+ allowedProtocols: ['http:', 'https:'],
280
+ allowAuthentication: false,
281
+ requireTld: true,
282
+ allowLocalhost: false,
283
+ allowIpAddress: true,
284
+ },
285
+ /**
286
+ * Development mode (allows localhost)
287
+ */
288
+ DEVELOPMENT: {
289
+ allowedProtocols: ['http:', 'https:'],
290
+ allowAuthentication: false,
291
+ requireTld: false,
292
+ allowLocalhost: true,
293
+ allowIpAddress: true,
294
+ },
295
+ /**
296
+ * API endpoints (allows authentication)
297
+ */
298
+ API: {
299
+ allowedProtocols: ['http:', 'https:'],
300
+ allowAuthentication: true,
301
+ requireTld: true,
302
+ allowLocalhost: false,
303
+ allowIpAddress: true,
304
+ },
305
+ };
306
+ //# sourceMappingURL=SecureUrlValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecureUrlValidator.js","sourceRoot":"","sources":["../../src/utils/SecureUrlValidator.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAiJH,kCA2IC;AAgBD,gCAKC;AAgBD,kCAMC;AAQD,0CAGC;AAQD,0BAGC;AArRD;;GAEG;AACH,MAAM,eAAe,GAA8E;IACjG,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;IACrC,mBAAmB,EAAE,KAAK;IAC1B,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,KAAK;IACrB,cAAc,EAAE,IAAI;IACpB,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,mBAAmB,GAAG;IAC1B,aAAa;IACb,OAAO;IACP,WAAW;IACX,OAAO;IACP,OAAO;IACP,QAAQ;CACT,CAAC;AAEF;;;GAGG;AACH,MAAM,SAAS,GAAG,eAAe,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,GAAG,qBAAqB,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAgB,WAAW,CACzB,SAAiB,EACjB,UAAgC,EAAE;IAElC,MAAM,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC;IAChD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,4BAA4B;IAC5B,IAAI,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,iCAAiC,IAAI,CAAC,SAAS,aAAa;SACpE,CAAC;IACJ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EG;IACH,WAAW,EAAE;QACX,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;QACrC,mBAAmB,EAAE,KAAK;QAC1B,UAAU,EAAE,KAAK;QACjB,cAAc,EAAE,IAAI;QACpB,cAAc,EAAE,IAAI;KACG;IAEzB;;OAEG;IACH,GAAG,EAAE;QACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;QACrC,mBAAmB,EAAE,IAAI;QACzB,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,KAAK;QACrB,cAAc,EAAE,IAAI;KACG;CAC1B,CAAC"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Secure Validation Utility
3
+ *
4
+ * Provides safe parameter validation without eval() or code execution.
5
+ * Replaces string-based validators with type-safe validation functions.
6
+ *
7
+ * Security: NO eval(), NO Function(), NO code strings
8
+ *
9
+ * @module utils/SecureValidation
10
+ */
11
+ /**
12
+ * Validation configuration types
13
+ */
14
+ export interface ValidationConfig {
15
+ /** Required parameter names */
16
+ requiredParams?: string[];
17
+ /** Type checks: param name -> expected type */
18
+ typeChecks?: Record<string, ValidationType>;
19
+ /** Range checks for numbers */
20
+ rangeChecks?: Record<string, {
21
+ min?: number;
22
+ max?: number;
23
+ }>;
24
+ /** Pattern checks using RegExp */
25
+ patternChecks?: Record<string, RegExp>;
26
+ /** Length checks for strings/arrays */
27
+ lengthChecks?: Record<string, {
28
+ min?: number;
29
+ max?: number;
30
+ }>;
31
+ /** Enum checks: param name -> allowed values */
32
+ enumChecks?: Record<string, any[]>;
33
+ /** Custom validator ID (references predefined validators) */
34
+ customValidatorId?: string;
35
+ }
36
+ /**
37
+ * Supported validation types
38
+ */
39
+ export type ValidationType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function' | 'undefined' | 'null';
40
+ /**
41
+ * Validation result
42
+ */
43
+ export interface ValidationResult {
44
+ valid: boolean;
45
+ errors: string[];
46
+ }
47
+ /**
48
+ * Secure validation utility class
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const config: ValidationConfig = {
53
+ * requiredParams: ['name', 'age'],
54
+ * typeChecks: { name: 'string', age: 'number' },
55
+ * rangeChecks: { age: { min: 0, max: 150 } }
56
+ * };
57
+ *
58
+ * const result = SecureValidation.validate(config, { name: 'John', age: 30 });
59
+ * // result.valid = true
60
+ *
61
+ * const result2 = SecureValidation.validate(config, { name: 'John', age: 200 });
62
+ * // result2.valid = false
63
+ * // result2.errors = ['Parameter age (200) exceeds maximum (150)']
64
+ * ```
65
+ */
66
+ export declare class SecureValidation {
67
+ /**
68
+ * Validate parameters against configuration
69
+ *
70
+ * @param config Validation configuration
71
+ * @param params Parameters to validate
72
+ * @returns Validation result with errors
73
+ */
74
+ static validate(config: ValidationConfig, params: Record<string, any>): ValidationResult;
75
+ /**
76
+ * Validate type of a value
77
+ *
78
+ * @param value Value to check
79
+ * @param expectedType Expected type
80
+ * @returns True if type matches
81
+ */
82
+ private static validateType;
83
+ /**
84
+ * Run predefined custom validator
85
+ *
86
+ * Security: Only predefined validators allowed, no dynamic code execution
87
+ *
88
+ * @param validatorId Validator identifier
89
+ * @param params Parameters to validate
90
+ * @returns Array of error messages
91
+ */
92
+ private static runCustomValidator;
93
+ /**
94
+ * Create validation config for required parameters
95
+ *
96
+ * @param paramNames Required parameter names
97
+ * @returns Validation configuration
98
+ */
99
+ static createRequiredParamsConfig(paramNames: string[]): ValidationConfig;
100
+ /**
101
+ * Create validation config for type checking
102
+ *
103
+ * @param typeMap Parameter name -> type mapping
104
+ * @returns Validation configuration
105
+ */
106
+ static createTypeCheckConfig(typeMap: Record<string, ValidationType>): ValidationConfig;
107
+ /**
108
+ * Validate without throwing exceptions
109
+ *
110
+ * @param config Validation configuration
111
+ * @param params Parameters to validate
112
+ * @returns True if valid, false otherwise
113
+ */
114
+ static isValid(config: ValidationConfig, params: Record<string, any>): boolean;
115
+ /**
116
+ * Validate and throw on error
117
+ *
118
+ * @param config Validation configuration
119
+ * @param params Parameters to validate
120
+ * @throws ValidationError if validation fails
121
+ */
122
+ static validateOrThrow(config: ValidationConfig, params: Record<string, any>): void;
123
+ }
124
+ /**
125
+ * Validation error class
126
+ */
127
+ export declare class ValidationError extends Error {
128
+ errors: string[];
129
+ constructor(message: string, errors: string[]);
130
+ }
131
+ //# sourceMappingURL=SecureValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecureValidation.d.ts","sourceRoot":"","sources":["../../src/utils/SecureValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACnC,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,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