swarmdo 1.4.8 → 1.5.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 (210) hide show
  1. package/.claude/helpers/statusline.cjs +7 -7
  2. package/README.md +3 -1
  3. package/package.json +5 -3
  4. package/v3/@swarmdo/cli/dist/src/commands/hooks.js +26 -24
  5. package/v3/@swarmdo/cli/dist/src/commands/index.js +4 -0
  6. package/v3/@swarmdo/cli/dist/src/commands/integrations.d.ts +14 -0
  7. package/v3/@swarmdo/cli/dist/src/commands/integrations.js +158 -0
  8. package/v3/@swarmdo/cli/dist/src/commands/memory.js +50 -1
  9. package/v3/@swarmdo/cli/dist/src/commands/providers.js +3 -0
  10. package/v3/@swarmdo/cli/dist/src/commands/release.d.ts +15 -0
  11. package/v3/@swarmdo/cli/dist/src/commands/release.js +224 -0
  12. package/v3/@swarmdo/cli/dist/src/commands/security.js +14 -0
  13. package/v3/@swarmdo/cli/dist/src/commands/transcript.js +82 -1
  14. package/v3/@swarmdo/cli/dist/src/commands/usage.js +80 -1
  15. package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +11 -1
  16. package/v3/@swarmdo/cli/dist/src/init/statusline-generator.js +6 -6
  17. package/v3/@swarmdo/cli/dist/src/integrations/integrations.d.ts +54 -0
  18. package/v3/@swarmdo/cli/dist/src/integrations/integrations.js +162 -0
  19. package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-execute-core.js +25 -3
  20. package/v3/@swarmdo/cli/dist/src/mcp-tools/agentdb-tools.js +8 -8
  21. package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.d.ts +12 -0
  22. package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.js +32 -1
  23. package/v3/@swarmdo/cli/dist/src/memory-vault/watch.d.ts +32 -0
  24. package/v3/@swarmdo/cli/dist/src/memory-vault/watch.js +66 -0
  25. package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.d.ts +91 -0
  26. package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.js +186 -0
  27. package/v3/@swarmdo/cli/dist/src/release/release.d.ts +72 -0
  28. package/v3/@swarmdo/cli/dist/src/release/release.js +86 -0
  29. package/v3/@swarmdo/cli/dist/src/resilience/backoff.d.ts +23 -0
  30. package/v3/@swarmdo/cli/dist/src/resilience/backoff.js +30 -0
  31. package/v3/@swarmdo/cli/dist/src/swarmvector/model-router.js +14 -0
  32. package/v3/@swarmdo/cli/dist/src/transcript/search.d.ts +39 -0
  33. package/v3/@swarmdo/cli/dist/src/transcript/search.js +67 -0
  34. package/v3/@swarmdo/cli/dist/src/usage/diff.d.ts +69 -0
  35. package/v3/@swarmdo/cli/dist/src/usage/diff.js +112 -0
  36. package/v3/@swarmdo/cli/package.json +4 -4
  37. package/v3/@swarmdo/cli-core/dist/src/index.js +1 -1
  38. package/v3/@swarmdo/codex/dist/cli.js +0 -0
  39. package/v3/@swarmdo/hooks/dist/cli/guidance-cli.js +0 -0
  40. package/v3/@swarmdo/hooks/dist/statusline/index.d.ts +3 -3
  41. package/v3/@swarmdo/hooks/dist/statusline/index.js +3 -3
  42. package/v3/@swarmdo/integration/dist/__tests__/agentic-flow-agent.test.js +4 -1
  43. package/v3/@swarmdo/neural/dist/flash-attention.d.ts +1 -1
  44. package/v3/@swarmdo/neural/dist/flash-attention.js +1 -1
  45. package/v3/@swarmdo/plugin-agent-federation/dist/plugin.js +1 -1
  46. package/v3/@swarmdo/plugin-agent-federation/dist/transport/midstream-aware-loader.js +2 -2
  47. package/v3/@swarmdo/providers/dist/swarmvector-provider.d.ts +1 -1
  48. package/v3/@swarmdo/providers/dist/swarmvector-provider.js +1 -1
  49. package/v3/@swarmdo/security/dist/input-validator.d.ts +6 -6
  50. package/v3/@swarmdo/shared/dist/hooks/safety/git-commit.js +1 -1
  51. package/v3/@swarmdo/shared/dist/mcp/transport/http.js +8 -1
  52. package/v3/vendor/agentdb/package.json +0 -1
  53. package/v3/vendor/agentic-flow/package.json +0 -1
  54. package/.claude/scheduled_tasks.lock +0 -1
  55. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__init__.cpython-314.pyc +0 -0
  56. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__main__.cpython-314.pyc +0 -0
  57. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/cli.cpython-314.pyc +0 -0
  58. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/compress.cpython-314.pyc +0 -0
  59. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/detect.cpython-314.pyc +0 -0
  60. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/validate.cpython-314.pyc +0 -0
  61. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +0 -2
  62. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +0 -2
  63. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +0 -138
  64. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +0 -418
  65. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +0 -15
  66. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +0 -240
  67. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +0 -7
  68. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +0 -508
  69. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +0 -54
  70. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +0 -2
  71. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +0 -46
  72. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +0 -2
  73. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +0 -18
  74. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +0 -28
  75. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +0 -5
  76. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +0 -2
  77. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +0 -35
  78. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +0 -2
  79. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +0 -11
  80. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +0 -2
  81. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +0 -9
  82. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +0 -2
  83. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +0 -5
  84. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +0 -2
  85. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +0 -12
  86. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +0 -2
  87. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +0 -19
  88. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +0 -2
  89. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +0 -44
  90. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +0 -117
  91. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +0 -70
  92. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +0 -194
  93. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +0 -69
  94. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +0 -139
  95. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +0 -34
  96. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +0 -101
  97. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +0 -10
  98. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +0 -10
  99. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +0 -64
  100. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +0 -70
  101. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +0 -44
  102. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +0 -79
  103. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +0 -37
  104. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +0 -39
  105. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +0 -67
  106. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +0 -58
  107. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +0 -45
  108. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +0 -63
  109. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +0 -26
  110. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +0 -17
  111. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +0 -51
  112. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +0 -110
  113. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +0 -13
  114. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +0 -25
  115. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +0 -11
  116. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +0 -19
  117. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +0 -11
  118. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +0 -27
  119. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +0 -6
  120. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +0 -6
  121. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +0 -41
  122. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +0 -64
  123. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +0 -8
  124. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +0 -703
  125. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +0 -23
  126. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +0 -239
  127. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +0 -17
  128. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +0 -42
  129. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +0 -18
  130. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +0 -45
  131. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +0 -19
  132. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +0 -50
  133. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +0 -19
  134. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +0 -47
  135. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +0 -17
  136. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +0 -40
  137. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +0 -18
  138. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +0 -51
  139. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +0 -214
  140. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +0 -595
  141. package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +0 -76
  142. package/v3/@swarmdo/testing/dist/fixtures/agents.js +0 -158
  143. package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +0 -157
  144. package/v3/@swarmdo/testing/dist/fixtures/configurations.js +0 -337
  145. package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +0 -10
  146. package/v3/@swarmdo/testing/dist/fixtures/index.js +0 -17
  147. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +0 -329
  148. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +0 -714
  149. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +0 -159
  150. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +0 -262
  151. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +0 -290
  152. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +0 -547
  153. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +0 -289
  154. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +0 -534
  155. package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +0 -106
  156. package/v3/@swarmdo/testing/dist/fixtures/tasks.js +0 -229
  157. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +0 -213
  158. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +0 -435
  159. package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +0 -135
  160. package/v3/@swarmdo/testing/dist/helpers/assertions.js +0 -217
  161. package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +0 -96
  162. package/v3/@swarmdo/testing/dist/helpers/create-mock.js +0 -164
  163. package/v3/@swarmdo/testing/dist/helpers/index.d.ts +0 -14
  164. package/v3/@swarmdo/testing/dist/helpers/index.js +0 -22
  165. package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +0 -323
  166. package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +0 -350
  167. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +0 -271
  168. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +0 -446
  169. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +0 -142
  170. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +0 -205
  171. package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +0 -190
  172. package/v3/@swarmdo/testing/dist/helpers/test-application.js +0 -138
  173. package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +0 -274
  174. package/v3/@swarmdo/testing/dist/helpers/test-utils.js +0 -456
  175. package/v3/@swarmdo/testing/dist/index.d.ts +0 -42
  176. package/v3/@swarmdo/testing/dist/index.js +0 -66
  177. package/v3/@swarmdo/testing/dist/mocks/index.d.ts +0 -8
  178. package/v3/@swarmdo/testing/dist/mocks/index.js +0 -10
  179. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +0 -206
  180. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +0 -575
  181. package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +0 -287
  182. package/v3/@swarmdo/testing/dist/mocks/mock-services.js +0 -563
  183. package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +0 -109
  184. package/v3/@swarmdo/testing/dist/regression/api-contract.js +0 -374
  185. package/v3/@swarmdo/testing/dist/regression/index.d.ts +0 -18
  186. package/v3/@swarmdo/testing/dist/regression/index.js +0 -18
  187. package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +0 -67
  188. package/v3/@swarmdo/testing/dist/regression/integration-regression.js +0 -334
  189. package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +0 -106
  190. package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +0 -268
  191. package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +0 -124
  192. package/v3/@swarmdo/testing/dist/regression/regression-runner.js +0 -227
  193. package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +0 -73
  194. package/v3/@swarmdo/testing/dist/regression/security-regression.js +0 -258
  195. package/v3/@swarmdo/testing/dist/setup.d.ts +0 -43
  196. package/v3/@swarmdo/testing/dist/setup.js +0 -91
  197. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +0 -10
  198. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +0 -433
  199. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +0 -10
  200. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +0 -352
  201. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +0 -206
  202. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +0 -839
  203. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +0 -10
  204. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +0 -428
  205. package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +0 -38
  206. package/v3/@swarmdo/testing/dist/v2-compat/index.js +0 -41
  207. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +0 -10
  208. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +0 -419
  209. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +0 -34
  210. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +0 -372
