claude-flow-novice 1.3.6 → 1.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 (347) hide show
  1. package/.claude/agents/analysis/code-analyzer.md +3 -20
  2. package/.claude/agents/analysis/code-review/analyze-code-quality.md +1 -1
  3. package/.claude/agents/analyst.md +208 -550
  4. package/.claude/agents/architect.md +136 -469
  5. package/.claude/agents/architecture/system-architect.md +20 -1
  6. package/.claude/agents/architecture/system-design/arch-system-design.md +1 -1
  7. package/.claude/agents/base-template-generator.md +24 -1
  8. package/.claude/agents/coder.md +87 -303
  9. package/.claude/agents/consensus/byzantine-coordinator.md +4 -21
  10. package/.claude/agents/consensus/consensus-builder.md +3 -20
  11. package/.claude/agents/consensus/crdt-synchronizer.md +4 -21
  12. package/.claude/agents/consensus/gossip-coordinator.md +4 -21
  13. package/.claude/agents/consensus/performance-benchmarker.md +4 -21
  14. package/.claude/agents/consensus/quorum-manager.md +4 -21
  15. package/.claude/agents/consensus/raft-manager.md +4 -21
  16. package/.claude/agents/consensus/security-manager.md +4 -21
  17. package/.claude/agents/coordinator.md +22 -11
  18. package/.claude/agents/data/ml/data-ml-model.md +2 -2
  19. package/.claude/agents/development/backend/dev-backend-api.md +2 -2
  20. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +2 -2
  21. package/.claude/agents/devops/devops-engineer.md +134 -402
  22. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +2 -2
  23. package/.claude/agents/github/code-review-swarm.md +1 -1
  24. package/.claude/agents/github/github-specialist.md +856 -0
  25. package/.claude/agents/github/pr-manager.md +1 -1
  26. package/.claude/agents/github/release-manager.md +1 -1
  27. package/.claude/agents/neural/neural-pattern-agent.md +762 -0
  28. package/.claude/agents/optimization/benchmark-suite.md +1 -1
  29. package/.claude/agents/optimization/perf-analyzer.md +1 -1
  30. package/.claude/agents/optimization/performance-monitor.md +1 -1
  31. package/.claude/agents/planner.md +135 -0
  32. package/.claude/agents/researcher.md +22 -9
  33. package/.claude/agents/reviewer.md +291 -0
  34. package/.claude/agents/security/security-specialist.md +1 -1
  35. package/.claude/agents/sparc/architecture.md +1 -1
  36. package/.claude/agents/sparc/pseudocode.md +1 -1
  37. package/.claude/agents/sparc/refinement.md +1 -1
  38. package/.claude/agents/sparc/specification.md +1 -1
  39. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +2 -2
  40. package/.claude/agents/tester.md +21 -11
  41. package/.claude/agents/testing/unit/tdd-london-swarm.md +1 -1
  42. package/.claude/agents/testing/validation/production-validator.md +1 -1
  43. package/.claude/commands/claude-soul.js +1 -1
  44. package/.claude/commands/fullstack.md +134 -0
  45. package/.claude/commands/index.js +4 -0
  46. package/.claude/hooks.json +12 -15
  47. package/{.claude → .claude-flow-novice/.claude}/agents/MIGRATION_SUMMARY.md +1 -1
  48. package/.claude-flow-novice/.claude/agents/analysis/code-analyzer.md +192 -0
  49. package/.claude-flow-novice/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
  50. package/.claude-flow-novice/.claude/agents/analyst.md +300 -0
  51. package/.claude-flow-novice/.claude/agents/architect.md +557 -0
  52. package/.claude-flow-novice/.claude/agents/architecture/system-architect.md +630 -0
  53. package/.claude-flow-novice/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
  54. package/.claude-flow-novice/.claude/agents/base-template-generator.md +65 -0
  55. package/.claude-flow-novice/.claude/agents/coder.md +180 -0
  56. package/.claude-flow-novice/.claude/agents/consensus/byzantine-coordinator.md +46 -0
  57. package/.claude-flow-novice/.claude/agents/consensus/consensus-builder.md +225 -0
  58. package/.claude-flow-novice/.claude/agents/consensus/crdt-synchronizer.md +980 -0
  59. package/.claude-flow-novice/.claude/agents/consensus/gossip-coordinator.md +46 -0
  60. package/.claude-flow-novice/.claude/agents/consensus/performance-benchmarker.md +834 -0
  61. package/.claude-flow-novice/.claude/agents/consensus/quorum-manager.md +806 -0
  62. package/.claude-flow-novice/.claude/agents/consensus/raft-manager.md +46 -0
  63. package/.claude-flow-novice/.claude/agents/consensus/security-manager.md +605 -0
  64. package/.claude-flow-novice/.claude/agents/coordinator.md +842 -0
  65. package/.claude-flow-novice/.claude/agents/data/ml/data-ml-model.md +193 -0
  66. package/.claude-flow-novice/.claude/agents/development/backend/dev-backend-api.md +142 -0
  67. package/.claude-flow-novice/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  68. package/.claude-flow-novice/.claude/agents/devops/devops-engineer.md +638 -0
  69. package/.claude-flow-novice/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  70. package/.claude-flow-novice/.claude/agents/github/code-review-swarm.md +538 -0
  71. package/.claude-flow-novice/.claude/agents/github/github-modes.md +173 -0
  72. package/.claude-flow-novice/.claude/agents/github/github-specialist.md +856 -0
  73. package/.claude-flow-novice/.claude/agents/github/issue-tracker.md +319 -0
  74. package/.claude-flow-novice/.claude/agents/github/multi-repo-swarm.md +553 -0
  75. package/.claude-flow-novice/.claude/agents/github/pr-manager.md +191 -0
  76. package/.claude-flow-novice/.claude/agents/github/project-board-sync.md +509 -0
  77. package/.claude-flow-novice/.claude/agents/github/release-manager.md +367 -0
  78. package/.claude-flow-novice/.claude/agents/github/release-swarm.md +583 -0
  79. package/.claude-flow-novice/.claude/agents/github/repo-architect.md +398 -0
  80. package/.claude-flow-novice/.claude/agents/github/swarm-issue.md +573 -0
  81. package/.claude-flow-novice/.claude/agents/github/swarm-pr.md +428 -0
  82. package/.claude-flow-novice/.claude/agents/github/sync-coordinator.md +452 -0
  83. package/.claude-flow-novice/.claude/agents/github/workflow-automation.md +635 -0
  84. package/.claude-flow-novice/.claude/agents/goal/goal-planner.md +73 -0
  85. package/.claude-flow-novice/.claude/agents/neural/neural-pattern-agent.md +762 -0
  86. package/.claude-flow-novice/.claude/agents/neural/safla-neural.md +74 -0
  87. package/.claude-flow-novice/.claude/agents/optimization/benchmark-suite.md +665 -0
  88. package/.claude-flow-novice/.claude/agents/optimization/load-balancer.md +431 -0
  89. package/.claude-flow-novice/.claude/agents/optimization/perf-analyzer.md +725 -0
  90. package/.claude-flow-novice/.claude/agents/optimization/performance-monitor.md +672 -0
  91. package/.claude-flow-novice/.claude/agents/optimization/resource-allocator.md +674 -0
  92. package/.claude-flow-novice/.claude/agents/optimization/topology-optimizer.md +808 -0
  93. package/.claude-flow-novice/.claude/agents/planner.md +135 -0
  94. package/.claude-flow-novice/.claude/agents/researcher.md +185 -0
  95. package/.claude-flow-novice/.claude/agents/reviewer.md +291 -0
  96. package/.claude-flow-novice/.claude/agents/security/security-specialist.md +978 -0
  97. package/.claude-flow-novice/.claude/agents/sparc/architecture.md +472 -0
  98. package/.claude-flow-novice/.claude/agents/sparc/pseudocode.md +318 -0
  99. package/.claude-flow-novice/.claude/agents/sparc/refinement.md +525 -0
  100. package/.claude-flow-novice/.claude/agents/sparc/specification.md +276 -0
  101. package/.claude-flow-novice/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
  102. package/.claude-flow-novice/.claude/agents/sublinear/consciousness-evolution-agent.md +499 -0
  103. package/.claude-flow-novice/.claude/agents/sublinear/matrix-solver-agent.md +113 -0
  104. package/.claude-flow-novice/.claude/agents/sublinear/nanosecond-scheduler-agent.md +644 -0
  105. package/.claude-flow-novice/.claude/agents/sublinear/pagerank-agent.md +699 -0
  106. package/.claude-flow-novice/.claude/agents/sublinear/phi-calculator-agent.md +749 -0
  107. package/.claude-flow-novice/.claude/agents/sublinear/psycho-symbolic-agent.md +543 -0
  108. package/.claude-flow-novice/.claude/agents/sublinear/sublinear.md +816 -0
  109. package/.claude-flow-novice/.claude/agents/sublinear/temporal-advantage-agent.md +360 -0
  110. package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator-enhanced.md +746 -0
  111. package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator.md +396 -0
  112. package/.claude-flow-novice/.claude/agents/swarm/hierarchical-coordinator.md +300 -0
  113. package/.claude-flow-novice/.claude/agents/swarm/mesh-coordinator.md +435 -0
  114. package/.claude-flow-novice/.claude/agents/templates/automation-smart-agent.md +205 -0
  115. package/.claude-flow-novice/.claude/agents/templates/coordinator-swarm-init.md +90 -0
  116. package/.claude-flow-novice/.claude/agents/templates/github-pr-manager.md +177 -0
  117. package/.claude-flow-novice/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  118. package/.claude-flow-novice/.claude/agents/templates/memory-coordinator.md +187 -0
  119. package/.claude-flow-novice/.claude/agents/templates/migration-plan.md +746 -0
  120. package/.claude-flow-novice/.claude/agents/templates/orchestrator-task.md +139 -0
  121. package/.claude-flow-novice/.claude/agents/templates/performance-analyzer.md +199 -0
  122. package/.claude-flow-novice/.claude/agents/templates/sparc-coordinator.md +183 -0
  123. package/.claude-flow-novice/.claude/agents/tester.md +663 -0
  124. package/.claude-flow-novice/.claude/agents/testing/e2e/playwright-agent.md +249 -0
  125. package/.claude-flow-novice/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
  126. package/.claude-flow-novice/.claude/agents/testing/validation/production-validator.md +395 -0
  127. package/.claude-flow-novice/dist/index.js +12 -24
  128. package/.claude-flow-novice/dist/index.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/agents/agent-manager.js +123 -69
  130. package/.claude-flow-novice/dist/src/agents/agent-manager.js.map +1 -1
  131. package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js +7 -7
  132. package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js.map +1 -1
  133. package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js +485 -0
  134. package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js +630 -0
  136. package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js.map +1 -0
  137. package/.claude-flow-novice/dist/src/cli/commands/agent.js +1 -1
  138. package/.claude-flow-novice/dist/src/cli/commands/agent.js.map +1 -1
  139. package/.claude-flow-novice/dist/src/cli/commands/config-integration.js +6 -6
  140. package/.claude-flow-novice/dist/src/cli/commands/enterprise.js +18 -18
  141. package/.claude-flow-novice/dist/src/cli/commands/enterprise.js.map +1 -1
  142. package/.claude-flow-novice/dist/src/cli/commands/goal-init.js +4 -4
  143. package/.claude-flow-novice/dist/src/cli/commands/help-new.js +23 -23
  144. package/.claude-flow-novice/dist/src/cli/commands/help-new.js.map +1 -1
  145. package/.claude-flow-novice/dist/src/cli/commands/help.js +74 -74
  146. package/.claude-flow-novice/dist/src/cli/commands/help.js.map +1 -1
  147. package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js +2 -2
  148. package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
  149. package/.claude-flow-novice/dist/src/cli/commands/hive.js +4 -4
  150. package/.claude-flow-novice/dist/src/cli/commands/index.js +103 -132
  151. package/.claude-flow-novice/dist/src/cli/commands/index.js.map +1 -1
  152. package/.claude-flow-novice/dist/src/cli/commands/mcp.js +1 -1
  153. package/.claude-flow-novice/dist/src/cli/commands/migrate.js +4 -4
  154. package/.claude-flow-novice/dist/src/cli/commands/migrate.js.map +1 -1
  155. package/.claude-flow-novice/dist/src/cli/commands/monitor.js +1 -1
  156. package/.claude-flow-novice/dist/src/cli/commands/neural-init.js +4 -4
  157. package/.claude-flow-novice/dist/src/cli/commands/ruv-swarm.js +8 -8
  158. package/.claude-flow-novice/dist/src/cli/commands/sparc.js +12 -12
  159. package/.claude-flow-novice/dist/src/cli/commands/sparc.js.map +1 -1
  160. package/.claude-flow-novice/dist/src/cli/commands/start/start-command.js +3 -3
  161. package/.claude-flow-novice/dist/src/cli/commands/status.js +1 -1
  162. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +7 -7
  163. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  164. package/.claude-flow-novice/dist/src/cli/commands/verification.js +18 -18
  165. package/.claude-flow-novice/dist/src/cli/completion.js +54 -54
  166. package/.claude-flow-novice/dist/src/cli/completion.js.map +1 -1
  167. package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js +11 -11
  168. package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js.map +1 -1
  169. package/.claude-flow-novice/dist/src/cli/consolidated/core/CommandHandlers.js +31 -31
  170. package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js +39 -39
  171. package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js.map +1 -1
  172. package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js +25 -25
  173. package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js.map +1 -1
  174. package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js +8 -8
  175. package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js.map +1 -1
  176. package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js +6 -6
  177. package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js.map +1 -1
  178. package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js +7 -7
  179. package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js.map +1 -1
  180. package/.claude-flow-novice/dist/src/cli/index-remote.js +10 -10
  181. package/.claude-flow-novice/dist/src/cli/index.js +1 -1
  182. package/.claude-flow-novice/dist/src/cli/init/directory-structure.js +8 -8
  183. package/.claude-flow-novice/dist/src/cli/init/index.js +3 -3
  184. package/.claude-flow-novice/dist/src/cli/init/sparc-environment.js +67 -67
  185. package/.claude-flow-novice/dist/src/cli/init/swarm-commands.js +18 -18
  186. package/.claude-flow-novice/dist/src/cli/node-repl.js +2 -2
  187. package/.claude-flow-novice/dist/src/cli/repl.js +1 -1
  188. package/.claude-flow-novice/dist/src/cli/simple-cli.js +68 -68
  189. package/.claude-flow-novice/dist/src/cli/simple-cli.js.map +1 -1
  190. package/.claude-flow-novice/dist/src/cli/simple-commands/session-start-soul.js +271 -0
  191. package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js +7 -7
  192. package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js.map +1 -1
  193. package/.claude-flow-novice/dist/src/cli/ui/fallback-handler.js +7 -7
  194. package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js +816 -0
  195. package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js +812 -0
  197. package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js.map +1 -0
  198. package/.claude-flow-novice/dist/src/communication/optimized-serialization.js +369 -0
  199. package/.claude-flow-novice/dist/src/communication/optimized-serialization.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/communication/performance-optimizations.js +526 -0
  201. package/.claude-flow-novice/dist/src/communication/performance-optimizations.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/communication/performance-validator.js +532 -0
  203. package/.claude-flow-novice/dist/src/communication/performance-validator.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/communication/priority-message-queue.js +525 -0
  205. package/.claude-flow-novice/dist/src/communication/priority-message-queue.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js +218 -0
  207. package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js +521 -0
  209. package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js +563 -0
  211. package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/communication/websocket-cluster.js +344 -0
  213. package/.claude-flow-novice/dist/src/communication/websocket-cluster.js.map +1 -0
  214. package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js +369 -0
  215. package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js.map +1 -0
  216. package/.claude-flow-novice/dist/src/config/config-manager.js +1 -1
  217. package/.claude-flow-novice/dist/src/config/config-manager.js.map +1 -1
  218. package/.claude-flow-novice/dist/src/config/core/intelligent-configuration-manager.js +1 -1
  219. package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js +6 -6
  220. package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js.map +1 -1
  221. package/.claude-flow-novice/dist/src/config/migration/config-migration.js +1 -1
  222. package/.claude-flow-novice/dist/src/config/ruv-swarm-integration.js +1 -1
  223. package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js +1 -1
  224. package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js.map +1 -1
  225. package/.claude-flow-novice/dist/src/config/web-portal-config.js +0 -9
  226. package/.claude-flow-novice/dist/src/config/web-portal-config.js.map +1 -1
  227. package/.claude-flow-novice/dist/src/config/zero-config-setup.js +18 -18
  228. package/.claude-flow-novice/dist/src/config/zero-config-setup.js.map +1 -1
  229. package/.claude-flow-novice/dist/src/core/logger.js +33 -10
  230. package/.claude-flow-novice/dist/src/core/logger.js.map +1 -1
  231. package/.claude-flow-novice/dist/src/migration/index.js +1 -1
  232. package/.claude-flow-novice/dist/src/migration/index.js.map +1 -1
  233. package/.claude-flow-novice/dist/src/migration/migration-runner.js +4 -4
  234. package/.claude-flow-novice/dist/src/migration/migration-runner.js.map +1 -1
  235. package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js +430 -0
  236. package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js.map +1 -0
  237. package/.claude-flow-novice/dist/src/slash-commands/claude-soul.js +248 -365
  238. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +1 -1
  239. package/.claude-flow-novice/dist/src/swarm/claude-code-interface.js +1 -1
  240. package/.claude-flow-novice/dist/src/swarm/claude-flow-executor.js +1 -1
  241. package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js +471 -0
  242. package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js.map +1 -0
  243. package/.claude-flow-novice/dist/src/swarm/hive-mind-integration.js +1 -1
  244. package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js +543 -0
  245. package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js.map +1 -0
  246. package/.claude-flow-novice/dist/src/swarm/optimizations/connection-pool.js +1 -1
  247. package/.claude-flow-novice/dist/src/swarm/optimizations/optimized-executor.js +1 -1
  248. package/.claude-flow-novice/dist/src/swarm/types.js.map +1 -1
  249. package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js +709 -0
  250. package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js.map +1 -0
  251. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js +612 -0
  252. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js.map +1 -0
  253. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js +679 -0
  254. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js.map +1 -0
  255. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js +654 -0
  256. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js.map +1 -0
  257. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js +402 -0
  258. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js.map +1 -0
  259. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js +459 -0
  260. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js.map +1 -0
  261. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js +513 -0
  262. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js.map +1 -0
  263. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js +19 -0
  264. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js.map +1 -0
  265. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js +568 -0
  266. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js.map +1 -0
  267. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js +418 -0
  268. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js.map +1 -0
  269. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js +530 -0
  270. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js.map +1 -0
  271. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js +250 -0
  272. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js.map +1 -0
  273. package/.claude-flow-novice/dist/src/task/index.js +7 -7
  274. package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js +420 -0
  275. package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js.map +1 -0
  276. package/.claude-flow-novice/dist/src/validation/production-validator.js +1435 -0
  277. package/.claude-flow-novice/dist/src/validation/production-validator.js.map +1 -0
  278. package/.claude-flow-novice/dist/src/verification/cli-integration.js +3 -3
  279. package/.claude-flow-novice/dist/src/verification/hooks.js +1 -1
  280. package/CHANGELOG.md +26 -0
  281. package/CLAUDE.md +1967 -68
  282. package/README.md +0 -1
  283. package/config/build/babel.config.cjs +19 -11
  284. package/config/typescript/tsconfig.json +1 -1
  285. package/examples/claude-api-error-handling.ts +2 -2
  286. package/examples/frontend-testing-demo.ts +470 -0
  287. package/examples/litellm/config/config.yaml +1 -1
  288. package/package.json +13 -7
  289. package/scripts/build/unified-builder.sh +6 -6
  290. package/scripts/build/validate-agents.js +238 -0
  291. package/scripts/run-production-validation.ts +590 -0
  292. package/scripts/test/test-coordination-features.ts +2 -2
  293. package/scripts/validate-stage3-performance.ts +377 -0
  294. package/src/cli/simple-commands/hooks.js +1 -0
  295. package/src/cli/simple-commands/init/agent-copier.js +0 -2
  296. package/src/cli/simple-commands/init/index.js +5 -97
  297. package/src/cli/simple-commands/init/templates/CLAUDE.md +163 -1158
  298. package/src/cli/simple-commands/init/templates/claude-md.js +38 -157
  299. package/src/swarm-fullstack/integrations/communication-bridge.ts +931 -0
  300. package/src/swarm-fullstack/testing/api-contract-validator.ts +909 -0
  301. package/src/swarm-fullstack/testing/backend-test-orchestrator.ts +791 -0
  302. package/src/swarm-fullstack/testing/frontend-test-orchestrator.ts +853 -0
  303. package/src/swarm-fullstack/testing/visual-regression.ts +507 -0
  304. package/src/swarm-fullstack/workflows/convergence-detector.ts +736 -0
  305. package/src/swarm-fullstack/workflows/fix-coordinator.ts +677 -0
  306. package/src/swarm-fullstack/workflows/index.ts +75 -0
  307. package/src/swarm-fullstack/workflows/iterative-build-test.ts +829 -0
  308. package/src/swarm-fullstack/workflows/regression-test-manager.ts +590 -0
  309. package/src/swarm-fullstack/workflows/test-result-analyzer.ts +739 -0
  310. package/src/swarm-fullstack/workflows/workflow-metrics.ts +399 -0
  311. package/wiki/command-reference/README.md +1 -2
  312. package/wiki/command-reference/mcp-tools/README.md +1 -1
  313. package/wiki/getting-started/claude-code-mcp/README.md +1 -2
  314. package/wiki/getting-started/installation/README.md +2 -10
  315. package/.claude/commands/flow-nexus/app-store.md +0 -124
  316. package/.claude/commands/flow-nexus/challenges.md +0 -120
  317. package/.claude/commands/flow-nexus/login-registration.md +0 -65
  318. package/.claude/commands/flow-nexus/neural-network.md +0 -134
  319. package/.claude/commands/flow-nexus/payments.md +0 -116
  320. package/.claude/commands/flow-nexus/sandbox.md +0 -83
  321. package/.claude/commands/flow-nexus/swarm.md +0 -87
  322. package/.claude/commands/flow-nexus/user-tools.md +0 -152
  323. package/.claude/commands/flow-nexus/workflow.md +0 -115
  324. package/.claude-flow-novice/dist/cli/index.js +0 -45
  325. package/.claude-flow-novice/dist/core/index.js +0 -22
  326. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +0 -595
  327. package/.claude-flow-novice/dist/mcp/mcp-server-sdk.js +0 -649
  328. package/.claude-flow-novice/dist/mcp/mcp-server-with-slash-commands.js +0 -776
  329. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/claude-md.js +0 -1101
  330. package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +0 -265
  331. /package/{.claude → .claude-flow-novice/.claude}/agents/README.md +0 -0
  332. /package/{.claude → .claude-flow-novice/.claude}/agents/backend-dev.json +0 -0
  333. /package/{.claude → .claude-flow-novice/.claude}/agents/code-analyzer.json +0 -0
  334. /package/{.claude → .claude-flow-novice/.claude}/agents/coder.json +0 -0
  335. /package/{.claude → .claude-flow-novice/.claude}/agents/consensus/README.md +0 -0
  336. /package/{.claude → .claude-flow-novice/.claude}/agents/core/coder.md +0 -0
  337. /package/{.claude → .claude-flow-novice/.claude}/agents/core/planner.md +0 -0
  338. /package/{.claude → .claude-flow-novice/.claude}/agents/core/researcher.md +0 -0
  339. /package/{.claude → .claude-flow-novice/.claude}/agents/core/reviewer.md +0 -0
  340. /package/{.claude → .claude-flow-novice/.claude}/agents/core/tester.md +0 -0
  341. /package/{.claude → .claude-flow-novice/.claude}/agents/optimization/README.md +0 -0
  342. /package/{.claude → .claude-flow-novice/.claude}/agents/planner.json +0 -0
  343. /package/{.claude → .claude-flow-novice/.claude}/agents/researcher.json +0 -0
  344. /package/{.claude → .claude-flow-novice/.claude}/agents/reviewer.json +0 -0
  345. /package/{.claude → .claude-flow-novice/.claude}/agents/swarm/README.md +0 -0
  346. /package/{.claude → .claude-flow-novice/.claude}/agents/system-architect.json +0 -0
  347. /package/{.claude → .claude-flow-novice/.claude}/agents/tester.json +0 -0