@@ -1,839 +0,0 @@
1
- /**
2
- * V2 Compatibility Validator
3
- *
4
- * Validates that V3 implementation maintains backward compatibility with V2 capabilities.
5
- * Tests CLI commands, MCP tools, hooks, and API interfaces.
6
- *
7
- * @module v3/testing/v2-compat/compatibility-validator
8
- */
9
- import { vi } from 'vitest';
10
- /**
11
- * V2 CLI Commands (25 total)
12
- */
13
- export const V2_CLI_COMMANDS = [
14
- // Core commands
15
- { name: 'init', aliases: ['i'], flags: ['--force', '--template'], description: 'Initialize swarmdo project', v3Equivalent: 'init' },
16
- { name: 'start', aliases: ['s'], flags: ['--detached', '--port'], description: 'Start MCP server', v3Equivalent: 'start' },
17
- { name: 'stop', aliases: [], flags: ['--force'], description: 'Stop MCP server', v3Equivalent: 'stop' },
18
- { name: 'status', aliases: ['st'], flags: ['--json', '--verbose'], description: 'Show system status', v3Equivalent: 'status' },
19
- { name: 'config', aliases: ['c'], flags: ['--get', '--set', '--list'], description: 'Manage configuration', v3Equivalent: 'config' },
20
- // Agent commands
21
- { name: 'agent spawn', aliases: ['a spawn'], flags: ['--type', '--id', '--config'], description: 'Spawn new agent', v3Equivalent: 'agent spawn' },
22
- { name: 'agent list', aliases: ['a ls'], flags: ['--status', '--type'], description: 'List agents', v3Equivalent: 'agent list' },
23
- { name: 'agent terminate', aliases: ['a kill'], flags: ['--force', '--all'], description: 'Terminate agent', v3Equivalent: 'agent terminate' },
24
- { name: 'agent info', aliases: ['a info'], flags: ['--metrics'], description: 'Show agent info', v3Equivalent: 'agent status' },
25
- // Swarm commands
26
- { name: 'swarm init', aliases: ['sw init'], flags: ['--topology', '--max-agents'], description: 'Initialize swarm', v3Equivalent: 'swarm init' },
27
- { name: 'swarm status', aliases: ['sw st'], flags: ['--detailed'], description: 'Show swarm status', v3Equivalent: 'swarm status' },
28
- { name: 'swarm scale', aliases: ['sw scale'], flags: ['--up', '--down'], description: 'Scale swarm', v3Equivalent: 'swarm scale' },
29
- // Memory commands
30
- { name: 'memory list', aliases: ['mem ls'], flags: ['--type', '--limit'], description: 'List memories', v3Equivalent: 'memory list' },
31
- { name: 'memory query', aliases: ['mem q'], flags: ['--search', '--type'], description: 'Query memory', v3Equivalent: 'memory search' },
32
- { name: 'memory clear', aliases: ['mem clear'], flags: ['--force', '--type'], description: 'Clear memory', v3Equivalent: 'memory clear' },
33
- // Hooks commands
34
- { name: 'hooks pre-edit', aliases: [], flags: ['--file'], description: 'Pre-edit hook', v3Equivalent: 'hooks pre-edit' },
35
- { name: 'hooks post-edit', aliases: [], flags: ['--file', '--success'], description: 'Post-edit hook', v3Equivalent: 'hooks post-edit' },
36
- { name: 'hooks pre-command', aliases: [], flags: ['--command'], description: 'Pre-command hook', v3Equivalent: 'hooks pre-command' },
37
- { name: 'hooks post-command', aliases: [], flags: ['--command', '--success'], description: 'Post-command hook', v3Equivalent: 'hooks post-command' },
38
- { name: 'hooks route', aliases: [], flags: ['--task'], description: 'Route task', v3Equivalent: 'hooks route' },
39
- { name: 'hooks pretrain', aliases: [], flags: [], description: 'Pretrain from repo', v3Equivalent: 'hooks pretrain' },
40
- { name: 'hooks metrics', aliases: [], flags: ['--dashboard'], description: 'Show metrics', v3Equivalent: 'hooks metrics' },
41
- // Deprecated but supported
42
- { name: 'hive-mind init', aliases: [], flags: [], description: 'Initialize hive', v3Equivalent: 'swarm init', deprecated: true },
43
- { name: 'neural init', aliases: [], flags: [], description: 'Initialize neural', v3Equivalent: 'hooks pretrain', deprecated: true },
44
- { name: 'goal init', aliases: [], flags: [], description: 'Initialize goals', v3Equivalent: 'hooks pretrain', deprecated: true },
45
- ];
46
- /**
47
- * V2 MCP Tools (65 total - showing key ones)
48
- */
49
- export const V2_MCP_TOOLS = [
50
- // Agent tools
51
- { name: 'dispatch_agent', parameters: { type: { type: 'string', required: true }, name: { type: 'string', required: false } }, returnType: 'AgentInfo', v3Equivalent: 'agent/spawn' },
52
- { name: 'agents/spawn', parameters: { type: { type: 'string', required: true }, config: { type: 'object', required: false } }, returnType: 'AgentInfo', v3Equivalent: 'agent/spawn' },
53
- { name: 'agents/list', parameters: { status: { type: 'string', required: false } }, returnType: 'AgentInfo[]', v3Equivalent: 'agent/list' },
54
- { name: 'agents/terminate', parameters: { id: { type: 'string', required: true } }, returnType: 'boolean', v3Equivalent: 'agent/terminate' },
55
- { name: 'agents/info', parameters: { id: { type: 'string', required: true } }, returnType: 'AgentInfo', v3Equivalent: 'agent/status' },
56
- { name: 'agent/create', parameters: { type: { type: 'string', required: true } }, returnType: 'AgentInfo', v3Equivalent: 'agent/spawn' },
57
- // Swarm tools
58
- { name: 'swarm_status', parameters: {}, returnType: 'SwarmStatus', v3Equivalent: 'swarm/status' },
59
- { name: 'swarm/get-status', parameters: {}, returnType: 'SwarmStatus', v3Equivalent: 'swarm/status' },
60
- { name: 'swarm/get-comprehensive-status', parameters: {}, returnType: 'ComprehensiveStatus', v3Equivalent: 'swarm/status' },
61
- { name: 'mcp__swarmdo-swarm__swarm_init', parameters: { topology: { type: 'string', required: false } }, returnType: 'SwarmInfo', v3Equivalent: 'swarm/init' },
62
- { name: 'mcp__swarmdo-swarm__swarm_status', parameters: {}, returnType: 'SwarmStatus', v3Equivalent: 'swarm/status' },
63
- { name: 'mcp__swarmdo-swarm__agent_spawn', parameters: { type: { type: 'string', required: true } }, returnType: 'AgentInfo', v3Equivalent: 'agent/spawn' },
64
- { name: 'mcp__swarmdo-swarm__agent_list', parameters: {}, returnType: 'AgentInfo[]', v3Equivalent: 'agent/list' },
65
- { name: 'mcp__swarmdo-swarm__agent_metrics', parameters: { id: { type: 'string', required: true } }, returnType: 'AgentMetrics', v3Equivalent: 'agent/status' },
66
- // Memory tools
67
- { name: 'memory/query', parameters: { search: { type: 'string', required: true } }, returnType: 'MemoryEntry[]', v3Equivalent: 'memory/search' },
68
- { name: 'memory/store', parameters: { content: { type: 'string', required: true }, type: { type: 'string', required: false } }, returnType: 'MemoryEntry', v3Equivalent: 'memory/store' },
69
- { name: 'memory/delete', parameters: { id: { type: 'string', required: true } }, returnType: 'boolean', v3Equivalent: 'memory/delete' },
70
- { name: 'mcp__swarmdo-swarm__memory_usage', parameters: {}, returnType: 'MemoryStats', v3Equivalent: 'memory/list' },
71
- // Config tools
72
- { name: 'config/get', parameters: { key: { type: 'string', required: true } }, returnType: 'any', v3Equivalent: 'config/load' },
73
- { name: 'config/update', parameters: { key: { type: 'string', required: true }, value: { type: 'any', required: true } }, returnType: 'boolean', v3Equivalent: 'config/save' },
74
- // Task tools
75
- { name: 'task/create', parameters: { description: { type: 'string', required: true } }, returnType: 'TaskInfo', v3Equivalent: 'task/create' },
76
- { name: 'task/assign', parameters: { taskId: { type: 'string', required: true }, agentId: { type: 'string', required: true } }, returnType: 'boolean', v3Equivalent: 'task/assign' },
77
- { name: 'task/status', parameters: { taskId: { type: 'string', required: true } }, returnType: 'TaskStatus', v3Equivalent: 'task/status' },
78
- { name: 'task/complete', parameters: { taskId: { type: 'string', required: true }, result: { type: 'any', required: false } }, returnType: 'boolean', v3Equivalent: 'task/complete' },
79
- // Neural/Learning tools
80
- { name: 'mcp__swarmdo-swarm__neural_status', parameters: {}, returnType: 'NeuralStatus', v3Equivalent: 'hooks/metrics' },
81
- { name: 'mcp__swarmdo-swarm__neural_train', parameters: { data: { type: 'object', required: true } }, returnType: 'TrainingResult', v3Equivalent: 'hooks/pretrain' },
82
- // GitHub integration tools
83
- { name: 'github/pr-create', parameters: { title: { type: 'string', required: true }, body: { type: 'string', required: false } }, returnType: 'PRInfo', v3Equivalent: 'github/pr-create' },
84
- { name: 'github/pr-review', parameters: { prNumber: { type: 'number', required: true } }, returnType: 'ReviewInfo', v3Equivalent: 'github/pr-review' },
85
- { name: 'github/issue-create', parameters: { title: { type: 'string', required: true } }, returnType: 'IssueInfo', v3Equivalent: 'github/issue-create' },
86
- // Coordination tools
87
- { name: 'coordinate/consensus', parameters: { proposal: { type: 'object', required: true } }, returnType: 'ConsensusResult', v3Equivalent: 'swarm/consensus' },
88
- { name: 'coordinate/broadcast', parameters: { message: { type: 'object', required: true } }, returnType: 'BroadcastResult', v3Equivalent: 'swarm/broadcast' },
89
- ];
90
- /**
91
- * V2 Hooks (42 total)
92
- */
93
- export const V2_HOOKS = [
94
- // Edit hooks
95
- { name: 'pre-edit', trigger: 'before:file:edit', parameters: ['filePath', 'content'], returnType: 'HookResult', v3Equivalent: 'pre-edit' },
96
- { name: 'post-edit', trigger: 'after:file:edit', parameters: ['filePath', 'success', 'changes'], returnType: 'HookResult', v3Equivalent: 'post-edit' },
97
- { name: 'pre-create', trigger: 'before:file:create', parameters: ['filePath'], returnType: 'HookResult', v3Equivalent: 'pre-edit' },
98
- { name: 'post-create', trigger: 'after:file:create', parameters: ['filePath', 'success'], returnType: 'HookResult', v3Equivalent: 'post-edit' },
99
- // Command hooks
100
- { name: 'pre-command', trigger: 'before:command:execute', parameters: ['command', 'args'], returnType: 'HookResult', v3Equivalent: 'pre-command' },
101
- { name: 'post-command', trigger: 'after:command:execute', parameters: ['command', 'success', 'output'], returnType: 'HookResult', v3Equivalent: 'post-command' },
102
- { name: 'pre-bash', trigger: 'before:bash:execute', parameters: ['script'], returnType: 'HookResult', v3Equivalent: 'pre-command' },
103
- { name: 'post-bash', trigger: 'after:bash:execute', parameters: ['script', 'exitCode'], returnType: 'HookResult', v3Equivalent: 'post-command' },
104
- // Task hooks
105
- { name: 'pre-task', trigger: 'before:task:start', parameters: ['task'], returnType: 'HookResult', v3Equivalent: 'pre-task' },
106
- { name: 'post-task', trigger: 'after:task:complete', parameters: ['task', 'result'], returnType: 'HookResult', v3Equivalent: 'post-task' },
107
- { name: 'task-assign', trigger: 'on:task:assign', parameters: ['task', 'agent'], returnType: 'HookResult', v3Equivalent: 'task-assign' },
108
- { name: 'task-fail', trigger: 'on:task:fail', parameters: ['task', 'error'], returnType: 'HookResult', v3Equivalent: 'task-fail' },
109
- // Agent hooks
110
- { name: 'agent-spawn', trigger: 'on:agent:spawn', parameters: ['agentConfig'], returnType: 'HookResult', v3Equivalent: 'agent-spawn' },
111
- { name: 'agent-terminate', trigger: 'on:agent:terminate', parameters: ['agentId', 'reason'], returnType: 'HookResult', v3Equivalent: 'agent-terminate' },
112
- { name: 'agent-message', trigger: 'on:agent:message', parameters: ['from', 'to', 'message'], returnType: 'HookResult', v3Equivalent: 'agent-message' },
113
- { name: 'agent-error', trigger: 'on:agent:error', parameters: ['agentId', 'error'], returnType: 'HookResult', v3Equivalent: 'agent-error' },
114
- // Swarm hooks
115
- { name: 'swarm-init', trigger: 'on:swarm:init', parameters: ['topology', 'config'], returnType: 'HookResult', v3Equivalent: 'swarm-init' },
116
- { name: 'swarm-scale', trigger: 'on:swarm:scale', parameters: ['direction', 'count'], returnType: 'HookResult', v3Equivalent: 'swarm-scale' },
117
- { name: 'swarm-consensus', trigger: 'on:swarm:consensus', parameters: ['proposal', 'result'], returnType: 'HookResult', v3Equivalent: 'swarm-consensus' },
118
- { name: 'swarm-broadcast', trigger: 'on:swarm:broadcast', parameters: ['message'], returnType: 'HookResult', v3Equivalent: 'swarm-broadcast' },
119
- // Memory hooks
120
- { name: 'memory-store', trigger: 'on:memory:store', parameters: ['entry'], returnType: 'HookResult', v3Equivalent: 'memory-store' },
121
- { name: 'memory-retrieve', trigger: 'on:memory:retrieve', parameters: ['query', 'results'], returnType: 'HookResult', v3Equivalent: 'memory-retrieve' },
122
- { name: 'memory-delete', trigger: 'on:memory:delete', parameters: ['id'], returnType: 'HookResult', v3Equivalent: 'memory-delete' },
123
- { name: 'memory-consolidate', trigger: 'on:memory:consolidate', parameters: [], returnType: 'HookResult', v3Equivalent: 'memory-consolidate' },
124
- // Learning hooks
125
- { name: 'learning-pattern', trigger: 'on:learning:pattern', parameters: ['pattern'], returnType: 'HookResult', v3Equivalent: 'learning-pattern' },
126
- { name: 'learning-reward', trigger: 'on:learning:reward', parameters: ['trajectory', 'reward'], returnType: 'HookResult', v3Equivalent: 'learning-reward' },
127
- { name: 'learning-distill', trigger: 'on:learning:distill', parameters: ['memories'], returnType: 'HookResult', v3Equivalent: 'learning-distill' },
128
- { name: 'learning-consolidate', trigger: 'on:learning:consolidate', parameters: [], returnType: 'HookResult', v3Equivalent: 'learning-consolidate' },
129
- // Session hooks
130
- { name: 'session-start', trigger: 'on:session:start', parameters: ['sessionId'], returnType: 'HookResult', v3Equivalent: 'session-start' },
131
- { name: 'session-end', trigger: 'on:session:end', parameters: ['sessionId', 'metrics'], returnType: 'HookResult', v3Equivalent: 'session-end' },
132
- { name: 'session-resume', trigger: 'on:session:resume', parameters: ['sessionId'], returnType: 'HookResult', v3Equivalent: 'session-resume' },
133
- { name: 'session-pause', trigger: 'on:session:pause', parameters: ['sessionId'], returnType: 'HookResult', v3Equivalent: 'session-pause' },
134
- // Config hooks
135
- { name: 'config-load', trigger: 'on:config:load', parameters: ['config'], returnType: 'HookResult', v3Equivalent: 'config-load' },
136
- { name: 'config-save', trigger: 'on:config:save', parameters: ['config'], returnType: 'HookResult', v3Equivalent: 'config-save' },
137
- { name: 'config-change', trigger: 'on:config:change', parameters: ['key', 'oldValue', 'newValue'], returnType: 'HookResult', v3Equivalent: 'config-change' },
138
- // Error hooks
139
- { name: 'error-global', trigger: 'on:error:global', parameters: ['error'], returnType: 'HookResult', v3Equivalent: 'error-global' },
140
- { name: 'error-recover', trigger: 'on:error:recover', parameters: ['error', 'strategy'], returnType: 'HookResult', v3Equivalent: 'error-recover' },
141
- // Performance hooks
142
- { name: 'perf-threshold', trigger: 'on:perf:threshold', parameters: ['metric', 'value'], returnType: 'HookResult', v3Equivalent: 'perf-threshold' },
143
- { name: 'perf-report', trigger: 'on:perf:report', parameters: ['report'], returnType: 'HookResult', v3Equivalent: 'perf-report' },
144
- // Security hooks
145
- { name: 'security-alert', trigger: 'on:security:alert', parameters: ['alert'], returnType: 'HookResult', v3Equivalent: 'security-alert' },
146
- { name: 'security-block', trigger: 'on:security:block', parameters: ['operation', 'reason'], returnType: 'HookResult', v3Equivalent: 'security-block' },
147
- { name: 'security-audit', trigger: 'on:security:audit', parameters: ['action', 'context'], returnType: 'HookResult', v3Equivalent: 'security-audit' },
148
- ];
149
- /**
150
- * V2 API Interfaces
151
- */
152
- export const V2_API_INTERFACES = [
153
- // Core interfaces
154
- {
155
- name: 'HiveMind',
156
- methods: [
157
- { name: 'initialize', signature: '(config?: HiveMindConfig): Promise<void>' },
158
- { name: 'spawn', signature: '(type: string, config?: AgentConfig): Promise<Agent>' },
159
- { name: 'getStatus', signature: '(): Promise<HiveMindStatus>' },
160
- { name: 'shutdown', signature: '(): Promise<void>' },
161
- ],
162
- v3Equivalent: 'UnifiedSwarmCoordinator',
163
- },
164
- {
165
- name: 'SwarmCoordinator',
166
- methods: [
167
- { name: 'init', signature: '(topology: string): Promise<void>' },
168
- { name: 'addAgent', signature: '(agent: Agent): Promise<void>' },
169
- { name: 'removeAgent', signature: '(agentId: string): Promise<void>' },
170
- { name: 'broadcast', signature: '(message: Message): Promise<void>' },
171
- { name: 'consensus', signature: '(proposal: Proposal): Promise<ConsensusResult>' },
172
- ],
173
- v3Equivalent: 'UnifiedSwarmCoordinator',
174
- },
175
- {
176
- name: 'MemoryManager',
177
- methods: [
178
- { name: 'store', signature: '(entry: MemoryEntry): Promise<string>' },
179
- { name: 'query', signature: '(search: string): Promise<MemoryEntry[]>' },
180
- { name: 'delete', signature: '(id: string): Promise<boolean>' },
181
- { name: 'clear', signature: '(): Promise<void>' },
182
- { name: 'getStats', signature: '(): Promise<MemoryStats>' },
183
- ],
184
- v3Equivalent: 'UnifiedMemoryService',
185
- },
186
- {
187
- name: 'AgentManager',
188
- methods: [
189
- { name: 'spawn', signature: '(config: AgentConfig): Promise<Agent>' },
190
- { name: 'terminate', signature: '(id: string): Promise<void>' },
191
- { name: 'list', signature: '(): Promise<Agent[]>' },
192
- { name: 'getInfo', signature: '(id: string): Promise<AgentInfo>' },
193
- ],
194
- v3Equivalent: 'AgentLifecycleService',
195
- },
196
- {
197
- name: 'TaskOrchestrator',
198
- methods: [
199
- { name: 'create', signature: '(definition: TaskDefinition): Promise<Task>' },
200
- { name: 'assign', signature: '(taskId: string, agentId: string): Promise<void>' },
201
- { name: 'complete', signature: '(taskId: string, result?: any): Promise<void>' },
202
- { name: 'getStatus', signature: '(taskId: string): Promise<TaskStatus>' },
203
- ],
204
- v3Equivalent: 'TaskExecutionService',
205
- },
206
- ];
207
- /**
208
- * V2 Compatibility Validator
209
- *
210
- * Tests V3 implementation against V2 capabilities to ensure backward compatibility.
211
- */
212
- export class V2CompatibilityValidator {
213
- v3Service;
214
- v2Version;
215
- v3Version;
216
- verbose;
217
- constructor(options = {}) {
218
- this.v3Service = options.v3Service || this.createDefaultMockService();
219
- this.v2Version = options.v2Version || '2.0.0';
220
- this.v3Version = options.v3Version || '3.0.0';
221
- this.verbose = options.verbose || false;
222
- }
223
- /**
224
- * Create default mock V3 service for testing
225
- */
226
- createDefaultMockService() {
227
- // Tool name mapping from V2 to V3
228
- const toolNameMapping = {
229
- 'dispatch_agent': 'agent/spawn',
230
- 'agents/spawn': 'agent/spawn',
231
- 'agents/list': 'agent/list',
232
- 'agents/terminate': 'agent/terminate',
233
- 'agents/info': 'agent/status',
234
- 'agent/create': 'agent/spawn',
235
- 'swarm_status': 'swarm/status',
236
- 'swarm/get-status': 'swarm/status',
237
- 'swarm/get-comprehensive-status': 'swarm/status',
238
- 'mcp__swarmdo-swarm__swarm_init': 'swarm/init',
239
- 'mcp__swarmdo-swarm__swarm_status': 'swarm/status',
240
- 'mcp__swarmdo-swarm__agent_spawn': 'agent/spawn',
241
- 'mcp__swarmdo-swarm__agent_list': 'agent/list',
242
- 'mcp__swarmdo-swarm__agent_metrics': 'agent/status',
243
- 'memory/query': 'memory/search',
244
- 'mcp__swarmdo-swarm__memory_usage': 'memory/list',
245
- 'config/get': 'config/load',
246
- 'config/update': 'config/save',
247
- 'mcp__swarmdo-swarm__neural_status': 'hooks/metrics',
248
- 'mcp__swarmdo-swarm__neural_train': 'hooks/pretrain',
249
- };
250
- const v3Tools = [
251
- 'agent/spawn', 'agent/list', 'agent/terminate', 'agent/status',
252
- 'swarm/init', 'swarm/status', 'swarm/scale', 'swarm/consensus', 'swarm/broadcast',
253
- 'memory/store', 'memory/search', 'memory/delete', 'memory/list',
254
- 'task/create', 'task/assign', 'task/status', 'task/complete',
255
- 'config/load', 'config/save',
256
- 'hooks/metrics', 'hooks/pretrain',
257
- 'github/pr-create', 'github/pr-review', 'github/issue-create',
258
- ];
259
- const v3Commands = [
260
- 'init', 'start', 'stop', 'status', 'config',
261
- 'agent spawn', 'agent list', 'agent terminate', 'agent status',
262
- 'swarm init', 'swarm status', 'swarm scale',
263
- 'memory list', 'memory search', 'memory clear',
264
- 'hooks pre-edit', 'hooks post-edit', 'hooks pre-command', 'hooks post-command',
265
- 'hooks route', 'hooks pretrain', 'hooks metrics',
266
- ];
267
- const v3Hooks = V2_HOOKS.map(h => h.v3Equivalent || h.name);
268
- const v3Classes = ['UnifiedSwarmCoordinator', 'UnifiedMemoryService', 'AgentLifecycleService', 'TaskExecutionService'];
269
- return {
270
- cli: {
271
- execute: vi.fn().mockImplementation(async (command) => {
272
- const isSupported = v3Commands.some(c => c === command || command.startsWith(c.split(' ')[0]));
273
- return { success: isSupported, output: isSupported ? 'OK' : 'Command not found' };
274
- }),
275
- getCommands: vi.fn().mockReturnValue(v3Commands),
276
- },
277
- mcp: {
278
- callTool: vi.fn().mockImplementation(async (name) => {
279
- const v3Name = toolNameMapping[name] || name;
280
- const isSupported = v3Tools.includes(v3Name);
281
- if (!isSupported)
282
- throw new Error(`Tool not found: ${name}`);
283
- return { success: true };
284
- }),
285
- getTools: vi.fn().mockReturnValue(v3Tools),
286
- translateToolName: vi.fn().mockImplementation((v2Name) => toolNameMapping[v2Name] || v2Name),
287
- },
288
- hooks: {
289
- trigger: vi.fn().mockImplementation(async (name) => {
290
- const isSupported = v3Hooks.includes(name);
291
- return { handled: isSupported, result: isSupported ? {} : null };
292
- }),
293
- getHooks: vi.fn().mockReturnValue(v3Hooks),
294
- },
295
- api: {
296
- getClass: vi.fn().mockImplementation((name) => {
297
- const mapping = {
298
- 'UnifiedSwarmCoordinator': { methods: ['initialize', 'spawn', 'addAgent', 'removeAgent', 'broadcast', 'consensus', 'getStatus', 'shutdown'] },
299
- 'UnifiedMemoryService': { methods: ['store', 'search', 'delete', 'clear', 'getStats'] },
300
- 'AgentLifecycleService': { methods: ['spawn', 'terminate', 'list', 'getInfo', 'getStatus'] },
301
- 'TaskExecutionService': { methods: ['create', 'assign', 'complete', 'getStatus'] },
302
- };
303
- return mapping[name] || null;
304
- }),
305
- getClasses: vi.fn().mockReturnValue(v3Classes),
306
- },
307
- };
308
- }
309
- /**
310
- * Validate CLI command compatibility
311
- */
312
- async validateCLI() {
313
- const startTime = Date.now();
314
- const checks = [];
315
- const v3Commands = this.v3Service.cli.getCommands();
316
- for (const cmd of V2_CLI_COMMANDS) {
317
- const v3Equivalent = cmd.v3Equivalent || cmd.name;
318
- const isSupported = v3Commands.some(c => c === v3Equivalent || c.startsWith(v3Equivalent.split(' ')[0]));
319
- // Check command exists
320
- checks.push({
321
- name: `CLI: ${cmd.name}`,
322
- category: 'cli',
323
- passed: isSupported,
324
- message: isSupported
325
- ? `Command "${cmd.name}" is supported via "${v3Equivalent}"`
326
- : `Command "${cmd.name}" is not available in V3`,
327
- v2Behavior: `Execute "${cmd.name}" with flags: ${cmd.flags.join(', ') || 'none'}`,
328
- v3Behavior: isSupported
329
- ? `Execute "${v3Equivalent}"`
330
- : 'Not available',
331
- breaking: !isSupported && !cmd.deprecated,
332
- migrationPath: isSupported ? `Use "${v3Equivalent}" instead` : undefined,
333
- });
334
- // Check aliases
335
- for (const alias of cmd.aliases) {
336
- const aliasSupported = v3Commands.some(c => c === alias || c.startsWith(alias.split(' ')[0]));
337
- checks.push({
338
- name: `CLI Alias: ${alias}`,
339
- category: 'cli',
340
- passed: aliasSupported || isSupported,
341
- message: aliasSupported
342
- ? `Alias "${alias}" is supported`
343
- : `Alias "${alias}" not directly supported, use "${v3Equivalent}"`,
344
- v2Behavior: `Execute "${alias}"`,
345
- v3Behavior: aliasSupported ? `Execute "${alias}"` : `Execute "${v3Equivalent}"`,
346
- breaking: false,
347
- migrationPath: `Use "${v3Equivalent}" for consistent behavior`,
348
- });
349
- }
350
- // Check flags
351
- for (const flag of cmd.flags) {
352
- checks.push({
353
- name: `CLI Flag: ${cmd.name} ${flag}`,
354
- category: 'cli',
355
- passed: isSupported, // Assume flags are supported if command is
356
- message: isSupported
357
- ? `Flag "${flag}" is expected to work with "${v3Equivalent}"`
358
- : `Flag "${flag}" not available (command not supported)`,
359
- v2Behavior: `Use "${flag}" with "${cmd.name}"`,
360
- v3Behavior: isSupported ? `Use "${flag}" with "${v3Equivalent}"` : 'Not available',
361
- breaking: !isSupported && !cmd.deprecated,
362
- });
363
- }
364
- }
365
- const passedChecks = checks.filter(c => c.passed).length;
366
- const breakingChanges = checks.filter(c => c.breaking).length;
367
- return {
368
- category: 'cli',
369
- totalChecks: checks.length,
370
- passedChecks,
371
- failedChecks: checks.length - passedChecks,
372
- breakingChanges,
373
- checks,
374
- duration: Date.now() - startTime,
375
- };
376
- }
377
- /**
378
- * Validate MCP tool compatibility
379
- */
380
- async validateMCPTools() {
381
- const startTime = Date.now();
382
- const checks = [];
383
- const v3Tools = this.v3Service.mcp.getTools();
384
- for (const tool of V2_MCP_TOOLS) {
385
- const v3Equivalent = this.v3Service.mcp.translateToolName(tool.name);
386
- const isSupported = v3Tools.includes(v3Equivalent);
387
- // Check tool exists
388
- checks.push({
389
- name: `MCP Tool: ${tool.name}`,
390
- category: 'mcp',
391
- passed: isSupported,
392
- message: isSupported
393
- ? `Tool "${tool.name}" maps to "${v3Equivalent}"`
394
- : `Tool "${tool.name}" has no V3 equivalent`,
395
- v2Behavior: `Call "${tool.name}" with params`,
396
- v3Behavior: isSupported
397
- ? `Call "${v3Equivalent}" with translated params`
398
- : 'Not available',
399
- breaking: !isSupported && !tool.deprecated,
400
- migrationPath: isSupported ? `Use "${v3Equivalent}" with updated parameters` : undefined,
401
- details: {
402
- v2Parameters: tool.parameters,
403
- v3Equivalent,
404
- },
405
- });
406
- // Check parameter translation
407
- if (isSupported) {
408
- for (const [paramName, paramDef] of Object.entries(tool.parameters)) {
409
- checks.push({
410
- name: `MCP Param: ${tool.name}.${paramName}`,
411
- category: 'mcp',
412
- passed: true, // Assume param translation works
413
- message: `Parameter "${paramName}" (${paramDef.type}) is translated`,
414
- v2Behavior: `Pass "${paramName}" as ${paramDef.type}`,
415
- v3Behavior: `Translated to V3 format`,
416
- breaking: false,
417
- });
418
- }
419
- }
420
- }
421
- const passedChecks = checks.filter(c => c.passed).length;
422
- const breakingChanges = checks.filter(c => c.breaking).length;
423
- return {
424
- category: 'mcp',
425
- totalChecks: checks.length,
426
- passedChecks,
427
- failedChecks: checks.length - passedChecks,
428
- breakingChanges,
429
- checks,
430
- duration: Date.now() - startTime,
431
- };
432
- }
433
- /**
434
- * Validate hook compatibility
435
- */
436
- async validateHooks() {
437
- const startTime = Date.now();
438
- const checks = [];
439
- const v3Hooks = this.v3Service.hooks.getHooks();
440
- for (const hook of V2_HOOKS) {
441
- const v3Equivalent = hook.v3Equivalent || hook.name;
442
- const isSupported = v3Hooks.includes(v3Equivalent);
443
- // Check hook exists
444
- checks.push({
445
- name: `Hook: ${hook.name}`,
446
- category: 'hooks',
447
- passed: isSupported,
448
- message: isSupported
449
- ? `Hook "${hook.name}" is supported as "${v3Equivalent}"`
450
- : `Hook "${hook.name}" is not available in V3`,
451
- v2Behavior: `Trigger on "${hook.trigger}" with params: ${hook.parameters.join(', ')}`,
452
- v3Behavior: isSupported
453
- ? `Trigger "${v3Equivalent}" with translated params`
454
- : 'Not available',
455
- breaking: !isSupported && !hook.deprecated,
456
- migrationPath: isSupported ? `Listen for "${v3Equivalent}" instead` : undefined,
457
- details: {
458
- v2Trigger: hook.trigger,
459
- v2Parameters: hook.parameters,
460
- v3Equivalent,
461
- },
462
- });
463
- // Check parameters
464
- for (const param of hook.parameters) {
465
- checks.push({
466
- name: `Hook Param: ${hook.name}.${param}`,
467
- category: 'hooks',
468
- passed: isSupported, // Assume params work if hook works
469
- message: isSupported
470
- ? `Parameter "${param}" is passed to hook`
471
- : `Parameter "${param}" not available (hook not supported)`,
472
- v2Behavior: `Receive "${param}" in hook handler`,
473
- v3Behavior: isSupported ? 'Translated parameter available' : 'Not available',
474
- breaking: !isSupported,
475
- });
476
- }
477
- // Check return type compatibility
478
- checks.push({
479
- name: `Hook Return: ${hook.name}`,
480
- category: 'hooks',
481
- passed: isSupported,
482
- message: isSupported
483
- ? `Return type "${hook.returnType}" is compatible`
484
- : `Return type not available (hook not supported)`,
485
- v2Behavior: `Return ${hook.returnType}`,
486
- v3Behavior: isSupported ? `Return compatible ${hook.returnType}` : 'Not available',
487
- breaking: !isSupported,
488
- });
489
- }
490
- const passedChecks = checks.filter(c => c.passed).length;
491
- const breakingChanges = checks.filter(c => c.breaking).length;
492
- return {
493
- category: 'hooks',
494
- totalChecks: checks.length,
495
- passedChecks,
496
- failedChecks: checks.length - passedChecks,
497
- breakingChanges,
498
- checks,
499
- duration: Date.now() - startTime,
500
- };
501
- }
502
- /**
503
- * Validate API compatibility
504
- */
505
- async validateAPI() {
506
- const startTime = Date.now();
507
- const checks = [];
508
- const v3Classes = this.v3Service.api.getClasses();
509
- for (const iface of V2_API_INTERFACES) {
510
- const v3Equivalent = iface.v3Equivalent || iface.name;
511
- const v3Class = this.v3Service.api.getClass(v3Equivalent);
512
- const isSupported = v3Class !== null;
513
- // Check class exists
514
- checks.push({
515
- name: `API Class: ${iface.name}`,
516
- category: 'api',
517
- passed: isSupported,
518
- message: isSupported
519
- ? `Class "${iface.name}" is available as "${v3Equivalent}"`
520
- : `Class "${iface.name}" has no V3 equivalent`,
521
- v2Behavior: `Import and use "${iface.name}"`,
522
- v3Behavior: isSupported
523
- ? `Import "${v3Equivalent}" from @swarmdo/*`
524
- : 'Not available',
525
- breaking: !isSupported && !iface.deprecated,
526
- migrationPath: isSupported
527
- ? `Use "${v3Equivalent}" with import alias`
528
- : undefined,
529
- });
530
- // Check methods
531
- for (const method of iface.methods) {
532
- const methodAvailable = v3Class?.methods.some(m => m === method.name || m.toLowerCase() === method.name.toLowerCase());
533
- checks.push({
534
- name: `API Method: ${iface.name}.${method.name}`,
535
- category: 'api',
536
- passed: methodAvailable || false,
537
- message: methodAvailable
538
- ? `Method "${method.name}" is available`
539
- : `Method "${method.name}" may have different name or signature`,
540
- v2Behavior: `Call ${iface.name}.${method.name}${method.signature}`,
541
- v3Behavior: methodAvailable
542
- ? `Call ${v3Equivalent}.${method.name}()`
543
- : 'May need migration',
544
- breaking: !methodAvailable && !iface.deprecated,
545
- migrationPath: methodAvailable
546
- ? 'Same method signature'
547
- : 'Check V3 API documentation',
548
- });
549
- }
550
- }
551
- const passedChecks = checks.filter(c => c.passed).length;
552
- const breakingChanges = checks.filter(c => c.breaking).length;
553
- return {
554
- category: 'api',
555
- totalChecks: checks.length,
556
- passedChecks,
557
- failedChecks: checks.length - passedChecks,
558
- breakingChanges,
559
- checks,
560
- duration: Date.now() - startTime,
561
- };
562
- }
563
- /**
564
- * Run full validation suite
565
- */
566
- async runFullValidation() {
567
- const startTime = Date.now();
568
- this.log('Starting V2 Compatibility Validation...');
569
- this.log('Validating CLI commands...');
570
- const cliResult = await this.validateCLI();
571
- this.log('Validating MCP tools...');
572
- const mcpResult = await this.validateMCPTools();
573
- this.log('Validating hooks...');
574
- const hooksResult = await this.validateHooks();
575
- this.log('Validating API interfaces...');
576
- const apiResult = await this.validateAPI();
577
- const totalChecks = cliResult.totalChecks + mcpResult.totalChecks + hooksResult.totalChecks + apiResult.totalChecks;
578
- const passedChecks = cliResult.passedChecks + mcpResult.passedChecks + hooksResult.passedChecks + apiResult.passedChecks;
579
- const failedChecks = totalChecks - passedChecks;
580
- const breakingChanges = cliResult.breakingChanges + mcpResult.breakingChanges + hooksResult.breakingChanges + apiResult.breakingChanges;
581
- const overallPassed = breakingChanges === 0;
582
- const recommendations = this.generateRecommendations(cliResult, mcpResult, hooksResult, apiResult);
583
- const report = {
584
- timestamp: new Date(),
585
- v2Version: this.v2Version,
586
- v3Version: this.v3Version,
587
- overallPassed,
588
- totalChecks,
589
- passedChecks,
590
- failedChecks,
591
- breakingChanges,
592
- cli: cliResult,
593
- mcp: mcpResult,
594
- hooks: hooksResult,
595
- api: apiResult,
596
- summary: this.generateSummary(cliResult, mcpResult, hooksResult, apiResult, overallPassed),
597
- recommendations,
598
- duration: Date.now() - startTime,
599
- };
600
- this.log('Validation complete.');
601
- return report;
602
- }
603
- /**
604
- * Generate recommendations based on results
605
- */
606
- generateRecommendations(cli, mcp, hooks, api) {
607
- const recommendations = [];
608
- if (cli.breakingChanges > 0) {
609
- recommendations.push('Update CLI command calls to use V3 equivalents');
610
- recommendations.push('Run migration script: npx @swarmdo/cli migrate');
611
- }
612
- if (mcp.breakingChanges > 0) {
613
- recommendations.push('Enable V2 compatibility mode in MCP server configuration');
614
- recommendations.push('Update tool calls to use new naming convention (e.g., agent/spawn)');
615
- }
616
- if (hooks.breakingChanges > 0) {
617
- recommendations.push('Review hook configuration for renamed or removed hooks');
618
- recommendations.push('Update hook listeners to use V3 event names');
619
- }
620
- if (api.breakingChanges > 0) {
621
- recommendations.push('Update import statements to use @swarmdo/* packages');
622
- recommendations.push('Use provided import aliases for backward compatibility');
623
- }
624
- if (cli.passedChecks < cli.totalChecks) {
625
- recommendations.push('Some CLI aliases may not be directly supported - use canonical command names');
626
- }
627
- if (mcp.passedChecks < mcp.totalChecks) {
628
- recommendations.push('Consider using tool name translation layer for gradual migration');
629
- }
630
- if (recommendations.length === 0) {
631
- recommendations.push('No migration actions required - V2 code is fully compatible');
632
- }
633
- return recommendations;
634
- }
635
- /**
636
- * Generate human-readable summary
637
- */
638
- generateSummary(cli, mcp, hooks, api, overallPassed) {
639
- const lines = [
640
- '='.repeat(70),
641
- ' V2 COMPATIBILITY VALIDATION REPORT',
642
- '='.repeat(70),
643
- '',
644
- `Status: ${overallPassed ? 'PASSED - No breaking changes detected' : 'FAILED - Breaking changes detected'}`,
645
- '',
646
- 'Category Summary:',
647
- '-'.repeat(70),
648
- `CLI Commands: ${cli.passedChecks}/${cli.totalChecks} passed (${cli.breakingChanges} breaking)`,
649
- `MCP Tools: ${mcp.passedChecks}/${mcp.totalChecks} passed (${mcp.breakingChanges} breaking)`,
650
- `Hooks: ${hooks.passedChecks}/${hooks.totalChecks} passed (${hooks.breakingChanges} breaking)`,
651
- `API Interfaces: ${api.passedChecks}/${api.totalChecks} passed (${api.breakingChanges} breaking)`,
652
- '-'.repeat(70),
653
- '',
654
- ];
655
- if (!overallPassed) {
656
- lines.push('Breaking Changes Detected:');
657
- lines.push('');
658
- const allBreaking = [
659
- ...cli.checks.filter(c => c.breaking).map(c => ` CLI: ${c.name}`),
660
- ...mcp.checks.filter(c => c.breaking).map(c => ` MCP: ${c.name}`),
661
- ...hooks.checks.filter(c => c.breaking).map(c => ` Hooks: ${c.name}`),
662
- ...api.checks.filter(c => c.breaking).map(c => ` API: ${c.name}`),
663
- ].slice(0, 20);
664
- lines.push(...allBreaking);
665
- if (cli.breakingChanges + mcp.breakingChanges + hooks.breakingChanges + api.breakingChanges > 20) {
666
- lines.push(` ... and ${cli.breakingChanges + mcp.breakingChanges + hooks.breakingChanges + api.breakingChanges - 20} more`);
667
- }
668
- lines.push('');
669
- }
670
- lines.push('='.repeat(70));
671
- return lines.join('\n');
672
- }
673
- /**
674
- * Log message if verbose mode is enabled
675
- */
676
- log(message) {
677
- if (this.verbose) {
678
- console.log(`[V2Compat] ${message}`);
679
- }
680
- }
681
- }
682
- /**
683
- * Generate markdown compatibility report
684
- */
685
- export function generateCompatibilityReport(report) {
686
- const lines = [
687
- '# V2 Compatibility Validation Report',
688
- '',
689
- `> Generated: ${report.timestamp.toISOString()}`,
690
- `> V2 Version: ${report.v2Version}`,
691
- `> V3 Version: ${report.v3Version}`,
692
- '',
693
- '## Executive Summary',
694
- '',
695
- `**Status**: ${report.overallPassed ? 'PASSED' : 'FAILED'}`,
696
- '',
697
- '| Metric | Value |',
698
- '|--------|-------|',
699
- `| Total Checks | ${report.totalChecks} |`,
700
- `| Passed | ${report.passedChecks} |`,
701
- `| Failed | ${report.failedChecks} |`,
702
- `| Breaking Changes | ${report.breakingChanges} |`,
703
- `| Duration | ${report.duration}ms |`,
704
- '',
705
- '## Category Results',
706
- '',
707
- '### CLI Commands',
708
- '',
709
- `- **Total**: ${report.cli.totalChecks}`,
710
- `- **Passed**: ${report.cli.passedChecks}`,
711
- `- **Failed**: ${report.cli.failedChecks}`,
712
- `- **Breaking**: ${report.cli.breakingChanges}`,
713
- '',
714
- '| Command | Status | Migration |',
715
- '|---------|--------|-----------|',
716
- ...report.cli.checks
717
- .filter(c => c.name.startsWith('CLI:'))
718
- .slice(0, 30)
719
- .map(c => `| ${c.name.replace('CLI: ', '')} | ${c.passed ? 'OK' : 'FAIL'} | ${c.migrationPath || 'N/A'} |`),
720
- '',
721
- '### MCP Tools',
722
- '',
723
- `- **Total**: ${report.mcp.totalChecks}`,
724
- `- **Passed**: ${report.mcp.passedChecks}`,
725
- `- **Failed**: ${report.mcp.failedChecks}`,
726
- `- **Breaking**: ${report.mcp.breakingChanges}`,
727
- '',
728
- '| Tool | Status | V3 Equivalent |',
729
- '|------|--------|---------------|',
730
- ...report.mcp.checks
731
- .filter(c => c.name.startsWith('MCP Tool:'))
732
- .slice(0, 40)
733
- .map(c => {
734
- const v3Name = c.details?.v3Equivalent || 'N/A';
735
- return `| ${c.name.replace('MCP Tool: ', '')} | ${c.passed ? 'OK' : 'FAIL'} | ${v3Name} |`;
736
- }),
737
- '',
738
- '### Hooks',
739
- '',
740
- `- **Total**: ${report.hooks.totalChecks}`,
741
- `- **Passed**: ${report.hooks.passedChecks}`,
742
- `- **Failed**: ${report.hooks.failedChecks}`,
743
- `- **Breaking**: ${report.hooks.breakingChanges}`,
744
- '',
745
- '| Hook | Status | V3 Trigger |',
746
- '|------|--------|------------|',
747
- ...report.hooks.checks
748
- .filter(c => c.name.startsWith('Hook:') && !c.name.includes('Param') && !c.name.includes('Return'))
749
- .slice(0, 50)
750
- .map(c => {
751
- const v3Name = c.details?.v3Equivalent || 'N/A';
752
- return `| ${c.name.replace('Hook: ', '')} | ${c.passed ? 'OK' : 'FAIL'} | ${v3Name} |`;
753
- }),
754
- '',
755
- '### API Interfaces',
756
- '',
757
- `- **Total**: ${report.api.totalChecks}`,
758
- `- **Passed**: ${report.api.passedChecks}`,
759
- `- **Failed**: ${report.api.failedChecks}`,
760
- `- **Breaking**: ${report.api.breakingChanges}`,
761
- '',
762
- '| Interface/Method | Status | Migration |',
763
- '|------------------|--------|-----------|',
764
- ...report.api.checks
765
- .slice(0, 30)
766
- .map(c => `| ${c.name.replace('API ', '')} | ${c.passed ? 'OK' : 'FAIL'} | ${c.migrationPath || 'N/A'} |`),
767
- '',
768
- '## Breaking Changes',
769
- '',
770
- ];
771
- const breakingChecks = [
772
- ...report.cli.checks.filter(c => c.breaking),
773
- ...report.mcp.checks.filter(c => c.breaking),
774
- ...report.hooks.checks.filter(c => c.breaking),
775
- ...report.api.checks.filter(c => c.breaking),
776
- ];
777
- if (breakingChecks.length === 0) {
778
- lines.push('No breaking changes detected.');
779
- }
780
- else {
781
- lines.push('| Category | Item | V2 Behavior | V3 Behavior |');
782
- lines.push('|----------|------|-------------|-------------|');
783
- for (const check of breakingChecks.slice(0, 50)) {
784
- lines.push(`| ${check.category.toUpperCase()} | ${check.name} | ${check.v2Behavior} | ${check.v3Behavior} |`);
785
- }
786
- }
787
- lines.push('');
788
- lines.push('## Recommendations');
789
- lines.push('');
790
- for (const rec of report.recommendations) {
791
- lines.push(`- ${rec}`);
792
- }
793
- lines.push('');
794
- lines.push('## Migration Guide');
795
- lines.push('');
796
- lines.push('### CLI Migration');
797
- lines.push('');
798
- lines.push('```bash');
799
- lines.push('# V2 commands are supported via compatibility layer');
800
- lines.push('# Deprecated commands will show warnings');
801
- lines.push('');
802
- lines.push('# V2 (deprecated)');
803
- lines.push('npx swarmdo hive-mind init');
804
- lines.push('');
805
- lines.push('# V3 (recommended)');
806
- lines.push('npx @swarmdo/cli swarm init');
807
- lines.push('```');
808
- lines.push('');
809
- lines.push('### MCP Tool Migration');
810
- lines.push('');
811
- lines.push('```typescript');
812
- lines.push('// V2 tool call');
813
- lines.push("await mcp.callTool('dispatch_agent', { type: 'coder' });");
814
- lines.push('');
815
- lines.push('// V3 tool call (direct)');
816
- lines.push("await mcp.callTool('agent/spawn', { agentType: 'coder' });");
817
- lines.push('');
818
- lines.push('// V3 with compatibility layer');
819
- lines.push("await mcp.callTool('dispatch_agent', { type: 'coder' }); // Auto-translated");
820
- lines.push('```');
821
- lines.push('');
822
- lines.push('### API Migration');
823
- lines.push('');
824
- lines.push('```typescript');
825
- lines.push("// V2 imports");
826
- lines.push("import { HiveMind } from 'swarmdo/hive-mind';");
827
- lines.push("import { SwarmCoordinator } from 'swarmdo/swarm';");
828
- lines.push('');
829
- lines.push("// V3 imports (using aliases)");
830
- lines.push("import { UnifiedSwarmCoordinator as HiveMind } from '@swarmdo/swarm';");
831
- lines.push("import { UnifiedSwarmCoordinator as SwarmCoordinator } from '@swarmdo/swarm';");
832
- lines.push('```');
833
- lines.push('');
834
- lines.push('---');
835
- lines.push('');
836
- lines.push('*Report generated by V2CompatibilityValidator*');
837
- return lines.join('\n');
838
- }
839
- //# sourceMappingURL=compatibility-validator.js.map