@@ -0,0 +1,909 @@
1
+ /**
2
+ * API Contract Validator - Validates API contracts and detects breaking changes
3
+ * Implements OpenAPI schema validation and contract testing
4
+ */
5
+
6
+ import { EventEmitter } from 'events';
7
+ import { ILogger } from '../../core/logger.js';
8
+
9
+ export interface APIContract {
10
+ version: string;
11
+ basePath: string;
12
+ endpoints: APIEndpoint[];
13
+ schemas: Map<string, Schema>;
14
+ securitySchemes?: SecurityScheme[];
15
+ }
16
+
17
+ export interface APIEndpoint {
18
+ path: string;
19
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
20
+ operationId: string;
21
+ summary?: string;
22
+ description?: string;
23
+ parameters: Parameter[];
24
+ requestBody?: RequestBody;
25
+ responses: Map<number, Response>;
26
+ security?: string[];
27
+ tags?: string[];
28
+ }
29
+
30
+ export interface Parameter {
31
+ name: string;
32
+ in: 'path' | 'query' | 'header' | 'cookie';
33
+ required: boolean;
34
+ schema: Schema;
35
+ description?: string;
36
+ deprecated?: boolean;
37
+ }
38
+
39
+ export interface RequestBody {
40
+ required: boolean;
41
+ content: Map<string, MediaType>;
42
+ description?: string;
43
+ }
44
+
45
+ export interface Response {
46
+ description: string;
47
+ content?: Map<string, MediaType>;
48
+ headers?: Map<string, Header>;
49
+ }
50
+
51
+ export interface MediaType {
52
+ schema: Schema;
53
+ examples?: Map<string, any>;
54
+ }
55
+
56
+ export interface Schema {
57
+ type: string;
58
+ properties?: Map<string, Schema>;
59
+ required?: string[];
60
+ items?: Schema;
61
+ format?: string;
62
+ pattern?: string;
63
+ minimum?: number;
64
+ maximum?: number;
65
+ enum?: any[];
66
+ additionalProperties?: boolean | Schema;
67
+ }
68
+
69
+ export interface Header {
70
+ description?: string;
71
+ schema: Schema;
72
+ required?: boolean;
73
+ }
74
+
75
+ export interface SecurityScheme {
76
+ type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
77
+ name?: string;
78
+ in?: 'query' | 'header' | 'cookie';
79
+ scheme?: string;
80
+ bearerFormat?: string;
81
+ }
82
+
83
+ export interface ValidationResult {
84
+ valid: boolean;
85
+ endpoint: string;
86
+ method: string;
87
+ errors: ValidationError[];
88
+ warnings: ValidationWarning[];
89
+ timestamp: string;
90
+ }
91
+
92
+ export interface ValidationError {
93
+ type: 'request' | 'response' | 'schema' | 'security';
94
+ severity: 'critical' | 'high' | 'medium' | 'low';
95
+ message: string;
96
+ path: string;
97
+ expected?: any;
98
+ actual?: any;
99
+ }
100
+
101
+ export interface ValidationWarning {
102
+ type: 'deprecation' | 'optimization' | 'best-practice';
103
+ message: string;
104
+ recommendation?: string;
105
+ }
106
+
107
+ export interface ContractDiff {
108
+ breaking: BreakingChange[];
109
+ nonBreaking: Change[];
110
+ additions: Addition[];
111
+ deprecations: Deprecation[];
112
+ }
113
+
114
+ export interface BreakingChange {
115
+ type: 'removed-endpoint' | 'removed-field' | 'type-change' | 'required-added' | 'enum-reduced';
116
+ endpoint: string;
117
+ path: string;
118
+ oldValue: any;
119
+ newValue: any;
120
+ impact: 'high' | 'medium';
121
+ }
122
+
123
+ export interface Change {
124
+ type: 'description-change' | 'example-change' | 'default-change';
125
+ endpoint: string;
126
+ path: string;
127
+ oldValue: any;
128
+ newValue: any;
129
+ }
130
+
131
+ export interface Addition {
132
+ type: 'new-endpoint' | 'new-field' | 'new-enum-value';
133
+ endpoint: string;
134
+ path: string;
135
+ value: any;
136
+ }
137
+
138
+ export interface Deprecation {
139
+ endpoint: string;
140
+ path: string;
141
+ deprecatedAt: string;
142
+ removeAt?: string;
143
+ replacement?: string;
144
+ }
145
+
146
+ export class APIContractValidator extends EventEmitter {
147
+ private contracts: Map<string, APIContract> = new Map();
148
+ private validationHistory: ValidationResult[] = [];
149
+
150
+ constructor(private logger: ILogger) {
151
+ super();
152
+ }
153
+
154
+ /**
155
+ * Register API contract
156
+ */
157
+ registerContract(name: string, contract: APIContract): void {
158
+ this.logger.info('Registering API contract', { name, version: contract.version });
159
+
160
+ // Validate contract structure
161
+ this.validateContractStructure(contract);
162
+
163
+ this.contracts.set(name, contract);
164
+ this.emit('contract-registered', { name, contract });
165
+ }
166
+
167
+ /**
168
+ * Validate API request/response against contract
169
+ */
170
+ async validateRequest(
171
+ contractName: string,
172
+ endpoint: string,
173
+ method: string,
174
+ request: {
175
+ params?: Record<string, any>;
176
+ query?: Record<string, any>;
177
+ headers?: Record<string, any>;
178
+ body?: any;
179
+ },
180
+ ): Promise<ValidationResult> {
181
+ this.logger.debug('Validating request', { contractName, endpoint, method });
182
+
183
+ const contract = this.contracts.get(contractName);
184
+ if (!contract) {
185
+ throw new Error(`Contract ${contractName} not found`);
186
+ }
187
+
188
+ const apiEndpoint = this.findEndpoint(contract, endpoint, method);
189
+ if (!apiEndpoint) {
190
+ return {
191
+ valid: false,
192
+ endpoint,
193
+ method,
194
+ errors: [
195
+ {
196
+ type: 'request',
197
+ severity: 'critical',
198
+ message: `Endpoint ${method} ${endpoint} not found in contract`,
199
+ path: endpoint,
200
+ },
201
+ ],
202
+ warnings: [],
203
+ timestamp: new Date().toISOString(),
204
+ };
205
+ }
206
+
207
+ const errors: ValidationError[] = [];
208
+ const warnings: ValidationWarning[] = [];
209
+
210
+ // Validate path parameters
211
+ if (request.params) {
212
+ const paramErrors = this.validateParameters(
213
+ apiEndpoint.parameters.filter((p) => p.in === 'path'),
214
+ request.params,
215
+ 'path',
216
+ );
217
+ errors.push(...paramErrors);
218
+ }
219
+
220
+ // Validate query parameters
221
+ if (request.query) {
222
+ const queryErrors = this.validateParameters(
223
+ apiEndpoint.parameters.filter((p) => p.in === 'query'),
224
+ request.query,
225
+ 'query',
226
+ );
227
+ errors.push(...queryErrors);
228
+ }
229
+
230
+ // Validate headers
231
+ if (request.headers) {
232
+ const headerErrors = this.validateParameters(
233
+ apiEndpoint.parameters.filter((p) => p.in === 'header'),
234
+ request.headers,
235
+ 'header',
236
+ );
237
+ errors.push(...headerErrors);
238
+ }
239
+
240
+ // Validate request body
241
+ if (request.body && apiEndpoint.requestBody) {
242
+ const bodyErrors = this.validateRequestBody(apiEndpoint.requestBody, request.body);
243
+ errors.push(...bodyErrors);
244
+ }
245
+
246
+ // Check for deprecated fields
247
+ warnings.push(...this.checkDeprecations(apiEndpoint, request));
248
+
249
+ const result: ValidationResult = {
250
+ valid: errors.length === 0,
251
+ endpoint,
252
+ method,
253
+ errors,
254
+ warnings,
255
+ timestamp: new Date().toISOString(),
256
+ };
257
+
258
+ this.validationHistory.push(result);
259
+ this.emit('request-validated', result);
260
+
261
+ return result;
262
+ }
263
+
264
+ /**
265
+ * Validate API response against contract
266
+ */
267
+ async validateResponse(
268
+ contractName: string,
269
+ endpoint: string,
270
+ method: string,
271
+ statusCode: number,
272
+ response: {
273
+ headers?: Record<string, any>;
274
+ body?: any;
275
+ },
276
+ ): Promise<ValidationResult> {
277
+ this.logger.debug('Validating response', { contractName, endpoint, method, statusCode });
278
+
279
+ const contract = this.contracts.get(contractName);
280
+ if (!contract) {
281
+ throw new Error(`Contract ${contractName} not found`);
282
+ }
283
+
284
+ const apiEndpoint = this.findEndpoint(contract, endpoint, method);
285
+ if (!apiEndpoint) {
286
+ return {
287
+ valid: false,
288
+ endpoint,
289
+ method,
290
+ errors: [
291
+ {
292
+ type: 'response',
293
+ severity: 'critical',
294
+ message: `Endpoint ${method} ${endpoint} not found in contract`,
295
+ path: endpoint,
296
+ },
297
+ ],
298
+ warnings: [],
299
+ timestamp: new Date().toISOString(),
300
+ };
301
+ }
302
+
303
+ const errors: ValidationError[] = [];
304
+ const warnings: ValidationWarning[] = [];
305
+
306
+ const expectedResponse = apiEndpoint.responses.get(statusCode);
307
+ if (!expectedResponse) {
308
+ errors.push({
309
+ type: 'response',
310
+ severity: 'high',
311
+ message: `Status code ${statusCode} not defined in contract`,
312
+ path: `${endpoint}.responses.${statusCode}`,
313
+ });
314
+ } else {
315
+ // Validate response body
316
+ if (response.body && expectedResponse.content) {
317
+ const contentType = 'application/json'; // Assume JSON for simplicity
318
+ const mediaType = expectedResponse.content.get(contentType);
319
+
320
+ if (mediaType) {
321
+ const bodyErrors = this.validateAgainstSchema(
322
+ response.body,
323
+ mediaType.schema,
324
+ `${endpoint}.response.body`,
325
+ );
326
+ errors.push(...bodyErrors);
327
+ }
328
+ }
329
+
330
+ // Validate response headers
331
+ if (response.headers && expectedResponse.headers) {
332
+ const headerErrors = this.validateResponseHeaders(
333
+ expectedResponse.headers,
334
+ response.headers,
335
+ );
336
+ errors.push(...headerErrors);
337
+ }
338
+ }
339
+
340
+ const result: ValidationResult = {
341
+ valid: errors.length === 0,
342
+ endpoint,
343
+ method,
344
+ errors,
345
+ warnings,
346
+ timestamp: new Date().toISOString(),
347
+ };
348
+
349
+ this.validationHistory.push(result);
350
+ this.emit('response-validated', result);
351
+
352
+ return result;
353
+ }
354
+
355
+ /**
356
+ * Compare two contracts to detect breaking changes
357
+ */
358
+ compareContracts(oldContract: APIContract, newContract: APIContract): ContractDiff {
359
+ this.logger.info('Comparing contracts', {
360
+ oldVersion: oldContract.version,
361
+ newVersion: newContract.version,
362
+ });
363
+
364
+ const diff: ContractDiff = {
365
+ breaking: [],
366
+ nonBreaking: [],
367
+ additions: [],
368
+ deprecations: [],
369
+ };
370
+
371
+ // Compare endpoints
372
+ const oldEndpoints = new Map(oldContract.endpoints.map((e) => [`${e.method} ${e.path}`, e]));
373
+ const newEndpoints = new Map(newContract.endpoints.map((e) => [`${e.method} ${e.path}`, e]));
374
+
375
+ // Check for removed endpoints (breaking)
376
+ oldEndpoints.forEach((oldEndpoint, key) => {
377
+ if (!newEndpoints.has(key)) {
378
+ diff.breaking.push({
379
+ type: 'removed-endpoint',
380
+ endpoint: key,
381
+ path: oldEndpoint.path,
382
+ oldValue: oldEndpoint,
383
+ newValue: null,
384
+ impact: 'high',
385
+ });
386
+ }
387
+ });
388
+
389
+ // Check for added endpoints (non-breaking)
390
+ newEndpoints.forEach((newEndpoint, key) => {
391
+ if (!oldEndpoints.has(key)) {
392
+ diff.additions.push({
393
+ type: 'new-endpoint',
394
+ endpoint: key,
395
+ path: newEndpoint.path,
396
+ value: newEndpoint,
397
+ });
398
+ }
399
+ });
400
+
401
+ // Compare existing endpoints
402
+ oldEndpoints.forEach((oldEndpoint, key) => {
403
+ const newEndpoint = newEndpoints.get(key);
404
+ if (newEndpoint) {
405
+ const endpointDiff = this.compareEndpoints(oldEndpoint, newEndpoint);
406
+ diff.breaking.push(...endpointDiff.breaking);
407
+ diff.nonBreaking.push(...endpointDiff.nonBreaking);
408
+ diff.additions.push(...endpointDiff.additions);
409
+ }
410
+ });
411
+
412
+ this.emit('contracts-compared', { diff });
413
+
414
+ return diff;
415
+ }
416
+
417
+ /**
418
+ * Generate OpenAPI specification from contract
419
+ */
420
+ generateOpenAPISpec(contract: APIContract): any {
421
+ this.logger.info('Generating OpenAPI specification', { version: contract.version });
422
+
423
+ const spec = {
424
+ openapi: '3.0.3',
425
+ info: {
426
+ version: contract.version,
427
+ title: 'API Contract',
428
+ },
429
+ servers: [
430
+ {
431
+ url: contract.basePath,
432
+ },
433
+ ],
434
+ paths: this.generatePaths(contract),
435
+ components: {
436
+ schemas: this.generateSchemas(contract.schemas),
437
+ securitySchemes: this.generateSecuritySchemes(contract.securitySchemes),
438
+ },
439
+ };
440
+
441
+ return spec;
442
+ }
443
+
444
+ /**
445
+ * Validate contract structure
446
+ */
447
+ private validateContractStructure(contract: APIContract): void {
448
+ if (!contract.version) {
449
+ throw new Error('Contract must have a version');
450
+ }
451
+
452
+ if (!contract.basePath) {
453
+ throw new Error('Contract must have a basePath');
454
+ }
455
+
456
+ if (!contract.endpoints || contract.endpoints.length === 0) {
457
+ throw new Error('Contract must have at least one endpoint');
458
+ }
459
+ }
460
+
461
+ /**
462
+ * Find endpoint in contract
463
+ */
464
+ private findEndpoint(
465
+ contract: APIContract,
466
+ path: string,
467
+ method: string,
468
+ ): APIEndpoint | undefined {
469
+ return contract.endpoints.find((e) => e.path === path && e.method === method);
470
+ }
471
+
472
+ /**
473
+ * Validate parameters
474
+ */
475
+ private validateParameters(
476
+ parameters: Parameter[],
477
+ values: Record<string, any>,
478
+ location: string,
479
+ ): ValidationError[] {
480
+ const errors: ValidationError[] = [];
481
+
482
+ // Check required parameters
483
+ parameters
484
+ .filter((p) => p.required)
485
+ .forEach((param) => {
486
+ if (values[param.name] === undefined) {
487
+ errors.push({
488
+ type: 'request',
489
+ severity: 'critical',
490
+ message: `Missing required ${location} parameter: ${param.name}`,
491
+ path: `${location}.${param.name}`,
492
+ });
493
+ }
494
+ });
495
+
496
+ // Validate parameter values
497
+ Object.entries(values).forEach(([name, value]) => {
498
+ const param = parameters.find((p) => p.name === name);
499
+ if (param) {
500
+ const schemaErrors = this.validateAgainstSchema(value, param.schema, `${location}.${name}`);
501
+ errors.push(...schemaErrors);
502
+ }
503
+ });
504
+
505
+ return errors;
506
+ }
507
+
508
+ /**
509
+ * Validate request body
510
+ */
511
+ private validateRequestBody(requestBody: RequestBody, body: any): ValidationError[] {
512
+ const errors: ValidationError[] = [];
513
+
514
+ if (requestBody.required && !body) {
515
+ errors.push({
516
+ type: 'request',
517
+ severity: 'critical',
518
+ message: 'Request body is required',
519
+ path: 'body',
520
+ });
521
+ return errors;
522
+ }
523
+
524
+ const contentType = 'application/json';
525
+ const mediaType = requestBody.content.get(contentType);
526
+
527
+ if (mediaType) {
528
+ const schemaErrors = this.validateAgainstSchema(body, mediaType.schema, 'body');
529
+ errors.push(...schemaErrors);
530
+ }
531
+
532
+ return errors;
533
+ }
534
+
535
+ /**
536
+ * Validate response headers
537
+ */
538
+ private validateResponseHeaders(
539
+ expectedHeaders: Map<string, Header>,
540
+ actualHeaders: Record<string, any>,
541
+ ): ValidationError[] {
542
+ const errors: ValidationError[] = [];
543
+
544
+ expectedHeaders.forEach((header, name) => {
545
+ if (header.required && actualHeaders[name] === undefined) {
546
+ errors.push({
547
+ type: 'response',
548
+ severity: 'high',
549
+ message: `Missing required response header: ${name}`,
550
+ path: `headers.${name}`,
551
+ });
552
+ }
553
+
554
+ if (actualHeaders[name] !== undefined) {
555
+ const schemaErrors = this.validateAgainstSchema(
556
+ actualHeaders[name],
557
+ header.schema,
558
+ `headers.${name}`,
559
+ );
560
+ errors.push(...schemaErrors);
561
+ }
562
+ });
563
+
564
+ return errors;
565
+ }
566
+
567
+ /**
568
+ * Validate value against schema
569
+ */
570
+ private validateAgainstSchema(value: any, schema: Schema, path: string): ValidationError[] {
571
+ const errors: ValidationError[] = [];
572
+
573
+ // Type validation
574
+ const actualType = Array.isArray(value) ? 'array' : typeof value;
575
+ if (schema.type && actualType !== schema.type) {
576
+ errors.push({
577
+ type: 'schema',
578
+ severity: 'critical',
579
+ message: `Type mismatch at ${path}`,
580
+ path,
581
+ expected: schema.type,
582
+ actual: actualType,
583
+ });
584
+ return errors;
585
+ }
586
+
587
+ // Format validation
588
+ if (schema.format && typeof value === 'string') {
589
+ // Add format validation logic
590
+ }
591
+
592
+ // Pattern validation
593
+ if (schema.pattern && typeof value === 'string') {
594
+ const regex = new RegExp(schema.pattern);
595
+ if (!regex.test(value)) {
596
+ errors.push({
597
+ type: 'schema',
598
+ severity: 'high',
599
+ message: `Value does not match pattern at ${path}`,
600
+ path,
601
+ expected: schema.pattern,
602
+ actual: value,
603
+ });
604
+ }
605
+ }
606
+
607
+ // Range validation
608
+ if (typeof value === 'number') {
609
+ if (schema.minimum !== undefined && value < schema.minimum) {
610
+ errors.push({
611
+ type: 'schema',
612
+ severity: 'high',
613
+ message: `Value below minimum at ${path}`,
614
+ path,
615
+ expected: `>= ${schema.minimum}`,
616
+ actual: value,
617
+ });
618
+ }
619
+
620
+ if (schema.maximum !== undefined && value > schema.maximum) {
621
+ errors.push({
622
+ type: 'schema',
623
+ severity: 'high',
624
+ message: `Value above maximum at ${path}`,
625
+ path,
626
+ expected: `<= ${schema.maximum}`,
627
+ actual: value,
628
+ });
629
+ }
630
+ }
631
+
632
+ // Enum validation
633
+ if (schema.enum && !schema.enum.includes(value)) {
634
+ errors.push({
635
+ type: 'schema',
636
+ severity: 'high',
637
+ message: `Value not in enum at ${path}`,
638
+ path,
639
+ expected: schema.enum,
640
+ actual: value,
641
+ });
642
+ }
643
+
644
+ // Object validation
645
+ if (schema.type === 'object' && schema.properties) {
646
+ // Check required properties
647
+ if (schema.required) {
648
+ schema.required.forEach((requiredProp) => {
649
+ if (value[requiredProp] === undefined) {
650
+ errors.push({
651
+ type: 'schema',
652
+ severity: 'critical',
653
+ message: `Missing required property: ${requiredProp}`,
654
+ path: `${path}.${requiredProp}`,
655
+ });
656
+ }
657
+ });
658
+ }
659
+
660
+ // Validate properties
661
+ schema.properties.forEach((propSchema, propName) => {
662
+ if (value[propName] !== undefined) {
663
+ const propErrors = this.validateAgainstSchema(
664
+ value[propName],
665
+ propSchema,
666
+ `${path}.${propName}`,
667
+ );
668
+ errors.push(...propErrors);
669
+ }
670
+ });
671
+ }
672
+
673
+ // Array validation
674
+ if (schema.type === 'array' && schema.items && Array.isArray(value)) {
675
+ value.forEach((item, index) => {
676
+ const itemErrors = this.validateAgainstSchema(item, schema.items!, `${path}[${index}]`);
677
+ errors.push(...itemErrors);
678
+ });
679
+ }
680
+
681
+ return errors;
682
+ }
683
+
684
+ /**
685
+ * Check for deprecated fields
686
+ */
687
+ private checkDeprecations(endpoint: APIEndpoint, request: any): ValidationWarning[] {
688
+ const warnings: ValidationWarning[] = [];
689
+
690
+ endpoint.parameters
691
+ .filter((p) => p.deprecated)
692
+ .forEach((param) => {
693
+ if (request.params?.[param.name] || request.query?.[param.name]) {
694
+ warnings.push({
695
+ type: 'deprecation',
696
+ message: `Parameter ${param.name} is deprecated`,
697
+ recommendation: param.description,
698
+ });
699
+ }
700
+ });
701
+
702
+ return warnings;
703
+ }
704
+
705
+ /**
706
+ * Compare two endpoints
707
+ */
708
+ private compareEndpoints(
709
+ oldEndpoint: APIEndpoint,
710
+ newEndpoint: APIEndpoint,
711
+ ): Omit<ContractDiff, 'deprecations'> {
712
+ const diff: Omit<ContractDiff, 'deprecations'> = {
713
+ breaking: [],
714
+ nonBreaking: [],
715
+ additions: [],
716
+ };
717
+
718
+ // Compare parameters
719
+ const oldParams = new Map(oldEndpoint.parameters.map((p) => [p.name, p]));
720
+ const newParams = new Map(newEndpoint.parameters.map((p) => [p.name, p]));
721
+
722
+ // Check for removed parameters (breaking)
723
+ oldParams.forEach((oldParam, name) => {
724
+ if (!newParams.has(name) && oldParam.required) {
725
+ diff.breaking.push({
726
+ type: 'removed-field',
727
+ endpoint: `${oldEndpoint.method} ${oldEndpoint.path}`,
728
+ path: `parameters.${name}`,
729
+ oldValue: oldParam,
730
+ newValue: null,
731
+ impact: 'high',
732
+ });
733
+ }
734
+ });
735
+
736
+ // Check for new required parameters (breaking)
737
+ newParams.forEach((newParam, name) => {
738
+ if (!oldParams.has(name) && newParam.required) {
739
+ diff.breaking.push({
740
+ type: 'required-added',
741
+ endpoint: `${newEndpoint.method} ${newEndpoint.path}`,
742
+ path: `parameters.${name}`,
743
+ oldValue: null,
744
+ newValue: newParam,
745
+ impact: 'medium',
746
+ });
747
+ }
748
+ });
749
+
750
+ return diff;
751
+ }
752
+
753
+ /**
754
+ * Generate OpenAPI paths
755
+ */
756
+ private generatePaths(contract: APIContract): any {
757
+ const paths: any = {};
758
+
759
+ contract.endpoints.forEach((endpoint) => {
760
+ if (!paths[endpoint.path]) {
761
+ paths[endpoint.path] = {};
762
+ }
763
+
764
+ paths[endpoint.path][endpoint.method.toLowerCase()] = {
765
+ operationId: endpoint.operationId,
766
+ summary: endpoint.summary,
767
+ description: endpoint.description,
768
+ parameters: this.generatePathParameters(endpoint.parameters),
769
+ requestBody: endpoint.requestBody
770
+ ? this.generateRequestBody(endpoint.requestBody)
771
+ : undefined,
772
+ responses: this.generateResponses(endpoint.responses),
773
+ security: endpoint.security,
774
+ tags: endpoint.tags,
775
+ };
776
+ });
777
+
778
+ return paths;
779
+ }
780
+
781
+ private generatePathParameters(parameters: Parameter[]): any[] {
782
+ return parameters.map((param) => ({
783
+ name: param.name,
784
+ in: param.in,
785
+ required: param.required,
786
+ description: param.description,
787
+ deprecated: param.deprecated,
788
+ schema: this.schemaToOpenAPI(param.schema),
789
+ }));
790
+ }
791
+
792
+ private generateRequestBody(requestBody: RequestBody): any {
793
+ const content: any = {};
794
+
795
+ requestBody.content.forEach((mediaType, contentType) => {
796
+ content[contentType] = {
797
+ schema: this.schemaToOpenAPI(mediaType.schema),
798
+ examples: mediaType.examples,
799
+ };
800
+ });
801
+
802
+ return {
803
+ required: requestBody.required,
804
+ description: requestBody.description,
805
+ content,
806
+ };
807
+ }
808
+
809
+ private generateResponses(responses: Map<number, Response>): any {
810
+ const openAPIResponses: any = {};
811
+
812
+ responses.forEach((response, statusCode) => {
813
+ const content: any = {};
814
+
815
+ if (response.content) {
816
+ response.content.forEach((mediaType, contentType) => {
817
+ content[contentType] = {
818
+ schema: this.schemaToOpenAPI(mediaType.schema),
819
+ examples: mediaType.examples,
820
+ };
821
+ });
822
+ }
823
+
824
+ openAPIResponses[statusCode] = {
825
+ description: response.description,
826
+ content: Object.keys(content).length > 0 ? content : undefined,
827
+ };
828
+ });
829
+
830
+ return openAPIResponses;
831
+ }
832
+
833
+ private generateSchemas(schemas: Map<string, Schema>): any {
834
+ const openAPISchemas: any = {};
835
+
836
+ schemas.forEach((schema, name) => {
837
+ openAPISchemas[name] = this.schemaToOpenAPI(schema);
838
+ });
839
+
840
+ return openAPISchemas;
841
+ }
842
+
843
+ private generateSecuritySchemes(securitySchemes?: SecurityScheme[]): any {
844
+ if (!securitySchemes) return undefined;
845
+
846
+ const schemes: any = {};
847
+
848
+ securitySchemes.forEach((scheme, index) => {
849
+ schemes[`scheme${index}`] = scheme;
850
+ });
851
+
852
+ return schemes;
853
+ }
854
+
855
+ private schemaToOpenAPI(schema: Schema): any {
856
+ const openAPISchema: any = {
857
+ type: schema.type,
858
+ };
859
+
860
+ if (schema.properties) {
861
+ openAPISchema.properties = {};
862
+ schema.properties.forEach((propSchema, propName) => {
863
+ openAPISchema.properties[propName] = this.schemaToOpenAPI(propSchema);
864
+ });
865
+ }
866
+
867
+ if (schema.required) {
868
+ openAPISchema.required = schema.required;
869
+ }
870
+
871
+ if (schema.items) {
872
+ openAPISchema.items = this.schemaToOpenAPI(schema.items);
873
+ }
874
+
875
+ if (schema.format) openAPISchema.format = schema.format;
876
+ if (schema.pattern) openAPISchema.pattern = schema.pattern;
877
+ if (schema.minimum !== undefined) openAPISchema.minimum = schema.minimum;
878
+ if (schema.maximum !== undefined) openAPISchema.maximum = schema.maximum;
879
+ if (schema.enum) openAPISchema.enum = schema.enum;
880
+ if (schema.additionalProperties !== undefined) {
881
+ openAPISchema.additionalProperties =
882
+ typeof schema.additionalProperties === 'boolean'
883
+ ? schema.additionalProperties
884
+ : this.schemaToOpenAPI(schema.additionalProperties);
885
+ }
886
+
887
+ return openAPISchema;
888
+ }
889
+
890
+ /**
891
+ * Get validation statistics
892
+ */
893
+ getValidationStats(): {
894
+ totalValidations: number;
895
+ successfulValidations: number;
896
+ failedValidations: number;
897
+ successRate: number;
898
+ } {
899
+ const total = this.validationHistory.length;
900
+ const successful = this.validationHistory.filter((v) => v.valid).length;
901
+
902
+ return {
903
+ totalValidations: total,
904
+ successfulValidations: successful,
905
+ failedValidations: total - successful,
906
+ successRate: total > 0 ? successful / total : 0,
907
+ };
908
+ }
909
+ }